Skip to content

Commit

Permalink
Update pre-commit and lint deps
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Jan 7, 2024
1 parent 004e104 commit 9681ba0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
19 changes: 10 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v3.15.0
hooks:
- id: pyupgrade
exclude: docopt.py
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/python/black
rev: 21.12b0
rev: 23.12.1
hooks:
- id: black
exclude: docopt.py
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==21.4.3]
additional_dependencies: [flake8-bugbear==23.12.2]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v1.8.0
hooks:
- id: mypy
exclude: example_rcfiles/
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==21.12b0]
additional_dependencies: [black==23.12.1]
20 changes: 13 additions & 7 deletions konch.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def style(

def sprint(text: str, *args: typing.Any, **kwargs: typing.Any) -> None:
file = kwargs.pop("file", sys.stdout)
return print(style(text, file=file, *args, **kwargs), file=file)
return print(style(text, *args, **kwargs, file=file), file=file)


def print_error(text: str) -> None:
Expand Down Expand Up @@ -371,7 +371,9 @@ def start(self) -> None:
if self.prompt:
sys.ps1 = self.prompt
if self.output:
warnings.warn("Custom output templates not supported by PythonShell.")
warnings.warn(
"Custom output templates not supported by PythonShell.", stacklevel=2
)
code.interact(self.banner, local=self.context)
return None

Expand Down Expand Up @@ -542,7 +544,6 @@ def configure(repl):


class PtIPythonShell(PtPythonShell):

banner_template: str = "{text}\n{context}"

def __init__(
Expand Down Expand Up @@ -620,9 +621,11 @@ def start(self) -> None:
except ImportError:
raise ShellNotAvailableError("BPython shell not available.")
if self.prompt:
warnings.warn("Custom prompts not supported by BPythonShell.")
warnings.warn("Custom prompts not supported by BPythonShell.", stacklevel=2)
if self.output:
warnings.warn("Custom output templates not supported by BPythonShell.")
warnings.warn(
"Custom output templates not supported by BPythonShell.", stacklevel=2
)
embed(banner=self.banner, locals_=self.context)
return None

Expand All @@ -643,10 +646,13 @@ def start(self) -> None:
except ImportError:
raise ShellNotAvailableError("BPython Curses shell not available.")
if self.prompt:
warnings.warn("Custom prompts not supported by BPython Curses shell.")
warnings.warn(
"Custom prompts not supported by BPython Curses shell.", stacklevel=2
)
if self.output:
warnings.warn(
"Custom output templates not supported by BPython Curses shell."
"Custom output templates not supported by BPython Curses shell.",
stacklevel=2,
)
main(banner=self.banner, locals_=self.context, args=["-i", "-q"])
return None
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ license_files = LICENSE
universal = 1

[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80
max-line-length = 90
max-complexity = 18
select = B,C,E,F,W,T4,B9
extend-ignore = E203, E266, E501, E731, B903

[mypy]
ignore_missing_imports = true
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
EXTRAS_REQUIRE = {
"tests": ["pytest", "mock", "scripttest==1.3", "ipython", "bpython"],
"lint": [
"mypy==0.910",
"flake8==3.9.2",
"flake8-bugbear==21.4.3",
"mypy==1.8.0",
"flake8==7.0.0",
"flake8-bugbear==23.12.2",
"pre-commit~=3.5",
],
}
Expand Down

0 comments on commit 9681ba0

Please sign in to comment.