-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added type stub for pytricia library
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from typing import TypeVar, overload, Generic, Iterator, List, Tuple, Union | ||
from socket import AF_INET as _AF_INET | ||
from ipaddress import _BaseAddress, _BaseNetwork | ||
|
||
_KT = Union[str, int, bytes, Tuple[bytes, int], _BaseAddress, _BaseNetwork] | ||
_KOutT = Union[str, Tuple[bytes, int]] | ||
_VT = TypeVar("_VT") | ||
|
||
|
||
class PyTricia(Generic[_VT]): | ||
def __init__(self, prefixlen: int = 32, family: int = _AF_INET, raw_output: bool = False) -> None: ... | ||
|
||
def __len__(self) -> int: ... | ||
def __contains__(self, key: _KT) -> bool: ... | ||
def __getitem__(self, key: _KT) -> _VT: ... | ||
def __setitem__(self, key: _KT, value: _VT) -> None: ... | ||
def __delitem__(self, key: _KT) -> None: ... | ||
def __iter__(self) -> Iterator[_KOutT]: ... | ||
|
||
def has_key(self, key: _KT) -> bool: ... | ||
def keys(self) -> List[_KOutT]: ... | ||
def get(self, key: _KT, default: _VT = None) -> _VT: ... | ||
def get_key(self, key: _KT) -> _KOutT: ... | ||
def delete(self, key: _KT) -> None: ... | ||
@overload | ||
def insert(self, key: _KT, value: _VT) -> None: ... | ||
@overload | ||
def insert(self, key: _KT, prefixlen: int, value: _VT) -> None: ... | ||
def children(self, key: _KT) -> List[_KOutT]: ... | ||
def parent(self, key: _KT) -> List[_KOutT]: ... |