1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-05-30 23:29:30 +03:00

edshipyard: Use pathlib.Path.open()

This commit is contained in:
Athanasius 2021-04-07 18:23:27 +01:00
parent 11fa46163a
commit dbdf42bb38

View File

@ -193,7 +193,7 @@ def export(data, filename=None) -> None: # noqa: C901, CCR001
regexp = re.compile(re.escape(ship) + r'\.\d{4}-\d\d-\d\dT\d\d\.\d\d\.\d\d\.txt')
oldfiles = sorted([x for x in os.listdir(config.get_str('outdir')) if regexp.match(x)])
if oldfiles:
with open(pathlib.Path(config.get_str('outdir')) / oldfiles[-1], 'rU') as h:
with (pathlib.Path(config.get_str('outdir')) / oldfiles[-1]).open('r') as h:
if h.read() == string:
return # same as last time - don't write