diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2024-10-23 05:33:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-23 06:33:09 -0600 |
commit | f33912d707ba63a9d4596b1b4a491a6b17d5b0b1 (patch) | |
tree | 98f4e9e6f1393b00ef6c26f6010edb1bbb7f0231 | |
parent | e785d3716e1e42439b1ac0b0c20d255f0cdb8f9a (diff) | |
download | spack-f33912d707ba63a9d4596b1b4a491a6b17d5b0b1.tar.gz spack-f33912d707ba63a9d4596b1b4a491a6b17d5b0b1.tar.bz2 spack-f33912d707ba63a9d4596b1b4a491a6b17d5b0b1.tar.xz spack-f33912d707ba63a9d4596b1b4a491a6b17d5b0b1.zip |
mypy: work around typing issues with `functools.partial` (#47160)
-rw-r--r-- | lib/spack/spack/filesystem_view.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/spack/spack/filesystem_view.py b/lib/spack/spack/filesystem_view.py index 2d5890c363..2785413779 100644 --- a/lib/spack/spack/filesystem_view.py +++ b/lib/spack/spack/filesystem_view.py @@ -33,6 +33,7 @@ from llnl.util.symlink import symlink from llnl.util.tty.color import colorize import spack.config +import spack.directory_layout import spack.paths import spack.projections import spack.relocate @@ -50,7 +51,7 @@ __all__ = ["FilesystemView", "YamlFilesystemView"] _projections_path = ".spack/projections.yaml" -LinkCallbackType = Callable[[str, str, "FilesystemView", Optional["spack.spec.Spec"]], None] +LinkCallbackType = Callable[[str, str, "FilesystemView", Optional[spack.spec.Spec]], None] def view_symlink(src: str, dst: str, *args, **kwargs) -> None: @@ -62,7 +63,7 @@ def view_hardlink(src: str, dst: str, *args, **kwargs) -> None: def view_copy( - src: str, dst: str, view: "FilesystemView", spec: Optional["spack.spec.Spec"] = None + src: str, dst: str, view: "FilesystemView", spec: Optional[spack.spec.Spec] = None ) -> None: """ Copy a file from src to dst. @@ -160,7 +161,7 @@ class FilesystemView: def __init__( self, root: str, - layout: "spack.directory_layout.DirectoryLayout", + layout: spack.directory_layout.DirectoryLayout, *, projections: Optional[Dict] = None, ignore_conflicts: bool = False, @@ -182,7 +183,10 @@ class FilesystemView: # Setup link function to include view self.link_type = link_type - self.link = ft.partial(function_for_link_type(link_type), view=self) + self._link = function_for_link_type(link_type) + + def link(self, src: str, dst: str, spec: Optional[spack.spec.Spec] = None) -> None: + self._link(src, dst, self, spec) def add_specs(self, *specs, **kwargs): """ @@ -283,7 +287,7 @@ class YamlFilesystemView(FilesystemView): def __init__( self, root: str, - layout: "spack.directory_layout.DirectoryLayout", + layout: spack.directory_layout.DirectoryLayout, *, projections: Optional[Dict] = None, ignore_conflicts: bool = False, |