From 509a8f620c304d81e854418af302b44df28a47bb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:49:54 +0000 Subject: [PATCH] [pre-commit.ci] Apply automatic pre-commit fixes --- conda-store-server/conda_store_server/app.py | 14 ++++++++------ .../conda_store_server/plugins/__init__.py | 5 +---- .../conda_store_server/plugins/hookspec.py | 6 +++--- .../conda_store_server/plugins/lock/conda_lock.py | 9 +++++---- .../conda_store_server/plugins/plugin_context.py | 9 +++++++-- .../conda_store_server/plugins/registry.py | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/conda-store-server/conda_store_server/app.py b/conda-store-server/conda_store_server/app.py index 15a4a4aa..5ac4498a 100644 --- a/conda-store-server/conda_store_server/app.py +++ b/conda-store-server/conda_store_server/app.py @@ -7,8 +7,8 @@ import sys from contextlib import contextmanager from typing import Any, Dict -import pluggy +import pluggy import pydantic from celery import Celery, group from sqlalchemy.orm import Session, sessionmaker @@ -28,9 +28,9 @@ from traitlets.config import LoggingConfigurable from conda_store_server import CONDA_STORE_DIR, BuildKey, api, registry, storage -from conda_store_server.plugins import hookspec, registry -from conda_store_server.exception import CondaStorePluginNotFoundError from conda_store_server._internal import conda_utils, environment, orm, schema, utils +from conda_store_server.exception import CondaStorePluginNotFoundError +from conda_store_server.plugins import hookspec, registry def conda_store_validate_specification( @@ -491,7 +491,7 @@ def plugin_manager(self): self._plugin_manager = pluggy.PluginManager(hookspec.spec_name) self._plugin_manager.add_hookspecs(hookspec.CondaStoreSpecs) - # Get settings - required to configure the lock plugin with the + # Get settings - required to configure the lock plugin with the # correct conda command with self.session_factory() as db: settings = self.get_settings(db) @@ -500,7 +500,7 @@ def plugin_manager(self): self.load_plugin_by_name( "lock-conda_lock", conda_command=settings.conda_command, - conda_flags=self.conda_flags + conda_flags=self.conda_flags, ) return self._plugin_manager @@ -509,7 +509,9 @@ def load_plugin_by_name(self, name, *args, **kwargs): """Loads a plugin from the plugin registry into the plugin manager""" target_plugin = self.plugin_registry.get_plugin(name) if target_plugin is None: - raise CondaStorePluginNotFoundError(name, self.plugin_registry.list_plugin_names()) + raise CondaStorePluginNotFoundError( + name, self.plugin_registry.list_plugin_names() + ) self.plugin_manager.register(target_plugin(*args, **kwargs)) def ensure_settings(self, db: Session): diff --git a/conda-store-server/conda_store_server/plugins/__init__.py b/conda-store-server/conda_store_server/plugins/__init__.py index 896f9127..1dc19cb8 100644 --- a/conda-store-server/conda_store_server/plugins/__init__.py +++ b/conda-store-server/conda_store_server/plugins/__init__.py @@ -4,7 +4,4 @@ from conda_store_server.plugins.lock import conda_lock - -BUILTIN_PLUGINS = [ - conda_lock.CondaLock -] \ No newline at end of file +BUILTIN_PLUGINS = [conda_lock.CondaLock] diff --git a/conda-store-server/conda_store_server/plugins/hookspec.py b/conda-store-server/conda_store_server/plugins/hookspec.py index 08245880..8385d76f 100644 --- a/conda-store-server/conda_store_server/plugins/hookspec.py +++ b/conda-store-server/conda_store_server/plugins/hookspec.py @@ -2,13 +2,13 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -import pluggy import typing +import pluggy + from conda_store_server._internal import conda_utils, schema from conda_store_server.plugins import plugin_context - spec_name = "conda-store-server" hookspec = pluggy.HookspecMarker(spec_name) @@ -23,7 +23,7 @@ class CondaStoreSpecs: def lock_environment( self, context: plugin_context.PluginContext, - spec: schema.CondaSpecification, + spec: schema.CondaSpecification, platforms: typing.List[str] = [conda_utils.conda_platform()], ) -> str: """Lock spec""" diff --git a/conda-store-server/conda_store_server/plugins/lock/conda_lock.py b/conda-store-server/conda_store_server/plugins/lock/conda_lock.py index bde97537..1ec9f7c4 100644 --- a/conda-store-server/conda_store_server/plugins/lock/conda_lock.py +++ b/conda-store-server/conda_store_server/plugins/lock/conda_lock.py @@ -8,7 +8,6 @@ import typing import yaml - from conda_lock.conda_lock import run_lock from conda_store_server._internal import conda_utils, schema @@ -16,12 +15,14 @@ from conda_store_server.plugins.plugin_context import PluginContext -class CondaLock(): +class CondaLock: @classmethod def name(cls): return "lock-conda_lock" - def __init__(self, conda_flags="--strict-channel-priority", conda_command="mamba", *kwargs): + def __init__( + self, conda_flags="--strict-channel-priority", conda_command="mamba", *kwargs + ): self.conda_command = conda_command self.conda_flags = conda_flags @@ -29,7 +30,7 @@ def __init__(self, conda_flags="--strict-channel-priority", conda_command="mamba def lock_environment( self, context: PluginContext, - spec: schema.CondaSpecification, + spec: schema.CondaSpecification, platforms: typing.List[str] = [conda_utils.conda_platform()], ) -> str: context.log.info("lock_environment entrypoint for conda-lock") diff --git a/conda-store-server/conda_store_server/plugins/plugin_context.py b/conda-store-server/conda_store_server/plugins/plugin_context.py index bd949646..fb027b21 100644 --- a/conda-store-server/conda_store_server/plugins/plugin_context.py +++ b/conda-store-server/conda_store_server/plugins/plugin_context.py @@ -15,14 +15,19 @@ class PluginContext: * the variables: conda_store, log, stdout, stderr * the functions: run_command, run """ - def __init__(self, conda_store=None, stdout=None, stderr=None, log_level=logging.INFO): + + def __init__( + self, conda_store=None, stdout=None, stderr=None, log_level=logging.INFO + ): if stdout is not None and stderr is None: stderr = stdout self.id = str(uuid.uuid4()) self.stdout = stdout if stdout is not None else io.StringIO() self.stderr = stderr if stderr is not None else io.StringIO() - self.log = logging.getLogger(f"conda_store_server.plugins.plugin_context.{self.id}") + self.log = logging.getLogger( + f"conda_store_server.plugins.plugin_context.{self.id}" + ) self.log.propagate = False self.log.addHandler(logging.StreamHandler(stream=self.stdout)) self.log.setLevel(log_level) diff --git a/conda-store-server/conda_store_server/plugins/registry.py b/conda-store-server/conda_store_server/plugins/registry.py index 361c1b72..d51c1242 100644 --- a/conda-store-server/conda_store_server/plugins/registry.py +++ b/conda-store-server/conda_store_server/plugins/registry.py @@ -5,7 +5,7 @@ from conda_store_server.plugins import BUILTIN_PLUGINS -class PluginRegistry(): +class PluginRegistry: _instance = None def __new__(cls):