mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Fixed alignment and comment grammar
This commit is contained in:
parent
9a482cb04b
commit
d9658f2cf9
38
monitor.py
38
monitor.py
@ -77,7 +77,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
# If 3 we need to inject a special 'StartUp' event since consumers won't see the LoadGame event.
|
# If 3 we need to inject a special 'StartUp' event since consumers won't see the LoadGame event.
|
||||||
self.live = False
|
self.live = False
|
||||||
|
|
||||||
self.game_was_running = False # For generation the "ShutDown" event
|
self.game_was_running = False # For generation of the "ShutDown" event
|
||||||
|
|
||||||
# Context for journal handling
|
# Context for journal handling
|
||||||
self.version: Optional[str] = None
|
self.version: Optional[str] = None
|
||||||
@ -342,7 +342,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
else:
|
else:
|
||||||
self.game_was_running = self.game_running()
|
self.game_was_running = self.game_running()
|
||||||
|
|
||||||
def parse_entry(self, line):
|
def parse_entry(self, line: str):
|
||||||
# TODO(A_D): a bunch of these can be simplified to use if itertools.product and filters
|
# TODO(A_D): a bunch of these can be simplified to use if itertools.product and filters
|
||||||
if line is None:
|
if line is None:
|
||||||
return {'event': None} # Fake startup event
|
return {'event': None} # Fake startup event
|
||||||
@ -350,7 +350,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
try:
|
try:
|
||||||
# Preserve property order because why not?
|
# Preserve property order because why not?
|
||||||
entry: OrderedDictT[str, Any] = json.loads(line, object_pairs_hook=OrderedDict)
|
entry: OrderedDictT[str, Any] = json.loads(line, object_pairs_hook=OrderedDict)
|
||||||
entry['timestamp'] # we expect this to exist
|
entry['timestamp'] # we expect this to exist # TODO: replace with assert? or an if key in check
|
||||||
|
|
||||||
event_type = entry['event']
|
event_type = entry['event']
|
||||||
if event_type == 'Fileheader':
|
if event_type == 'Fileheader':
|
||||||
@ -361,11 +361,11 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
self.mode = None
|
self.mode = None
|
||||||
self.group = None
|
self.group = None
|
||||||
self.planet = None
|
self.planet = None
|
||||||
self.system: Optional[str] = None
|
self.system = None
|
||||||
self.station: Optional[str] = None
|
self.station = None
|
||||||
self.station_marketid: Optional[int] = None
|
self.station_marketid = None
|
||||||
self.stationtype: Optional[str] = None
|
self.stationtype = None
|
||||||
self.stationservices: Optional[List[str]] = None
|
self.stationservices = None
|
||||||
self.coordinates = None
|
self.coordinates = None
|
||||||
self.systemaddress = None
|
self.systemaddress = None
|
||||||
self.started = None
|
self.started = None
|
||||||
@ -490,12 +490,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
|
|
||||||
elif event_type == 'ModuleBuy':
|
elif event_type == 'ModuleBuy':
|
||||||
self.state['Modules'][entry['Slot']] = {
|
self.state['Modules'][entry['Slot']] = {
|
||||||
'Slot': entry['Slot'],
|
'Slot': entry['Slot'],
|
||||||
'Item': self.canonicalise(entry['BuyItem']),
|
'Item': self.canonicalise(entry['BuyItem']),
|
||||||
'On': True,
|
'On': True,
|
||||||
'Priority': 1,
|
'Priority': 1,
|
||||||
'Health': 1.0,
|
'Health': 1.0,
|
||||||
'Value': entry['BuyPrice'],
|
'Value': entry['BuyPrice'],
|
||||||
}
|
}
|
||||||
|
|
||||||
elif event_type == 'ModuleSell':
|
elif event_type == 'ModuleSell':
|
||||||
@ -668,13 +668,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
module = self.state['Modules'][entry['Slot']]
|
module = self.state['Modules'][entry['Slot']]
|
||||||
assert(module['Item'] == self.canonicalise(entry['Module']))
|
assert(module['Item'] == self.canonicalise(entry['Module']))
|
||||||
module['Engineering'] = {
|
module['Engineering'] = {
|
||||||
'Engineer': entry['Engineer'],
|
'Engineer': entry['Engineer'],
|
||||||
'EngineerID': entry['EngineerID'],
|
'EngineerID': entry['EngineerID'],
|
||||||
'BlueprintName': entry['BlueprintName'],
|
'BlueprintName': entry['BlueprintName'],
|
||||||
'BlueprintID': entry['BlueprintID'],
|
'BlueprintID': entry['BlueprintID'],
|
||||||
'Level': entry['Level'],
|
'Level': entry['Level'],
|
||||||
'Quality': entry['Quality'],
|
'Quality': entry['Quality'],
|
||||||
'Modifiers': entry['Modifiers'],
|
'Modifiers': entry['Modifiers'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if 'ExperimentalEffect' in entry:
|
if 'ExperimentalEffect' in entry:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user