MCPcopy Index your code
hub / github.com/bpython/bpython / next_indentation

Method next_indentation

bpython/repl.py:845–862  ·  view source on GitHub ↗

Return the indentation of the next line based on the current input buffer.

(self)

Source from the content-addressed store, hash-verified

843 return out
844
845 def next_indentation(self) -> int:
846 """Return the indentation of the next line based on the current
847 input buffer."""
848 if self.buffer:
849 indentation = next_indentation(
850 self.buffer[-1], self.config.tab_length
851 )
852 if indentation and self.config.dedent_after > 0:
853
854 def line_is_empty(line):
855 return not line.strip()
856
857 empty_lines = takewhile(line_is_empty, reversed(self.buffer))
858 if sum(1 for _ in empty_lines) >= self.config.dedent_after:
859 indentation -= 1
860 else:
861 indentation = 0
862 return indentation
863
864 @abstractmethod
865 def getstdout(self) -> str:

Callers 2

reevaluateMethod · 0.80
promptMethod · 0.80

Calls 1

next_indentationFunction · 0.85

Tested by

no test coverage detected