Skip to content

Commit 4645d93

Browse files
committed
Applied Black
1 parent befaa0c commit 4645d93

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Diff for: csv_diff/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
def load_csv(fp, key=None, dialect=None):
88
if dialect is None and fp.seekable():
99
# Peek at first 1MB to sniff the delimiter and other dialect details
10-
peek = fp.read(1024**2)
10+
peek = fp.read(1024 ** 2)
1111
fp.seek(0)
1212
try:
1313
dialect = csv.Sniffer().sniff(peek, delimiters=",\t")
1414
except csv.Error:
1515
# Oh well, we tried. Fallback to the default.
1616
pass
17-
fp = csv.reader(fp, dialect=(dialect or 'excel'))
17+
fp = csv.reader(fp, dialect=(dialect or "excel"))
1818
headings = next(fp)
1919
rows = [dict(zip(headings, line)) for line in fp]
2020
if key:

Diff for: csv_diff/cli.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"--key", type=str, default=None, help="Column to use as a unique ID for each row"
1818
)
1919
@click.option(
20-
"--format", type=click.Choice(["csv", "tsv"]), default=None, help="Explicitly specify input format (csv, tsv) instead of auto-detecting"
20+
"--format",
21+
type=click.Choice(["csv", "tsv"]),
22+
default=None,
23+
help="Explicitly specify input format (csv, tsv) instead of auto-detecting",
2124
)
2225
@click.option(
2326
"--json", type=bool, default=False, help="Output changes as JSON", is_flag=True
@@ -40,8 +43,12 @@ def cli(previous, current, key, format, json, singular, plural):
4043
"csv": "excel",
4144
"tsv": "excel-tab",
4245
}
46+
4347
def load(filename):
44-
return load_csv(open(filename, newline=""), key=key, dialect=dialect.get(format))
48+
return load_csv(
49+
open(filename, newline=""), key=key, dialect=dialect.get(format)
50+
)
51+
4552
diff = compare(load(previous), load(current))
4653
if json:
4754
print(std_json.dumps(diff, indent=4))

0 commit comments

Comments
 (0)