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

Method decode

21-async/mojifinder/bottle.py:1916–1925  ·  view source on GitHub ↗

Returns a copy with all keys and values de- or recoded to match :attr:`input_encoding`. Some libraries (e.g. WTForms) want a unicode dictionary.

(self, encoding=None)

Source from the content-addressed store, hash-verified

1914 return s
1915
1916 def decode(self, encoding=None):
1917 ''' Returns a copy with all keys and values de- or recoded to match
1918 :attr:`input_encoding`. Some libraries (e.g. WTForms) want a
1919 unicode dictionary. '''
1920 copy = FormsDict()
1921 enc = copy.input_encoding = encoding or self.input_encoding
1922 copy.recode_unicode = False
1923 for key, value in self.allitems():
1924 copy.append(self._fix(key, enc), self._fix(value, enc))
1925 return copy
1926
1927 def getunicode(self, name, default=None, encoding=None):
1928 ''' Return the value as a unicode string, or the default. '''

Callers 12

handle_echoFunction · 0.80
handle_echoFunction · 0.80
finderFunction · 0.80
touniFunction · 0.80
_handleMethod · 0.80
headerlistMethod · 0.80
_fixMethod · 0.80
filenameMethod · 0.80
loaderMethod · 0.80
__init__Method · 0.80
iter_iso_recordsFunction · 0.80

Calls 4

_fixMethod · 0.95
FormsDictClass · 0.85
allitemsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected