Skip to content

Commit ba57b7d

Browse files
authored
[netaddr]: Annotate missing parameter types (#14990)
1 parent ec2714c commit ba57b7d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

stubs/netaddr/netaddr/ip/__init__.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from _typeshed import ConvertibleToInt, Unused
22
from abc import abstractmethod
33
from collections.abc import Iterable, Iterator
4+
from types import ModuleType
45
from typing import Literal, SupportsIndex, SupportsInt, overload
56
from typing_extensions import Self, TypeAlias
67

@@ -95,7 +96,9 @@ class IPListMixin:
9596
def __contains__(self, other: BaseIP | _IPAddressAddr) -> bool: ...
9697
def __bool__(self) -> Literal[True]: ...
9798

98-
def parse_ip_network(module, addr: tuple[int, int] | str, flags: int = 0, *, expand_partial: bool = False) -> tuple[int, int]: ...
99+
def parse_ip_network(
100+
module: ModuleType, addr: tuple[int, int] | str, flags: int = 0, *, expand_partial: bool = False
101+
) -> tuple[int, int]: ...
99102

100103
class IPNetwork(BaseIP, IPListMixin):
101104
__slots__ = ("_prefixlen",)

stubs/netaddr/netaddr/ip/iana.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from _typeshed import Incomplete, SupportsWrite
1+
from _typeshed import SupportsWrite
22
from collections.abc import Callable, Mapping, MutableMapping
33
from typing import Any
44
from typing_extensions import TypeAlias
5-
from xml.sax import handler
6-
from xml.sax.xmlreader import AttributesImpl, XMLReader
5+
from xml.sax import _Source, handler
6+
from xml.sax.xmlreader import AttributesImpl, InputSource, XMLReader
77

88
from netaddr.core import Publisher, Subscriber
99
from netaddr.ip import IPAddress, IPNetwork, IPRange
@@ -20,8 +20,8 @@ class SaxRecordParser(handler.ContentHandler):
2020

2121
class XMLRecordParser(Publisher):
2222
xmlparser: XMLReader
23-
fh: Incomplete
24-
def __init__(self, fh, **kwargs: object) -> None: ...
23+
fh: InputSource | _Source
24+
def __init__(self, fh: InputSource | _Source, **kwargs: object) -> None: ...
2525
def process_record(self, rec: Mapping[str, object]) -> dict[str, str] | None: ...
2626
def consume_record(self, rec: object) -> None: ...
2727
def parse(self) -> None: ...
@@ -41,11 +41,11 @@ class MulticastParser(XMLRecordParser):
4141
def normalise_addr(self, addr: str) -> str: ...
4242

4343
class DictUpdater(Subscriber):
44-
dct: MutableMapping[_IanaInfoKey, Incomplete]
44+
dct: MutableMapping[_IanaInfoKey, dict[str, Any]]
4545
topic: str
4646
unique_key: str
47-
def __init__(self, dct: MutableMapping[_IanaInfoKey, Incomplete], topic: str, unique_key: str) -> None: ...
48-
def update(self, data) -> None: ...
47+
def __init__(self, dct: MutableMapping[_IanaInfoKey, dict[str, Any]], topic: str, unique_key: str) -> None: ...
48+
def update(self, data: dict[str, Any]) -> None: ...
4949

5050
def load_info() -> None: ...
5151
def pprint_info(fh: SupportsWrite[str] | None = None) -> None: ...

0 commit comments

Comments
 (0)