MCPcopy Create free account
hub / github.com/numpy/numpy / coerce_text

Function coerce_text

tools/npy_tempita/compat3.py:43–53  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

41
42
43def coerce_text(v):
44 if not isinstance(v, basestring_):
45 if sys.version_info[0] < 3:
46 attr = '__unicode__'
47 else:
48 attr = '__str__'
49 if hasattr(v, attr):
50 return unicode(v)
51 else:
52 return bytes(v)
53 return v

Callers 5

_evalMethod · 0.85
_reprMethod · 0.85
html_quoteFunction · 0.85
urlFunction · 0.85
fill_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected