MCPcopy Index your code
hub / github.com/python/cpython / decode

Method decode

Lib/test/test_io/test_textio.py:84–99  ·  view source on GitHub ↗
(self, input, final=False)

Source from the content-addressed store, hash-verified

82 self.i, self.o = i ^ 1, o ^ 1
83
84 def decode(self, input, final=False):
85 output = ''
86 for b in input:
87 if self.i == 0: # variable-length, terminated with period
88 if b == ord('.'):
89 if self.buffer:
90 output += self.process_word()
91 else:
92 self.buffer.append(b)
93 else: # fixed-length, terminate after self.i bytes
94 self.buffer.append(b)
95 if len(self.buffer) == self.i:
96 output += self.process_word()
97 if final and self.buffer: # EOF terminates the last word
98 output += self.process_word()
99 return output
100
101 def process_word(self):
102 output = ''

Callers 15

test_decoderMethod · 0.95
test_get_sourceMethod · 0.45
test_read_textMethod · 0.45
test_open_textMethod · 0.45
test_only_sourceMethod · 0.45
test_qualname_sourceMethod · 0.45
test_builtinsMethod · 0.45
test_detailsMethod · 0.45
_from_subinterpMethod · 0.45
process_wordMethod · 0.45

Calls 2

process_wordMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected