From c2e7a1602f153cb08c908e96f10578bbce731bb3 Mon Sep 17 00:00:00 2001 From: Chris Kerr Date: Sun, 16 Feb 2020 09:49:40 +0200 Subject: [PATCH] Remove maketrans compatibility code --- galvani/BioLogic.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/galvani/BioLogic.py b/galvani/BioLogic.py index be2996f..3191c07 100644 --- a/galvani/BioLogic.py +++ b/galvani/BioLogic.py @@ -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):