Remove redundant string conversions

This commit is contained in:
usov_i 2021-01-07 11:28:47 +01:00
parent d0b67b8565
commit 315b025341

View File

@ -120,12 +120,13 @@ def parse_1D(fileobj, data_type):
if "=" in line:
variable, value = line.split("=")
variable = variable.strip()
value = value.strip()
if variable in META_VARS_FLOAT:
metadata[variable] = float(value)
elif variable in META_VARS_STR:
metadata[variable] = str(value)[:-1].strip()
metadata[variable] = value
elif variable in META_UB_MATRIX:
metadata[variable] = re.findall(r"[-+]?\d*\.\d+|\d+", str(value))
metadata[variable] = re.findall(r"[-+]?\d*\.\d+|\d+", value)
if "#data" in line:
# this is the end of metadata and the start of data section