|
1 | 1 | import types |
2 | | -from _typeshed import Incomplete |
3 | | -from typing import Any, Generic, TypeVar, overload |
| 2 | +from _typeshed import SupportsWrite |
| 3 | +from collections.abc import Iterable, Sequence |
| 4 | +from typing import Any, ClassVar, Generic, TypeVar, overload |
| 5 | + |
| 6 | +from pygments.style import Style |
| 7 | +from pygments.token import _TokenType |
4 | 8 |
|
5 | 9 | _T = TypeVar("_T", str, bytes) |
6 | 10 |
|
7 | 11 | __all__ = ["Formatter"] |
8 | 12 |
|
9 | 13 | class Formatter(Generic[_T]): |
10 | | - name: Incomplete |
11 | | - aliases: Incomplete |
12 | | - filenames: Incomplete |
13 | | - unicodeoutput: bool |
14 | | - style: Incomplete |
15 | | - full: Incomplete |
16 | | - title: Incomplete |
17 | | - encoding: Incomplete |
18 | | - options: Incomplete |
| 14 | + name: ClassVar[str] # Set to None, but always overridden with a non-None value in subclasses. |
| 15 | + aliases: ClassVar[Sequence[str]] # Not intended to be mutable |
| 16 | + filenames: ClassVar[Sequence[str]] # Not intended to be mutable |
| 17 | + unicodeoutput: ClassVar[bool] |
| 18 | + style: type[Style] |
| 19 | + full: bool |
| 20 | + title: str |
| 21 | + encoding: str | None |
| 22 | + options: dict[str, Any] # arbitrary values used by subclasses |
19 | 23 | @overload |
20 | | - def __init__(self: Formatter[str], *, encoding: None = None, outencoding: None = None, **options) -> None: ... |
| 24 | + def __init__( |
| 25 | + self: Formatter[str], |
| 26 | + *, |
| 27 | + style: type[Style] | str = "default", |
| 28 | + full: bool = False, |
| 29 | + title: str = "", |
| 30 | + encoding: None = None, |
| 31 | + outencoding: None = None, |
| 32 | + **options: Any, # arbitrary values used by subclasses |
| 33 | + ) -> None: ... |
21 | 34 | @overload |
22 | | - def __init__(self: Formatter[bytes], *, encoding: str, outencoding: None = None, **options) -> None: ... |
| 35 | + def __init__( |
| 36 | + self: Formatter[bytes], |
| 37 | + *, |
| 38 | + style: type[Style] | str = "default", |
| 39 | + full: bool = False, |
| 40 | + title: str = "", |
| 41 | + encoding: str, |
| 42 | + outencoding: None = None, |
| 43 | + **options: Any, # arbitrary values used by subclasses |
| 44 | + ) -> None: ... |
23 | 45 | @overload |
24 | | - def __init__(self: Formatter[bytes], *, encoding: None = None, outencoding: str, **options) -> None: ... |
| 46 | + def __init__( |
| 47 | + self: Formatter[bytes], |
| 48 | + *, |
| 49 | + style: type[Style] | str = "default", |
| 50 | + full: bool = False, |
| 51 | + title: str = "", |
| 52 | + encoding: None = None, |
| 53 | + outencoding: str, |
| 54 | + **options: Any, # arbitrary values used by subclasses |
| 55 | + ) -> None: ... |
25 | 56 | def __class_getitem__(cls, name: Any) -> types.GenericAlias: ... |
26 | | - def get_style_defs(self, arg: str = ""): ... |
27 | | - def format(self, tokensource, outfile): ... |
| 57 | + def get_style_defs(self, arg: str = "") -> str: ... |
| 58 | + def format(self, tokensource: Iterable[tuple[_TokenType, str]], outfile: SupportsWrite[_T]) -> None: ... |
0 commit comments