Skip to content

Commit

Permalink
Remove string types now that future annotations are in place.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 26, 2023
1 parent cb09881 commit 9ff0824
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class EntryPoint:
value: str
group: str

dist: Optional['Distribution'] = None
dist: Optional[Distribution] = None

def __init__(self, name: str, value: str, group: str) -> None:
vars(self).update(name=name, value=value, group=group)
Expand Down Expand Up @@ -311,9 +311,9 @@ def _from_text(text):
class PackagePath(pathlib.PurePosixPath):
"""A reference to a path in a package"""

hash: Optional["FileHash"]
hash: Optional[FileHash]
size: int
dist: "Distribution"
dist: Distribution

def read_text(self, encoding: str = 'utf-8') -> str: # type: ignore[override]
return self.locate().read_text(encoding=encoding)
Expand Down Expand Up @@ -395,7 +395,7 @@ def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
"""

@classmethod
def from_name(cls, name: str) -> "Distribution":
def from_name(cls, name: str) -> Distribution:
"""Return the Distribution for the given package name.
:param name: The name of the distribution package to search for.
Expand All @@ -414,8 +414,8 @@ def from_name(cls, name: str) -> "Distribution":

@classmethod
def discover(
cls, *, context: Optional['DistributionFinder.Context'] = None, **kwargs
) -> Iterable["Distribution"]:
cls, *, context: Optional[DistributionFinder.Context] = None, **kwargs
) -> Iterable[Distribution]:
"""Return an iterable of Distribution objects for all packages.
Pass a ``context`` or pass keyword arguments for constructing
Expand All @@ -433,7 +433,7 @@ def discover(
)

@staticmethod
def at(path: str | os.PathLike[str]) -> "Distribution":
def at(path: str | os.PathLike[str]) -> Distribution:
"""Return a Distribution for the indicated metadata path.
:param path: a string or path-like object
Expand Down Expand Up @@ -809,7 +809,7 @@ class MetadataPathFinder(NullFinder, DistributionFinder):

def find_distributions(
self, context=DistributionFinder.Context()
) -> Iterable["PathDistribution"]:
) -> Iterable[PathDistribution]:
"""
Find distributions.
Expand Down

0 comments on commit 9ff0824

Please sign in to comment.