MCPcopy Create free account
hub / github.com/catboost/catboost / to_unicode

Function to_unicode

library/python/strings/strings.py:45–53  ·  view source on GitHub ↗
(value, from_enc=DEFAULT_ENCODING)

Source from the content-addressed store, hash-verified

43
44
45def to_unicode(value, from_enc=DEFAULT_ENCODING):
46 if isinstance(value, six.text_type):
47 return value
48 if isinstance(value, six.binary_type):
49 if six.PY2:
50 return unicode(value, from_enc, ENCODING_ERRORS_POLICY) # noqa
51 else:
52 return value.decode(from_enc, errors=ENCODING_ERRORS_POLICY)
53 return six.text_type(value)
54
55
56# Optional from_enc enables transcoding

Callers 1

to_strFunction · 0.85

Calls 2

isinstanceFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected