Skip to content

Commit

Permalink
Fix typing again
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Morin <[email protected]>
  • Loading branch information
JeanChristopheMorinPerso committed Apr 29, 2024
1 parent a2a1f9e commit 361601a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/rez_pip/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class PackageGroup:
"""A group of package"""

packages: typing.List[PackageInfo]
dists: typing.List[importlib_metadata.Distribution]
dists: typing.List["importlib_metadata.Distribution"]

def __init__(self, packages: typing.List[PackageInfo]) -> None:
self.packages = packages
Expand Down
2 changes: 1 addition & 1 deletion src/rez_pip/plugins/PySide6.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def groupPackages(


@rez_pip.plugins.hookimpl
def cleanup(dist: importlib_metadata.Distribution, path: str) -> None:
def cleanup(dist: "importlib_metadata.Distribution", path: str) -> None:
if packaging.utils.canonicalize_name(dist.name) not in [
"pyside6",
"pyside6-addons",
Expand Down
21 changes: 11 additions & 10 deletions src/rez_pip/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class PluginSpec:
@hookspec
def prePipResolve(
self,
packages: rez_pip.compat.Sequence[str], # Immutable
requirements: rez_pip.compat.Sequence[str], # Immutable
packages: "rez_pip.compat.Sequence[str]", # Immutable
requirements: "rez_pip.compat.Sequence[str]", # Immutable
) -> None:
"""
Take an action before resolving the packages using pip.
Expand All @@ -43,7 +43,8 @@ def prePipResolve(

@hookspec
def postPipResolve(
self, packages: rez_pip.compat.Sequence["rez_pip.pip.PackageInfo"] # Immutable
self,
packages: 'rez_pip.compat.Sequence["rez_pip.pip.PackageInfo"]', # Immutable
) -> None:
"""
Take an action after resolving the packages using pip.
Expand All @@ -52,8 +53,8 @@ def postPipResolve(

@hookspec
def groupPackages( # type: ignore[empty-body]
self, packages: rez_pip.compat.MutableSequence["rez_pip.pip.PackageInfo"]
) -> rez_pip.compat.Sequence["rez_pip.pip.PackageGroup"]:
self, packages: 'rez_pip.compat.MutableSequence["rez_pip.pip.PackageInfo"]'
) -> 'rez_pip.compat.Sequence["rez_pip.pip.PackageGroup"]':
"""
Merge packages into groups of packages. The name and version of the first package
in the group will be used as the name and version for the rez package.
Expand All @@ -63,7 +64,7 @@ def groupPackages( # type: ignore[empty-body]

@hookspec
def cleanup(
self, dist: rez_pip.compat.importlib_metadata.Distribution, path: str
self, dist: "rez_pip.compat.importlib_metadata.Distribution", path: str
) -> None:
"""Cleanup installed distribution"""

Expand All @@ -77,8 +78,8 @@ def metadata(self, package: rez.package_maker.PackageMaker) -> None:

def before(
hookName: str,
hookImpls: rez_pip.compat.Sequence[pluggy.HookImpl],
kwargs: rez_pip.compat.Mapping[str, typing.Any],
hookImpls: "rez_pip.compat.Sequence[pluggy.HookImpl]",
kwargs: "rez_pip.compat.Mapping[str, typing.Any]",
) -> None:
"""Function that will be called before each hook."""
_LOG.debug("Calling the %r hooks", hookName)
Expand All @@ -87,8 +88,8 @@ def before(
def after(
outcome: pluggy.Result[typing.Any],
hookName: str,
hookImpls: rez_pip.compat.Sequence[pluggy.HookImpl],
kwargs: rez_pip.compat.Mapping[str, typing.Any],
hookImpls: "rez_pip.compat.Sequence[pluggy.HookImpl]",
kwargs: "rez_pip.compat.Mapping[str, typing.Any]",
) -> None:
"""Function that will be called after each hook."""
_LOG.debug("Called the %r hooks", hookName)
Expand Down
2 changes: 1 addition & 1 deletion src/rez_pip/plugins/shiboken6.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@rez_pip.plugins.hookimpl
def cleanup(dist: importlib_metadata.Distribution, path: str) -> None:
def cleanup(dist: "importlib_metadata.Distribution", path: str) -> None:
if packaging.utils.canonicalize_name(dist.name) != "shiboken6":
return

Expand Down
2 changes: 1 addition & 1 deletion src/rez_pip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def convertMarker(marker: str) -> typing.List[str]:


def getRezRequirements(
installedDist: importlib_metadata.Distribution,
installedDist: "importlib_metadata.Distribution",
pythonVersion: rez.version.Version,
nameCasings: typing.Optional[typing.List[str]] = None,
) -> RequirementsDict:
Expand Down

0 comments on commit 361601a

Please sign in to comment.