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

Function tob

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

Source from the content-addressed store, hash-verified

124
125# Some helpers for string/byte handling
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

Callers 7

default_error_handlerMethod · 0.85
wsgiMethod · 0.85
_iter_chunkedMethod · 0.85
parse_authFunction · 0.85
cookie_encodeFunction · 0.85
cookie_decodeFunction · 0.85
cookie_is_encodedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected