mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 15:27:14 +03:00
Merge pull request #2123 from HullSeals/enhancement/2122/list-to-tuple-comparitors
[#2122] Handover a number of Lists to Tuples
This commit is contained in:
commit
e3f3c802be
@ -1549,7 +1549,7 @@ class AppWindow:
|
||||
self.w.update_idletasks()
|
||||
|
||||
# Companion login
|
||||
if entry['event'] in [None, 'StartUp', 'NewCommander', 'LoadGame'] and monitor.cmdr:
|
||||
if entry['event'] in (None, 'StartUp', 'NewCommander', 'LoadGame') and monitor.cmdr:
|
||||
if not config.get_list('cmdrs') or monitor.cmdr not in config.get_list('cmdrs'):
|
||||
config.set('cmdrs', config.get_list('cmdrs', default=[]) + [monitor.cmdr])
|
||||
self.login()
|
||||
@ -1567,7 +1567,7 @@ class AppWindow:
|
||||
logger.trace_if('journal.queue', 'Startup, returning')
|
||||
return # Startup
|
||||
|
||||
if entry['event'] in ['StartUp', 'LoadGame'] and monitor.started:
|
||||
if entry['event'] in ('StartUp', 'LoadGame') and monitor.started:
|
||||
logger.info('StartUp or LoadGame event')
|
||||
|
||||
# Disable WinSparkle automatic update checks, IFF configured to do so when in-game
|
||||
|
@ -211,12 +211,12 @@ class MacHotkeyMgr(AbstractHotkeyMgr):
|
||||
return False
|
||||
|
||||
# BkSp, Del, Clear = clear hotkey
|
||||
if keycode in [0x7f, ord(NSDeleteFunctionKey), ord(NSClearLineFunctionKey)]:
|
||||
if keycode in (0x7f, ord(NSDeleteFunctionKey), ord(NSClearLineFunctionKey)):
|
||||
self.acquire_state = MacHotkeyMgr.ACQUIRE_INACTIVE
|
||||
return None
|
||||
|
||||
# don't allow keys needed for typing in System Map
|
||||
if keycode in [0x13, 0x20, 0x2d] or 0x61 <= keycode <= 0x7a:
|
||||
if keycode in (0x13, 0x20, 0x2d) or 0x61 <= keycode <= 0x7a:
|
||||
NSBeep()
|
||||
self.acquire_state = MacHotkeyMgr.ACQUIRE_INACTIVE
|
||||
return None
|
||||
|
@ -284,23 +284,23 @@ class WindowsHotkeyMgr(AbstractHotkeyMgr):
|
||||
| ((GetKeyState(VK_RWIN) & 0x8000) and MOD_WIN)
|
||||
keycode = event.keycode
|
||||
|
||||
if keycode in [VK_SHIFT, VK_CONTROL, VK_MENU, VK_LWIN, VK_RWIN]:
|
||||
if keycode in (VK_SHIFT, VK_CONTROL, VK_MENU, VK_LWIN, VK_RWIN):
|
||||
return 0, modifiers
|
||||
|
||||
if not modifiers:
|
||||
if keycode == VK_ESCAPE: # Esc = retain previous
|
||||
return False
|
||||
|
||||
if keycode in [VK_BACK, VK_DELETE, VK_CLEAR, VK_OEM_CLEAR]: # BkSp, Del, Clear = clear hotkey
|
||||
if keycode in (VK_BACK, VK_DELETE, VK_CLEAR, VK_OEM_CLEAR): # BkSp, Del, Clear = clear hotkey
|
||||
return None
|
||||
|
||||
if (
|
||||
keycode in [VK_RETURN, VK_SPACE, VK_OEM_MINUS] or ord('A') <= keycode <= ord('Z')
|
||||
keycode in (VK_RETURN, VK_SPACE, VK_OEM_MINUS) or ord('A') <= keycode <= ord('Z')
|
||||
): # don't allow keys needed for typing in System Map
|
||||
winsound.MessageBeep()
|
||||
return None
|
||||
|
||||
if (keycode in [VK_NUMLOCK, VK_SCROLL, VK_PROCESSKEY]
|
||||
if (keycode in (VK_NUMLOCK, VK_SCROLL, VK_PROCESSKEY)
|
||||
or VK_CAPITAL <= keycode <= VK_MODECHANGE): # ignore unmodified mode switch keys
|
||||
return 0, modifiers
|
||||
|
||||
|
@ -79,7 +79,7 @@ def lookup(module, ship_map, entitled=False) -> dict | None: # noqa: C901, CCR0
|
||||
new['rating'] = 'I'
|
||||
|
||||
# Skip uninteresting stuff - some no longer present in ED 3.1 cAPI data
|
||||
elif (name[0] in [
|
||||
elif (name[0] in (
|
||||
'bobble',
|
||||
'decal',
|
||||
'nameplate',
|
||||
@ -87,7 +87,7 @@ def lookup(module, ship_map, entitled=False) -> dict | None: # noqa: C901, CCR0
|
||||
'enginecustomisation',
|
||||
'voicepack',
|
||||
'weaponcustomisation'
|
||||
]
|
||||
)
|
||||
or name[1].startswith('shipkit')):
|
||||
return None
|
||||
|
||||
@ -205,10 +205,10 @@ def lookup(module, ship_map, entitled=False) -> dict | None: # noqa: C901, CCR0
|
||||
elif len(name) < 4 and name[1] == 'resourcesiphon': # Hack! 128066402 has no size or class.
|
||||
(new['class'], new['rating']) = ('1', 'I')
|
||||
|
||||
elif len(name) < 4 and name[1] in ['guardianpowerdistributor', 'guardianpowerplant']: # Hack! No class.
|
||||
elif len(name) < 4 and name[1] in ('guardianpowerdistributor', 'guardianpowerplant'): # Hack! No class.
|
||||
(new['class'], new['rating']) = (str(name[2][4:]), 'A')
|
||||
|
||||
elif len(name) < 4 and name[1] in ['guardianfsdbooster']: # Hack! No class.
|
||||
elif len(name) < 4 and name[1] == 'guardianfsdbooster': # Hack! No class.
|
||||
(new['class'], new['rating']) = (str(name[2][4:]), 'H')
|
||||
|
||||
else:
|
||||
|
4
plug.py
4
plug.py
@ -165,7 +165,7 @@ def load_plugins(master: tk.Tk) -> None:
|
||||
def _load_internal_plugins():
|
||||
internal = []
|
||||
for name in sorted(os.listdir(config.internal_plugin_dir_path)):
|
||||
if name.endswith('.py') and name[0] not in ['.', '_']:
|
||||
if name.endswith('.py') and name[0] not in ('.', '_'):
|
||||
try:
|
||||
plugin = Plugin(name[:-3], os.path.join(config.internal_plugin_dir_path, name), logger)
|
||||
plugin.folder = None
|
||||
@ -184,7 +184,7 @@ def _load_found_plugins():
|
||||
|
||||
for name in sorted(os.listdir(config.plugin_dir_path), key=lambda n: (
|
||||
not os.path.isfile(os.path.join(config.plugin_dir_path, n, '__init__.py')), n.lower())):
|
||||
if not os.path.isdir(os.path.join(config.plugin_dir_path, name)) or name[0] in ['.', '_']:
|
||||
if not os.path.isdir(os.path.join(config.plugin_dir_path, name)) or name[0] in ('.', '_'):
|
||||
pass
|
||||
elif name.endswith('.disabled'):
|
||||
name, discard = name.rsplit('.', 1)
|
||||
|
@ -918,7 +918,7 @@ def journal_entry( # noqa: C901, CCR001
|
||||
])
|
||||
|
||||
# optional mission-specific properties
|
||||
for (iprop, prop) in [
|
||||
for (iprop, prop) in (
|
||||
('missionExpiry', 'Expiry'), # Listed as optional in the docs, but always seems to be present
|
||||
('starsystemNameTarget', 'DestinationSystem'),
|
||||
('stationNameTarget', 'DestinationStation'),
|
||||
@ -932,7 +932,7 @@ def journal_entry( # noqa: C901, CCR001
|
||||
('passengerCount', 'PassengerCount'),
|
||||
('passengerIsVIP', 'PassengerVIPs'),
|
||||
('passengerIsWanted', 'PassengerWanted'),
|
||||
]:
|
||||
):
|
||||
|
||||
if prop in entry:
|
||||
data[iprop] = entry[prop]
|
||||
@ -1295,7 +1295,7 @@ def journal_entry( # noqa: C901, CCR001
|
||||
|
||||
# Friends
|
||||
if event_name == 'Friends':
|
||||
if entry['Status'] in ['Added', 'Online']:
|
||||
if entry['Status'] in ('Added', 'Online'):
|
||||
new_add_event(
|
||||
'addCommanderFriend',
|
||||
entry['timestamp'],
|
||||
@ -1305,7 +1305,7 @@ def journal_entry( # noqa: C901, CCR001
|
||||
}
|
||||
)
|
||||
|
||||
elif entry['Status'] in ['Declined', 'Lost']:
|
||||
elif entry['Status'] in ('Declined', 'Lost'):
|
||||
new_add_event(
|
||||
'delCommanderFriend',
|
||||
entry['timestamp'],
|
||||
@ -1666,7 +1666,7 @@ def handle_special_events(data_event: dict[str, Any], reply_event: dict[str, Any
|
||||
this.lastlocation = reply_event.get('eventData', {})
|
||||
if not config.shutting_down:
|
||||
this.system_link.event_generate('<<InaraLocation>>', when="tail")
|
||||
elif data_event['eventName'] in ['addCommanderShip', 'setCommanderShip']:
|
||||
elif data_event['eventName'] in ('addCommanderShip', 'setCommanderShip'):
|
||||
this.lastship = reply_event.get('eventData', {})
|
||||
if not config.shutting_down:
|
||||
this.system_link.event_generate('<<InaraShip>>', when="tail")
|
||||
|
@ -296,7 +296,7 @@ class OldConfig:
|
||||
None,
|
||||
ctypes.byref(key_size)
|
||||
)
|
||||
or key_type.value not in [REG_SZ, REG_MULTI_SZ]
|
||||
or key_type.value not in (REG_SZ, REG_MULTI_SZ)
|
||||
):
|
||||
return default
|
||||
|
||||
|
@ -81,10 +81,10 @@ class HyperlinkLabel(sys.platform == 'darwin' and tk.Label or ttk.Label): # typ
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None:
|
||||
"""Change cursor and appearance depending on state and text."""
|
||||
# This class' state
|
||||
for thing in ['url', 'popup_copy', 'underline']:
|
||||
for thing in ('url', 'popup_copy', 'underline'):
|
||||
if thing in kw:
|
||||
setattr(self, thing, kw.pop(thing))
|
||||
for thing in ['foreground', 'disabledforeground']:
|
||||
for thing in ('foreground', 'disabledforeground'):
|
||||
if thing in kw:
|
||||
setattr(self, thing, kw[thing])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user