Remove maketrans compatibility code

This commit is contained in:
2020-02-16 09:49:40 +02:00
parent 9ba43ecc2e
commit c2e7a1602f

View File

@@ -17,10 +17,8 @@ import numpy as np
if sys.version_info.major <= 2:
str3 = str
from string import maketrans
else:
str3 = functools.partial(str, encoding='ascii')
maketrans = bytes.maketrans
def fieldname_to_dtype(fieldname):
@@ -49,10 +47,10 @@ def fieldname_to_dtype(fieldname):
raise ValueError("Invalid column header: %s" % fieldname)
def comma_converter(float_string):
"""Convert numbers to floats whether the decimal point is '.' or ','"""
trans_table = maketrans(b',', b'.')
return float(float_string.translate(trans_table))
def comma_converter(float_text):
"""Convert text to float whether the decimal point is '.' or ','"""
trans_table = bytes.maketrans(b',', b'.')
return float(float_text.translate(trans_table))
def MPTfile(file_or_path):