Temporarily restore 3.6.0 support

This commit is contained in:
Anthony Sottile
2020-02-24 15:05:05 -08:00
parent 76d77b72a5
commit c4944669e9
2 changed files with 31 additions and 22 deletions

View File

@@ -11,9 +11,10 @@ repos:
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: [flake8-typing-imports==1.7.0]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.4
hooks:
@@ -33,7 +34,3 @@ repos:
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.730
hooks:
- id: mypy

24
babi.py
View File

@@ -137,19 +137,28 @@ class Margin(NamedTuple):
header: bool
footer: bool
@property
def body_lines(self) -> int:
@property
def body_lines(self) -> int:
return curses.LINES - self.header - self.footer
@property
def page_size(self) -> int:
Margin.body_lines = body_lines
@property
def page_size(self) -> int:
if self.body_lines <= 2:
return 1
else:
return self.body_lines - 2
@classmethod
def from_screen(cls, screen: 'curses._CursesWindow') -> 'Margin':
Margin.page_size = page_size
@classmethod
def from_screen(cls, screen: 'curses._CursesWindow') -> 'Margin':
if curses.LINES == 1:
return cls(header=False, footer=False)
elif curses.LINES == 2:
@@ -158,6 +167,9 @@ class Margin(NamedTuple):
return cls(header=True, footer=True)
Margin.from_screen = from_screen
def _get_color_pair_mapping() -> Dict[Tuple[int, int], int]:
ret = {}
i = 0