[Draft] Fix airfoil data detection regex

The regular expression that Draft's airfoil data importer uses did not allow for lowercase "e" when using scientific notation. This corrects that, and silences Python Developer Mode warnings about deprecated escape sequences by converting most of the regex to use raw strings.
This commit is contained in:
Chris Hennes
2020-12-07 13:13:34 -06:00
parent 983e513704
commit ccc4e5cd21

View File

@@ -157,9 +157,9 @@ def process(doc, filename):
with the parsed information.
"""
# Regex to identify data rows and throw away unused metadata
xval = '(?P<xval>(\-|\d*)\.\d+(E\-?\d+)?)'
yval = '(?P<yval>\-?\s*\d*\.\d+(E\-?\d+)?)'
_regex = '^\s*' + xval + '\,?\s*' + yval + '\s*$'
xval = r'(?P<xval>(\-|\d*)\.\d+([Ee]\-?\d+)?)'
yval = r'(?P<yval>\-?\s*\d*\.\d+([Ee]\-?\d+)?)'
_regex = r'^\s*' + xval + r'\,?\s*' + yval + r'\s*$'
regex = re.compile(_regex)
afile = pythonopen(filename, 'r')