MCPcopy
hub / github.com/rocky/python-uncompyle6 / write

Method write

uncompyle6/semantics/pysource.py:478–508  ·  view source on GitHub ↗
(self, *data)

Source from the content-addressed store, hash-verified

476 return result
477
478 def write(self, *data):
479 if (len(data) == 0) or (len(data) == 1 and data[0] == ""):
480 return
481 out = "".join((str(j) for j in data))
482 n = 0
483 for i in out:
484 if i == "\n":
485 n += 1
486 if n == len(out):
487 self.pending_newlines = max(self.pending_newlines, n)
488 return
489 elif n:
490 self.pending_newlines = max(self.pending_newlines, n)
491 out = out[n:]
492 break
493 else:
494 break
495
496 if self.pending_newlines > 0:
497 self.f.write("\n" * self.pending_newlines)
498 self.pending_newlines = 0
499
500 for i in out[::-1]:
501 if i == "\n":
502 self.pending_newlines += 1
503 else:
504 break
505
506 if self.pending_newlines:
507 out = out[: -self.pending_newlines]
508 self.f.write(out)
509
510 def println(self, *data):
511 if data and not (len(data) == 1 and data[0] == ""):

Callers 11

indent_if_source_nlMethod · 0.95
printlnMethod · 0.95
pp_tupleMethod · 0.95
print_super_classesMethod · 0.95
print_super_classes3Method · 0.95
kv_mapMethod · 0.95
template_engineMethod · 0.95
gen_sourceMethod · 0.95
str_with_templateMethod · 0.45
traverseMethod · 0.45
code_deparseFunction · 0.45

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected