Skip to content

Commit 9b5c1ca

Browse files
committed
Fix remaining linter errors
1 parent dbda852 commit 9b5c1ca

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

data/boston/script/table2csv.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def namify_member(name):
1212

1313
def namify_club(name):
1414
"""Convert data formmated club name into human readable form."""
15+
1516
def split_on(s, splitters):
1617
if not s:
1718
return []
@@ -37,9 +38,7 @@ def split_on(s, splitters):
3738
ids = {name: idx for (idx, name) in enumerate(club_names + member_names)}
3839

3940
# Create member and club tables.
40-
members = [
41-
{'_key': ids[name], 'name': namify_member(name)} for name in member_names
42-
]
41+
members = [{'_key': ids[name], 'name': namify_member(name)} for name in member_names]
4342
clubs = [{'_key': ids[name], 'name': namify_club(name)} for name in club_names]
4443

4544
# Create the membership table.

data/eurovis-2019/script/process.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def convert_link(link, idx):
2020
"""Convert the D3 JSON link data into a Multinet-style record."""
2121
return {
2222
'_key': str(idx),
23-
'_from': f'''people/{link['source']}''',
24-
'_to': f'''people/{link['target']}''',
23+
'_from': f"people/{link['source']}",
24+
'_to': f"people/{link['target']}",
2525
}
2626

2727

@@ -56,8 +56,8 @@ def main():
5656
link
5757
for link in links
5858
if (
59-
any(f'''people/{node['_key']}''' == link['_from'] for node in nodes)
60-
and any(f'''people/{node['_key']}''' == link['_to'] for node in nodes)
59+
any(f"people/{node['_key']}" == link['_from'] for node in nodes)
60+
and any(f"people/{node['_key']}" == link['_to'] for node in nodes)
6161
)
6262
]
6363
links = [link for (index, link) in enumerate(links) if index % 10 == 0]

data/miserables/scripts/process.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def add_key(rec, idx):
1313
def convert_link(link):
1414
"""Convert the D3 JSON link data into a Multinet-style record."""
1515
return {
16-
'_from': f'''characters/{link['source']}''',
17-
'_to': f'''characters/{link['target']}''',
16+
'_from': f"characters/{link['source']}",
17+
'_to': f"characters/{link['target']}",
1818
'value': link['value'],
1919
}
2020

@@ -35,12 +35,12 @@ def main():
3535

3636
# Prepare the node data by adjoining a key value equal to each record's
3737
# index in the original data.
38-
nodes = [add_key(record, index) for (index, record) in enumerate(data["nodes"])]
38+
nodes = [add_key(record, index) for (index, record) in enumerate(data['nodes'])]
3939

4040
# Convert the link data to Multinet form. Note that the D3 JSON format uses
4141
# node list indices to refer to the source and target nodes; these can be
4242
# used unchanged because of how the key value for the nodes was set above.
43-
links = [convert_link(link) for link in data["links"]]
43+
links = [convert_link(link) for link in data['links']]
4444

4545
# Write out both the node and link data to CSV files.
4646
write_csv(nodes, ['_key', 'name', 'group'], 'characters.csv')

data/openflights/script/process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def main():
1717
# Filter out flights to or from undeclared airports.
1818
if row['_from'] in ids and row['_to'] in ids:
1919
# Prepend the presumed node table name to the from/to columns.
20-
row['_from'] = f'''airports/{row['_from']}'''
21-
row['_to'] = f'''airports/{row['_to']}'''
20+
row['_from'] = f"airports/{row['_from']}"
21+
row['_to'] = f"airports/{row['_to']}"
2222

2323
writer.writerow(row)
2424

0 commit comments

Comments
 (0)