Skip to content

Commit a9b4fa0

Browse files
authored
Fix some stubtest complaints before they happen (#9585)
Add missing objects to various stubs
1 parent 4148a7b commit a9b4fa0

File tree

8 files changed

+21
-1
lines changed

8 files changed

+21
-1
lines changed

stdlib/lib2to3/pygram.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from lib2to3.pgen2.grammar import Grammar
23

34
class Symbols:
@@ -110,4 +111,6 @@ class pattern_symbols(Symbols):
110111

111112
python_grammar: Grammar
112113
python_grammar_no_print_statement: Grammar
114+
if sys.version_info >= (3, 8):
115+
python_grammar_no_print_and_exec_statement: Grammar
113116
pattern_grammar: Grammar

stubs/decorator/decorator.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import inspect
12
from builtins import dict as _dict # alias to avoid conflicts with attribute name
23
from collections.abc import Callable, Iterator
34
from contextlib import _GeneratorContextManager
45
from inspect import Signature, getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction
56
from re import Pattern
67
from typing import Any, TypeVar
7-
from typing_extensions import ParamSpec
8+
from typing_extensions import Literal, ParamSpec
89

910
_C = TypeVar("_C", bound=Callable[..., Any])
1011
_Func = TypeVar("_Func", bound=Callable[..., Any])
@@ -14,6 +15,7 @@ _P = ParamSpec("_P")
1415
def get_init(cls: type) -> None: ...
1516

1617
DEF: Pattern[str]
18+
POS: Literal[inspect._ParameterKind.POSITIONAL_OR_KEYWORD]
1719

1820
class FunctionMaker:
1921
args: list[str]

stubs/dockerfile-parse/dockerfile_parse/parser.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import logging
12
from collections.abc import Mapping, Sequence
23
from typing import IO, ClassVar
34
from typing_extensions import TypedDict
45

56
from .util import Context
67

8+
logger: logging.Logger
9+
710
class KeyValues(dict[str, str]):
811
parser_attr: ClassVar[str | None]
912
parser: DockerfileParser

stubs/playsound/playsound.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import logging
12
import pathlib
23

4+
logger: logging.Logger
5+
36
class PlaysoundException(Exception): ...
47

58
def playsound(sound: str | pathlib.Path, block: bool = ...) -> None: ...

stubs/pyinstaller/PyInstaller/__main__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# https://pyinstaller.org/en/stable/usage.html#running-pyinstaller-from-python-code
2+
import logging
23
from _typeshed import SupportsKeysAndGetItem
34
from collections.abc import Iterable
45
from typing_extensions import TypeAlias
@@ -8,4 +9,6 @@ _PyIConfig: TypeAlias = (
89
SupportsKeysAndGetItem[str, bool | str | list[str] | None] | Iterable[tuple[str, bool | str | list[str] | None]]
910
)
1011

12+
logger: logging.Logger
13+
1114
def run(pyi_args: Iterable[str] | None = ..., pyi_config: _PyIConfig | None = ...) -> None: ...

stubs/pyinstaller/PyInstaller/utils/hooks/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# https://pyinstaller.org/en/stable/hooks.html
22

3+
import logging
34
from _typeshed import StrOrBytesPath, StrPath
45
from collections.abc import Callable, Iterable
56
from typing import Any
@@ -13,6 +14,7 @@ from PyInstaller.utils.hooks.win32 import get_pywin32_module_file_attribute as g
1314

1415
conda_support = conda
1516

17+
logger: logging.Logger
1618
PY_IGNORE_EXTENSIONS: set[str]
1719
hook_variables: dict[str, str]
1820

stubs/retry/retry/api.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ from typing import Any, TypeVar
55

66
_R = TypeVar("_R")
77

8+
logging_logger: Logger
9+
810
def retry_call(
911
f: Callable[..., _R],
1012
fargs: Sequence[Any] | None = ...,

stubs/vobject/vobject/base.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import logging
12
from _typeshed import Incomplete, SupportsWrite
23
from collections.abc import Iterable, Iterator
34
from typing import Any, TypeVar, overload
45
from typing_extensions import Literal
56

7+
logger: logging.Logger
68
DEBUG: bool
79
CR: str
810
LF: str

0 commit comments

Comments
 (0)