Skip to content

Commit ada29a1

Browse files
[pycountry] Optimize stubs for pycountry 24.6.1 (thanks @donbarbos)
1 parent 61428d8 commit ada29a1

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

stubs/pycountry/METADATA.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
version = "24.6.*"
1+
version = "24.6.*"
22
upstream_repository = "https://github.com/pycountry/pycountry"
3-
4-
[tool.stubtest]
5-
skip = false

stubs/pycountry/pycountry/db.pyi

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import logging
22
from collections.abc import Callable, Iterator
3-
from typing import Any, TypeVar
3+
from typing import TypeVar
4+
from typing_extensions import ParamSpec
45

56
logger: logging.Logger
67

7-
_F = TypeVar("_F", bound=Callable[..., Any])
8+
_P = ParamSpec("_P")
9+
_R = TypeVar("_R")
810

911
class Data:
1012
def __init__(self, **fields: str) -> None: ...
@@ -16,7 +18,7 @@ class Data:
1618
class Country(Data): ...
1719
class Subdivision(Data): ...
1820

19-
def lazy_load(f: _F) -> _F: ...
21+
def lazy_load(f: Callable[_P, _R]) -> Callable[_P, _R]: ...
2022

2123
class Database:
2224
data_class: type | str
@@ -32,12 +34,12 @@ class Database:
3234
@lazy_load
3335
def add_entry(self, **kw: str) -> None: ...
3436
@lazy_load
35-
def remove_entry(self, **kw: Any) -> None: ...
37+
def remove_entry(self, **kw: str) -> None: ...
3638
@lazy_load
3739
def __iter__(self) -> Iterator[Data]: ...
3840
@lazy_load
3941
def __len__(self) -> int: ...
4042
@lazy_load
41-
def get(self, *, default: Data | None = ..., **kw: Any) -> Data | None: ...
43+
def get(self, *, default: Data | None = ..., **kw: str) -> Data | None: ...
4244
@lazy_load
4345
def lookup(self, value: str) -> Data: ...

0 commit comments

Comments
 (0)