Skip to content

Commit 50077ef

Browse files
committed
CLN: inlined to_text_string
encoding argument was not used
1 parent d82bb77 commit 50077ef

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

larray_editor/arraymodel.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
from inspect import stack
44
import numpy as np
5-
from larray_editor.utils import (get_default_font, to_text_string,
5+
from larray_editor.utils import (get_default_font,
66
is_float, is_number, LinearGradient, SUPPORTED_FORMATS, scale_to_01range,
77
Product, is_number_value, get_sample, get_sample_indices, logger)
88
from qtpy.QtCore import Qt, QModelIndex, QAbstractTableModel, Signal
@@ -456,10 +456,8 @@ def convert_value(self, value):
456456
return bool(float(value))
457457
except ValueError:
458458
return value.lower() == "true"
459-
elif dtype.name.startswith("string"):
459+
elif dtype.name.startswith("string") or dtype.name.startswith("unicode"):
460460
return str(value)
461-
elif dtype.name.startswith("unicode"):
462-
return to_text_string(value)
463461
elif is_float(dtype):
464462
return float(value)
465463
elif is_number(dtype):

larray_editor/utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,6 @@ def _(text):
167167
return text
168168

169169

170-
def to_text_string(obj, encoding=None):
171-
"""Convert `obj` to (unicode) text string"""
172-
if encoding is None:
173-
return str(obj)
174-
elif isinstance(obj, str):
175-
# In case this function is not used properly, this could happen
176-
return obj
177-
else:
178-
return str(obj, encoding)
179-
180-
181170
def keybinding(attr):
182171
"""Return keybinding"""
183172
ks = getattr(QKeySequence, attr)

0 commit comments

Comments
 (0)