MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / expandtabs

Method expandtabs

pye.py:1047–1061  ·  view source on GitHub ↗
(self, s)

Source from the content-addressed store, hash-verified

1045 pass
1046 os.rename(tmpfile, fname)
1047 def expandtabs(self, s):
1048 if '\t' in s:
1049 self.write_tabs = True
1050 sb = StringIO()
1051 pos = 0
1052 for c in s:
1053 if c == '\t':
1054 sb.write(" " * (8 - pos % 8))
1055 pos += 8 - pos % 8
1056 else:
1057 sb.write(c)
1058 pos += 1
1059 return sb.getvalue()
1060 else:
1061 return s
1062def pye_edit(content, tab_size=4, undo=50, io_device=None):
1063 if io_device is None:
1064 print("IO device not defined")

Callers 1

get_fileMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected