Return the indentation of the next line based on the current input buffer.
(self)
| 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: |
no test coverage detected