Skip to content

Fix linters #1028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master
with:
skip: '*.po'
ignore_words_list: ba,te,deltion,dedent,dedented
skip: '*.po',encoding_latin1.py
ignore_words_list: ba,te,deltion,dedent,dedented,assertIn

mypy:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion bpython/_typing_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
# introduced in Python 3.11
from typing import Never
except ImportError:
from typing import NoReturn as Never # type: ignore
from typing_extensions import Never # type: ignore
3 changes: 2 additions & 1 deletion bpython/curtsiesfrontend/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def close(self) -> None:

@property
def encoding(self) -> str:
return sys.__stdin__.encoding
# `encoding` is new in py39
return sys.__stdin__.encoding # type: ignore

# TODO write a read() method?

Expand Down
3 changes: 2 additions & 1 deletion bpython/pager.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def page(data: str, use_internal: bool = False) -> None:
try:
popen = subprocess.Popen(command, stdin=subprocess.PIPE)
assert popen.stdin is not None
data_bytes = data.encode(sys.__stdout__.encoding, "replace")
# `encoding` is new in py39
data_bytes = data.encode(sys.__stdout__.encoding, "replace") # type: ignore
popen.stdin.write(data_bytes)
popen.stdin.close()
except OSError as e:
Expand Down
4 changes: 3 additions & 1 deletion bpython/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def runsource(
with self.timer:
return super().runsource(source, filename, symbol)

def showsyntaxerror(self, filename: Optional[str] = None, source: Optional[str] = None) -> None:
def showsyntaxerror(
self, filename: Optional[str] = None, source: Optional[str] = None
) -> None:
"""Override the regular handler, the code's copied and pasted from
code.py, as per showtraceback, but with the syntaxerror callback called
and the text in a pretty colour."""
Expand Down
3 changes: 2 additions & 1 deletion bpython/test/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import unittest

from code import compile_command as compiler
from codeop import CommandCompiler
from functools import partial

from bpython.curtsiesfrontend.interpreter import code_finished_will_parse
from bpython.curtsiesfrontend.preprocess import preprocess
from bpython.test.fodder import original, processed


preproc = partial(preprocess, compiler=compiler)
preproc = partial(preprocess, compiler=CommandCompiler)


def get_fodder_source(test_name):
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ install_requires =
pygments
pyxdg
requests
typing_extensions ; python_version < "3.11"

[options.extras_require]
clipboard = pyperclip
Expand Down