Skip to content

Commit b73e99c

Browse files
authored
ANN204 (missing return type for special methods) autofixes (#4736)
2 parents 1f79847 + 8c78ed8 commit b73e99c

19 files changed

+34
-32
lines changed

_distutils_hack/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def do_override():
9090

9191

9292
class _TrivialRe:
93-
def __init__(self, *patterns):
93+
def __init__(self, *patterns) -> None:
9494
self._patterns = patterns
9595

9696
def match(self, string):

pkg_resources/tests/test_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def pairwise(iterable):
3232
class Metadata(pkg_resources.EmptyProvider):
3333
"""Mock object to return metadata as if from an on-disk distribution"""
3434

35-
def __init__(self, *pairs):
35+
def __init__(self, *pairs) -> None:
3636
self.metadata = dict(pairs)
3737

3838
def has_metadata(self, name) -> bool:

pkg_resources/tests/test_working_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def parse_distributions(s):
5656

5757

5858
class FakeInstaller:
59-
def __init__(self, installable_dists):
59+
def __init__(self, installable_dists) -> None:
6060
self._installable_dists = installable_dists
6161

6262
def __call__(self, req):

setuptools/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class MinimalDistribution(distutils.core.Distribution):
6060
fetch_build_eggs interface.
6161
"""
6262

63-
def __init__(self, attrs: Mapping[str, object]):
63+
def __init__(self, attrs: Mapping[str, object]) -> None:
6464
_incl = 'dependency_links', 'setup_requires'
6565
filtered = {k: attrs[k] for k in set(_incl) & set(attrs)}
6666
super().__init__(filtered)
@@ -167,7 +167,7 @@ class Command(_Command):
167167
command_consumes_arguments = False
168168
distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution
169169

170-
def __init__(self, dist: Distribution, **kw):
170+
def __init__(self, dist: Distribution, **kw) -> None:
171171
"""
172172
Construct the command for dist, updating
173173
vars(self) with any keyword parameters.

setuptools/build_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373

7474
class SetupRequirementsError(BaseException):
75-
def __init__(self, specifiers):
75+
def __init__(self, specifiers) -> None:
7676
self.specifiers = specifiers
7777

7878

setuptools/command/develop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class VersionlessRequirement:
185185
'foo'
186186
"""
187187

188-
def __init__(self, dist):
188+
def __init__(self, dist) -> None:
189189
self.__dist = dist
190190

191191
def __getattr__(self, name: str):

setuptools/command/easy_install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ def get_exe_prefixes(exe_filename):
16121612
class PthDistributions(Environment):
16131613
"""A .pth file with Distribution paths in it"""
16141614

1615-
def __init__(self, filename, sitedirs=()):
1615+
def __init__(self, filename, sitedirs=()) -> None:
16161616
self.filename = filename
16171617
self.sitedirs = list(map(normalize_path, sitedirs))
16181618
self.basedir = normalize_path(os.path.dirname(self.filename))

setuptools/command/editable_wheel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def __exit__(
392392

393393

394394
class _StaticPth:
395-
def __init__(self, dist: Distribution, name: str, path_entries: list[Path]):
395+
def __init__(self, dist: Distribution, name: str, path_entries: list[Path]) -> None:
396396
self.dist = dist
397397
self.name = name
398398
self.path_entries = path_entries
@@ -436,7 +436,7 @@ def __init__(
436436
name: str,
437437
auxiliary_dir: StrPath,
438438
build_lib: StrPath,
439-
):
439+
) -> None:
440440
self.auxiliary_dir = Path(auxiliary_dir)
441441
self.build_lib = Path(build_lib).resolve()
442442
self._file = dist.get_command_obj("build_py").copy_file
@@ -496,7 +496,7 @@ def __exit__(
496496

497497

498498
class _TopLevelFinder:
499-
def __init__(self, dist: Distribution, name: str):
499+
def __init__(self, dist: Distribution, name: str) -> None:
500500
self.dist = dist
501501
self.name = name
502502

setuptools/command/egg_info.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ def find_sources(self) -> None:
324324
class FileList(_FileList):
325325
# Implementations of the various MANIFEST.in commands
326326

327-
def __init__(self, warn=None, debug_print=None, ignore_egg_info_dir: bool = False):
327+
def __init__(
328+
self, warn=None, debug_print=None, ignore_egg_info_dir: bool = False
329+
) -> None:
328330
super().__init__(warn, debug_print)
329331
self.ignore_egg_info_dir = ignore_egg_info_dir
330332

setuptools/config/expand.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
class StaticModule:
5353
"""Proxy to a module object that avoids executing arbitrary code."""
5454

55-
def __init__(self, name: str, spec: ModuleSpec):
55+
def __init__(self, name: str, spec: ModuleSpec) -> None:
5656
module = ast.parse(pathlib.Path(spec.origin).read_bytes()) # type: ignore[arg-type] # Let it raise an error on None
5757
vars(self).update(locals())
5858
del self.self
@@ -383,7 +383,7 @@ class EnsurePackagesDiscovered:
383383
and those might not have been processed yet.
384384
"""
385385

386-
def __init__(self, distribution: Distribution):
386+
def __init__(self, distribution: Distribution) -> None:
387387
self._dist = distribution
388388
self._called = False
389389

@@ -430,7 +430,7 @@ class LazyMappingProxy(Mapping[_K, _V_co]):
430430
'other value'
431431
"""
432432

433-
def __init__(self, obtain_mapping_value: Callable[[], Mapping[_K, _V_co]]):
433+
def __init__(self, obtain_mapping_value: Callable[[], Mapping[_K, _V_co]]) -> None:
434434
self._obtain = obtain_mapping_value
435435
self._value: Mapping[_K, _V_co] | None = None
436436

0 commit comments

Comments
 (0)