Skip to content

Commit c70fa70

Browse files
mxrsebastinas
authored andcommitted
mypy
1 parent d3e7a17 commit c70fa70

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

bpython/_typing_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
# introduced in Python 3.11
2525
from typing import Never
2626
except ImportError:
27-
from typing import NoReturn as Never # type: ignore
27+
from typing_extensions import Never # type: ignore

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ def close(self) -> None:
236236

237237
@property
238238
def encoding(self) -> str:
239-
return sys.__stdin__.encoding
239+
# `encoding` is new in py39
240+
return sys.__stdin__.encoding # type: ignore
240241

241242
# TODO write a read() method?
242243

bpython/pager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def page(data: str, use_internal: bool = False) -> None:
5555
try:
5656
popen = subprocess.Popen(command, stdin=subprocess.PIPE)
5757
assert popen.stdin is not None
58-
data_bytes = data.encode(sys.__stdout__.encoding, "replace")
58+
# `encoding` is new in py39
59+
data_bytes = data.encode(sys.__stdout__.encoding, "replace") # type: ignore
5960
popen.stdin.write(data_bytes)
6061
popen.stdin.close()
6162
except OSError as e:

bpython/test/test_preprocess.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
import unittest
55

66
from code import compile_command as compiler
7+
from codeop import CommandCompiler
78
from functools import partial
89

910
from bpython.curtsiesfrontend.interpreter import code_finished_will_parse
1011
from bpython.curtsiesfrontend.preprocess import preprocess
1112
from bpython.test.fodder import original, processed
1213

1314

14-
preproc = partial(preprocess, compiler=compiler)
15+
preproc = partial(preprocess, compiler=CommandCompiler)
1516

1617

1718
def get_fodder_source(test_name):

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ install_requires =
2929
pygments
3030
pyxdg
3131
requests
32+
typing_extensions ; python_version < "3.11"
3233

3334
[options.extras_require]
3435
clipboard = pyperclip

0 commit comments

Comments
 (0)