scripts: Adopted json -> is_json tweak, avoiding name conflict
This was a humorous name conflict that went unnoticed only because we lazily import json in read_csv.
This commit is contained in:
+2
-2
@@ -892,10 +892,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -747,10 +747,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -1350,10 +1350,10 @@ def collect_csv(csv_paths, *,
|
|||||||
try:
|
try:
|
||||||
with openio(path) as f:
|
with openio(path) as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
# collect fields
|
# collect fields
|
||||||
fields.update((k, True) for k in reader.fieldnames or [])
|
fields.update((k, True) for k in reader.fieldnames or [])
|
||||||
|
|||||||
+2
-2
@@ -1152,10 +1152,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -892,10 +892,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -1253,10 +1253,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -1227,10 +1227,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -895,10 +895,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
+2
-2
@@ -1033,10 +1033,10 @@ def read_csv(path, Result, *,
|
|||||||
|
|
||||||
with openio(path, 'r') as f:
|
with openio(path, 'r') as f:
|
||||||
# csv or json? assume json starts with [
|
# csv or json? assume json starts with [
|
||||||
json = (f.buffer.peek(1)[:1] == b'[')
|
is_json = (f.buffer.peek(1)[:1] == b'[')
|
||||||
|
|
||||||
# read csv?
|
# read csv?
|
||||||
if not json:
|
if not is_json:
|
||||||
results = []
|
results = []
|
||||||
reader = csv.DictReader(f, restval='')
|
reader = csv.DictReader(f, restval='')
|
||||||
for r in reader:
|
for r in reader:
|
||||||
|
|||||||
Reference in New Issue
Block a user