Skip to content

Commit 1c3c8fa

Browse files
committed
mypy: fix all call-overload
1 parent 399a98f commit 1c3c8fa

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎distutils/archive_util.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import annotations
77

88
import os
9+
from collections.abc import Callable
910
from typing import Literal, overload
1011

1112
try:
@@ -114,7 +115,7 @@ def _set_uid_gid(tarinfo):
114115
tarinfo.uname = owner
115116
return tarinfo
116117

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

187188

188-
ARCHIVE_FORMATS = {
189+
ARCHIVE_FORMATS: dict[
190+
str, tuple[Callable[..., str], list[tuple[str, str | None]], str]
191+
] = {
189192
'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
190193
'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
191194
'xztar': (make_tarball, [('compress', 'xz')], "xz'ed tar-file"),

‎distutils/compilers/C/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Compiler:
7171
# dictionary (see below -- used by the 'new_compiler()' factory
7272
# function) -- authors of new compiler interface classes are
7373
# responsible for updating 'compiler_class'!
74-
compiler_type: ClassVar[str] = None
74+
compiler_type: ClassVar[str | None] = None
7575

7676
# XXX things not handled by this compiler abstraction model:
7777
# * client can't provide additional options for a compiler,

‎distutils/dist.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,7 @@ def get_command_obj(
863863
self, command: str, create: Literal[True] = True
864864
) -> Command: ...
865865
@overload
866-
def get_command_obj(
867-
self, command: str, create: Literal[False]
868-
) -> Command | None: ...
866+
def get_command_obj(self, command: str, create: bool) -> Command | None: ...
869867
def get_command_obj(self, command: str, create: bool = True) -> Command | None:
870868
"""Return the command object for 'command'. Normally this object
871869
is cached on a previous call to 'get_command_obj()'; if no command

‎distutils/filelist.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def process_template_line(self, line: str) -> None: # noqa: C901
200200
@overload
201201
def include_pattern(
202202
self,
203-
pattern: str,
203+
pattern: str | None,
204204
anchor: bool = True,
205205
prefix: str | None = None,
206206
is_regex: Literal[False] = False,
@@ -224,7 +224,7 @@ def include_pattern(
224224
) -> bool: ...
225225
def include_pattern(
226226
self,
227-
pattern: str | re.Pattern,
227+
pattern: str | re.Pattern | None,
228228
anchor: bool = True,
229229
prefix: str | None = None,
230230
is_regex: bool = False,
@@ -272,7 +272,7 @@ def include_pattern(
272272
@overload
273273
def exclude_pattern(
274274
self,
275-
pattern: str,
275+
pattern: str | None,
276276
anchor: bool = True,
277277
prefix: str | None = None,
278278
is_regex: Literal[False] = False,
@@ -296,7 +296,7 @@ def exclude_pattern(
296296
) -> bool: ...
297297
def exclude_pattern(
298298
self,
299-
pattern: str | re.Pattern,
299+
pattern: str | re.Pattern | None,
300300
anchor: bool = True,
301301
prefix: str | None = None,
302302
is_regex: bool = False,

‎mypy.ini‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ disable_error_code =
2626
operator,
2727
arg-type,
2828
assignment,
29-
call-overload,
3029
index,
3130
func-returns-value,
3231
union-attr,

0 commit comments

Comments
 (0)