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

Class BufferedFiller

Tools/unicode/genmap_support.py:9–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9class BufferedFiller:
10 def __init__(self, column=78):
11 self.column = column
12 self.buffered = []
13 self.cline = []
14 self.clen = 0
15 self.count = 0
16
17 def write(self, *data):
18 for s in data:
19 if len(s) > self.column:
20 raise ValueError("token is too long")
21 if len(s) + self.clen > self.column:
22 self.flush()
23 self.clen += len(s)
24 self.cline.append(s)
25 self.count += 1
26
27 def flush(self):
28 if not self.cline:
29 return
30 self.buffered.append(''.join(self.cline))
31 self.clen = 0
32 del self.cline[:]
33
34 def printout(self, fp):
35 self.flush()
36 for l in self.buffered:
37 fp.write(f'{l}\n')
38 del self.buffered[:]
39
40 def __len__(self):
41 return self.count
42
43
44class DecodeMapWriter:

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…