mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
collate: Convert .format to f-string
This commit is contained in:
parent
4dfe467d1c
commit
7fc6b624ee
16
collate.py
16
collate.py
@ -62,7 +62,7 @@ def addcommodities(data):
|
||||
|
||||
if old and companion_category_map.get(commodity['categoryname'], True):
|
||||
if new['symbol'] != old['symbol'] or new['name'] != old['name']:
|
||||
raise ValueError('{}: {!r} != {!r}'.format(key, new, old))
|
||||
raise ValueError(f'{key}: {new!r} != {old!r}')
|
||||
|
||||
commodities[key] = new
|
||||
|
||||
@ -79,7 +79,7 @@ def addcommodities(data):
|
||||
for key in sorted(commodities):
|
||||
writer.writerow(commodities[key])
|
||||
|
||||
print('Added {} new commodities'.format(len(commodities) - size_pre))
|
||||
print(f'Added {len(commodities) - size_pre} new commodities')
|
||||
|
||||
|
||||
# keep a summary of modules found
|
||||
@ -104,13 +104,13 @@ def addmodules(data):
|
||||
# sanity check
|
||||
key = int(key)
|
||||
if key != module.get('id'):
|
||||
raise ValueError('id: {} != {}'.format(key, module['id']))
|
||||
raise ValueError(f'id: {key} != {module['id']}')
|
||||
|
||||
try:
|
||||
new = outfitting.lookup(module, ship_name_map, True)
|
||||
|
||||
except Exception:
|
||||
print('{}, {}:'.format(module['id'], module['name']))
|
||||
print(f'{module["id"]}, {module["name"]}:')
|
||||
print_exc(0)
|
||||
new = None
|
||||
|
||||
@ -123,7 +123,7 @@ def addmodules(data):
|
||||
size_pre -= 1
|
||||
|
||||
elif str(new.get(thing, '')) != old.get(thing):
|
||||
raise ValueError('{}: {} {!r}!={!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
||||
raise ValueError(f'{key}: {thing} {new.get(thing)!r}!={old.get(thing)!r}')
|
||||
|
||||
modules[key] = new
|
||||
|
||||
@ -140,7 +140,7 @@ def addmodules(data):
|
||||
for key in sorted(modules):
|
||||
writer.writerow(modules[key])
|
||||
|
||||
print('Added {} new modules'.format(len(modules) - size_pre))
|
||||
print(f'Added {len(modules) - size_pre} new modules')
|
||||
|
||||
|
||||
# keep a summary of ships found
|
||||
@ -176,7 +176,7 @@ def addships(data):
|
||||
size_pre -= 1
|
||||
|
||||
elif str(new.get(thing, '')) != old.get(thing):
|
||||
raise ValueError('{}: {} {!r} != {!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
||||
raise ValueError(f'{key}: {thing} {new.get(thing)!r} != {old.get(thing)!r}')
|
||||
|
||||
ships[key] = new
|
||||
|
||||
@ -193,7 +193,7 @@ def addships(data):
|
||||
for key in sorted(ships):
|
||||
writer.writerow(ships[key])
|
||||
|
||||
print('Added {} new ships'.format(len(ships) - size_pre))
|
||||
print(f'Added {len(ships) - size_pre} new ships')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user