diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0aba36a..a910df5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.5.5 + rev: v0.15.2 hooks: # Run the linter. - id: ruff @@ -12,7 +12,7 @@ repos: pass_filenames: false - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.0 + rev: v1.19.1 hooks: - id: mypy additional_dependencies: ["types-pyyaml"] diff --git a/src/textmate_grammar/elements.py b/src/textmate_grammar/elements.py index e026e9b..cfec9cd 100644 --- a/src/textmate_grammar/elements.py +++ b/src/textmate_grammar/elements.py @@ -2,9 +2,10 @@ from abc import ABC from collections import defaultdict +from collections.abc import Generator from itertools import groupby from pprint import pprint -from typing import TYPE_CHECKING, Generator +from typing import TYPE_CHECKING from .handler import POS, ContentHandler, Match, Pattern from .utils.logger import LOGGER diff --git a/src/textmate_grammar/handler.py b/src/textmate_grammar/handler.py index 3b675bb..47b9646 100644 --- a/src/textmate_grammar/handler.py +++ b/src/textmate_grammar/handler.py @@ -1,7 +1,7 @@ from __future__ import annotations +from collections.abc import Callable from pathlib import Path -from typing import Callable import charset_normalizer as charset from onigurumacffi import _Match as Match diff --git a/src/textmate_grammar/utils/logger.py b/src/textmate_grammar/utils/logger.py index 0a607e0..baef92c 100644 --- a/src/textmate_grammar/utils/logger.py +++ b/src/textmate_grammar/utils/logger.py @@ -114,7 +114,7 @@ def format_message( else: msg_id = "." * self.max_token_length - vb_message = f"{'|'*(depth-1)}{'-'*bool(depth)}{message}" + vb_message = f"{'|' * (depth - 1)}{'-' * bool(depth)}{message}" if len(vb_message) > MAX_LENGTH: half_length = min([(MAX_LENGTH - 6) // 2, (len(vb_message) - 6) // 2])