Skip to content

Commit 526415a

Browse files
authored
[Pygments] Use Incomplete instead of Any (#15053)
1 parent 5da111e commit 526415a

File tree

23 files changed

+215
-204
lines changed

23 files changed

+215
-204
lines changed

stubs/Pygments/pygments/console.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import Any
1+
from _typeshed import Incomplete
22

33
esc: str
4-
codes: Any
5-
dark_colors: Any
6-
light_colors: Any
4+
codes: Incomplete
5+
dark_colors: Incomplete
6+
light_colors: Incomplete
77

88
def reset_color(): ...
99
def colorize(color_key, text): ...

stubs/Pygments/pygments/filter.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from _typeshed import Incomplete
12
from collections.abc import Iterable, Iterator
2-
from typing import Any
33

44
from pygments.lexer import Lexer
55
from pygments.token import _TokenType
@@ -8,11 +8,11 @@ def apply_filters(stream, filters, lexer=None): ...
88
def simplefilter(f): ...
99

1010
class Filter:
11-
options: Any
11+
options: Incomplete
1212
def __init__(self, **options) -> None: ...
1313
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
1414

1515
class FunctionFilter(Filter):
16-
function: Any
16+
function: Incomplete
1717
def __init__(self, **options) -> None: ...
1818
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1+
from _typeshed import Incomplete
12
from collections.abc import Generator, Iterable, Iterator
2-
from typing import Any
33

44
from pygments.filter import Filter
55
from pygments.lexer import Lexer
66
from pygments.token import _TokenType
77

88
def find_filter_class(filtername): ...
99
def get_filter_by_name(filtername, **options): ...
10-
def get_all_filters() -> Generator[str, None, None]: ...
10+
def get_all_filters() -> Generator[str]: ...
1111

1212
class CodeTagFilter(Filter):
13-
tag_re: Any
13+
tag_re: Incomplete
1414
def __init__(self, **options) -> None: ...
1515
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
1616

1717
class SymbolFilter(Filter):
18-
latex_symbols: Any
19-
isabelle_symbols: Any
20-
lang_map: Any
21-
symbols: Any
18+
latex_symbols: Incomplete
19+
isabelle_symbols: Incomplete
20+
lang_map: Incomplete
21+
symbols: Incomplete
2222
def __init__(self, **options) -> None: ...
2323
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
2424

2525
class KeywordCaseFilter(Filter):
26-
convert: Any
26+
convert: Incomplete
2727
def __init__(self, **options) -> None: ...
2828
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
2929

3030
class NameHighlightFilter(Filter):
31-
names: Any
32-
tokentype: Any
31+
names: Incomplete
32+
tokentype: Incomplete
3333
def __init__(self, **options) -> None: ...
3434
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
3535

3636
class ErrorToken(Exception): ...
3737

3838
class RaiseOnErrorTokenFilter(Filter):
39-
exception: Any
39+
exception: Incomplete
4040
def __init__(self, **options) -> None: ...
4141
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
4242

4343
class VisibleWhitespaceFilter(Filter):
44-
wstt: Any
44+
wstt: Incomplete
4545
def __init__(self, **options) -> None: ...
4646
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
4747

4848
class GobbleFilter(Filter):
49-
n: Any
49+
n: Incomplete
5050
def __init__(self, **options) -> None: ...
5151
def gobble(self, value, left): ...
5252
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
@@ -55,4 +55,4 @@ class TokenMergeFilter(Filter):
5555
def __init__(self, **options) -> None: ...
5656
def filter(self, lexer: Lexer, stream: Iterable[tuple[_TokenType, str]]) -> Iterator[tuple[_TokenType, str]]: ...
5757

58-
FILTERS: Any
58+
FILTERS: Incomplete

stubs/Pygments/pygments/formatter.pyi

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
from typing import Any, Generic, TypeVar, overload
1+
from _typeshed import Incomplete
2+
from typing import Generic, TypeVar, overload
23

34
_T = TypeVar("_T", str, bytes)
45

56
class Formatter(Generic[_T]):
6-
name: Any
7-
aliases: Any
8-
filenames: Any
7+
name: Incomplete
8+
aliases: Incomplete
9+
filenames: Incomplete
910
unicodeoutput: bool
10-
style: Any
11-
full: Any
12-
title: Any
13-
encoding: Any
14-
options: Any
11+
style: Incomplete
12+
full: Incomplete
13+
title: Incomplete
14+
encoding: Incomplete
15+
options: Incomplete
1516
@overload
1617
def __init__(self: Formatter[str], *, encoding: None = None, outencoding: None = None, **options) -> None: ...
1718
@overload

stubs/Pygments/pygments/formatters/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from _typeshed import Incomplete
12
from collections.abc import Generator
2-
from typing import Any
33

44
from ..formatter import Formatter
55
from .bbcode import BBCodeFormatter as BBCodeFormatter
@@ -19,7 +19,7 @@ from .svg import SvgFormatter as SvgFormatter
1919
from .terminal import TerminalFormatter as TerminalFormatter
2020
from .terminal256 import Terminal256Formatter as Terminal256Formatter, TerminalTrueColorFormatter as TerminalTrueColorFormatter
2121

22-
def get_all_formatters() -> Generator[type[Formatter[Any]], None, None]: ...
22+
def get_all_formatters() -> Generator[type[Formatter[Incomplete]]]: ...
2323
def get_formatter_by_name(_alias, **options): ...
2424
def load_formatter_from_file(filename, formattername: str = "CustomFormatter", **options): ...
2525
def get_formatter_for_filename(fn, **options): ...
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from typing import Any
1+
from _typeshed import Incomplete
22

3-
FORMATTERS: Any
3+
FORMATTERS: Incomplete
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
from typing import Any, TypeVar
1+
from _typeshed import Incomplete
2+
from typing import TypeVar
23

34
from pygments.formatter import Formatter
45

56
_T = TypeVar("_T", str, bytes)
67

78
class BBCodeFormatter(Formatter[_T]):
89
name: str
9-
aliases: Any
10-
filenames: Any
11-
styles: Any
10+
aliases: Incomplete
11+
filenames: Incomplete
12+
styles: Incomplete
1213
def format_unencoded(self, tokensource, outfile) -> None: ...

stubs/Pygments/pygments/formatters/html.pyi

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
from typing import Any, TypeVar
1+
from _typeshed import Incomplete
2+
from typing import TypeVar
23

34
from pygments.formatter import Formatter
45

56
_T = TypeVar("_T", str, bytes)
67

78
class HtmlFormatter(Formatter[_T]):
89
name: str
9-
aliases: Any
10-
filenames: Any
11-
title: Any
12-
nowrap: Any
13-
noclasses: Any
14-
classprefix: Any
15-
cssclass: Any
16-
cssstyles: Any
17-
prestyles: Any
18-
cssfile: Any
19-
noclobber_cssfile: Any
20-
tagsfile: Any
21-
tagurlformat: Any
22-
filename: Any
23-
wrapcode: Any
24-
span_element_openers: Any
10+
aliases: Incomplete
11+
filenames: Incomplete
12+
title: Incomplete
13+
nowrap: Incomplete
14+
noclasses: Incomplete
15+
classprefix: Incomplete
16+
cssclass: Incomplete
17+
cssstyles: Incomplete
18+
prestyles: Incomplete
19+
cssfile: Incomplete
20+
noclobber_cssfile: Incomplete
21+
tagsfile: Incomplete
22+
tagurlformat: Incomplete
23+
filename: Incomplete
24+
wrapcode: Incomplete
25+
span_element_openers: Incomplete
2526
linenos: int
26-
linenostart: Any
27-
linenostep: Any
28-
linenospecial: Any
29-
nobackground: Any
30-
lineseparator: Any
31-
lineanchors: Any
32-
linespans: Any
33-
anchorlinenos: Any
34-
hl_lines: Any
27+
linenostart: Incomplete
28+
linenostep: Incomplete
29+
linenospecial: Incomplete
30+
nobackground: Incomplete
31+
lineseparator: Incomplete
32+
lineanchors: Incomplete
33+
linespans: Incomplete
34+
anchorlinenos: Incomplete
35+
hl_lines: Incomplete
3536
def get_style_defs(self, arg=None): ...
3637
def get_token_style_defs(self, arg=None): ...
3738
def get_background_style_defs(self, arg=None): ...
Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, TypeVar
1+
from _typeshed import Incomplete
2+
from typing import TypeVar
23

34
from pygments.formatter import Formatter
45

@@ -8,10 +9,10 @@ class PilNotAvailable(ImportError): ...
89
class FontNotFound(Exception): ...
910

1011
class FontManager:
11-
font_name: Any
12-
font_size: Any
13-
fonts: Any
14-
encoding: Any
12+
font_name: Incomplete
13+
font_size: Incomplete
14+
fonts: Incomplete
15+
encoding: Incomplete
1516
variable: bool
1617
def __init__(self, font_name, font_size: int = 14) -> None: ...
1718
def get_char_size(self): ...
@@ -21,48 +22,48 @@ class FontManager:
2122

2223
class ImageFormatter(Formatter[_T]):
2324
name: str
24-
aliases: Any
25-
filenames: Any
25+
aliases: Incomplete
26+
filenames: Incomplete
2627
unicodeoutput: bool
2728
default_image_format: str
2829
encoding: str
29-
styles: Any
30+
styles: Incomplete
3031
background_color: str
31-
image_format: Any
32-
image_pad: Any
33-
line_pad: Any
34-
fonts: Any
35-
line_number_fg: Any
36-
line_number_bg: Any
37-
line_number_chars: Any
38-
line_number_bold: Any
39-
line_number_italic: Any
40-
line_number_pad: Any
41-
line_numbers: Any
42-
line_number_separator: Any
43-
line_number_step: Any
44-
line_number_start: Any
45-
line_number_width: Any
46-
hl_lines: Any
47-
hl_color: Any
48-
drawables: Any
32+
image_format: Incomplete
33+
image_pad: Incomplete
34+
line_pad: Incomplete
35+
fonts: Incomplete
36+
line_number_fg: Incomplete
37+
line_number_bg: Incomplete
38+
line_number_chars: Incomplete
39+
line_number_bold: Incomplete
40+
line_number_italic: Incomplete
41+
line_number_pad: Incomplete
42+
line_numbers: Incomplete
43+
line_number_separator: Incomplete
44+
line_number_step: Incomplete
45+
line_number_start: Incomplete
46+
line_number_width: Incomplete
47+
hl_lines: Incomplete
48+
hl_color: Incomplete
49+
drawables: Incomplete
4950
def get_style_defs(self, arg: str = "") -> None: ...
5051
def format(self, tokensource, outfile) -> None: ...
5152

5253
class GifImageFormatter(ImageFormatter[_T]):
5354
name: str
54-
aliases: Any
55-
filenames: Any
55+
aliases: Incomplete
56+
filenames: Incomplete
5657
default_image_format: str
5758

5859
class JpgImageFormatter(ImageFormatter[_T]):
5960
name: str
60-
aliases: Any
61-
filenames: Any
61+
aliases: Incomplete
62+
filenames: Incomplete
6263
default_image_format: str
6364

6465
class BmpImageFormatter(ImageFormatter[_T]):
6566
name: str
66-
aliases: Any
67-
filenames: Any
67+
aliases: Incomplete
68+
filenames: Incomplete
6869
default_image_format: str
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
from typing import Any, TypeVar
1+
from _typeshed import Incomplete
2+
from typing import TypeVar
23

34
from pygments.formatter import Formatter
45

56
_T = TypeVar("_T", str, bytes)
67

78
class IRCFormatter(Formatter[_T]):
89
name: str
9-
aliases: Any
10-
filenames: Any
11-
darkbg: Any
12-
colorscheme: Any
13-
linenos: Any
10+
aliases: Incomplete
11+
filenames: Incomplete
12+
darkbg: Incomplete
13+
colorscheme: Incomplete
14+
linenos: Incomplete
1415
def format_unencoded(self, tokensource, outfile) -> None: ...

0 commit comments

Comments
 (0)