MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / touni

Function touni

21-async/mojifinder/bottle.py:128–129  ·  view source on GitHub ↗
(s, enc='utf8', err='strict')

Source from the content-addressed store, hash-verified

126def tob(s, enc='utf8'):
127 return s.encode(enc) if isinstance(s, unicode) else bytes(s)
128def touni(s, enc='utf8', err='strict'):
129 return s.decode(enc, err) if isinstance(s, bytes) else unicode(s)
130tonat = touni if py3k else tob
131
132# 3.2 fixes cgi.FieldStorage to accept bytes (which makes a lot of sense).

Callers 6

bottle.pyFile · 0.85
set_cookieMethod · 0.85
parse_authFunction · 0.85
prepareMethod · 0.85
codeMethod · 0.85
__init__Method · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected