Skip to content

Commit e13ebb8

Browse files
committed
chore(ruff) Automated fixes for typing annotations
Fixed 12 errors: - src/libvcs/_internal/query_list.py: 2 × UP006 (non-pep585-annotation) 1 × I001 (unsorted-imports) - tests/_internal/test_query_list.py: 1 × I001 (unsorted-imports) 1 × UP006 (non-pep585-annotation) - tests/sync/test_git.py: 3 × UP006 (non-pep585-annotation) 1 × I001 (unsorted-imports) - tests/url/test_registry.py: 1 × I001 (unsorted-imports) 1 × UP006 (non-pep585-annotation) 1 × TC003 (typing-only-standard-library-import) Found 1918 errors (12 fixed, 1906 remaining). 51 files left unchanged uv run ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; uv run ruff format .
1 parent cdf99c8 commit e13ebb8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/libvcs/_internal/query_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import re
1010
import traceback
1111
import typing as t
12-
from collections.abc import Iterable, Mapping, Sequence
12+
from collections.abc import Callable, Iterable, Mapping, Sequence
1313

1414
logger = logging.getLogger(__name__)
1515

@@ -502,7 +502,7 @@ def __eq__(
502502

503503
def filter(
504504
self,
505-
matcher: t.Optional[t.Union[t.Callable[[T], bool], T]] = None,
505+
matcher: t.Optional[t.Union[Callable[[T], bool], T]] = None,
506506
**kwargs: t.Any,
507507
) -> "QueryList[T]":
508508
def filter_lookup(obj: t.Any) -> bool:
@@ -542,7 +542,7 @@ def val_match(obj: t.Union[str, list[t.Any], T]) -> bool:
542542

543543
def get(
544544
self,
545-
matcher: t.Optional[t.Union[t.Callable[[T], bool], T]] = None,
545+
matcher: t.Optional[t.Union[Callable[[T], bool], T]] = None,
546546
default: t.Optional[t.Any] = no_arg,
547547
**kwargs: t.Any,
548548
) -> t.Optional[T]:

tests/_internal/test_query_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import dataclasses
22
import typing as t
3+
from collections.abc import Callable
34

45
import pytest
56

@@ -250,7 +251,7 @@ class Obj:
250251
)
251252
def test_filter(
252253
items: list[dict[str, t.Any]],
253-
filter_expr: t.Optional[t.Union[t.Callable[[t.Any], bool], t.Any]],
254+
filter_expr: t.Optional[t.Union[Callable[[t.Any], bool], t.Any]],
254255
expected_result: t.Union[QueryList[t.Any], list[dict[str, t.Any]]],
255256
) -> None:
256257
qs = QueryList(items)

tests/sync/test_git.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import shutil
77
import textwrap
88
import typing as t
9+
from collections.abc import Callable
910

1011
import pytest
1112
from pytest_mock import MockerFixture
@@ -25,9 +26,9 @@
2526
pytestmark = pytest.mark.skip(reason="git is not available")
2627

2728

28-
ProjectTestFactory = t.Callable[..., GitSync]
29-
ProjectTestFactoryLazyKwargs = t.Callable[..., dict[str, str]]
30-
ProjectTestFactoryRemoteLazyExpected = t.Callable[..., dict[str, GitRemote]]
29+
ProjectTestFactory = Callable[..., GitSync]
30+
ProjectTestFactoryLazyKwargs = Callable[..., dict[str, str]]
31+
ProjectTestFactoryRemoteLazyExpected = Callable[..., dict[str, GitRemote]]
3132

3233

3334
@pytest.mark.parametrize(

tests/url/test_registry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
from libvcs.url.svn import SvnURL
1111

1212
if t.TYPE_CHECKING:
13+
from collections.abc import Callable
14+
1315
from typing_extensions import TypeAlias
1416

15-
ParserMatchLazy: TypeAlias = t.Callable[[str], registry.ParserMatch]
17+
ParserMatchLazy: TypeAlias = Callable[[str], registry.ParserMatch]
1618
DetectVCSFixtureExpectedMatch: TypeAlias = t.Union[
1719
registry.ParserMatch,
1820
ParserMatchLazy,

0 commit comments

Comments
 (0)