mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-15 23:02:16 +03:00
loadout.py: Collapse the construction of output filename
All the intermediate variables were more a "work in progress" thing. Tested as still working.
This commit is contained in:
parent
e4055530b4
commit
c61f235734
22
loadout.py
22
loadout.py
@ -49,19 +49,11 @@ def export(data: companion.CAPIData, requested_filename: Optional[str] = None) -
|
|||||||
query_time = config.get_int('querytime', default=int(time.time()))
|
query_time = config.get_int('querytime', default=int(time.time()))
|
||||||
|
|
||||||
# Write
|
# Write
|
||||||
#
|
|
||||||
# When this is refactored into multi-line CHECK IT WORKS, avoiding the
|
with open(
|
||||||
# brainfart we had with dangling commas in commodity.py:export() !!!
|
pathlib.Path(config.get_str('outdir')) / pathlib.Path(
|
||||||
#
|
ship + '.' + time.strftime('%Y-%m-%dT%H.%M.%S', time.localtime(query_time)) + '.txt'
|
||||||
output_path = pathlib.Path(config.get_str('outdir'))
|
),
|
||||||
output_filename = pathlib.Path(
|
'wt'
|
||||||
ship + '.' + time.strftime('%Y-%m-%dT%H.%M.%S', time.localtime(query_time)) + '.txt'
|
) as h:
|
||||||
)
|
|
||||||
# Can't re-use `filename`, different type
|
|
||||||
file_name = output_path / output_filename
|
|
||||||
#
|
|
||||||
# When this is refactored into multi-line CHECK IT WORKS, avoiding the
|
|
||||||
# brainfart we had with dangling commas in commodity.py:export() !!!
|
|
||||||
#
|
|
||||||
with open(file_name, 'wt') as h:
|
|
||||||
h.write(string)
|
h.write(string)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user