Skip to content

Commit f8c7d7c

Browse files
committed
fix: use typevar to annotate registry
1 parent 0fa0116 commit f8c7d7c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

translation_finder/api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,26 @@
88

99
import sys
1010
from argparse import ArgumentParser
11-
from typing import TYPE_CHECKING, TextIO
11+
from typing import TYPE_CHECKING, TextIO, TypeVar
12+
13+
from translation_finder.discovery.base import BaseDiscovery
1214

1315
from .finder import Finder
1416

1517
if TYPE_CHECKING:
1618
from pathlib import PurePath
1719

18-
from translation_finder.discovery.base import BaseDiscovery
1920
from translation_finder.discovery.result import DiscoveryResult
2021

2122
from .finder import PathMockType
2223

2324
BACKENDS: list[type[BaseDiscovery]] = []
2425

2526

26-
def register_discovery(cls: type[BaseDiscovery]) -> type[BaseDiscovery]:
27+
DiscoveryT = TypeVar("DiscoveryT", bound=type[BaseDiscovery])
28+
29+
30+
def register_discovery(cls: DiscoveryT) -> DiscoveryT:
2731
"""Register a discovery class."""
2832
BACKENDS.append(cls)
2933
return cls

0 commit comments

Comments
 (0)