1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 08:40:34 +03:00

Replaced modulo formatters with .format formatters

This commit is contained in:
A_D 2020-07-19 18:44:05 +02:00 committed by Athanasius
parent 05e6d49880
commit ed45d59af1

View File

@ -160,8 +160,8 @@ class EDLogs(FileSystemEventHandler):
self.observed = self.observer.schedule(self, self.currentdir)
if __debug__:
print('%s Journal "%s"' % (polling and 'Polling' or 'Monitoring', self.currentdir))
print('Start logfile "%s"' % self.logfile)
print('{} Journal {!r}'.format(polling and 'Polling' or 'Monitoring', self.currentdir))
print('Start logfile {!r}'.format(self.logfile))
if not self.running():
self.thread = threading.Thread(target=self.worker, name='Journal worker')
@ -232,7 +232,7 @@ class EDLogs(FileSystemEventHandler):
except Exception:
if __debug__:
print('Invalid journal entry "%s"' % repr(line))
print('Invalid journal entry {!r}'.format(line))
log_pos = loghandle.tell()
@ -308,7 +308,7 @@ class EDLogs(FileSystemEventHandler):
log_pos = 0
if __debug__:
print('New logfile "%s"' % logfile)
print('New logfile {!r}'.format(logfile))
if logfile:
loghandle.seek(0, SEEK_END) # required to make macOS notice log change over SMB
@ -330,7 +330,7 @@ class EDLogs(FileSystemEventHandler):
if self.game_was_running:
if not self.game_running():
self.event_queue.append(
'{ "timestamp":"%s", "event":"ShutDown" }' % strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())
'{{ "timestamp":"{}", "event":"ShutDown" }}'.format(strftime('%Y-%m-%dT%H:%M:%SZ', gmtime()))
)
self.root.event_generate('<<JournalEvent>>', when="tail")
@ -747,7 +747,7 @@ class EDLogs(FileSystemEventHandler):
return entry
except Exception:
if __debug__:
print('Invalid journal entry "%s"' % repr(line))
print('Invalid journal entry {!r}'.format(line))
print_exc()
return {'event': None}
@ -804,7 +804,7 @@ class EDLogs(FileSystemEventHandler):
elif self.live and entry['event'] == 'Music' and entry.get('MusicTrack') == 'MainMenu':
self.event_queue.append(
'{ "timestamp":"%s", "event":"ShutDown" }' % strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())
'{{ "timestamp":"{}", "event":"ShutDown" }}'.format(strftime('%Y-%m-%dT%H:%M:%SZ', gmtime()))
)
return entry
@ -897,7 +897,9 @@ class EDLogs(FileSystemEventHandler):
return # same as last time - don't write
# Write
filename = join(config.get('outdir'), '%s.%s.txt' % (ship, strftime('%Y-%m-%dT%H.%M.%S', localtime(time()))))
filename = join(
config.get('outdir'), '{}.{}.txt'.format(ship, strftime('%Y-%m-%dT%H.%M.%S', localtime(time())))
)
with open(filename, 'wt') as h:
h.write(string)