Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve all [ignore-without-code]
Browse files Browse the repository at this point in the history
Avasam committed Aug 28, 2024
1 parent 57b722b commit 973f66a
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg_resources/__init__.py
Original file line number Diff line number Diff line change
@@ -2777,7 +2777,7 @@ def load(
if require:
# We could pass `env` and `installer` directly,
# but keeping `*args` and `**kwargs` for backwards compatibility
self.require(*args, **kwargs) # type: ignore
self.require(*args, **kwargs) # type: ignore[arg-type]
return self.resolve()

def resolve(self) -> _ResolvedEntryPoint:
13 changes: 8 additions & 5 deletions setuptools/config/expand.py
Original file line number Diff line number Diff line change
@@ -203,7 +203,9 @@ def _load_spec(spec: ModuleSpec, module_name: str) -> ModuleType:
return sys.modules[name]
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module # cache (it also ensures `==` works on loaded items)
spec.loader.exec_module(module) # type: ignore
if spec.loader is None:
raise AttributeError(f"spec {spec} is missing a loader")
spec.loader.exec_module(module)
return module


@@ -285,10 +287,10 @@ def find_packages(

from setuptools.discovery import construct_package_dir

if namespaces:
from setuptools.discovery import PEP420PackageFinder as PackageFinder
if not namespaces:
from setuptools.discovery import PackageFinder
else:
from setuptools.discovery import PackageFinder # type: ignore
from setuptools.discovery import PEP420PackageFinder as PackageFinder

root_dir = root_dir or os.curdir
where = kwargs.pop('where', ['.'])
@@ -359,7 +361,8 @@ def entry_points(text: str, text_source="entry-points") -> dict[str, dict]:
entry-point names, and the second level values are references to objects
(that correspond to the entry-point value).
"""
parser = ConfigParser(default_section=None, delimiters=("=",)) # type: ignore
# TODO: Explain why passing None is fine here when ConfigParser.default_section expects to be str
parser = ConfigParser(default_section=None, delimiters=("=",)) # type: ignore[call-overload]
parser.optionxform = str # case sensitive
parser.read_string(text, text_source)
groups = {k: dict(v.items()) for k, v in parser.items()}
4 changes: 2 additions & 2 deletions setuptools/config/pyprojecttoml.py
Original file line number Diff line number Diff line change
@@ -44,8 +44,8 @@ def validate(config: dict, filepath: StrPath) -> bool:

trove_classifier = validator.FORMAT_FUNCTIONS.get("trove-classifier")
if hasattr(trove_classifier, "_disable_download"):
# Improve reproducibility by default. See issue 31 for validate-pyproject.
trove_classifier._disable_download() # type: ignore
# Improve reproducibility by default. See abravalheri/validate-pyproject#31
trove_classifier._disable_download() # type: ignore[union-attr]

try:
return validator.validate(config)
8 changes: 4 additions & 4 deletions setuptools/tests/test_editable_install.py
Original file line number Diff line number Diff line change
@@ -878,18 +878,18 @@ class TestOverallBehaviour:
"otherfile.py": "",
"mypkg": {
"__init__.py": "",
"mod1.py": FLAT_LAYOUT["mypkg"]["mod1.py"], # type: ignore
"mod1.py": FLAT_LAYOUT["mypkg"]["mod1.py"], # type: ignore[index] # Would need a TypedDict
},
"other": FLAT_LAYOUT["mypkg"]["subpackage"], # type: ignore
"other": FLAT_LAYOUT["mypkg"]["subpackage"], # type: ignore[index] # Would need a TypedDict
},
"namespace": {
"pyproject.toml": dedent(PYPROJECT),
"MANIFEST.in": EXAMPLE["MANIFEST.in"],
"otherfile.py": "",
"src": {
"mypkg": {
"mod1.py": FLAT_LAYOUT["mypkg"]["mod1.py"], # type: ignore
"subpackage": FLAT_LAYOUT["mypkg"]["subpackage"], # type: ignore
"mod1.py": FLAT_LAYOUT["mypkg"]["mod1.py"], # type: ignore[index] # Would need a TypedDict
"subpackage": FLAT_LAYOUT["mypkg"]["subpackage"], # type: ignore[index] # Would need a TypedDict
},
},
},

0 comments on commit 973f66a

Please sign in to comment.