mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 07:47:14 +03:00
replace modulo formatting with .format
This commit is contained in:
parent
02d205fbee
commit
fd3a4852f2
18
collate.py
18
collate.py
@ -45,7 +45,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 AssertionError('%s: "%s"!="%s"' % (key, new, old))
|
||||
raise AssertionError('{}: {!r} != {!r}'.format(key, new, old))
|
||||
|
||||
commodities[key] = new
|
||||
|
||||
@ -63,7 +63,7 @@ def addcommodities(data):
|
||||
for key in sorted(commodities):
|
||||
writer.writerow(commodities[key])
|
||||
|
||||
print('Added %d new commodities' % (len(commodities) - size_pre))
|
||||
print('Added {} new commodities'.format(len(commodities) - size_pre))
|
||||
|
||||
|
||||
# keep a summary of modules found
|
||||
@ -87,13 +87,13 @@ def addmodules(data):
|
||||
for key, module in data['lastStarport'].get('modules').items():
|
||||
# sanity check
|
||||
if int(key) != module.get('id'):
|
||||
raise AssertionError('id: %s!=%s' % (key, module['id']))
|
||||
raise AssertionError('id: {} != {}'.format(key, module['id']))
|
||||
|
||||
try:
|
||||
new = outfitting.lookup(module, companion.ship_map, True)
|
||||
|
||||
except:
|
||||
print('%d, %s:' % (module['id'], module['name']))
|
||||
except Exception:
|
||||
print('{}, {}:'.format(module['id'], module['name']))
|
||||
print_exc(0)
|
||||
new = None
|
||||
|
||||
@ -106,7 +106,7 @@ def addmodules(data):
|
||||
size_pre -= 1
|
||||
|
||||
elif str(new.get(thing, '')) != old.get(thing):
|
||||
raise AssertionError('%s: %s "%s"!="%s"' % (key, thing, new.get(thing), old.get(thing)))
|
||||
raise AssertionError('{}: {} {!r}!={!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
||||
|
||||
modules[int(key)] = new
|
||||
|
||||
@ -124,7 +124,7 @@ def addmodules(data):
|
||||
for key in sorted(modules):
|
||||
writer.writerow(modules[key])
|
||||
|
||||
print('Added %d new modules' % (len(modules) - size_pre))
|
||||
print('Added {} new modules'.format(len(modules) - size_pre))
|
||||
|
||||
|
||||
# keep a summary of ships found
|
||||
@ -160,7 +160,7 @@ def addships(data):
|
||||
size_pre -= 1
|
||||
|
||||
elif str(new.get(thing, '')) != old.get(thing):
|
||||
raise AssertionError('%s: %s "%s"!="%s"' % (key, thing, new.get(thing), old.get(thing)))
|
||||
raise AssertionError('{}: {} {!r} != {!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
||||
|
||||
ships[int(key)] = new
|
||||
|
||||
@ -179,7 +179,7 @@ def addships(data):
|
||||
for key in sorted(ships):
|
||||
writer.writerow(ships[key])
|
||||
|
||||
print('Added %d new ships' % (len(ships) - size_pre))
|
||||
print('Added {} new ships'.format(len(ships) - size_pre))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user