diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af71903..b9f3bbc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,13 +3,13 @@ ci: skip: [markdownlint_docker] repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.0.264" + rev: "v0.1.11" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/pre-commit/mirrors-prettier # keep it before yamllint - rev: v3.0.0-alpha.9-for-vscode + rev: v4.0.0-alpha.8 hooks: - id: prettier always_run: true @@ -22,12 +22,12 @@ repos: hooks: - id: markdownlint_docker - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.12.1 hooks: - id: black args: [--safe] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -38,14 +38,14 @@ repos: - id: debug-statements language_version: python3 - repo: https://github.com/adrienverge/yamllint.git - rev: v1.31.0 + rev: v1.33.0 hooks: - id: yamllint files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.2.0 + rev: v1.8.0 hooks: - id: mypy # mypy args needed in order to match mypy cli behavior @@ -61,7 +61,7 @@ repos: - subprocess-tee - typer>=0.7.0 - repo: https://github.com/pycqa/pylint - rev: v3.0.0a6 + rev: v3.0.3 hooks: - id: pylint additional_dependencies: diff --git a/src/mk/ctx.py b/src/mk/ctx.py index d02e7f3..71c23dd 100644 --- a/src/mk/ctx.py +++ b/src/mk/ctx.py @@ -1,11 +1,11 @@ -from typing import Optional +from __future__ import annotations from mk.runner import Runner class Context: def __init__(self) -> None: - self._runner: Optional[Runner] = None + self._runner: Runner | None = None @property def runner(self) -> Runner: diff --git a/src/mk/text.py b/src/mk/text.py index 2bcdf03..1b6430a 100644 --- a/src/mk/text.py +++ b/src/mk/text.py @@ -1,8 +1,9 @@ +from __future__ import annotations + import re -from typing import Union -def strip_ansi_escape(text: Union[str, bytes]) -> str: +def strip_ansi_escape(text: str | bytes) -> str: """Remove all ANSI escapes from string or bytes. If bytes is passed instead of string, it will be converted to string diff --git a/src/mk/tools/git.py b/src/mk/tools/git.py index d44967f..7f4bfd1 100644 --- a/src/mk/tools/git.py +++ b/src/mk/tools/git.py @@ -97,8 +97,9 @@ def up(self): if result.returncode == 0: pr_list = [] if result.stdout: - for line in result.stdout.splitlines(): - pr_list.append(line.split("\t")[0]) + pr_list = [ + line.split("\t")[0] for line in result.stdout.splitlines() + ] if len(pr_list) == 0: logging.debug("Existing PR not found, creating one.") commit = repo.head.commit diff --git a/test/test_cli.py b/test/test_cli.py index 4405348..9370eea 100644 --- a/test/test_cli.py +++ b/test/test_cli.py @@ -1,7 +1,8 @@ +from __future__ import annotations + import os import re import runpy -from typing import Optional import pytest from subprocess_tee import run @@ -39,7 +40,7 @@ def test_completion_speed(benchmark, monkeypatch) -> None: # monkeypatch.setenv("_MK_COMPLETE", "complete_zsh") # monkeypatch.setenv("_TYPER_COMPLETE_ARGS", "c") - def do_complete() -> Optional[int]: + def do_complete() -> int | None: # shell execution can add considerable extra time that varies from # system to system. We only benchmark our own module execution time try: