Skip to content

zimscraperlib.typing

Classes:

Callback dataclass

Callback(
    func: Callable[..., Any],
    args: tuple[Any, ...] | None = None,
    kwargs: dict[str, Any] | None = None,
)

Methods:

Attributes:

args class-attribute instance-attribute

args: tuple[Any, ...] | None = None

callable property

callable: bool

func instance-attribute

func: Callable[..., Any]

kwargs class-attribute instance-attribute

kwargs: dict[str, Any] | None = None

call

call()
Source code in src/zimscraperlib/typing.py
28
29
def call(self):
    self.call_with(*self.get_args(), **self.get_kwargs())

call_with

call_with(*args: Any, **kwargs: Any)
Source code in src/zimscraperlib/typing.py
25
26
def call_with(self, *args: Any, **kwargs: Any):
    self.func(*args, **kwargs)

get_args

get_args() -> tuple[Any, ...]
Source code in src/zimscraperlib/typing.py
19
20
def get_args(self) -> tuple[Any, ...]:
    return self.args or ()

get_kwargs

get_kwargs() -> dict[str, Any]
Source code in src/zimscraperlib/typing.py
22
23
def get_kwargs(self) -> dict[str, Any]:
    return self.kwargs or {}

SupportsRead

Bases: Protocol[_T_co]

Methods:

read

read(length: int = ...) -> _T_co
Source code in src/zimscraperlib/typing.py
41
def read(self, length: int = ..., /) -> _T_co: ...

SupportsSeekableRead

Bases: SupportsRead[_T_co], SupportsSeeking, Protocol

Methods:

read

read(length: int = ...) -> _T_co
Source code in src/zimscraperlib/typing.py
41
def read(self, length: int = ..., /) -> _T_co: ...

seek

seek(target: int, whence: int = 0) -> int
Source code in src/zimscraperlib/typing.py
48
def seek(self, target: int, whence: int = 0) -> int: ...

seekable

seekable() -> bool
Source code in src/zimscraperlib/typing.py
46
def seekable(self) -> bool: ...

tell

tell() -> int
Source code in src/zimscraperlib/typing.py
50
def tell(self) -> int: ...

truncate

truncate(pos: int) -> int
Source code in src/zimscraperlib/typing.py
52
def truncate(self, pos: int) -> int: ...

SupportsSeekableWrite

Bases: SupportsWrite[_T_contra], SupportsSeeking, Protocol

Methods:

seek

seek(target: int, whence: int = 0) -> int
Source code in src/zimscraperlib/typing.py
48
def seek(self, target: int, whence: int = 0) -> int: ...

seekable

seekable() -> bool
Source code in src/zimscraperlib/typing.py
46
def seekable(self) -> bool: ...

tell

tell() -> int
Source code in src/zimscraperlib/typing.py
50
def tell(self) -> int: ...

truncate

truncate(pos: int) -> int
Source code in src/zimscraperlib/typing.py
52
def truncate(self, pos: int) -> int: ...

write

write(s: _T_contra) -> object
Source code in src/zimscraperlib/typing.py
36
def write(self, s: _T_contra, /) -> object: ...

SupportsSeeking

Bases: Protocol

Methods:

seek

seek(target: int, whence: int = 0) -> int
Source code in src/zimscraperlib/typing.py
48
def seek(self, target: int, whence: int = 0) -> int: ...

seekable

seekable() -> bool
Source code in src/zimscraperlib/typing.py
46
def seekable(self) -> bool: ...

tell

tell() -> int
Source code in src/zimscraperlib/typing.py
50
def tell(self) -> int: ...

truncate

truncate(pos: int) -> int
Source code in src/zimscraperlib/typing.py
52
def truncate(self, pos: int) -> int: ...

SupportsWrite

Bases: Protocol[_T_contra]

Protocol exposing an expected write method

Methods:

write

write(s: _T_contra) -> object
Source code in src/zimscraperlib/typing.py
36
def write(self, s: _T_contra, /) -> object: ...