1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-07 19:03:23 +03:00

replaced constant contains checks with tuples

This commit is contained in:
A_D 2020-08-25 12:06:26 +02:00
parent 62f3203c3f
commit f2add920c7
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -361,7 +361,7 @@ entry: {entry!r}'''
elif entry['event'] == 'LoadGame': elif entry['event'] == 'LoadGame':
this.coordinates = None this.coordinates = None
if entry['event'] in ['LoadGame', 'Commander', 'NewCommander']: if entry['event'] in ('LoadGame', 'Commander', 'NewCommander'):
this.newgame = True this.newgame = True
this.newgame_docked = False this.newgame_docked = False
this.navbeaconscan = 0 this.navbeaconscan = 0
@ -523,7 +523,7 @@ def worker() -> None:
else: else:
for e, r in zip(pending, reply['events']): for e, r in zip(pending, reply['events']):
if not closing and e['event'] in ['StartUp', 'Location', 'FSDJump', 'CarrierJump']: if not closing and e['event'] in ('StartUp', 'Location', 'FSDJump', 'CarrierJump'):
# Update main window's system status # Update main window's system status
this.lastlookup = r this.lastlookup = r
# calls update_status in main thread # calls update_status in main thread
@ -558,7 +558,7 @@ def should_send(entries: List[Mapping[str, Any]]) -> bool:
else: else:
assert(False) assert(False)
this.navbeaconscan = 0 this.navbeaconscan = 0 # TODO: Unreachable code?
for entry in entries: for entry in entries:
if (entry['event'] == 'Cargo' and not this.newgame_docked) or entry['event'] == 'Docked': if (entry['event'] == 'Cargo' and not this.newgame_docked) or entry['event'] == 'Docked':
@ -570,10 +570,10 @@ def should_send(entries: List[Mapping[str, Any]]) -> bool:
elif this.newgame: elif this.newgame:
pass pass
elif entry['event'] not in [ elif entry['event'] not in (
'CommunityGoal', # Spammed periodically 'CommunityGoal', # Spammed periodically
'ModuleBuy', 'ModuleSell', 'ModuleSwap', # will be shortly followed by "Loadout" 'ModuleBuy', 'ModuleSell', 'ModuleSwap', # will be shortly followed by "Loadout"
'ShipyardBuy', 'ShipyardNew', 'ShipyardSwap']: # " 'ShipyardBuy', 'ShipyardNew', 'ShipyardSwap'): # "
return True return True
return False return False