From eb29442b5339683ae63350a2503fe381c5ec1dfe Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Sat, 23 Nov 2024 19:45:05 +0100 Subject: [PATCH] Bump ruff to v0.8.0 --- .pre-commit-config.yaml | 2 +- src/aiida/brokers/rabbitmq/client.py | 2 +- src/aiida/brokers/rabbitmq/utils.py | 2 +- .../cmdline/params/arguments/__init__.py | 2 +- src/aiida/cmdline/params/arguments/main.py | 16 ++--- src/aiida/cmdline/params/options/__init__.py | 8 +-- src/aiida/cmdline/params/options/main.py | 2 +- src/aiida/cmdline/params/types/computer.py | 2 +- src/aiida/cmdline/params/types/strings.py | 2 +- src/aiida/cmdline/utils/decorators.py | 2 +- src/aiida/cmdline/utils/echo.py | 10 +-- src/aiida/common/__init__.py | 2 +- src/aiida/common/datastructures.py | 2 +- src/aiida/common/exceptions.py | 64 +++++++++---------- src/aiida/common/extendeddicts.py | 2 +- src/aiida/common/progress_reporter.py | 8 +-- src/aiida/engine/__init__.py | 2 +- src/aiida/engine/launch.py | 2 +- src/aiida/engine/processes/__init__.py | 2 +- .../engine/processes/calcjobs/manager.py | 2 +- src/aiida/engine/processes/functions.py | 2 +- src/aiida/engine/processes/ports.py | 6 +- src/aiida/engine/processes/process.py | 6 +- src/aiida/engine/processes/process_spec.py | 2 +- .../engine/processes/workchains/awaitable.py | 2 +- .../engine/processes/workchains/context.py | 2 +- .../engine/processes/workchains/workchain.py | 2 +- src/aiida/engine/utils.py | 2 +- src/aiida/manage/caching.py | 2 +- src/aiida/manage/configuration/__init__.py | 2 +- .../configuration/migrations/migrations.py | 6 +- src/aiida/manage/configuration/options.py | 2 +- src/aiida/manage/configuration/settings.py | 2 +- src/aiida/orm/__init__.py | 2 +- src/aiida/orm/entities.py | 2 +- src/aiida/orm/fields.py | 2 +- src/aiida/orm/groups.py | 2 +- src/aiida/orm/implementation/entities.py | 2 +- src/aiida/orm/implementation/utils.py | 2 +- src/aiida/orm/logs.py | 2 +- src/aiida/orm/nodes/data/structure.py | 2 +- src/aiida/orm/utils/links.py | 2 +- src/aiida/orm/utils/loaders.py | 14 ++-- src/aiida/orm/utils/managers.py | 2 +- src/aiida/orm/utils/node.py | 6 +- src/aiida/plugins/entry_point.py | 2 +- src/aiida/plugins/factories.py | 2 +- src/aiida/repository/common.py | 2 +- src/aiida/restapi/run_api.py | 2 +- src/aiida/schedulers/datastructures.py | 6 +- src/aiida/tools/__init__.py | 2 +- src/aiida/tools/archive/__init__.py | 4 +- src/aiida/tools/archive/create.py | 2 +- src/aiida/tools/archive/exceptions.py | 8 +-- src/aiida/tools/data/array/kpoints/main.py | 2 +- src/aiida/tools/data/structure.py | 2 +- src/aiida/tools/graph/deletions.py | 2 +- src/aiida/tools/groups/paths.py | 2 +- src/aiida/tools/pytest_fixtures/__init__.py | 10 +-- src/aiida/tools/visualization/graph.py | 2 +- src/aiida/transports/plugins/ssh.py | 2 +- tests/tools/archive/orm/test_links.py | 4 +- 62 files changed, 135 insertions(+), 135 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 307403bdac..551d7cb5ff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: args: [--line-length=120, --fail-on-change] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.3 + rev: v0.8.0 hooks: - id: ruff-format - id: ruff diff --git a/src/aiida/brokers/rabbitmq/client.py b/src/aiida/brokers/rabbitmq/client.py index 2d4995a55b..e6f85b71b2 100644 --- a/src/aiida/brokers/rabbitmq/client.py +++ b/src/aiida/brokers/rabbitmq/client.py @@ -9,7 +9,7 @@ if t.TYPE_CHECKING: import requests -__all__ = ('RabbitmqManagementClient', 'ManagementApiConnectionError') +__all__ = ('ManagementApiConnectionError', 'RabbitmqManagementClient') class ManagementApiConnectionError(AiidaException): diff --git a/src/aiida/brokers/rabbitmq/utils.py b/src/aiida/brokers/rabbitmq/utils.py index 5046a11ab4..341a259e59 100644 --- a/src/aiida/brokers/rabbitmq/utils.py +++ b/src/aiida/brokers/rabbitmq/utils.py @@ -2,7 +2,7 @@ from . import defaults -__all__ = ('get_rmq_url', 'get_launch_queue_name', 'get_message_exchange_name', 'get_task_exchange_name') +__all__ = ('get_launch_queue_name', 'get_message_exchange_name', 'get_rmq_url', 'get_task_exchange_name') def get_rmq_url(protocol=None, username=None, password=None, host=None, port=None, virtual_host=None, **kwargs): diff --git a/src/aiida/cmdline/params/arguments/__init__.py b/src/aiida/cmdline/params/arguments/__init__.py index 1ae3fbbb4b..4fa6437fbc 100644 --- a/src/aiida/cmdline/params/arguments/__init__.py +++ b/src/aiida/cmdline/params/arguments/__init__.py @@ -31,7 +31,6 @@ 'NODE', 'NODES', 'OUTPUT_FILE', - 'OverridableArgument', 'PROCESS', 'PROCESSES', 'PROFILE', @@ -39,6 +38,7 @@ 'USER', 'WORKFLOW', 'WORKFLOWS', + 'OverridableArgument', ) # fmt: on diff --git a/src/aiida/cmdline/params/arguments/main.py b/src/aiida/cmdline/params/arguments/main.py index faae2ffa81..86c2892c5a 100644 --- a/src/aiida/cmdline/params/arguments/main.py +++ b/src/aiida/cmdline/params/arguments/main.py @@ -15,29 +15,29 @@ from .overridable import OverridableArgument __all__ = ( - 'PROFILE', - 'PROFILES', 'CALCULATION', 'CALCULATIONS', 'CODE', 'CODES', 'COMPUTER', 'COMPUTERS', - 'DATUM', + 'CONFIG_OPTION', 'DATA', + 'DATUM', 'GROUP', 'GROUPS', + 'INPUT_FILE', + 'LABEL', 'NODE', 'NODES', + 'OUTPUT_FILE', 'PROCESS', 'PROCESSES', + 'PROFILE', + 'PROFILES', + 'USER', 'WORKFLOW', 'WORKFLOWS', - 'INPUT_FILE', - 'OUTPUT_FILE', - 'LABEL', - 'USER', - 'CONFIG_OPTION', ) diff --git a/src/aiida/cmdline/params/options/__init__.py b/src/aiida/cmdline/params/options/__init__.py index ea4be61461..0824d449f1 100644 --- a/src/aiida/cmdline/params/options/__init__.py +++ b/src/aiida/cmdline/params/options/__init__.py @@ -38,8 +38,6 @@ 'COMPUTER', 'COMPUTERS', 'CONFIG_FILE', - 'CallableDefaultOption', - 'ConfigFileOption', 'DATA', 'DATUM', 'DB_BACKEND', @@ -69,14 +67,12 @@ 'INPUT_PLUGIN', 'LABEL', 'LIMIT', - 'MultipleValueOption', 'NODE', 'NODES', 'NON_INTERACTIVE', 'OLDER_THAN', 'ORDER_BY', 'ORDER_DIRECTION', - 'OverridableOption', 'PAST_DAYS', 'PAUSED', 'PORT', @@ -108,6 +104,10 @@ 'WAIT', 'WITH_ELEMENTS', 'WITH_ELEMENTS_EXCLUSIVE', + 'CallableDefaultOption', + 'ConfigFileOption', + 'MultipleValueOption', + 'OverridableOption', 'active_process_states', 'graph_traversal_rules', 'valid_calc_job_states', diff --git a/src/aiida/cmdline/params/options/main.py b/src/aiida/cmdline/params/options/main.py index 3bf05e4191..c2ce719375 100644 --- a/src/aiida/cmdline/params/options/main.py +++ b/src/aiida/cmdline/params/options/main.py @@ -81,8 +81,8 @@ 'ORDER_BY', 'ORDER_DIRECTION', 'OVERWRITE', - 'PATH', 'PAST_DAYS', + 'PATH', 'PAUSED', 'PORT', 'PREPEND_TEXT', diff --git a/src/aiida/cmdline/params/types/computer.py b/src/aiida/cmdline/params/types/computer.py index 1e50453e32..67d4431b80 100644 --- a/src/aiida/cmdline/params/types/computer.py +++ b/src/aiida/cmdline/params/types/computer.py @@ -14,7 +14,7 @@ from ...utils import decorators from .identifier import IdentifierParamType -__all__ = ('ComputerParamType', 'ShebangParamType', 'MpirunCommandParamType') +__all__ = ('ComputerParamType', 'MpirunCommandParamType', 'ShebangParamType') class ComputerParamType(IdentifierParamType): diff --git a/src/aiida/cmdline/params/types/strings.py b/src/aiida/cmdline/params/types/strings.py index e40d03472c..4bea23b938 100644 --- a/src/aiida/cmdline/params/types/strings.py +++ b/src/aiida/cmdline/params/types/strings.py @@ -12,7 +12,7 @@ from click.types import StringParamType -__all__ = ('EmailType', 'EntryPointType', 'HostnameType', 'NonEmptyStringParamType', 'LabelStringType') +__all__ = ('EmailType', 'EntryPointType', 'HostnameType', 'LabelStringType', 'NonEmptyStringParamType') class NonEmptyStringParamType(StringParamType): diff --git a/src/aiida/cmdline/utils/decorators.py b/src/aiida/cmdline/utils/decorators.py index 5363926978..c5fdf826ca 100644 --- a/src/aiida/cmdline/utils/decorators.py +++ b/src/aiida/cmdline/utils/decorators.py @@ -27,7 +27,7 @@ DAEMON_NOT_RUNNING_DEFAULT_MESSAGE = 'daemon is not running' -__all__ = ('with_dbenv', 'dbenv', 'only_if_daemon_running') +__all__ = ('dbenv', 'only_if_daemon_running', 'with_dbenv') @decorator diff --git a/src/aiida/cmdline/utils/echo.py b/src/aiida/cmdline/utils/echo.py index d8e4bea6b8..07bd6a7452 100644 --- a/src/aiida/cmdline/utils/echo.py +++ b/src/aiida/cmdline/utils/echo.py @@ -20,14 +20,14 @@ CMDLINE_LOGGER = logging.getLogger('verdi') __all__ = ( - 'echo_report', + 'echo_critical', + 'echo_dictionary', + 'echo_error', 'echo_info', + 'echo_report', 'echo_success', - 'echo_warning', - 'echo_error', - 'echo_critical', 'echo_tabulate', - 'echo_dictionary', + 'echo_warning', ) diff --git a/src/aiida/common/__init__.py b/src/aiida/common/__init__.py index b6a140a055..9291c530c6 100644 --- a/src/aiida/common/__init__.py +++ b/src/aiida/common/__init__.py @@ -25,6 +25,7 @@ __all__ = ( 'AIIDA_LOGGER', + 'TQDM_BAR_FORMAT', 'AiidaException', 'AttributeDict', 'CalcInfo', @@ -74,7 +75,6 @@ 'StashMode', 'StorageMigrationError', 'StoringNotAllowed', - 'TQDM_BAR_FORMAT', 'TestsNotAllowedError', 'TransportTaskException', 'UniquenessError', diff --git a/src/aiida/common/datastructures.py b/src/aiida/common/datastructures.py index dc09712a7c..0f5c009a89 100644 --- a/src/aiida/common/datastructures.py +++ b/src/aiida/common/datastructures.py @@ -15,7 +15,7 @@ from .extendeddicts import DefaultFieldsAttributeDict -__all__ = ('StashMode', 'CalcJobState', 'CalcInfo', 'CodeInfo', 'CodeRunMode') +__all__ = ('CalcInfo', 'CalcJobState', 'CodeInfo', 'CodeRunMode', 'StashMode') class StashMode(Enum): diff --git a/src/aiida/common/exceptions.py b/src/aiida/common/exceptions.py index 6fdd1c2620..30cccf66fe 100644 --- a/src/aiida/common/exceptions.py +++ b/src/aiida/common/exceptions.py @@ -10,48 +10,48 @@ __all__ = ( 'AiidaException', - 'NotExistent', - 'NotExistentAttributeError', - 'NotExistentKeyError', - 'MultipleObjectsError', - 'RemoteOperationError', + 'ClosedStorage', + 'ConfigurationError', + 'ConfigurationVersionError', 'ContentNotExistent', + 'CorruptStorage', + 'DbContentError', + 'EntryPointError', 'FailedError', - 'StoringNotAllowed', - 'ModificationNotAllowed', + 'FeatureDisabled', + 'FeatureNotAvailable', + 'HashingError', + 'IncompatibleStorageSchema', + 'InputValidationError', 'IntegrityError', - 'UniquenessError', - 'EntryPointError', - 'MissingEntryPointError', - 'MultipleEntryPointError', - 'LoadingEntryPointError', + 'InternalError', 'InvalidEntryPointTypeError', 'InvalidOperation', + 'LicensingException', + 'LoadingEntryPointError', + 'LockedProfileError', + 'LockingProfileError', + 'MissingConfigurationError', + 'MissingEntryPointError', + 'ModificationNotAllowed', + 'MultipleEntryPointError', + 'MultipleObjectsError', + 'NotExistent', + 'NotExistentAttributeError', + 'NotExistentKeyError', + 'OutputParsingError', 'ParsingError', - 'InternalError', 'PluginInternalError', - 'ValidationError', - 'ConfigurationError', 'ProfileConfigurationError', - 'MissingConfigurationError', - 'ConfigurationVersionError', - 'IncompatibleStorageSchema', - 'CorruptStorage', - 'DbContentError', - 'InputValidationError', - 'FeatureNotAvailable', - 'FeatureDisabled', - 'LicensingException', + 'RemoteOperationError', + 'StorageBackupError', + 'StorageMigrationError', + 'StoringNotAllowed', 'TestsNotAllowedError', - 'UnsupportedSpeciesError', 'TransportTaskException', - 'OutputParsingError', - 'HashingError', - 'StorageMigrationError', - 'StorageBackupError', - 'LockedProfileError', - 'LockingProfileError', - 'ClosedStorage', + 'UniquenessError', + 'UnsupportedSpeciesError', + 'ValidationError', ) diff --git a/src/aiida/common/extendeddicts.py b/src/aiida/common/extendeddicts.py index f3ddf987e0..b45c191c31 100644 --- a/src/aiida/common/extendeddicts.py +++ b/src/aiida/common/extendeddicts.py @@ -12,7 +12,7 @@ from . import exceptions -__all__ = ('AttributeDict', 'FixedFieldsAttributeDict', 'DefaultFieldsAttributeDict') +__all__ = ('AttributeDict', 'DefaultFieldsAttributeDict', 'FixedFieldsAttributeDict') class AttributeDict(dict): diff --git a/src/aiida/common/progress_reporter.py b/src/aiida/common/progress_reporter.py index 4b098526ca..7f1217f7eb 100644 --- a/src/aiida/common/progress_reporter.py +++ b/src/aiida/common/progress_reporter.py @@ -21,12 +21,12 @@ from typing import Any, Callable, Optional, Type __all__ = ( - 'get_progress_reporter', - 'set_progress_reporter', - 'set_progress_bar_tqdm', - 'ProgressReporterAbstract', 'TQDM_BAR_FORMAT', + 'ProgressReporterAbstract', 'create_callback', + 'get_progress_reporter', + 'set_progress_bar_tqdm', + 'set_progress_reporter', ) TQDM_BAR_FORMAT = '{desc:40.40}{percentage:6.1f}%|{bar}| {n_fmt}/{total_fmt}' diff --git a/src/aiida/engine/__init__.py b/src/aiida/engine/__init__.py index b9e0077cd2..0a855c6484 100644 --- a/src/aiida/engine/__init__.py +++ b/src/aiida/engine/__init__.py @@ -21,6 +21,7 @@ from .utils import * __all__ = ( + 'PORT_NAMESPACE_SEPARATOR', 'AiiDAPersister', 'Awaitable', 'AwaitableAction', @@ -40,7 +41,6 @@ 'JobsList', 'ObjectLoader', 'OutputPort', - 'PORT_NAMESPACE_SEPARATOR', 'PastException', 'PortNamespace', 'Process', diff --git a/src/aiida/engine/launch.py b/src/aiida/engine/launch.py index 34fd1d7c0d..78e42df19b 100644 --- a/src/aiida/engine/launch.py +++ b/src/aiida/engine/launch.py @@ -25,7 +25,7 @@ from .runners import ResultAndPk from .utils import instantiate_process, is_process_scoped, prepare_inputs -__all__ = ('run', 'run_get_pk', 'run_get_node', 'submit', 'await_processes') +__all__ = ('await_processes', 'run', 'run_get_node', 'run_get_pk', 'submit') TYPE_RUN_PROCESS = t.Union[Process, t.Type[Process], ProcessBuilder] # run can also be process function, but it is not clear what type this should be diff --git a/src/aiida/engine/processes/__init__.py b/src/aiida/engine/processes/__init__.py index cf48af33e3..59b8b3a987 100644 --- a/src/aiida/engine/processes/__init__.py +++ b/src/aiida/engine/processes/__init__.py @@ -23,6 +23,7 @@ from .workchains import * __all__ = ( + 'PORT_NAMESPACE_SEPARATOR', 'Awaitable', 'AwaitableAction', 'AwaitableTarget', @@ -38,7 +39,6 @@ 'JobManager', 'JobsList', 'OutputPort', - 'PORT_NAMESPACE_SEPARATOR', 'PortNamespace', 'Process', 'ProcessBuilder', diff --git a/src/aiida/engine/processes/calcjobs/manager.py b/src/aiida/engine/processes/calcjobs/manager.py index 75b9bb6ab1..c93634c3b9 100644 --- a/src/aiida/engine/processes/calcjobs/manager.py +++ b/src/aiida/engine/processes/calcjobs/manager.py @@ -22,7 +22,7 @@ from aiida.engine.transports import TransportQueue from aiida.schedulers.datastructures import JobInfo -__all__ = ('JobsList', 'JobManager') +__all__ = ('JobManager', 'JobsList') class JobsList: diff --git a/src/aiida/engine/processes/functions.py b/src/aiida/engine/processes/functions.py index 509e2d0258..8bca68f55c 100644 --- a/src/aiida/engine/processes/functions.py +++ b/src/aiida/engine/processes/functions.py @@ -64,7 +64,7 @@ if TYPE_CHECKING: from .exit_code import ExitCode -__all__ = ('calcfunction', 'workfunction', 'FunctionProcess') +__all__ = ('FunctionProcess', 'calcfunction', 'workfunction') LOGGER = logging.getLogger(__name__) diff --git a/src/aiida/engine/processes/ports.py b/src/aiida/engine/processes/ports.py index 50f9b0d6e1..efb3baa2e6 100644 --- a/src/aiida/engine/processes/ports.py +++ b/src/aiida/engine/processes/ports.py @@ -22,13 +22,13 @@ from aiida.orm import Data, Node, to_aiida_type __all__ = ( - 'PortNamespace', + 'PORT_NAMESPACE_SEPARATOR', + 'CalcJobOutputPort', 'InputPort', 'OutputPort', - 'CalcJobOutputPort', + 'PortNamespace', 'WithNonDb', 'WithSerialize', - 'PORT_NAMESPACE_SEPARATOR', ) PORT_NAME_MAX_CONSECUTIVE_UNDERSCORES = 1 diff --git a/src/aiida/engine/processes/process.py b/src/aiida/engine/processes/process.py index bdd1dd279d..e25d1b7c23 100644 --- a/src/aiida/engine/processes/process.py +++ b/src/aiida/engine/processes/process.py @@ -854,7 +854,7 @@ def _flatten_inputs( ): return [(parent_name, port_value)] - if port is None and isinstance(port_value, Mapping) or isinstance(port, PortNamespace): + if (port is None and isinstance(port_value, Mapping)) or isinstance(port, PortNamespace): items = [] for name, value in port_value.items(): prefixed_key = parent_name + separator + name if parent_name else name @@ -892,10 +892,10 @@ def _flatten_outputs( :return: flat list of outputs """ - if port is None and isinstance(port_value, orm.Node) or isinstance(port, OutputPort): + if (port is None and isinstance(port_value, orm.Node)) or isinstance(port, OutputPort): return [(parent_name, port_value)] - if port is None and isinstance(port_value, Mapping) or isinstance(port, PortNamespace): + if (port is None and isinstance(port_value, Mapping)) or isinstance(port, PortNamespace): items = [] for name, value in port_value.items(): prefixed_key = parent_name + separator + name if parent_name else name diff --git a/src/aiida/engine/processes/process_spec.py b/src/aiida/engine/processes/process_spec.py index f88542960c..4d1464f076 100644 --- a/src/aiida/engine/processes/process_spec.py +++ b/src/aiida/engine/processes/process_spec.py @@ -17,7 +17,7 @@ from .exit_code import ExitCode, ExitCodesNamespace from .ports import CalcJobOutputPort, InputPort, PortNamespace -__all__ = ('ProcessSpec', 'CalcJobProcessSpec') +__all__ = ('CalcJobProcessSpec', 'ProcessSpec') class ProcessSpec(plumpy.process_spec.ProcessSpec): diff --git a/src/aiida/engine/processes/workchains/awaitable.py b/src/aiida/engine/processes/workchains/awaitable.py index 742d9fb31c..044627a5c2 100644 --- a/src/aiida/engine/processes/workchains/awaitable.py +++ b/src/aiida/engine/processes/workchains/awaitable.py @@ -15,7 +15,7 @@ from aiida.orm import ProcessNode -__all__ = ('Awaitable', 'AwaitableTarget', 'AwaitableAction', 'construct_awaitable') +__all__ = ('Awaitable', 'AwaitableAction', 'AwaitableTarget', 'construct_awaitable') class Awaitable(AttributesDict): diff --git a/src/aiida/engine/processes/workchains/context.py b/src/aiida/engine/processes/workchains/context.py index a9af96f67a..e837ad8c18 100644 --- a/src/aiida/engine/processes/workchains/context.py +++ b/src/aiida/engine/processes/workchains/context.py @@ -14,7 +14,7 @@ from .awaitable import Awaitable, AwaitableAction, construct_awaitable -__all__ = ('ToContext', 'assign_', 'append_') +__all__ = ('ToContext', 'append_', 'assign_') ToContext = dict diff --git a/src/aiida/engine/processes/workchains/workchain.py b/src/aiida/engine/processes/workchains/workchain.py index 6a82a703e0..8818db5eb8 100644 --- a/src/aiida/engine/processes/workchains/workchain.py +++ b/src/aiida/engine/processes/workchains/workchain.py @@ -35,7 +35,7 @@ if t.TYPE_CHECKING: from aiida.engine.runners import Runner -__all__ = ('WorkChain', 'if_', 'while_', 'return_') +__all__ = ('WorkChain', 'if_', 'return_', 'while_') class WorkChainSpec(ProcessSpec, PlumpyWorkChainSpec): diff --git a/src/aiida/engine/utils.py b/src/aiida/engine/utils.py index 4053156a97..86517a5ada 100644 --- a/src/aiida/engine/utils.py +++ b/src/aiida/engine/utils.py @@ -23,7 +23,7 @@ from .processes import Process, ProcessBuilder from .runners import Runner -__all__ = ('interruptable_task', 'InterruptableFuture', 'is_process_function') +__all__ = ('InterruptableFuture', 'interruptable_task', 'is_process_function') LOGGER = logging.getLogger(__name__) PROCESS_STATE_CHANGE_KEY = 'process|state_change|{}' diff --git a/src/aiida/manage/caching.py b/src/aiida/manage/caching.py index e713fb5623..92c3758517 100644 --- a/src/aiida/manage/caching.py +++ b/src/aiida/manage/caching.py @@ -21,7 +21,7 @@ from aiida.manage.configuration import get_config_option from aiida.plugins.entry_point import ENTRY_POINT_GROUP_TO_MODULE_PATH_MAP, ENTRY_POINT_STRING_SEPARATOR -__all__ = ('get_use_cache', 'enable_caching', 'disable_caching') +__all__ = ('disable_caching', 'enable_caching', 'get_use_cache') class ConfigKeys(Enum): diff --git a/src/aiida/manage/configuration/__init__.py b/src/aiida/manage/configuration/__init__.py index 097fcfc012..481bd5bd70 100644 --- a/src/aiida/manage/configuration/__init__.py +++ b/src/aiida/manage/configuration/__init__.py @@ -39,13 +39,13 @@ __all__ += ( + 'CONFIG', 'get_config', 'get_config_option', 'get_config_path', 'get_profile', 'load_profile', 'reset_config', - 'CONFIG', ) import os diff --git a/src/aiida/manage/configuration/migrations/migrations.py b/src/aiida/manage/configuration/migrations/migrations.py index c432c6fe81..0b2a316c6d 100644 --- a/src/aiida/manage/configuration/migrations/migrations.py +++ b/src/aiida/manage/configuration/migrations/migrations.py @@ -15,13 +15,13 @@ __all__ = ( 'CURRENT_CONFIG_VERSION', + 'MIGRATIONS', 'OLDEST_COMPATIBLE_CONFIG_VERSION', - 'get_current_version', 'check_and_migrate_config', 'config_needs_migrating', - 'upgrade_config', 'downgrade_config', - 'MIGRATIONS', + 'get_current_version', + 'upgrade_config', ) ConfigType = Dict[str, Any] diff --git a/src/aiida/manage/configuration/options.py b/src/aiida/manage/configuration/options.py index 110df675f6..4f4ea167aa 100644 --- a/src/aiida/manage/configuration/options.py +++ b/src/aiida/manage/configuration/options.py @@ -12,7 +12,7 @@ from aiida.common.exceptions import ConfigurationError -__all__ = ('get_option', 'get_option_names', 'parse_option', 'Option') +__all__ = ('Option', 'get_option', 'get_option_names', 'parse_option') class Option: diff --git a/src/aiida/manage/configuration/settings.py b/src/aiida/manage/configuration/settings.py index f47a2dd66e..eafd179e47 100644 --- a/src/aiida/manage/configuration/settings.py +++ b/src/aiida/manage/configuration/settings.py @@ -26,7 +26,7 @@ DEFAULT_DAEMON_LOG_DIR_NAME = 'log' DEFAULT_ACCESS_CONTROL_DIR_NAME = 'access' -__all__ = ('AiiDAConfigPathResolver', 'AiiDAConfigDir') +__all__ = ('AiiDAConfigDir', 'AiiDAConfigPathResolver') @final diff --git a/src/aiida/orm/__init__.py b/src/aiida/orm/__init__.py index 2e1fe9618d..49a04d9ba1 100644 --- a/src/aiida/orm/__init__.py +++ b/src/aiida/orm/__init__.py @@ -27,6 +27,7 @@ __all__ = ( 'ASCENDING', + 'DESCENDING', 'AbstractCode', 'AbstractNodeMeta', 'ArrayData', @@ -49,7 +50,6 @@ 'Computer', 'ComputerEntityLoader', 'ContainerizedCode', - 'DESCENDING', 'Data', 'Dict', 'Entity', diff --git a/src/aiida/orm/entities.py b/src/aiida/orm/entities.py index a55f6f7b79..62ea4f4868 100644 --- a/src/aiida/orm/entities.py +++ b/src/aiida/orm/entities.py @@ -28,7 +28,7 @@ from aiida.orm.implementation import BackendEntity, StorageBackend from aiida.orm.querybuilder import FilterType, OrderByType, QueryBuilder -__all__ = ('Entity', 'Collection', 'EntityTypes') +__all__ = ('Collection', 'Entity', 'EntityTypes') CollectionType = TypeVar('CollectionType', bound='Collection') EntityType = TypeVar('EntityType', bound='Entity') diff --git a/src/aiida/orm/fields.py b/src/aiida/orm/fields.py index 60d576a175..4cd8fa6e94 100644 --- a/src/aiida/orm/fields.py +++ b/src/aiida/orm/fields.py @@ -44,12 +44,12 @@ class QbField: """A field of an ORM entity, accessible via the ``QueryBuilder``""" __slots__ = ( - '_key', '_backend_key', '_doc', '_dtype', '_is_attribute', '_is_subscriptable', + '_key', ) def __init__( diff --git a/src/aiida/orm/groups.py b/src/aiida/orm/groups.py index 38da3e616d..71894b0604 100644 --- a/src/aiida/orm/groups.py +++ b/src/aiida/orm/groups.py @@ -27,7 +27,7 @@ from aiida.orm.implementation import StorageBackend from aiida.orm.implementation.groups import BackendGroup # noqa: F401 -__all__ = ('Group', 'AutoGroup', 'ImportGroup', 'UpfFamily') +__all__ = ('AutoGroup', 'Group', 'ImportGroup', 'UpfFamily') SelfType = TypeVar('SelfType', bound='Group') diff --git a/src/aiida/orm/implementation/entities.py b/src/aiida/orm/implementation/entities.py index b6be5d61c2..f45dc51cf7 100644 --- a/src/aiida/orm/implementation/entities.py +++ b/src/aiida/orm/implementation/entities.py @@ -16,7 +16,7 @@ if TYPE_CHECKING: from aiida.orm.implementation import StorageBackend -__all__ = ('BackendEntity', 'BackendCollection', 'EntityType', 'BackendEntityExtrasMixin') +__all__ = ('BackendCollection', 'BackendEntity', 'BackendEntityExtrasMixin', 'EntityType') EntityType = TypeVar('EntityType', bound='BackendEntity') diff --git a/src/aiida/orm/implementation/utils.py b/src/aiida/orm/implementation/utils.py index 0df21f3790..9cf98d6427 100644 --- a/src/aiida/orm/implementation/utils.py +++ b/src/aiida/orm/implementation/utils.py @@ -20,7 +20,7 @@ # therefore is not allowed in individual attribute or extra keys. FIELD_SEPARATOR = '.' -__all__ = ('validate_attribute_extra_key', 'clean_value') +__all__ = ('clean_value', 'validate_attribute_extra_key') def validate_attribute_extra_key(key): diff --git a/src/aiida/orm/logs.py b/src/aiida/orm/logs.py index 25f9a594a5..619fb2393b 100644 --- a/src/aiida/orm/logs.py +++ b/src/aiida/orm/logs.py @@ -24,7 +24,7 @@ from aiida.orm.implementation.logs import BackendLog # noqa: F401 from aiida.orm.querybuilder import FilterType, OrderByType -__all__ = ('Log', 'OrderSpecifier', 'ASCENDING', 'DESCENDING') +__all__ = ('ASCENDING', 'DESCENDING', 'Log', 'OrderSpecifier') ASCENDING = 'asc' DESCENDING = 'desc' diff --git a/src/aiida/orm/nodes/data/structure.py b/src/aiida/orm/nodes/data/structure.py index f046898b52..48d8756618 100644 --- a/src/aiida/orm/nodes/data/structure.py +++ b/src/aiida/orm/nodes/data/structure.py @@ -22,7 +22,7 @@ from .data import Data -__all__ = ('StructureData', 'Kind', 'Site') +__all__ = ('Kind', 'Site', 'StructureData') # Threshold used to check if the mass of two different Site objects is the same. diff --git a/src/aiida/orm/utils/links.py b/src/aiida/orm/utils/links.py index 56596b2e76..4129fd8774 100644 --- a/src/aiida/orm/utils/links.py +++ b/src/aiida/orm/utils/links.py @@ -20,7 +20,7 @@ from aiida.orm import Node from aiida.orm.implementation.storage_backend import StorageBackend -__all__ = ('LinkPair', 'LinkTriple', 'LinkManager', 'validate_link') +__all__ = ('LinkManager', 'LinkPair', 'LinkTriple', 'validate_link') class LinkPair(NamedTuple): diff --git a/src/aiida/orm/utils/loaders.py b/src/aiida/orm/utils/loaders.py index d7a3f06b34..4ead5e1fe7 100644 --- a/src/aiida/orm/utils/loaders.py +++ b/src/aiida/orm/utils/loaders.py @@ -20,18 +20,18 @@ from aiida.orm import Code, Computer, Group, Node __all__ = ( - 'load_code', - 'load_computer', - 'load_group', - 'load_node', - 'load_entity', - 'get_loader', - 'OrmEntityLoader', 'CalculationEntityLoader', 'CodeEntityLoader', 'ComputerEntityLoader', 'GroupEntityLoader', 'NodeEntityLoader', + 'OrmEntityLoader', + 'get_loader', + 'load_code', + 'load_computer', + 'load_entity', + 'load_group', + 'load_node', ) diff --git a/src/aiida/orm/utils/managers.py b/src/aiida/orm/utils/managers.py index 56f47d1d5d..689df47fcd 100644 --- a/src/aiida/orm/utils/managers.py +++ b/src/aiida/orm/utils/managers.py @@ -16,7 +16,7 @@ from aiida.common.links import LinkType from aiida.common.warnings import warn_deprecation -__all__ = ('NodeLinksManager', 'AttributeManager') +__all__ = ('AttributeManager', 'NodeLinksManager') class NodeLinksManager: diff --git a/src/aiida/orm/utils/node.py b/src/aiida/orm/utils/node.py index 0848c72f3d..520979e5f5 100644 --- a/src/aiida/orm/utils/node.py +++ b/src/aiida/orm/utils/node.py @@ -16,10 +16,10 @@ from aiida.orm.fields import EntityFieldMeta __all__ = ( - 'load_node_class', - 'get_type_string_from_class', - 'get_query_type_from_type_string', 'AbstractNodeMeta', + 'get_query_type_from_type_string', + 'get_type_string_from_class', + 'load_node_class', ) diff --git a/src/aiida/plugins/entry_point.py b/src/aiida/plugins/entry_point.py index e8c553e3c6..57d93483a6 100644 --- a/src/aiida/plugins/entry_point.py +++ b/src/aiida/plugins/entry_point.py @@ -26,7 +26,7 @@ # So for now we use the backport importlib_metadata package. from importlib_metadata import EntryPoint, EntryPoints -__all__ = ('load_entry_point', 'load_entry_point_from_string', 'parse_entry_point', 'get_entry_points') +__all__ = ('get_entry_points', 'load_entry_point', 'load_entry_point_from_string', 'parse_entry_point') ENTRY_POINT_GROUP_PREFIX = 'aiida.' ENTRY_POINT_STRING_SEPARATOR = ':' diff --git a/src/aiida/plugins/factories.py b/src/aiida/plugins/factories.py index 3c028a3c47..d007ef0dd3 100644 --- a/src/aiida/plugins/factories.py +++ b/src/aiida/plugins/factories.py @@ -18,8 +18,8 @@ __all__ = ( 'BaseFactory', 'BrokerFactory', - 'CalculationFactory', 'CalcJobImporterFactory', + 'CalculationFactory', 'DataFactory', 'DbImporterFactory', 'GroupFactory', diff --git a/src/aiida/repository/common.py b/src/aiida/repository/common.py index 0a606d3d78..86e00a9de6 100644 --- a/src/aiida/repository/common.py +++ b/src/aiida/repository/common.py @@ -11,7 +11,7 @@ import enum import typing -__all__ = ('FileType', 'File') +__all__ = ('File', 'FileType') class FileType(enum.Enum): diff --git a/src/aiida/restapi/run_api.py b/src/aiida/restapi/run_api.py index fd471e5323..c8801efb7f 100755 --- a/src/aiida/restapi/run_api.py +++ b/src/aiida/restapi/run_api.py @@ -17,7 +17,7 @@ from . import api as api_classes from .common.config import API_CONFIG, APP_CONFIG, CLI_DEFAULTS -__all__ = ('run_api', 'configure_api') +__all__ = ('configure_api', 'run_api') def run_api(flask_app=api_classes.App, flask_api=api_classes.AiidaApi, **kwargs): diff --git a/src/aiida/schedulers/datastructures.py b/src/aiida/schedulers/datastructures.py index 1257c6c9dc..b1ad22bcf6 100644 --- a/src/aiida/schedulers/datastructures.py +++ b/src/aiida/schedulers/datastructures.py @@ -30,13 +30,13 @@ SCHEDULER_LOGGER = AIIDA_LOGGER.getChild('scheduler') __all__ = ( - 'JobState', + 'JobInfo', 'JobResource', + 'JobState', 'JobTemplate', - 'JobInfo', + 'MachineInfo', 'NodeNumberJobResource', 'ParEnvJobResource', - 'MachineInfo', ) diff --git a/src/aiida/tools/__init__.py b/src/aiida/tools/__init__.py index 9c238fd858..8645ce9ded 100644 --- a/src/aiida/tools/__init__.py +++ b/src/aiida/tools/__init__.py @@ -30,8 +30,8 @@ from .visualization import * __all__ = ( - 'CalculationTools', 'DELETE_LOGGER', + 'CalculationTools', 'Graph', 'GroupNotFoundError', 'GroupNotUniqueError', diff --git a/src/aiida/tools/archive/__init__.py b/src/aiida/tools/archive/__init__.py index d951c166b7..e39fc41375 100644 --- a/src/aiida/tools/archive/__init__.py +++ b/src/aiida/tools/archive/__init__.py @@ -21,16 +21,16 @@ from .imports import * __all__ = ( + 'EXPORT_LOGGER', + 'IMPORT_LOGGER', 'ArchiveExportError', 'ArchiveFormatAbstract', 'ArchiveFormatSqlZip', 'ArchiveImportError', 'ArchiveReaderAbstract', 'ArchiveWriterAbstract', - 'EXPORT_LOGGER', 'ExportImportException', 'ExportValidationError', - 'IMPORT_LOGGER', 'ImportTestRun', 'ImportUniquenessError', 'ImportValidationError', diff --git a/src/aiida/tools/archive/create.py b/src/aiida/tools/archive/create.py index ebf6064ebe..94ca88cd49 100644 --- a/src/aiida/tools/archive/create.py +++ b/src/aiida/tools/archive/create.py @@ -37,7 +37,7 @@ from .exceptions import ArchiveExportError, ExportValidationError from .implementations.sqlite_zip import ArchiveFormatSqlZip -__all__ = ('create_archive', 'EXPORT_LOGGER') +__all__ = ('EXPORT_LOGGER', 'create_archive') EXPORT_LOGGER = AIIDA_LOGGER.getChild('export') QbType = Callable[[], orm.QueryBuilder] diff --git a/src/aiida/tools/archive/exceptions.py b/src/aiida/tools/archive/exceptions.py index 032c846311..746d564569 100644 --- a/src/aiida/tools/archive/exceptions.py +++ b/src/aiida/tools/archive/exceptions.py @@ -15,13 +15,13 @@ from aiida.common.exceptions import AiidaException __all__ = ( - 'ExportImportException', 'ArchiveExportError', - 'ExportValidationError', 'ArchiveImportError', - 'ImportValidationError', - 'ImportUniquenessError', + 'ExportImportException', + 'ExportValidationError', 'ImportTestRun', + 'ImportUniquenessError', + 'ImportValidationError', ) diff --git a/src/aiida/tools/data/array/kpoints/main.py b/src/aiida/tools/data/array/kpoints/main.py index 50e1903035..b11cee986d 100644 --- a/src/aiida/tools/data/array/kpoints/main.py +++ b/src/aiida/tools/data/array/kpoints/main.py @@ -12,7 +12,7 @@ from aiida.orm import Dict, KpointsData -__all__ = ('get_kpoints_path', 'get_explicit_kpoints_path') +__all__ = ('get_explicit_kpoints_path', 'get_kpoints_path') def get_kpoints_path(structure, method='seekpath', **kwargs): diff --git a/src/aiida/tools/data/structure.py b/src/aiida/tools/data/structure.py index e88fdf8821..92d02e504c 100644 --- a/src/aiida/tools/data/structure.py +++ b/src/aiida/tools/data/structure.py @@ -21,7 +21,7 @@ from aiida.engine import calcfunction from aiida.orm.nodes.data.structure import Kind, Site, StructureData -__all__ = ('structure_to_spglib_tuple', 'spglib_tuple_to_structure') +__all__ = ('spglib_tuple_to_structure', 'structure_to_spglib_tuple') @calcfunction diff --git a/src/aiida/tools/graph/deletions.py b/src/aiida/tools/graph/deletions.py index ef28136729..3a835d6711 100644 --- a/src/aiida/tools/graph/deletions.py +++ b/src/aiida/tools/graph/deletions.py @@ -16,7 +16,7 @@ from aiida.orm import Group, Node, QueryBuilder from aiida.tools.graph.graph_traversers import get_nodes_delete -__all__ = ('DELETE_LOGGER', 'delete_nodes', 'delete_group_nodes') +__all__ = ('DELETE_LOGGER', 'delete_group_nodes', 'delete_nodes') DELETE_LOGGER = AIIDA_LOGGER.getChild('delete') diff --git a/src/aiida/tools/groups/paths.py b/src/aiida/tools/groups/paths.py index 25fb04f221..95d4f78851 100644 --- a/src/aiida/tools/groups/paths.py +++ b/src/aiida/tools/groups/paths.py @@ -17,7 +17,7 @@ from aiida import orm from aiida.common.exceptions import NotExistent -__all__ = ('GroupPath', 'InvalidPath', 'GroupNotFoundError', 'GroupNotUniqueError', 'NoGroupsInPathError') +__all__ = ('GroupNotFoundError', 'GroupNotUniqueError', 'GroupPath', 'InvalidPath', 'NoGroupsInPathError') REGEX_ATTR = re.compile('^[a-zA-Z][\\_a-zA-Z0-9]*$') diff --git a/src/aiida/tools/pytest_fixtures/__init__.py b/src/aiida/tools/pytest_fixtures/__init__.py index 1b2c38e285..c2729d16c5 100644 --- a/src/aiida/tools/pytest_fixtures/__init__.py +++ b/src/aiida/tools/pytest_fixtures/__init__.py @@ -28,21 +28,21 @@ from .storage import config_psql_dos, config_sqlite_dos, postgres_cluster __all__ = ( - 'aiida_code_installed', 'aiida_code', + 'aiida_code_installed', + 'aiida_computer', 'aiida_computer_local', 'aiida_computer_ssh', - 'aiida_computer', + 'aiida_config', 'aiida_config_factory', 'aiida_config_tmp', - 'aiida_config', 'aiida_localhost', 'aiida_manager', - 'aiida_profile_clean_class', + 'aiida_profile', 'aiida_profile_clean', + 'aiida_profile_clean_class', 'aiida_profile_factory', 'aiida_profile_tmp', - 'aiida_profile', 'config_psql_dos', 'config_sqlite_dos', 'daemon_client', diff --git a/src/aiida/tools/visualization/graph.py b/src/aiida/tools/visualization/graph.py index 91411796ea..dd9993ed16 100644 --- a/src/aiida/tools/visualization/graph.py +++ b/src/aiida/tools/visualization/graph.py @@ -26,7 +26,7 @@ if TYPE_CHECKING: from aiida.orm.implementation import StorageBackend -__all__ = ('Graph', 'default_link_styles', 'default_node_styles', 'pstate_node_styles', 'default_node_sublabels') +__all__ = ('Graph', 'default_link_styles', 'default_node_styles', 'default_node_sublabels', 'pstate_node_styles') LinkAnnotateType = Literal[None, 'label', 'type', 'both'] IdentifierType = Literal['pk', 'uuid', 'label'] diff --git a/src/aiida/transports/plugins/ssh.py b/src/aiida/transports/plugins/ssh.py index d6159fe46f..6858da5d2a 100644 --- a/src/aiida/transports/plugins/ssh.py +++ b/src/aiida/transports/plugins/ssh.py @@ -22,7 +22,7 @@ from ..transport import Transport, TransportInternalError -__all__ = ('parse_sshconfig', 'convert_to_bool', 'SshTransport') +__all__ = ('SshTransport', 'convert_to_bool', 'parse_sshconfig') def parse_sshconfig(computername): diff --git a/tests/tools/archive/orm/test_links.py b/tests/tools/archive/orm/test_links.py index 75e7ada226..ee7392f7b2 100644 --- a/tests/tools/archive/orm/test_links.py +++ b/tests/tools/archive/orm/test_links.py @@ -409,7 +409,7 @@ def link_flags_export_helper(name, all_nodes, tmp_path, nodes_to_export, flags, export_nodes_uuid = {_: set() for _ in export_types} for node in nodes_to_export: - for node_type in export_nodes_uuid: + for node_type in export_nodes_uuid: # noqa: PLC0206 if node.startswith(node_type): export_nodes_uuid[node_type].update({all_nodes[node]['uuid']}) nodes_to_export = ([all_nodes[_]['node'] for _ in nodes_to_export], export_nodes_uuid) @@ -418,7 +418,7 @@ def link_flags_export_helper(name, all_nodes, tmp_path, nodes_to_export, flags, for expected_node_list in expected_nodes_temp: expected_nodes_uuid = {_: set() for _ in expected_types} for node in expected_node_list: - for node_type in expected_nodes_uuid: + for node_type in expected_nodes_uuid: # noqa: PLC0206 if node.startswith(node_type): expected_nodes_uuid[node_type].update({all_nodes[node]['uuid']}) expected_nodes.append(expected_nodes_uuid)