mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 09:57:40 +03:00
Tidied regexp
Python regexps should always be held in r'' or raw strings, ensuring that python doesn't try to expand the regexp escapes. I also removed the escaped -, as they're only special characters in character groups
This commit is contained in:
parent
be9ac29a5b
commit
a6e6b6353d
@ -200,7 +200,7 @@ def export(data, filename=None):
|
|||||||
|
|
||||||
# Look for last ship of this type
|
# Look for last ship of this type
|
||||||
ship = companion.ship_file_name(data['ship'].get('shipName'), data['ship']['name'])
|
ship = companion.ship_file_name(data['ship'].get('shipName'), data['ship']['name'])
|
||||||
regexp = re.compile(re.escape(ship) + '\.\d\d\d\d\-\d\d\-\d\dT\d\d\.\d\d\.\d\d\.txt')
|
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('outdir')) if regexp.match(x)])
|
oldfiles = sorted([x for x in os.listdir(config.get('outdir')) if regexp.match(x)])
|
||||||
if oldfiles:
|
if oldfiles:
|
||||||
with open(join(config.get('outdir'), oldfiles[-1]), 'rU') as h:
|
with open(join(config.get('outdir'), oldfiles[-1]), 'rU') as h:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user