MCPcopy Index your code
hub / github.com/RustPython/RustPython / decode

Method decode

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

Source from the content-addressed store, hash-verified

2742 self.i, self.o = i ^ 1, o ^ 1
2743
2744 def decode(self, input, final=False):
2745 output = ''
2746 for b in input:
2747 if self.i == 0: # variable-length, terminated with period
2748 if b == ord('.'):
2749 if self.buffer:
2750 output += self.process_word()
2751 else:
2752 self.buffer.append(b)
2753 else: # fixed-length, terminate after self.i bytes
2754 self.buffer.append(b)
2755 if len(self.buffer) == self.i:
2756 output += self.process_word()
2757 if final and self.buffer: # EOF terminates the last word
2758 output += self.process_word()
2759 return output
2760
2761 def process_word(self):
2762 output = ''

Callers 15

test_decoderMethod · 0.95
process_wordMethod · 0.45
setUpMethod · 0.45
test_newlines_inputMethod · 0.45
test_read_byteslikeMethod · 0.45
_check_decodeMethod · 0.45
_decode_bytewiseMethod · 0.45

Calls 4

process_wordMethod · 0.95
ordFunction · 0.85
lenFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected