mirror of
https://github.com/echemdata/galvani.git
synced 2025-12-14 09:15:34 +00:00
Remove maketrans compatibility code
This commit is contained in:
@@ -17,10 +17,8 @@ import numpy as np
|
|||||||
|
|
||||||
if sys.version_info.major <= 2:
|
if sys.version_info.major <= 2:
|
||||||
str3 = str
|
str3 = str
|
||||||
from string import maketrans
|
|
||||||
else:
|
else:
|
||||||
str3 = functools.partial(str, encoding='ascii')
|
str3 = functools.partial(str, encoding='ascii')
|
||||||
maketrans = bytes.maketrans
|
|
||||||
|
|
||||||
|
|
||||||
def fieldname_to_dtype(fieldname):
|
def fieldname_to_dtype(fieldname):
|
||||||
@@ -49,10 +47,10 @@ def fieldname_to_dtype(fieldname):
|
|||||||
raise ValueError("Invalid column header: %s" % fieldname)
|
raise ValueError("Invalid column header: %s" % fieldname)
|
||||||
|
|
||||||
|
|
||||||
def comma_converter(float_string):
|
def comma_converter(float_text):
|
||||||
"""Convert numbers to floats whether the decimal point is '.' or ','"""
|
"""Convert text to float whether the decimal point is '.' or ','"""
|
||||||
trans_table = maketrans(b',', b'.')
|
trans_table = bytes.maketrans(b',', b'.')
|
||||||
return float(float_string.translate(trans_table))
|
return float(float_text.translate(trans_table))
|
||||||
|
|
||||||
|
|
||||||
def MPTfile(file_or_path):
|
def MPTfile(file_or_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user