mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-25 18:48:15 +00:00
remove typing_extensions requirement
The typing_extensions package is only necessary now when running mypy. It won't be used at runtime anymore.
This commit is contained in:
@@ -7,12 +7,9 @@
|
||||
"""
|
||||
Common data types and protocols for analysers.
|
||||
"""
|
||||
from typing import TypeVar, Mapping, List, Any
|
||||
from typing import Mapping, List, Any
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
|
||||
T_config = TypeVar('T_config') # pylint: disable=invalid-name
|
||||
from nominatim.typing import Protocol
|
||||
|
||||
class Analyser(Protocol):
|
||||
""" Instance of the token analyser.
|
||||
@@ -28,17 +25,17 @@ class Analyser(Protocol):
|
||||
and transliterate the result.
|
||||
"""
|
||||
|
||||
class AnalysisModule(Protocol[T_config]):
|
||||
class AnalysisModule(Protocol):
|
||||
""" Protocol for analysis modules.
|
||||
"""
|
||||
|
||||
def configure(self, rules: Mapping[str, Any], normalization_rules: str) -> T_config:
|
||||
def configure(self, rules: Mapping[str, Any], normalization_rules: str) -> Any:
|
||||
""" Prepare the configuration of the analysis module.
|
||||
This function should prepare all data that can be shared
|
||||
between instances of this analyser.
|
||||
"""
|
||||
|
||||
def create(self, normalizer: Any, transliterator: Any, config: T_config) -> Analyser:
|
||||
def create(self, normalizer: Any, transliterator: Any, config: Any) -> Analyser:
|
||||
""" Create a new instance of the analyser.
|
||||
A separate instance of the analyser is created for each thread
|
||||
when used in multi-threading context.
|
||||
|
||||
Reference in New Issue
Block a user