Skip to content

Commit

Permalink
Make distutils.dist.Distribution.get_command_obj not return None
Browse files Browse the repository at this point in the history
…by default (#11950)
  • Loading branch information
Avasam committed May 18, 2024
1 parent 3e0269b commit 003361c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions stdlib/distutils/dist.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from _typeshed import FileDescriptorOrPath, Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from distutils.cmd import Command
from re import Pattern
from typing import IO, Any, ClassVar, TypeVar, overload
from typing import IO, Any, ClassVar, Literal, TypeVar, overload
from typing_extensions import TypeAlias

command_re: Pattern[str]
Expand Down Expand Up @@ -63,7 +63,10 @@ class Distribution:
def __init__(self, attrs: Mapping[str, Any] | None = None) -> None: ...
def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ...
def parse_config_files(self, filenames: Iterable[str] | None = None) -> None: ...
def get_command_obj(self, command: str, create: bool = True) -> Command | None: ...
@overload
def get_command_obj(self, command: str, create: Literal[1, True] = 1) -> Command: ...
@overload
def get_command_obj(self, command: str, create: Literal[0, False]) -> Command | None: ...
global_options: ClassVar[_OptionsList]
common_usage: ClassVar[str]
display_options: ClassVar[_OptionsList]
Expand Down
3 changes: 0 additions & 3 deletions stubs/setuptools/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ pkg_resources.PathMetadata.egg_info
pkg_resources.EggMetadata.loader
pkg_resources.ZipProvider.loader

# 1 used for True as a default value
setuptools._distutils.dist.Distribution.get_command_obj

# Dynamically created in __init__
setuptools._distutils.dist.Distribution.get_name
setuptools._distutils.dist.Distribution.get_version
Expand Down
7 changes: 5 additions & 2 deletions stubs/setuptools/setuptools/_distutils/dist.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import FileDescriptorOrPath, Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from re import Pattern
from typing import IO, Any, ClassVar, TypeVar, overload
from typing import IO, Any, ClassVar, Literal, TypeVar, overload
from typing_extensions import TypeAlias

from .cmd import Command
Expand Down Expand Up @@ -64,7 +64,10 @@ class Distribution:
def __init__(self, attrs: Mapping[str, Any] | None = None) -> None: ...
def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ...
def parse_config_files(self, filenames: Iterable[str] | None = None) -> None: ...
def get_command_obj(self, command: str, create: bool = True) -> Command | None: ...
@overload
def get_command_obj(self, command: str, create: Literal[1, True] = 1) -> Command: ...
@overload
def get_command_obj(self, command: str, create: Literal[0, False]) -> Command | None: ...
global_options: ClassVar[_OptionsList]
common_usage: ClassVar[str]
display_options: ClassVar[_OptionsList]
Expand Down

0 comments on commit 003361c

Please sign in to comment.