Skip to content

Commit

Permalink
Fix all mypy notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored and abravalheri committed Nov 19, 2024
1 parent 3d9e8ad commit 593bf67
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions setuptools/command/build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def build_package_data(self) -> None:
_outf, _copied = self.copy_file(srcfile, target)
make_writable(target)

def analyze_manifest(self):
def analyze_manifest(self) -> None:
self.manifest_files: dict[str, list[str]] = {}
if not self.distribution.include_package_data:
return
Expand Down Expand Up @@ -215,7 +215,9 @@ def analyze_manifest(self):
check.warn(importable)
self.manifest_files.setdefault(src_dirs[d], []).append(path)

def _filter_build_files(self, files: Iterable[str], egg_info: str) -> Iterator[str]:
def _filter_build_files(
self, files: Iterable[str], egg_info: StrPath
) -> Iterator[str]:
"""
``build_meta`` may try to create egg_info outside of the project directory,
and this can be problematic for certain plugins (reported in issue #3500).
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _render_version():
print(f'setuptools {dist.version} from {dist.location} (Python {ver})')
raise SystemExit

def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME
def finalize_options(self) -> None: # noqa: C901 # is too complex (25) # FIXME
self.version and self._render_version()

py_version = sys.version.split()[0]
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/editable_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def _empty_dir(dir_: _P) -> _P:


class _NamespaceInstaller(namespaces.Installer):
def __init__(self, distribution, installation_dir, editable_name, src_root):
def __init__(self, distribution, installation_dir, editable_name, src_root) -> None:
self.distribution = distribution
self.src_root = src_root
self.installation_dir = installation_dir
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def __init__(
super().__init__(warn, debug_print)
self.ignore_egg_info_dir = ignore_egg_info_dir

def process_template_line(self, line):
def process_template_line(self, line) -> None:
# Parse the line: split it up, make sure the right number of words
# is there, and return the relevant words. 'action' is always
# defined: it's the first word of the line. Which of the other
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/install_egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class install_egg_info(namespaces.Installer, Command):
def initialize_options(self):
self.install_dir = None

def finalize_options(self):
def finalize_options(self) -> None:
self.set_undefined_options('install_lib', ('install_dir', 'install_dir'))
ei_cmd = self.get_finalized_command("egg_info")
basename = f"{ei_cmd._get_egg_basename()}.egg-info"
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/saveopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class saveopts(option_base):

description = "save supplied options to setup.cfg or other config file"

def run(self):
def run(self) -> None:
dist = self.distribution
settings: dict[str, dict[str, str]] = {}

Expand Down
2 changes: 1 addition & 1 deletion setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def _parse_command_opts(self, parser, args):

return nargs

def get_cmdline_options(self):
def get_cmdline_options(self) -> dict[str, dict[str, str | None]]:
"""Return a '{cmd: {opt:val}}' map of all command-line options
Option names are all long, but do not include the leading '--', and
Expand Down
4 changes: 2 additions & 2 deletions setuptools/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def find_reg_vs_vers(self):
vs_vers.append(ver)
return sorted(vs_vers)

def find_programdata_vs_vers(self):
def find_programdata_vs_vers(self) -> dict[float, str]:
r"""
Find Visual studio 2017+ versions from information in
"C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
Expand Down Expand Up @@ -607,7 +607,7 @@ def WindowsSdkLastVersion(self):
return self._use_last_dir_name(os.path.join(self.WindowsSdkDir, 'lib'))

@property
def WindowsSdkDir(self): # noqa: C901 # is too complex (12) # FIXME
def WindowsSdkDir(self) -> str | None: # noqa: C901 # is too complex (12) # FIXME
"""
Microsoft Windows SDK directory.
Expand Down

0 comments on commit 593bf67

Please sign in to comment.