Skip to content

Commit

Permalink
Pass mypy and link issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 26, 2024
1 parent f9a91a1 commit 04c6983
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __str__(self) -> str:
return f"No package metadata was found for {self.name}"

@property
def name(self) -> str: # type: ignore[override]
def name(self) -> str: # type: ignore[override] # make readonly
(name,) = self.args
return name

Expand Down Expand Up @@ -284,7 +284,7 @@ class EntryPoints(tuple):

__slots__ = ()

def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] # Work with str instead of int
"""
Get the EntryPoint in self matching name.
"""
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,3 @@ type = [


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143
7 changes: 4 additions & 3 deletions tests/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def symlink_to(self, target): ... # pragma: no cover


def _ensure_tree_maker(obj: Union[str, TreeMaker]) -> TreeMaker:
return obj if isinstance(obj, TreeMaker) else pathlib.Path(obj) # type: ignore[return-value]
return obj if isinstance(obj, TreeMaker) else pathlib.Path(obj) # type: ignore[return-value] # jaraco/jaraco.path#4


def build(
spec: FilesSpec,
prefix: Union[str, TreeMaker] = pathlib.Path(), # type: ignore[assignment]
prefix: Union[str, TreeMaker] = pathlib.Path(), # type: ignore[assignment] # jaraco/jaraco.path#4
):
"""
Build a set of files/directories, as described by the spec.
Expand Down Expand Up @@ -67,7 +67,8 @@ def build(
@functools.singledispatch
def create(content: Union[str, bytes, FilesSpec], path):
path.mkdir(exist_ok=True)
build(content, prefix=path) # type: ignore[arg-type]
# Mypy only looks at the signature of the main singledispatch method. So it must contain the complete Union
build(content, prefix=path) # type: ignore[arg-type] # python/mypy#11727


@create.register
Expand Down
9 changes: 3 additions & 6 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
from .compat.py39 import os_helper
from .compat.py312 import import_helper

try:
if sys.version_info >= (3, 9):
from importlib import resources

getattr(resources, 'files')
getattr(resources, 'as_file')
except (ImportError, AttributeError):
import importlib_resources as resources # type: ignore[import-not-found, no-redef, unused-ignore]
else:
import importlib_resources as resources


@contextlib.contextmanager
Expand Down

0 comments on commit 04c6983

Please sign in to comment.