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

Method _fix

21-async/mojifinder/bottle.py:1908–1914  ·  view source on GitHub ↗
(self, s, encoding=None)

Source from the content-addressed store, hash-verified

1906 recode_unicode = True
1907
1908 def _fix(self, s, encoding=None):
1909 if isinstance(s, unicode) and self.recode_unicode: # Python 3 WSGI
1910 return s.encode('latin1').decode(encoding or self.input_encoding)
1911 elif isinstance(s, bytes): # Python 2 WSGI
1912 return s.decode(encoding or self.input_encoding)
1913 else:
1914 return s
1915
1916 def decode(self, encoding=None):
1917 ''' Returns a copy with all keys and values de- or recoded to match

Callers 2

decodeMethod · 0.95
getunicodeMethod · 0.95

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected