Remove a few redundant imports (#47250)

* remove self-imports

* remove unused imports
This commit is contained in:
Harmen Stoppels 2024-10-27 22:40:05 +01:00 committed by GitHub
parent e80d75cbe3
commit 2ec4281c4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 15 deletions

View File

@ -45,7 +45,6 @@
import spack.util.executable import spack.util.executable
import spack.util.path import spack.util.path
import spack.util.spack_yaml import spack.util.spack_yaml
import spack.util.url
import spack.version import spack.version
from spack.installer import PackageInstaller from spack.installer import PackageInstaller

View File

@ -29,7 +29,6 @@
import spack.config import spack.config
import spack.error import spack.error
import spack.fetch_strategy import spack.fetch_strategy
import spack.mirror
import spack.oci.image import spack.oci.image
import spack.repo import spack.repo
import spack.spec import spack.spec
@ -756,7 +755,7 @@ def create_mirror_from_package_object(pkg_obj, mirror_cache, mirror_stats):
def require_mirror_name(mirror_name): def require_mirror_name(mirror_name):
"""Find a mirror by name and raise if it does not exist""" """Find a mirror by name and raise if it does not exist"""
mirror = spack.mirror.MirrorCollection().get(mirror_name) mirror = MirrorCollection().get(mirror_name)
if not mirror: if not mirror:
raise ValueError(f'no mirror named "{mirror_name}"') raise ValueError(f'no mirror named "{mirror_name}"')
return mirror return mirror

View File

@ -32,7 +32,6 @@
from llnl.util.lang import classproperty, memoized from llnl.util.lang import classproperty, memoized
from llnl.util.link_tree import LinkTree from llnl.util.link_tree import LinkTree
import spack.build_environment
import spack.builder import spack.builder
import spack.compilers import spack.compilers
import spack.config import spack.config
@ -50,7 +49,6 @@
import spack.store import spack.store
import spack.url import spack.url
import spack.util.environment import spack.util.environment
import spack.util.executable
import spack.util.path import spack.util.path
import spack.util.web import spack.util.web
from spack.error import InstallError, NoURLError, PackageError from spack.error import InstallError, NoURLError, PackageError

View File

@ -39,7 +39,6 @@
import spack.error import spack.error
import spack.patch import spack.patch
import spack.provider_index import spack.provider_index
import spack.repo
import spack.spec import spack.spec
import spack.tag import spack.tag
import spack.util.git import spack.util.git
@ -216,9 +215,9 @@ def compute_loader(self, fullname):
def packages_path(): def packages_path():
"""Get the test repo if it is active, otherwise the builtin repo.""" """Get the test repo if it is active, otherwise the builtin repo."""
try: try:
return spack.repo.PATH.get_repo("builtin.mock").packages_path return PATH.get_repo("builtin.mock").packages_path
except spack.repo.UnknownNamespaceError: except UnknownNamespaceError:
return spack.repo.PATH.get_repo("builtin").packages_path return PATH.get_repo("builtin").packages_path
class GitExe: class GitExe:
@ -314,7 +313,7 @@ def add_package_to_git_stage(packages):
git = GitExe() git = GitExe()
for pkg_name in packages: for pkg_name in packages:
filename = spack.repo.PATH.filename_for_package_name(pkg_name) filename = PATH.filename_for_package_name(pkg_name)
if not os.path.isfile(filename): if not os.path.isfile(filename):
tty.die("No such package: %s. Path does not exist:" % pkg_name, filename) tty.die("No such package: %s. Path does not exist:" % pkg_name, filename)
@ -1585,7 +1584,7 @@ def __init__(self, name, repo=None):
long_msg = "Use 'spack create' to create a new package." long_msg = "Use 'spack create' to create a new package."
if not repo: if not repo:
repo = spack.repo.PATH repo = PATH
# We need to compare the base package name # We need to compare the base package name
pkg_name = name.rsplit(".", 1)[-1] pkg_name = name.rsplit(".", 1)[-1]

View File

@ -33,7 +33,6 @@
import spack.error import spack.error
import spack.paths import spack.paths
import spack.spec import spack.spec
import spack.store
import spack.util.path import spack.util.path
#: default installation root, relative to the Spack install path #: default installation root, relative to the Spack install path
@ -308,7 +307,7 @@ def find(
matching_specs: List[spack.spec.Spec] = [] matching_specs: List[spack.spec.Spec] = []
errors = [] errors = []
query_fn = query_fn or spack.store.STORE.db.query query_fn = query_fn or STORE.db.query
for spec in constraints: for spec in constraints:
current_matches = query_fn(spec, **kwargs) current_matches = query_fn(spec, **kwargs)
@ -341,7 +340,7 @@ def specfile_matches(filename: str, **kwargs) -> List["spack.spec.Spec"]:
**kwargs: keyword arguments forwarded to "find" **kwargs: keyword arguments forwarded to "find"
""" """
query = [spack.spec.Spec.from_specfile(filename)] query = [spack.spec.Spec.from_specfile(filename)]
return spack.store.find(query, **kwargs) return find(query, **kwargs)
def ensure_singleton_created() -> None: def ensure_singleton_created() -> None:

View File

@ -18,7 +18,6 @@
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
import spack.compilers import spack.compilers
import spack.config
import spack.deptypes as dt import spack.deptypes as dt
import spack.error import spack.error
import spack.install_test import spack.install_test