Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions distutils/archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import annotations

import os
from collections.abc import Callable
from typing import Literal, overload

try:
Expand Down Expand Up @@ -114,7 +115,7 @@ def _set_uid_gid(tarinfo):
tarinfo.uname = owner
return tarinfo

tar = tarfile.open(archive_name, f'w|{tar_compression[compress]}')
tar = tarfile.open(archive_name, f'w|{tar_compression[compress]}') # type: ignore[call-overload] # Dynamic mode
try:
tar.add(base_dir, filter=_set_uid_gid)
finally:
Expand Down Expand Up @@ -185,7 +186,9 @@ def make_zipfile(
return zip_filename


ARCHIVE_FORMATS = {
ARCHIVE_FORMATS: dict[
str, tuple[Callable[..., str], list[tuple[str, str | None]], str]
] = {
'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
'xztar': (make_tarball, [('compress', 'xz')], "xz'ed tar-file"),
Expand Down
17 changes: 8 additions & 9 deletions distutils/compilers/C/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ class Compiler:
attributes may be varied on a per-compilation or per-link basis.
"""

# 'compiler_type' is a class attribute that identifies this class. It
# keeps code that wants to know what kind of compiler it's dealing with
# from having to import all possible compiler classes just to do an
# 'isinstance'. In concrete CCompiler subclasses, 'compiler_type'
# should really, really be one of the keys of the 'compiler_class'
# dictionary (see below -- used by the 'new_compiler()' factory
# function) -- authors of new compiler interface classes are
# responsible for updating 'compiler_class'!
compiler_type: ClassVar[str] = None
compiler_type: ClassVar[str]
"""
Identify the kind of compiler, so callers can tell compilers apart
without importing every compiler class for an ``isinstance`` check.
Set this in each concrete subclass to one of the keys of
``compiler_class`` (see below, used by ``new_compiler()``), and update
``compiler_class`` to match.
"""

# XXX things not handled by this compiler abstraction model:
# * client can't provide additional options for a compiler,
Expand Down
4 changes: 1 addition & 3 deletions distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,7 @@ def get_command_obj(
self, command: str, create: Literal[True] = True
) -> Command: ...
@overload
def get_command_obj(
self, command: str, create: Literal[False]
) -> Command | None: ...
def get_command_obj(self, command: str, create: bool) -> Command | None: ...
def get_command_obj(self, command: str, create: bool = True) -> Command | None:
"""Return the command object for 'command'. Normally this object
is cached on a previous call to 'get_command_obj()'; if no command
Expand Down
8 changes: 4 additions & 4 deletions distutils/filelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def process_template_line(self, line: str) -> None: # noqa: C901
@overload
def include_pattern(
self,
pattern: str,
pattern: str | None,
anchor: bool = True,
prefix: str | None = None,
is_regex: Literal[False] = False,
Expand All @@ -224,7 +224,7 @@ def include_pattern(
) -> bool: ...
def include_pattern(
self,
pattern: str | re.Pattern,
pattern: str | re.Pattern | None,
anchor: bool = True,
prefix: str | None = None,
is_regex: bool = False,
Expand Down Expand Up @@ -272,7 +272,7 @@ def include_pattern(
@overload
def exclude_pattern(
self,
pattern: str,
pattern: str | None,
anchor: bool = True,
prefix: str | None = None,
is_regex: Literal[False] = False,
Expand All @@ -296,7 +296,7 @@ def exclude_pattern(
) -> bool: ...
def exclude_pattern(
self,
pattern: str | re.Pattern,
pattern: str | re.Pattern | None,
anchor: bool = True,
prefix: str | None = None,
is_regex: bool = False,
Expand Down
1 change: 0 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ disable_error_code =
operator,
arg-type,
assignment,
call-overload,
union-attr,
misc,

Expand Down
Loading