Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#260)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.7.2](astral-sh/ruff-pre-commit@v0.6.3...v0.7.2)
- [github.com/python-jsonschema/check-jsonschema: 0.29.2 → 0.29.4](python-jsonschema/check-jsonschema@0.29.2...0.29.4)
- [github.com/asottile/blacken-docs: 1.18.0 → 1.19.1](adamchainz/blacken-docs@1.18.0...1.19.1)
- [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.13.0](pre-commit/mirrors-mypy@v1.11.2...v1.13.0)

* Fix typing of context arg

* Restrict Context arg

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and sloria authored Nov 5, 2024
1 parent 97f3698 commit 151d5f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ venv

# pytest
.pytest_cache
tests/test-output

# Other
.directory
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ ci:
exclude: docopt.py
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.7.2
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
rev: 0.29.4
hooks:
- id: check-github-workflows
- id: check-readthedocs
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==23.12.1]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
exclude: example_rcfiles/
9 changes: 6 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ Changelog
5.0.0 (unreleased)
------------------

* *Backwards-incompatible*: Remove ``konch.__version__`` attribute.
Use ``importlib.metadata.version("konch")`` instead.
Typing:

* Fix typing of ``context`` parameter to allow callables.
* Restrict ``Context`` type to ``dict[str, Any]``.

Other changes:

* Drop support for Python 3.8 (EOL).
* Test against Python 3.13.
* Remove unnecessary tabcomplete code from ``PythonShell``,
since tab completion is enabled by default.

* *Backwards-incompatible*: Remove ``konch.__version__`` attribute.
Use ``importlib.metadata.version("konch")`` instead.

4.5.0 (2024-01-10)
------------------
Expand Down
8 changes: 5 additions & 3 deletions src/konch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def print_warning(text: str) -> None:
return sprint(f"{prefix}: {text}", file=sys.stderr)


Context = typing.Mapping[str, typing.Any]
Context = dict[str, typing.Any]
Formatter = typing.Callable[[Context], str]
ContextFormat = typing.Union[str, Formatter]

Expand Down Expand Up @@ -324,7 +324,7 @@ class Shell:

def __init__(
self,
context: Context,
context: typing.Union[Context, typing.Callable[[], Context]],
banner: typing.Optional[str] = None,
prompt: typing.Optional[str] = None,
output: typing.Optional[str] = None,
Expand Down Expand Up @@ -803,7 +803,9 @@ def update(self, d: typing.Mapping) -> None: # type: ignore


def start(
context: typing.Optional[typing.Mapping] = None,
context: typing.Optional[
typing.Union[Context, typing.Callable[[], Context]]
] = None,
banner: typing.Optional[str] = None,
shell: type[Shell] = AutoShell,
prompt: typing.Optional[str] = None,
Expand Down

0 comments on commit 151d5f1

Please sign in to comment.