diff --git a/.github/system_tests/test_containerized_code.py b/.github/system_tests/test_containerized_code.py index 306d7aa612..a4286d8ba7 100644 --- a/.github/system_tests/test_containerized_code.py +++ b/.github/system_tests/test_containerized_code.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Test running a :class:`~aiida.orm.nodes.data.codes.containerized.ContainerizedCode` code.""" + from aiida import orm from aiida.engine import run_get_node diff --git a/.github/system_tests/test_daemon.py b/.github/system_tests/test_daemon.py index 15470280dc..7f652f8d69 100644 --- a/.github/system_tests/test_daemon.py +++ b/.github/system_tests/test_daemon.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Tests to run with a running daemon.""" + import os import re import shutil diff --git a/.github/system_tests/workchains.py b/.github/system_tests/workchains.py index cfa6c99b52..34b29af58a 100644 --- a/.github/system_tests/workchains.py +++ b/.github/system_tests/workchains.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Work chain implementations for testing purposes.""" + from aiida.common import AttributeDict from aiida.engine import ( BaseRestartWorkChain, diff --git a/.github/workflows/check_release_tag.py b/.github/workflows/check_release_tag.py index d49c0964e2..cf4d755fbf 100644 --- a/.github/workflows/check_release_tag.py +++ b/.github/workflows/check_release_tag.py @@ -1,4 +1,5 @@ """Check that the GitHub release tag matches the package version.""" + import argparse import ast from pathlib import Path diff --git a/.molecule/default/files/polish/cli.py b/.molecule/default/files/polish/cli.py index 7829d72cc1..e162fc97d8 100755 --- a/.molecule/default/files/polish/cli.py +++ b/.molecule/default/files/polish/cli.py @@ -8,6 +8,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Command line interface to dynamically create and run a WorkChain that can evaluate a reversed polish expression.""" + import importlib import sys import time diff --git a/.molecule/default/files/polish/lib/expression.py b/.molecule/default/files/polish/lib/expression.py index 49d1b86dc2..369b14093e 100644 --- a/.molecule/default/files/polish/lib/expression.py +++ b/.molecule/default/files/polish/lib/expression.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Functions to dynamically generate reversed polish notation expressions.""" + import collections import operator as operators import random diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 723ae70494..c33f51e54f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: args: [--line-length=120, --fail-on-change] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 + rev: v0.3.5 hooks: - id: ruff-format exclude: &exclude_ruff > diff --git a/docs/source/conf.py b/docs/source/conf.py index 7c525a5f56..9cfaae4847 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -238,9 +238,9 @@ def run_apidoc(_): # See https://stackoverflow.com/a/30144019 env = os.environ.copy() - env[ - 'SPHINX_APIDOC_OPTIONS' - ] = 'members,special-members,private-members,undoc-members,show-inheritance,ignore-module-all' + env['SPHINX_APIDOC_OPTIONS'] = ( + 'members,special-members,private-members,undoc-members,show-inheritance,ignore-module-all' + ) subprocess.check_call([cmd_path] + cli_options, env=env) diff --git a/docs/source/howto/include/scripts/performance_benchmark_base.py b/docs/source/howto/include/scripts/performance_benchmark_base.py index 656f186408..7fda09f54b 100755 --- a/docs/source/howto/include/scripts/performance_benchmark_base.py +++ b/docs/source/howto/include/scripts/performance_benchmark_base.py @@ -1,5 +1,6 @@ #!/usr/bin/env python """Script to benchmark the performance of the AiiDA workflow engine on a given installation.""" + import click from aiida.cmdline.params import options from aiida.cmdline.utils import decorators, echo diff --git a/docs/source/howto/include/snippets/extend_workflows.py b/docs/source/howto/include/snippets/extend_workflows.py index 0642ca033e..99579b38c0 100644 --- a/docs/source/howto/include/snippets/extend_workflows.py +++ b/docs/source/howto/include/snippets/extend_workflows.py @@ -8,6 +8,7 @@ ########################################################################### # start-marker for docs """Code snippets for the "How to extend workflows" section.""" + from aiida.engine import ToContext, WorkChain, calcfunction from aiida.orm import AbstractCode, Bool, Int from aiida.plugins.factories import CalculationFactory diff --git a/docs/source/howto/include/snippets/plugins/launch.py b/docs/source/howto/include/snippets/plugins/launch.py index d46538ce31..953f8e0f54 100644 --- a/docs/source/howto/include/snippets/plugins/launch.py +++ b/docs/source/howto/include/snippets/plugins/launch.py @@ -1,4 +1,5 @@ """Launch a calculation using the 'diff-tutorial' plugin""" + from pathlib import Path from aiida import engine, orm diff --git a/docs/source/topics/include/scheduler_template.py b/docs/source/topics/include/scheduler_template.py index 5204224464..455f0be5fb 100644 --- a/docs/source/topics/include/scheduler_template.py +++ b/docs/source/topics/include/scheduler_template.py @@ -1,4 +1,5 @@ """Template for a scheduler plugin.""" + import logging from aiida.common import exceptions diff --git a/pyproject.toml b/pyproject.toml index b29e95d8e9..5669c7bc44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -378,6 +378,12 @@ testpaths = [ xfail_strict = true [tool.ruff] +line-length = 120 + +[tool.ruff.format] +quote-style = 'single' + +[tool.ruff.lint] ignore = [ 'F403', # Star imports unable to detect undefined names 'F405', # Import may be undefined or defined from star imports @@ -389,7 +395,6 @@ ignore = [ 'RUF005', # Consider iterable unpacking instead of concatenation 'RUF012' # Mutable class attributes should be annotated with `typing.ClassVar` ] -line-length = 120 select = [ 'E', # pydocstyle 'W', # pydocstyle @@ -403,9 +408,6 @@ select = [ 'RUF' # ruff ] -[tool.ruff.format] -quote-style = 'single' - [tool.tox] legacy_tox_ini = """ [tox] diff --git a/src/aiida/__init__.py b/src/aiida/__init__.py index 9c8fd3ece8..e136eeafa7 100644 --- a/src/aiida/__init__.py +++ b/src/aiida/__init__.py @@ -18,6 +18,7 @@ More information at http://www.aiida.net """ + from aiida.common.log import configure_logging # noqa: F401 from aiida.manage.configuration import get_config_option, get_profile, load_profile, profile_context # noqa: F401 diff --git a/src/aiida/__main__.py b/src/aiida/__main__.py index 73e571a425..f7a58e0091 100644 --- a/src/aiida/__main__.py +++ b/src/aiida/__main__.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Expose the AiiDA CLI, for usage as `python -m aiida`""" + import sys if __name__ == '__main__': diff --git a/src/aiida/brokers/broker.py b/src/aiida/brokers/broker.py index 805b22ea29..cfb8b3d50e 100644 --- a/src/aiida/brokers/broker.py +++ b/src/aiida/brokers/broker.py @@ -1,4 +1,5 @@ """Interface for a message broker that facilitates communication with and between process runners.""" + import abc import typing as t diff --git a/src/aiida/brokers/rabbitmq/broker.py b/src/aiida/brokers/rabbitmq/broker.py index 34b1c12e66..9916d1398d 100644 --- a/src/aiida/brokers/rabbitmq/broker.py +++ b/src/aiida/brokers/rabbitmq/broker.py @@ -1,4 +1,5 @@ """Implementation of the message broker interface using RabbitMQ through ``kiwipy``.""" + from __future__ import annotations import functools diff --git a/src/aiida/brokers/rabbitmq/client.py b/src/aiida/brokers/rabbitmq/client.py index 9a46fafb9f..2d4995a55b 100644 --- a/src/aiida/brokers/rabbitmq/client.py +++ b/src/aiida/brokers/rabbitmq/client.py @@ -1,4 +1,5 @@ """Client for RabbitMQ Management HTTP API.""" + from __future__ import annotations import typing as t diff --git a/src/aiida/brokers/rabbitmq/defaults.py b/src/aiida/brokers/rabbitmq/defaults.py index 82e9c9a87b..6e3684ae0e 100644 --- a/src/aiida/brokers/rabbitmq/defaults.py +++ b/src/aiida/brokers/rabbitmq/defaults.py @@ -1,4 +1,5 @@ """Defaults related to RabbitMQ.""" + from aiida.common.extendeddicts import AttributeDict __all__ = ('BROKER_DEFAULTS',) diff --git a/src/aiida/calculations/arithmetic/add.py b/src/aiida/calculations/arithmetic/add.py index 57c4e09373..2fd64eab7d 100644 --- a/src/aiida/calculations/arithmetic/add.py +++ b/src/aiida/calculations/arithmetic/add.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`CalcJob` implementation to add two numbers using bash for testing and demonstration purposes.""" + from aiida import orm from aiida.common.datastructures import CalcInfo, CodeInfo from aiida.common.folders import Folder diff --git a/src/aiida/calculations/diff_tutorial/calculations.py b/src/aiida/calculations/diff_tutorial/calculations.py index dcb711791e..c357bc5d5c 100644 --- a/src/aiida/calculations/diff_tutorial/calculations.py +++ b/src/aiida/calculations/diff_tutorial/calculations.py @@ -2,6 +2,7 @@ Register calculations via the "aiida.calculations" entry point in the pyproject.toml file. """ + from aiida.common import datastructures from aiida.engine import CalcJob from aiida.orm import SinglefileData diff --git a/src/aiida/calculations/importers/arithmetic/add.py b/src/aiida/calculations/importers/arithmetic/add.py index e8dd642854..69a84a1757 100644 --- a/src/aiida/calculations/importers/arithmetic/add.py +++ b/src/aiida/calculations/importers/arithmetic/add.py @@ -1,4 +1,5 @@ """Importer for the :class:`aiida.calculations.arithmetic.add.ArithmeticAddCalculation` plugin.""" + from pathlib import Path from re import match from tempfile import NamedTemporaryFile diff --git a/src/aiida/calculations/monitors/base.py b/src/aiida/calculations/monitors/base.py index f7c177f3bb..e165647ea4 100644 --- a/src/aiida/calculations/monitors/base.py +++ b/src/aiida/calculations/monitors/base.py @@ -1,4 +1,5 @@ """Monitors for the :class:`aiida.calculations.arithmetic.add.ArithmeticAddCalculation` plugin.""" + from __future__ import annotations import tempfile diff --git a/src/aiida/calculations/templatereplacer.py b/src/aiida/calculations/templatereplacer.py index eb95294cb1..0d5c45b3a7 100644 --- a/src/aiida/calculations/templatereplacer.py +++ b/src/aiida/calculations/templatereplacer.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Generic `CalcJob` implementation where input file is a parametrized template file.""" + import io from aiida import orm diff --git a/src/aiida/cmdline/commands/__init__.py b/src/aiida/cmdline/commands/__init__.py index 9d93f18680..4be9693761 100644 --- a/src/aiida/cmdline/commands/__init__.py +++ b/src/aiida/cmdline/commands/__init__.py @@ -11,6 +11,7 @@ The commands need to be imported here for them to be registered with the top-level command group. """ + from aiida.cmdline.commands import ( cmd_archive, cmd_calcjob, diff --git a/src/aiida/cmdline/commands/cmd_archive.py b/src/aiida/cmdline/commands/cmd_archive.py index 765265682b..4ed99bc883 100644 --- a/src/aiida/cmdline/commands/cmd_archive.py +++ b/src/aiida/cmdline/commands/cmd_archive.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi archive` command.""" + import logging import traceback from enum import Enum diff --git a/src/aiida/cmdline/commands/cmd_calcjob.py b/src/aiida/cmdline/commands/cmd_calcjob.py index edb7bb5f7b..df49ffc358 100644 --- a/src/aiida/cmdline/commands/cmd_calcjob.py +++ b/src/aiida/cmdline/commands/cmd_calcjob.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi calcjob` commands.""" + import os import click diff --git a/src/aiida/cmdline/commands/cmd_code.py b/src/aiida/cmdline/commands/cmd_code.py index f6365f5e34..e4ff613159 100644 --- a/src/aiida/cmdline/commands/cmd_code.py +++ b/src/aiida/cmdline/commands/cmd_code.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi code` command.""" + from collections import defaultdict from functools import partial diff --git a/src/aiida/cmdline/commands/cmd_computer.py b/src/aiida/cmdline/commands/cmd_computer.py index 9234970b00..3cd0a5065d 100644 --- a/src/aiida/cmdline/commands/cmd_computer.py +++ b/src/aiida/cmdline/commands/cmd_computer.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi computer` command.""" + from copy import deepcopy from functools import partial from math import isclose diff --git a/src/aiida/cmdline/commands/cmd_config.py b/src/aiida/cmdline/commands/cmd_config.py index bd7a571936..43d1228e1e 100644 --- a/src/aiida/cmdline/commands/cmd_config.py +++ b/src/aiida/cmdline/commands/cmd_config.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi config` command.""" + from __future__ import annotations import json diff --git a/src/aiida/cmdline/commands/cmd_daemon.py b/src/aiida/cmdline/commands/cmd_daemon.py index 9d83af7567..e525c8ba9b 100644 --- a/src/aiida/cmdline/commands/cmd_daemon.py +++ b/src/aiida/cmdline/commands/cmd_daemon.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi daemon` commands.""" + from __future__ import annotations import subprocess diff --git a/src/aiida/cmdline/commands/cmd_data/cmd_export.py b/src/aiida/cmdline/commands/cmd_data/cmd_export.py index be8d76c6bc..6f75b82999 100644 --- a/src/aiida/cmdline/commands/cmd_data/cmd_export.py +++ b/src/aiida/cmdline/commands/cmd_data/cmd_export.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""This module provides export functionality to all data types -""" +"""This module provides export functionality to all data types""" import click diff --git a/src/aiida/cmdline/commands/cmd_data/cmd_list.py b/src/aiida/cmdline/commands/cmd_data/cmd_list.py index 5c27652ee0..1d5be4609f 100644 --- a/src/aiida/cmdline/commands/cmd_data/cmd_list.py +++ b/src/aiida/cmdline/commands/cmd_data/cmd_list.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""This module provides list functionality to all data types. -""" +"""This module provides list functionality to all data types.""" from aiida.cmdline.params import options diff --git a/src/aiida/cmdline/commands/cmd_data/cmd_remote.py b/src/aiida/cmdline/commands/cmd_data/cmd_remote.py index 3719576003..16ee691129 100644 --- a/src/aiida/cmdline/commands/cmd_data/cmd_remote.py +++ b/src/aiida/cmdline/commands/cmd_data/cmd_remote.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi data core.remote` command.""" + import stat import click diff --git a/src/aiida/cmdline/commands/cmd_data/cmd_show.py b/src/aiida/cmdline/commands/cmd_data/cmd_show.py index b333ab8cf4..40f2dee514 100644 --- a/src/aiida/cmdline/commands/cmd_data/cmd_show.py +++ b/src/aiida/cmdline/commands/cmd_data/cmd_show.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""This allows to manage showfunctionality to all data types. -""" +"""This allows to manage showfunctionality to all data types.""" + import pathlib from aiida.cmdline.utils import echo diff --git a/src/aiida/cmdline/commands/cmd_devel.py b/src/aiida/cmdline/commands/cmd_devel.py index 3082231040..d42f0f1451 100644 --- a/src/aiida/cmdline/commands/cmd_devel.py +++ b/src/aiida/cmdline/commands/cmd_devel.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi devel` commands.""" + import sys import click diff --git a/src/aiida/cmdline/commands/cmd_group.py b/src/aiida/cmdline/commands/cmd_group.py index 019a86299b..092c21b8f0 100644 --- a/src/aiida/cmdline/commands/cmd_group.py +++ b/src/aiida/cmdline/commands/cmd_group.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi group` commands""" + import click from aiida.cmdline.commands.cmd_verdi import verdi diff --git a/src/aiida/cmdline/commands/cmd_node.py b/src/aiida/cmdline/commands/cmd_node.py index bfb5557e0e..2cfac9c518 100644 --- a/src/aiida/cmdline/commands/cmd_node.py +++ b/src/aiida/cmdline/commands/cmd_node.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi node` command.""" + import datetime import pathlib diff --git a/src/aiida/cmdline/commands/cmd_process.py b/src/aiida/cmdline/commands/cmd_process.py index def4d7d358..38674f2f74 100644 --- a/src/aiida/cmdline/commands/cmd_process.py +++ b/src/aiida/cmdline/commands/cmd_process.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi process` command.""" + import click from aiida.cmdline.commands.cmd_verdi import verdi @@ -128,7 +129,7 @@ def process_list( echo.echo(f'\nTotal results: {len(projected)}\n') if 'cached' in project: - echo.echo_report('\u267B Processes marked with check-mark were not run but taken from the cache.') + echo.echo_report('\u267b Processes marked with check-mark were not run but taken from the cache.') echo.echo_report('Add the option `-P pk cached_from` to the command to display cache source.') print_last_process_state_change() diff --git a/src/aiida/cmdline/commands/cmd_profile.py b/src/aiida/cmdline/commands/cmd_profile.py index 8be4ed3bbf..e32d403b83 100644 --- a/src/aiida/cmdline/commands/cmd_profile.py +++ b/src/aiida/cmdline/commands/cmd_profile.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi profile` command.""" + from __future__ import annotations import click diff --git a/src/aiida/cmdline/commands/cmd_rabbitmq.py b/src/aiida/cmdline/commands/cmd_rabbitmq.py index 317a880d4d..34f068e97c 100644 --- a/src/aiida/cmdline/commands/cmd_rabbitmq.py +++ b/src/aiida/cmdline/commands/cmd_rabbitmq.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi devel rabbitmq` commands.""" + from __future__ import annotations import re diff --git a/src/aiida/cmdline/commands/cmd_run.py b/src/aiida/cmdline/commands/cmd_run.py index 3b08c9c6b2..6f5103f4e2 100644 --- a/src/aiida/cmdline/commands/cmd_run.py +++ b/src/aiida/cmdline/commands/cmd_run.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi run` command.""" + import contextlib import pathlib import sys diff --git a/src/aiida/cmdline/commands/cmd_setup.py b/src/aiida/cmdline/commands/cmd_setup.py index acdb8e379a..1072db6126 100644 --- a/src/aiida/cmdline/commands/cmd_setup.py +++ b/src/aiida/cmdline/commands/cmd_setup.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """The `verdi setup` and `verdi quicksetup` commands.""" + import click from aiida.cmdline.commands.cmd_verdi import verdi diff --git a/src/aiida/cmdline/commands/cmd_status.py b/src/aiida/cmdline/commands/cmd_status.py index c8cecbc22c..7317e334fc 100644 --- a/src/aiida/cmdline/commands/cmd_status.py +++ b/src/aiida/cmdline/commands/cmd_status.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi status` command.""" + import enum import sys @@ -42,7 +43,7 @@ class ServiceStatus(enum.IntEnum): }, ServiceStatus.WARNING: { 'color': 'yellow', - 'string': '\u23FA', + 'string': '\u23fa', }, ServiceStatus.DOWN: { 'color': 'red', diff --git a/src/aiida/cmdline/commands/cmd_storage.py b/src/aiida/cmdline/commands/cmd_storage.py index bb5970b846..c86227e8ba 100644 --- a/src/aiida/cmdline/commands/cmd_storage.py +++ b/src/aiida/cmdline/commands/cmd_storage.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi storage` commands.""" + import click from click_spinner import spinner diff --git a/src/aiida/cmdline/commands/cmd_user.py b/src/aiida/cmdline/commands/cmd_user.py index c092a73c16..b3505baa51 100644 --- a/src/aiida/cmdline/commands/cmd_user.py +++ b/src/aiida/cmdline/commands/cmd_user.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`verdi user` command.""" + import click from aiida.cmdline.commands.cmd_verdi import verdi diff --git a/src/aiida/cmdline/commands/cmd_verdi.py b/src/aiida/cmdline/commands/cmd_verdi.py index 4a14f10e01..c67b4b017a 100644 --- a/src/aiida/cmdline/commands/cmd_verdi.py +++ b/src/aiida/cmdline/commands/cmd_verdi.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """The main `verdi` click group.""" + import click from aiida import __version__ diff --git a/src/aiida/cmdline/groups/dynamic.py b/src/aiida/cmdline/groups/dynamic.py index 413d0951fc..6c84f72b88 100644 --- a/src/aiida/cmdline/groups/dynamic.py +++ b/src/aiida/cmdline/groups/dynamic.py @@ -1,4 +1,5 @@ """Subclass of :class:`click.Group` that loads subcommands dynamically from entry points.""" + from __future__ import annotations import functools diff --git a/src/aiida/cmdline/groups/verdi.py b/src/aiida/cmdline/groups/verdi.py index 08c9abc856..a3c40e50b8 100644 --- a/src/aiida/cmdline/groups/verdi.py +++ b/src/aiida/cmdline/groups/verdi.py @@ -1,4 +1,5 @@ """Subclass of :class:`click.Group` for the ``verdi`` CLI.""" + from __future__ import annotations import base64 diff --git a/src/aiida/cmdline/params/arguments/overridable.py b/src/aiida/cmdline/params/arguments/overridable.py index c7fb0b1904..53811c58d5 100644 --- a/src/aiida/cmdline/params/arguments/overridable.py +++ b/src/aiida/cmdline/params/arguments/overridable.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Convenience class which can be used to defined a set of commonly used arguments that can be easily reused.""" + import click __all__ = ('OverridableArgument',) diff --git a/src/aiida/cmdline/params/options/commands/code.py b/src/aiida/cmdline/params/options/commands/code.py index c075a47f62..91f7dd10dd 100644 --- a/src/aiida/cmdline/params/options/commands/code.py +++ b/src/aiida/cmdline/params/options/commands/code.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Reusable command line interface options for Code commands.""" + import click from aiida.cmdline.params import options, types diff --git a/src/aiida/cmdline/params/options/commands/computer.py b/src/aiida/cmdline/params/options/commands/computer.py index a37b6e86a7..c826bd9c42 100644 --- a/src/aiida/cmdline/params/options/commands/computer.py +++ b/src/aiida/cmdline/params/options/commands/computer.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Reusable command line interface options for Computer commands.""" + import click from aiida.cmdline.params import options, types diff --git a/src/aiida/cmdline/params/options/commands/setup.py b/src/aiida/cmdline/params/options/commands/setup.py index b907884e3c..3a0d6c3a67 100644 --- a/src/aiida/cmdline/params/options/commands/setup.py +++ b/src/aiida/cmdline/params/options/commands/setup.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Reusable command line interface options for the setup commands.""" + import functools import getpass diff --git a/src/aiida/cmdline/params/options/conditional.py b/src/aiida/cmdline/params/options/conditional.py index 0877bc3014..2eded4a276 100644 --- a/src/aiida/cmdline/params/options/conditional.py +++ b/src/aiida/cmdline/params/options/conditional.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Option whose requiredness is determined by a callback function.""" + import click diff --git a/src/aiida/cmdline/params/options/config.py b/src/aiida/cmdline/params/options/config.py index bfc8df37d7..99794b862d 100644 --- a/src/aiida/cmdline/params/options/config.py +++ b/src/aiida/cmdline/params/options/config.py @@ -14,6 +14,7 @@ minor modification to ``configuration_callback`` to add a check for unknown parameters in the configuration file and the default provider is changed to :func:`yaml_config_file_provider`. """ + from __future__ import annotations import functools diff --git a/src/aiida/cmdline/params/options/interactive.py b/src/aiida/cmdline/params/options/interactive.py index e13c2ec6f2..c044d04907 100644 --- a/src/aiida/cmdline/params/options/interactive.py +++ b/src/aiida/cmdline/params/options/interactive.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Tools and an option class for interactive parameter entry with additional features such as help lookup.""" + import typing as t import click diff --git a/src/aiida/cmdline/params/options/main.py b/src/aiida/cmdline/params/options/main.py index 4b7a7db7c6..72545b2a9f 100644 --- a/src/aiida/cmdline/params/options/main.py +++ b/src/aiida/cmdline/params/options/main.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with pre-defined reusable commandline options that can be used as `click` decorators.""" + import click from aiida.brokers.rabbitmq.defaults import BROKER_DEFAULTS diff --git a/src/aiida/cmdline/params/options/multivalue.py b/src/aiida/cmdline/params/options/multivalue.py index 3d6d10bda2..8b4631f682 100644 --- a/src/aiida/cmdline/params/options/multivalue.py +++ b/src/aiida/cmdline/params/options/multivalue.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module to define multi value options for click. -""" +"""Module to define multi value options for click.""" import click diff --git a/src/aiida/cmdline/params/types/calculation.py b/src/aiida/cmdline/params/types/calculation.py index 8bf3c39a0b..7c79db3a9e 100644 --- a/src/aiida/cmdline/params/types/calculation.py +++ b/src/aiida/cmdline/params/types/calculation.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for the calculation parameter type -""" +"""Module for the calculation parameter type""" from .identifier import IdentifierParamType diff --git a/src/aiida/cmdline/params/types/choice.py b/src/aiida/cmdline/params/types/choice.py index 03ddf8cc7a..487af555b7 100644 --- a/src/aiida/cmdline/params/types/choice.py +++ b/src/aiida/cmdline/params/types/choice.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""A custom click type that defines a lazy choice -""" +"""A custom click type that defines a lazy choice""" + import click __all__ = ('LazyChoice',) diff --git a/src/aiida/cmdline/params/types/code.py b/src/aiida/cmdline/params/types/code.py index 4869f985d7..c34ddb4434 100644 --- a/src/aiida/cmdline/params/types/code.py +++ b/src/aiida/cmdline/params/types/code.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module to define the custom click type for code.""" + import click from aiida.cmdline.utils import decorators diff --git a/src/aiida/cmdline/params/types/computer.py b/src/aiida/cmdline/params/types/computer.py index f9d28fa53b..1e50453e32 100644 --- a/src/aiida/cmdline/params/types/computer.py +++ b/src/aiida/cmdline/params/types/computer.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for the custom click param type computer -""" +"""Module for the custom click param type computer""" + from click.shell_completion import CompletionItem from click.types import StringParamType diff --git a/src/aiida/cmdline/params/types/config.py b/src/aiida/cmdline/params/types/config.py index 338d0226bd..f798dc173d 100644 --- a/src/aiida/cmdline/params/types/config.py +++ b/src/aiida/cmdline/params/types/config.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module to define the custom click type for code.""" + import click __all__ = ('ConfigOptionParamType',) diff --git a/src/aiida/cmdline/params/types/data.py b/src/aiida/cmdline/params/types/data.py index 81bc0eb3f0..a8dab495c3 100644 --- a/src/aiida/cmdline/params/types/data.py +++ b/src/aiida/cmdline/params/types/data.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for the custom click param type for data -""" +"""Module for the custom click param type for data""" + from .identifier import IdentifierParamType __all__ = ('DataParamType',) diff --git a/src/aiida/cmdline/params/types/group.py b/src/aiida/cmdline/params/types/group.py index eb863f7e30..542e6e883a 100644 --- a/src/aiida/cmdline/params/types/group.py +++ b/src/aiida/cmdline/params/types/group.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for custom click param type group.""" + import click from aiida.cmdline.utils import decorators diff --git a/src/aiida/cmdline/params/types/identifier.py b/src/aiida/cmdline/params/types/identifier.py index ecc209883a..759a5a47a0 100644 --- a/src/aiida/cmdline/params/types/identifier.py +++ b/src/aiida/cmdline/params/types/identifier.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for custom click param type identifier -""" +"""Module for custom click param type identifier""" + from __future__ import annotations import typing as t diff --git a/src/aiida/cmdline/params/types/multiple.py b/src/aiida/cmdline/params/types/multiple.py index 1f1dceb2ec..c31232e10e 100644 --- a/src/aiida/cmdline/params/types/multiple.py +++ b/src/aiida/cmdline/params/types/multiple.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module to define custom click param type for multiple values -""" +"""Module to define custom click param type for multiple values""" + import click __all__ = ('MultipleValueParamType',) diff --git a/src/aiida/cmdline/params/types/node.py b/src/aiida/cmdline/params/types/node.py index 4a30a3dd8b..0192288959 100644 --- a/src/aiida/cmdline/params/types/node.py +++ b/src/aiida/cmdline/params/types/node.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module to define the custom click param type for node -""" +"""Module to define the custom click param type for node""" + from .identifier import IdentifierParamType __all__ = ('NodeParamType',) diff --git a/src/aiida/cmdline/params/types/path.py b/src/aiida/cmdline/params/types/path.py index 2863474297..f52acd82c6 100644 --- a/src/aiida/cmdline/params/types/path.py +++ b/src/aiida/cmdline/params/types/path.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Click parameter types for paths.""" + import os import click diff --git a/src/aiida/cmdline/params/types/plugin.py b/src/aiida/cmdline/params/types/plugin.py index 9a4386a927..c2cac73b5f 100644 --- a/src/aiida/cmdline/params/types/plugin.py +++ b/src/aiida/cmdline/params/types/plugin.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Click parameter type for AiiDA Plugins.""" + from __future__ import annotations import functools diff --git a/src/aiida/cmdline/params/types/process.py b/src/aiida/cmdline/params/types/process.py index 188c2f1b66..3c4a2a3923 100644 --- a/src/aiida/cmdline/params/types/process.py +++ b/src/aiida/cmdline/params/types/process.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for the process node parameter type -""" +"""Module for the process node parameter type""" from .identifier import IdentifierParamType diff --git a/src/aiida/cmdline/params/types/profile.py b/src/aiida/cmdline/params/types/profile.py index a44a42ef81..b73ca510d7 100644 --- a/src/aiida/cmdline/params/types/profile.py +++ b/src/aiida/cmdline/params/types/profile.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Profile param type for click.""" + from click.shell_completion import CompletionItem from .strings import LabelStringType diff --git a/src/aiida/cmdline/params/types/strings.py b/src/aiida/cmdline/params/types/strings.py index 776ab4deff..e40d03472c 100644 --- a/src/aiida/cmdline/params/types/strings.py +++ b/src/aiida/cmdline/params/types/strings.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for various text-based string validation. -""" +"""Module for various text-based string validation.""" import re diff --git a/src/aiida/cmdline/params/types/user.py b/src/aiida/cmdline/params/types/user.py index 913f9c7699..9957b415a9 100644 --- a/src/aiida/cmdline/params/types/user.py +++ b/src/aiida/cmdline/params/types/user.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """User param type for click.""" + import click from aiida.cmdline.utils.decorators import with_dbenv diff --git a/src/aiida/cmdline/params/types/workflow.py b/src/aiida/cmdline/params/types/workflow.py index b9f72b0887..30d1eb9f35 100644 --- a/src/aiida/cmdline/params/types/workflow.py +++ b/src/aiida/cmdline/params/types/workflow.py @@ -6,8 +6,7 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Module for the workflow parameter type -""" +"""Module for the workflow parameter type""" from .identifier import IdentifierParamType diff --git a/src/aiida/cmdline/utils/ascii_vis.py b/src/aiida/cmdline/utils/ascii_vis.py index 00c3198ddd..f42317e7a8 100644 --- a/src/aiida/cmdline/utils/ascii_vis.py +++ b/src/aiida/cmdline/utils/ascii_vis.py @@ -7,12 +7,13 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utility functions to draw ASCII diagrams to the command line.""" + from typing import Optional __all__ = ('format_call_graph',) TREE_LAST_ENTRY = '\u2514\u2500\u2500 ' -TREE_MIDDLE_ENTRY = '\u251C\u2500\u2500 ' +TREE_MIDDLE_ENTRY = '\u251c\u2500\u2500 ' TREE_FIRST_ENTRY = TREE_MIDDLE_ENTRY diff --git a/src/aiida/cmdline/utils/common.py b/src/aiida/cmdline/utils/common.py index dc2e216d27..53420fd33b 100644 --- a/src/aiida/cmdline/utils/common.py +++ b/src/aiida/cmdline/utils/common.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Common utility functions for command line commands.""" + import logging import os import sys diff --git a/src/aiida/cmdline/utils/decorators.py b/src/aiida/cmdline/utils/decorators.py index d84cbf4a77..0a91c2c5e1 100644 --- a/src/aiida/cmdline/utils/decorators.py +++ b/src/aiida/cmdline/utils/decorators.py @@ -17,6 +17,7 @@ code branch gets visited and possibly avoiding the overhead if not """ + from contextlib import contextmanager from click_spinner import spinner diff --git a/src/aiida/cmdline/utils/echo.py b/src/aiida/cmdline/utils/echo.py index 7863c804c5..26e88337da 100644 --- a/src/aiida/cmdline/utils/echo.py +++ b/src/aiida/cmdline/utils/echo.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Convenience functions for logging output from ``verdi`` commands.""" + import collections import enum import json diff --git a/src/aiida/cmdline/utils/log.py b/src/aiida/cmdline/utils/log.py index 32ef588576..46f8511ebc 100644 --- a/src/aiida/cmdline/utils/log.py +++ b/src/aiida/cmdline/utils/log.py @@ -1,4 +1,5 @@ """Utilities for logging in the command line interface context.""" + import logging import click diff --git a/src/aiida/cmdline/utils/multi_line_input.py b/src/aiida/cmdline/utils/multi_line_input.py index 9e2d5ba191..843224a309 100644 --- a/src/aiida/cmdline/utils/multi_line_input.py +++ b/src/aiida/cmdline/utils/multi_line_input.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utilities for getting multi line input from the commandline.""" + import re import click diff --git a/src/aiida/cmdline/utils/pluginable.py b/src/aiida/cmdline/utils/pluginable.py index e4a1c81c65..ce7925ce05 100644 --- a/src/aiida/cmdline/utils/pluginable.py +++ b/src/aiida/cmdline/utils/pluginable.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Plugin aware click command Group.""" + from aiida.cmdline.groups import VerdiCommandGroup from aiida.common import exceptions from aiida.plugins.entry_point import get_entry_point_names, load_entry_point diff --git a/src/aiida/cmdline/utils/query/calculation.py b/src/aiida/cmdline/utils/query/calculation.py index 9ca4a32f4d..84f1f555eb 100644 --- a/src/aiida/cmdline/utils/query/calculation.py +++ b/src/aiida/cmdline/utils/query/calculation.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """A utility module with a factory of standard QueryBuilder instances for Calculation nodes.""" + from aiida.common.warnings import warn_deprecation warn_deprecation('This module is deprecated, use `aiida.tools.query.calculation` instead.', version=3) diff --git a/src/aiida/cmdline/utils/query/formatting.py b/src/aiida/cmdline/utils/query/formatting.py index 3f8e33ca90..c4f0a36212 100644 --- a/src/aiida/cmdline/utils/query/formatting.py +++ b/src/aiida/cmdline/utils/query/formatting.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """A utility module with simple functions to format variables into strings for cli outputs.""" + from aiida.common.warnings import warn_deprecation warn_deprecation('This module is deprecated, use `aiida.tools.query.formatting` instead.', version=3) diff --git a/src/aiida/cmdline/utils/query/mapping.py b/src/aiida/cmdline/utils/query/mapping.py index f304d72edf..806ba519c3 100644 --- a/src/aiida/cmdline/utils/query/mapping.py +++ b/src/aiida/cmdline/utils/query/mapping.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """A utility module with mapper objects that map database entities projections on attributes and labels.""" + from aiida.common.warnings import warn_deprecation warn_deprecation('This module is deprecated, use `aiida.tools.query.mapping` instead.', version=3) diff --git a/src/aiida/cmdline/utils/repository.py b/src/aiida/cmdline/utils/repository.py index 0d899abb73..b374abaeec 100644 --- a/src/aiida/cmdline/utils/repository.py +++ b/src/aiida/cmdline/utils/repository.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utility functions for command line commands operating on the repository.""" + from aiida.cmdline.utils import echo diff --git a/src/aiida/cmdline/utils/templates.py b/src/aiida/cmdline/utils/templates.py index e105a4054a..ef6cd75810 100644 --- a/src/aiida/cmdline/utils/templates.py +++ b/src/aiida/cmdline/utils/templates.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Templates for input/output of verdi commands.""" + from jinja2 import Environment, PackageLoader env = Environment(loader=PackageLoader('aiida', 'cmdline/templates')) diff --git a/src/aiida/common/datastructures.py b/src/aiida/common/datastructures.py index 3cfee48a27..dc09712a7c 100644 --- a/src/aiida/common/datastructures.py +++ b/src/aiida/common/datastructures.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module to define commonly used data structures.""" + from __future__ import annotations from enum import Enum, IntEnum diff --git a/src/aiida/common/extendeddicts.py b/src/aiida/common/extendeddicts.py index 0d1f7b6ea2..f3ddf987e0 100644 --- a/src/aiida/common/extendeddicts.py +++ b/src/aiida/common/extendeddicts.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Various dictionary types with extended functionality.""" + from collections.abc import Mapping from . import exceptions diff --git a/src/aiida/common/files.py b/src/aiida/common/files.py index 0d6f6e19b9..cbeabe11ce 100644 --- a/src/aiida/common/files.py +++ b/src/aiida/common/files.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utility functions to operate on filesystem files.""" + import hashlib diff --git a/src/aiida/common/folders.py b/src/aiida/common/folders.py index 2848f0d11a..d5a2e62b7f 100644 --- a/src/aiida/common/folders.py +++ b/src/aiida/common/folders.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utility functions to operate on filesystem folders.""" + from __future__ import annotations import contextlib diff --git a/src/aiida/common/hashing.py b/src/aiida/common/hashing.py index 21ecffc12f..9fed9f8a6d 100644 --- a/src/aiida/common/hashing.py +++ b/src/aiida/common/hashing.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Common password and hash generation functions.""" + import hashlib import numbers import secrets diff --git a/src/aiida/common/json.py b/src/aiida/common/json.py index 6fef3395a9..6af6183a06 100644 --- a/src/aiida/common/json.py +++ b/src/aiida/common/json.py @@ -14,6 +14,7 @@ dropped and for Python 3, one should simply use the ``json`` module of the standard library directly. """ + import codecs import json diff --git a/src/aiida/common/lang.py b/src/aiida/common/lang.py index 3b1719fe5e..23a9eaa6f1 100644 --- a/src/aiida/common/lang.py +++ b/src/aiida/common/lang.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utilities that extend the basic python language.""" + import functools import keyword from typing import Any, Callable, Generic, TypeVar diff --git a/src/aiida/common/log.py b/src/aiida/common/log.py index 13e932cc9e..3948ca5a5e 100644 --- a/src/aiida/common/log.py +++ b/src/aiida/common/log.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for all logging methods/classes that don't need the ORM.""" + from __future__ import annotations import collections diff --git a/src/aiida/common/progress_reporter.py b/src/aiida/common/progress_reporter.py index 082d9ded33..4b098526ca 100644 --- a/src/aiida/common/progress_reporter.py +++ b/src/aiida/common/progress_reporter.py @@ -15,6 +15,7 @@ set_progress_reporter(tqdm, bar_format='{l_bar}{bar}{r_bar}') """ + from functools import partial from types import TracebackType from typing import Any, Callable, Optional, Type diff --git a/src/aiida/common/pydantic.py b/src/aiida/common/pydantic.py index 997e0cfb32..633e83428d 100644 --- a/src/aiida/common/pydantic.py +++ b/src/aiida/common/pydantic.py @@ -1,4 +1,5 @@ """Utilities related to ``pydantic``.""" + from __future__ import annotations import typing as t diff --git a/src/aiida/common/timezone.py b/src/aiida/common/timezone.py index dca9a2484b..6fa991609c 100644 --- a/src/aiida/common/timezone.py +++ b/src/aiida/common/timezone.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utility functions to operate on datetime objects.""" + from datetime import datetime, timedelta, timezone, tzinfo from typing import Optional diff --git a/src/aiida/common/utils.py b/src/aiida/common/utils.py index 9e5e413251..54fe5453d5 100644 --- a/src/aiida/common/utils.py +++ b/src/aiida/common/utils.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Miscellaneous generic utility functions and classes.""" + import filecmp import inspect import io diff --git a/src/aiida/common/warnings.py b/src/aiida/common/warnings.py index a8c0c3e10a..950c43648c 100644 --- a/src/aiida/common/warnings.py +++ b/src/aiida/common/warnings.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Define warnings that can be thrown by AiiDA.""" + import os import warnings diff --git a/src/aiida/engine/daemon/client.py b/src/aiida/engine/daemon/client.py index 538a06e283..692ed93d7a 100644 --- a/src/aiida/engine/daemon/client.py +++ b/src/aiida/engine/daemon/client.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Client to interact with the daemon.""" + from __future__ import annotations import contextlib diff --git a/src/aiida/engine/daemon/execmanager.py b/src/aiida/engine/daemon/execmanager.py index b348e69f97..305dd174b7 100644 --- a/src/aiida/engine/daemon/execmanager.py +++ b/src/aiida/engine/daemon/execmanager.py @@ -11,6 +11,7 @@ the routines make reference to the suitable plugins for all plugin-specific operations. """ + from __future__ import annotations import os diff --git a/src/aiida/engine/daemon/worker.py b/src/aiida/engine/daemon/worker.py index 1d20891750..ee3e26cab8 100644 --- a/src/aiida/engine/daemon/worker.py +++ b/src/aiida/engine/daemon/worker.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Function that starts a daemon worker.""" + import asyncio import logging import signal diff --git a/src/aiida/engine/launch.py b/src/aiida/engine/launch.py index 481d793fe1..013fd4d690 100644 --- a/src/aiida/engine/launch.py +++ b/src/aiida/engine/launch.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Top level functions that can be used to launch a Process.""" + from __future__ import annotations import time diff --git a/src/aiida/engine/processes/builder.py b/src/aiida/engine/processes/builder.py index 3600300cff..dbee7b3dfa 100644 --- a/src/aiida/engine/processes/builder.py +++ b/src/aiida/engine/processes/builder.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Convenience classes to help building the input dictionaries for Processes.""" + import json from collections.abc import Mapping, MutableMapping from typing import TYPE_CHECKING, Any, Type diff --git a/src/aiida/engine/processes/calcjobs/calcjob.py b/src/aiida/engine/processes/calcjobs/calcjob.py index bc6d914369..de4fbd8663 100644 --- a/src/aiida/engine/processes/calcjobs/calcjob.py +++ b/src/aiida/engine/processes/calcjobs/calcjob.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Implementation of the CalcJob process.""" + from __future__ import annotations import dataclasses diff --git a/src/aiida/engine/processes/calcjobs/importer.py b/src/aiida/engine/processes/calcjobs/importer.py index d7626b7b0b..f9012a6a87 100644 --- a/src/aiida/engine/processes/calcjobs/importer.py +++ b/src/aiida/engine/processes/calcjobs/importer.py @@ -1,4 +1,5 @@ """Abstract utility class that helps to import calculation jobs completed outside of AiiDA.""" + from abc import ABC, abstractmethod from typing import Dict, Union diff --git a/src/aiida/engine/processes/calcjobs/manager.py b/src/aiida/engine/processes/calcjobs/manager.py index a20bc46261..75b9bb6ab1 100644 --- a/src/aiida/engine/processes/calcjobs/manager.py +++ b/src/aiida/engine/processes/calcjobs/manager.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module containing utilities and classes relating to job calculations running on systems that require transport.""" + import asyncio import contextlib import contextvars diff --git a/src/aiida/engine/processes/calcjobs/monitors.py b/src/aiida/engine/processes/calcjobs/monitors.py index 56af82c711..507122ff1e 100644 --- a/src/aiida/engine/processes/calcjobs/monitors.py +++ b/src/aiida/engine/processes/calcjobs/monitors.py @@ -1,4 +1,5 @@ """Utilities to define monitor functions for ``CalcJobs``.""" + from __future__ import annotations import collections diff --git a/src/aiida/engine/processes/calcjobs/tasks.py b/src/aiida/engine/processes/calcjobs/tasks.py index 94c0895b80..085e5c1f50 100644 --- a/src/aiida/engine/processes/calcjobs/tasks.py +++ b/src/aiida/engine/processes/calcjobs/tasks.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Transport tasks for calculation jobs.""" + from __future__ import annotations import asyncio diff --git a/src/aiida/engine/processes/control.py b/src/aiida/engine/processes/control.py index ae87f052d5..7cc214c76c 100644 --- a/src/aiida/engine/processes/control.py +++ b/src/aiida/engine/processes/control.py @@ -1,4 +1,5 @@ """Functions to control and interact with running processes.""" + from __future__ import annotations import collections diff --git a/src/aiida/engine/processes/exit_code.py b/src/aiida/engine/processes/exit_code.py index 089c698dc1..637ea59f70 100644 --- a/src/aiida/engine/processes/exit_code.py +++ b/src/aiida/engine/processes/exit_code.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """A namedtuple and namespace for ExitCodes that can be used to exit from Processes.""" + from typing import NamedTuple, Optional, Union from aiida.common.extendeddicts import AttributeDict diff --git a/src/aiida/engine/processes/functions.py b/src/aiida/engine/processes/functions.py index c48d37f1cf..7376fba308 100644 --- a/src/aiida/engine/processes/functions.py +++ b/src/aiida/engine/processes/functions.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Class and decorators to generate processes out of simple python functions.""" + from __future__ import annotations import collections @@ -101,17 +102,13 @@ def get_stack_size(size: int = 2) -> int: # type: ignore[return] class ProcessFunctionType(t.Protocol, t.Generic[P, R_co, N]): """Protocol for a decorated process function.""" - def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R_co: - ... + def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R_co: ... - def run(self, *args: P.args, **kwargs: P.kwargs) -> R_co: - ... + def run(self, *args: P.args, **kwargs: P.kwargs) -> R_co: ... - def run_get_pk(self, *args: P.args, **kwargs: P.kwargs) -> tuple[dict[str, t.Any] | None, int]: - ... + def run_get_pk(self, *args: P.args, **kwargs: P.kwargs) -> tuple[dict[str, t.Any] | None, int]: ... - def run_get_node(self, *args: P.args, **kwargs: P.kwargs) -> tuple[dict[str, t.Any] | None, N]: - ... + def run_get_node(self, *args: P.args, **kwargs: P.kwargs) -> tuple[dict[str, t.Any] | None, N]: ... is_process_function: bool diff --git a/src/aiida/engine/processes/futures.py b/src/aiida/engine/processes/futures.py index ea3cf1b2e3..096c11b277 100644 --- a/src/aiida/engine/processes/futures.py +++ b/src/aiida/engine/processes/futures.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Futures that can poll or receive broadcasted messages while waiting for a task to be completed.""" + import asyncio from typing import Optional, Union diff --git a/src/aiida/engine/processes/launcher.py b/src/aiida/engine/processes/launcher.py index c7a600348c..b6c72aa724 100644 --- a/src/aiida/engine/processes/launcher.py +++ b/src/aiida/engine/processes/launcher.py @@ -1,4 +1,5 @@ """A sub class of ``plumpy.ProcessLauncher`` to launch a ``Process``.""" + import asyncio import logging import traceback diff --git a/src/aiida/engine/processes/ports.py b/src/aiida/engine/processes/ports.py index b173318b1f..538e6ab195 100644 --- a/src/aiida/engine/processes/ports.py +++ b/src/aiida/engine/processes/ports.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """AiiDA specific implementation of plumpy Ports and PortNamespaces for the ProcessSpec.""" + import re import warnings from collections.abc import Mapping diff --git a/src/aiida/engine/processes/process.py b/src/aiida/engine/processes/process.py index 454dab9838..5ee3657d06 100644 --- a/src/aiida/engine/processes/process.py +++ b/src/aiida/engine/processes/process.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """The AiiDA process class""" + from __future__ import annotations import asyncio diff --git a/src/aiida/engine/processes/process_spec.py b/src/aiida/engine/processes/process_spec.py index 879463596a..f88542960c 100644 --- a/src/aiida/engine/processes/process_spec.py +++ b/src/aiida/engine/processes/process_spec.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """AiiDA specific implementation of plumpy's ProcessSpec.""" + from typing import Optional import plumpy.process_spec diff --git a/src/aiida/engine/processes/utils.py b/src/aiida/engine/processes/utils.py index 5a706e823d..694af5de64 100644 --- a/src/aiida/engine/processes/utils.py +++ b/src/aiida/engine/processes/utils.py @@ -1,4 +1,5 @@ """Module with utilities.""" + from collections.abc import Mapping from aiida.orm import Node diff --git a/src/aiida/engine/processes/workchains/awaitable.py b/src/aiida/engine/processes/workchains/awaitable.py index a36bc8898b..742d9fb31c 100644 --- a/src/aiida/engine/processes/workchains/awaitable.py +++ b/src/aiida/engine/processes/workchains/awaitable.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Enums and function for the awaitables of Processes.""" + from enum import Enum from typing import Union diff --git a/src/aiida/engine/processes/workchains/context.py b/src/aiida/engine/processes/workchains/context.py index dfc3ad1866..a9af96f67a 100644 --- a/src/aiida/engine/processes/workchains/context.py +++ b/src/aiida/engine/processes/workchains/context.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Convenience functions to add awaitables to the Context of a WorkChain.""" + from typing import Union from aiida.orm import ProcessNode diff --git a/src/aiida/engine/processes/workchains/restart.py b/src/aiida/engine/processes/workchains/restart.py index 552133ed20..426139cc09 100644 --- a/src/aiida/engine/processes/workchains/restart.py +++ b/src/aiida/engine/processes/workchains/restart.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Base implementation of `WorkChain` class that implements a simple automated restart mechanism for sub processes.""" + import functools from inspect import getmembers from types import FunctionType diff --git a/src/aiida/engine/processes/workchains/utils.py b/src/aiida/engine/processes/workchains/utils.py index 7e97971492..44bc47304e 100644 --- a/src/aiida/engine/processes/workchains/utils.py +++ b/src/aiida/engine/processes/workchains/utils.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utilities for `WorkChain` implementations.""" + from functools import partial from inspect import getfullargspec from types import FunctionType diff --git a/src/aiida/engine/processes/workchains/workchain.py b/src/aiida/engine/processes/workchains/workchain.py index 909ff42592..1107204ab0 100644 --- a/src/aiida/engine/processes/workchains/workchain.py +++ b/src/aiida/engine/processes/workchains/workchain.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Components for the WorkChain concept of the workflow engine.""" + from __future__ import annotations import collections.abc diff --git a/src/aiida/engine/runners.py b/src/aiida/engine/runners.py index 65d087d394..42cb76244c 100644 --- a/src/aiida/engine/runners.py +++ b/src/aiida/engine/runners.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Runners that can run and submit processes.""" + from __future__ import annotations import asyncio diff --git a/src/aiida/engine/transports.py b/src/aiida/engine/transports.py index e62781ef73..fe32df7884 100644 --- a/src/aiida/engine/transports.py +++ b/src/aiida/engine/transports.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """A transport queue to batch process multiple tasks that require a Transport.""" + import asyncio import contextlib import contextvars diff --git a/src/aiida/engine/utils.py b/src/aiida/engine/utils.py index a1b707d647..44b8319ddc 100644 --- a/src/aiida/engine/utils.py +++ b/src/aiida/engine/utils.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utilities for the workflow engine.""" + from __future__ import annotations import asyncio diff --git a/src/aiida/manage/caching.py b/src/aiida/manage/caching.py index d011988ff4..e713fb5623 100644 --- a/src/aiida/manage/caching.py +++ b/src/aiida/manage/caching.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Definition of caching mechanism and configuration for calculations.""" + from __future__ import annotations import keyword diff --git a/src/aiida/manage/configuration/config.py b/src/aiida/manage/configuration/config.py index 19efc61ca0..a6d5fc44aa 100644 --- a/src/aiida/manage/configuration/config.py +++ b/src/aiida/manage/configuration/config.py @@ -12,6 +12,7 @@ with PEP 563 (https://peps.python.org/pep-0563/), this is not compatible with ``pydantic`` for Python 3.9 and older ( See https://github.com/pydantic/pydantic/issues/2678 for details). """ + from __future__ import annotations import codecs diff --git a/src/aiida/manage/configuration/migrations/migrations.py b/src/aiida/manage/configuration/migrations/migrations.py index 24d3d339bf..c432c6fe81 100644 --- a/src/aiida/manage/configuration/migrations/migrations.py +++ b/src/aiida/manage/configuration/migrations/migrations.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Define the current configuration version and migrations.""" + from typing import Any, Dict, Iterable, Optional, Protocol, Type from aiida.common import exceptions diff --git a/src/aiida/manage/configuration/options.py b/src/aiida/manage/configuration/options.py index 7f6ab8e0b9..110df675f6 100644 --- a/src/aiida/manage/configuration/options.py +++ b/src/aiida/manage/configuration/options.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Definition of known configuration options and methods to parse and get option values.""" + from typing import Any, Dict, List, Tuple from aiida.common.exceptions import ConfigurationError diff --git a/src/aiida/manage/configuration/profile.py b/src/aiida/manage/configuration/profile.py index 752339fa9d..6365e7a1b5 100644 --- a/src/aiida/manage/configuration/profile.py +++ b/src/aiida/manage/configuration/profile.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """AiiDA profile related code""" + from __future__ import annotations import collections diff --git a/src/aiida/manage/configuration/settings.py b/src/aiida/manage/configuration/settings.py index a4c496089a..fee042d9e1 100644 --- a/src/aiida/manage/configuration/settings.py +++ b/src/aiida/manage/configuration/settings.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Base settings required for the configuration of an AiiDA instance.""" + from __future__ import annotations import os diff --git a/src/aiida/manage/external/postgres.py b/src/aiida/manage/external/postgres.py index f397e033b5..530d23b9c5 100644 --- a/src/aiida/manage/external/postgres.py +++ b/src/aiida/manage/external/postgres.py @@ -14,6 +14,7 @@ installed by default on various systems. If the postgres setup is not the default installation, additional information needs to be provided. """ + from typing import TYPE_CHECKING from pgsu import DEFAULT_DSN as DEFAULT_DBINFO diff --git a/src/aiida/manage/manager.py b/src/aiida/manage/manager.py index 53293d2879..2ed86b88c7 100644 --- a/src/aiida/manage/manager.py +++ b/src/aiida/manage/manager.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """AiiDA manager for global settings""" + from __future__ import annotations from typing import TYPE_CHECKING, Any, Optional, Union diff --git a/src/aiida/manage/profile_access.py b/src/aiida/manage/profile_access.py index c67967145f..5b04481e66 100644 --- a/src/aiida/manage/profile_access.py +++ b/src/aiida/manage/profile_access.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for the ProfileAccessManager that tracks process access to the profile.""" + import contextlib import os import typing diff --git a/src/aiida/manage/tests/__init__.py b/src/aiida/manage/tests/__init__.py index c1432b0f22..97f0f4c57b 100644 --- a/src/aiida/manage/tests/__init__.py +++ b/src/aiida/manage/tests/__init__.py @@ -6,5 +6,4 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""Testing infrastructure for easy testing of AiiDA plugins. -""" +"""Testing infrastructure for easy testing of AiiDA plugins.""" diff --git a/src/aiida/manage/tests/pytest_fixtures.py b/src/aiida/manage/tests/pytest_fixtures.py index 2ed09f6385..7aceafa5d6 100644 --- a/src/aiida/manage/tests/pytest_fixtures.py +++ b/src/aiida/manage/tests/pytest_fixtures.py @@ -15,6 +15,7 @@ This will make all the fixtures in this file available and ready for use. Simply use them as you would any other ``pytest`` fixture. """ + from __future__ import annotations import asyncio diff --git a/src/aiida/orm/authinfos.py b/src/aiida/orm/authinfos.py index cf27fb93e8..e87be97367 100644 --- a/src/aiida/orm/authinfos.py +++ b/src/aiida/orm/authinfos.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for the `AuthInfo` ORM class.""" + from typing import TYPE_CHECKING, Any, Dict, Optional, Type from aiida.common import exceptions diff --git a/src/aiida/orm/autogroup.py b/src/aiida/orm/autogroup.py index 0babbec68d..70940145f9 100644 --- a/src/aiida/orm/autogroup.py +++ b/src/aiida/orm/autogroup.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module to manage the autogrouping functionality by ``verdi run``.""" + from __future__ import annotations import re diff --git a/src/aiida/orm/comments.py b/src/aiida/orm/comments.py index 00a1556f82..bc92351c54 100644 --- a/src/aiida/orm/comments.py +++ b/src/aiida/orm/comments.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Comment objects and functions""" + from datetime import datetime from typing import TYPE_CHECKING, List, Optional, Type diff --git a/src/aiida/orm/computers.py b/src/aiida/orm/computers.py index 588d16602b..bae925b25c 100644 --- a/src/aiida/orm/computers.py +++ b/src/aiida/orm/computers.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for Computer entities""" + import logging import os from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union diff --git a/src/aiida/orm/convert.py b/src/aiida/orm/convert.py index 73a20f5dc9..2c28ccf712 100644 --- a/src/aiida/orm/convert.py +++ b/src/aiida/orm/convert.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for converting backend entities into frontend, ORM, entities""" + from collections.abc import Iterator, Mapping, Sized from functools import singledispatch diff --git a/src/aiida/orm/entities.py b/src/aiida/orm/entities.py index dc93ced2e5..a55f6f7b79 100644 --- a/src/aiida/orm/entities.py +++ b/src/aiida/orm/entities.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for all common top level AiiDA entity classes and methods""" + from __future__ import annotations import abc diff --git a/src/aiida/orm/extras.py b/src/aiida/orm/extras.py index 57ba1f7ca5..0c4177fb1c 100644 --- a/src/aiida/orm/extras.py +++ b/src/aiida/orm/extras.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Interface to the extras of a node instance.""" + import copy from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Tuple, Union diff --git a/src/aiida/orm/fields.py b/src/aiida/orm/fields.py index 4291c49f28..0a8a1340e7 100644 --- a/src/aiida/orm/fields.py +++ b/src/aiida/orm/fields.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module which provides decorators for AiiDA ORM entity -> DB field mappings.""" + import datetime import typing as t from abc import ABCMeta @@ -160,8 +161,7 @@ def _get_dtype_as_str(self) -> str: if t.TYPE_CHECKING: - def __getitem__(self, key: str) -> 'QbField': - ... + def __getitem__(self, key: str) -> 'QbField': ... class QbNumericField(QbField): diff --git a/src/aiida/orm/groups.py b/src/aiida/orm/groups.py index 56e2065e9b..e48c3342de 100644 --- a/src/aiida/orm/groups.py +++ b/src/aiida/orm/groups.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """AiiDA Group entites""" + import warnings from functools import cached_property from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union, cast diff --git a/src/aiida/orm/implementation/authinfos.py b/src/aiida/orm/implementation/authinfos.py index 151957d65a..508874943b 100644 --- a/src/aiida/orm/implementation/authinfos.py +++ b/src/aiida/orm/implementation/authinfos.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for the backend implementation of the `AuthInfo` ORM class.""" + import abc from typing import TYPE_CHECKING, Any, Dict diff --git a/src/aiida/orm/implementation/comments.py b/src/aiida/orm/implementation/comments.py index 2b9f3c7147..be0fca8f99 100644 --- a/src/aiida/orm/implementation/comments.py +++ b/src/aiida/orm/implementation/comments.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for comment backend classes.""" + import abc from datetime import datetime from typing import TYPE_CHECKING, List, Optional diff --git a/src/aiida/orm/implementation/computers.py b/src/aiida/orm/implementation/computers.py index 208d3beacc..cd607c6d26 100644 --- a/src/aiida/orm/implementation/computers.py +++ b/src/aiida/orm/implementation/computers.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Backend specific computer objects and methods""" + import abc import logging from typing import Any, Dict diff --git a/src/aiida/orm/implementation/entities.py b/src/aiida/orm/implementation/entities.py index c26cc634bc..b6be5d61c2 100644 --- a/src/aiida/orm/implementation/entities.py +++ b/src/aiida/orm/implementation/entities.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Classes and methods for backend non-specific entities""" + from __future__ import annotations import abc diff --git a/src/aiida/orm/implementation/groups.py b/src/aiida/orm/implementation/groups.py index 53ec4d7e7d..121271ca95 100644 --- a/src/aiida/orm/implementation/groups.py +++ b/src/aiida/orm/implementation/groups.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Backend group module""" + import abc from typing import TYPE_CHECKING, List, Optional, Protocol, Sequence, Union diff --git a/src/aiida/orm/implementation/logs.py b/src/aiida/orm/implementation/logs.py index 3ff9bbea6e..9833a77a68 100644 --- a/src/aiida/orm/implementation/logs.py +++ b/src/aiida/orm/implementation/logs.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Backend group module""" + import abc from datetime import datetime from typing import TYPE_CHECKING, Any, Dict, List diff --git a/src/aiida/orm/implementation/nodes.py b/src/aiida/orm/implementation/nodes.py index 8387608dff..d16268b1e1 100644 --- a/src/aiida/orm/implementation/nodes.py +++ b/src/aiida/orm/implementation/nodes.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Abstract BackendNode and BackendNodeCollection implementation.""" + import abc from datetime import datetime from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar diff --git a/src/aiida/orm/implementation/querybuilder.py b/src/aiida/orm/implementation/querybuilder.py index 6b8b27ab19..6cc83f58b1 100644 --- a/src/aiida/orm/implementation/querybuilder.py +++ b/src/aiida/orm/implementation/querybuilder.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Abstract `QueryBuilder` definition.""" + import abc from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Literal, Optional, Set, TypedDict, Union diff --git a/src/aiida/orm/implementation/storage_backend.py b/src/aiida/orm/implementation/storage_backend.py index c438ebe1ec..601b3ed70d 100644 --- a/src/aiida/orm/implementation/storage_backend.py +++ b/src/aiida/orm/implementation/storage_backend.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Generic backend related objects""" + from __future__ import annotations import abc diff --git a/src/aiida/orm/implementation/users.py b/src/aiida/orm/implementation/users.py index 8bd0309b48..143fe72df3 100644 --- a/src/aiida/orm/implementation/users.py +++ b/src/aiida/orm/implementation/users.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Backend user""" + import abc from .entities import BackendCollection, BackendEntity diff --git a/src/aiida/orm/implementation/utils.py b/src/aiida/orm/implementation/utils.py index 6761fdd612..0df21f3790 100644 --- a/src/aiida/orm/implementation/utils.py +++ b/src/aiida/orm/implementation/utils.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utility methods for backend non-specific implementations.""" + import math import numbers from collections.abc import Iterable, Mapping diff --git a/src/aiida/orm/logs.py b/src/aiida/orm/logs.py index a98814f82c..25f9a594a5 100644 --- a/src/aiida/orm/logs.py +++ b/src/aiida/orm/logs.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for orm logging abstract classes""" + import logging from datetime import datetime from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type diff --git a/src/aiida/orm/nodes/attributes.py b/src/aiida/orm/nodes/attributes.py index f7b1d870f7..e3e0e171ef 100644 --- a/src/aiida/orm/nodes/attributes.py +++ b/src/aiida/orm/nodes/attributes.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Interface to the attributes of a node instance.""" + import copy from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Tuple diff --git a/src/aiida/orm/nodes/caching.py b/src/aiida/orm/nodes/caching.py index 41439f02e8..ded466bc87 100644 --- a/src/aiida/orm/nodes/caching.py +++ b/src/aiida/orm/nodes/caching.py @@ -1,4 +1,5 @@ """Interface to control caching of a node instance.""" + from __future__ import annotations import importlib diff --git a/src/aiida/orm/nodes/comments.py b/src/aiida/orm/nodes/comments.py index 4530f6a3b4..e638642e9f 100644 --- a/src/aiida/orm/nodes/comments.py +++ b/src/aiida/orm/nodes/comments.py @@ -1,4 +1,5 @@ """Interface for comments of a node instance.""" + from __future__ import annotations import typing as t diff --git a/src/aiida/orm/nodes/data/array/array.py b/src/aiida/orm/nodes/data/array/array.py index ed00d8de4b..b77761acde 100644 --- a/src/aiida/orm/nodes/data/array/array.py +++ b/src/aiida/orm/nodes/data/array/array.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""AiiDA ORM data class storing (numpy) arrays -""" +"""AiiDA ORM data class storing (numpy) arrays""" + from __future__ import annotations from typing import Any, Iterator diff --git a/src/aiida/orm/nodes/data/array/bands.py b/src/aiida/orm/nodes/data/array/bands.py index 4d256f722e..b31f0f44d2 100644 --- a/src/aiida/orm/nodes/data/array/bands.py +++ b/src/aiida/orm/nodes/data/array/bands.py @@ -9,6 +9,7 @@ """This module defines the classes related to band structures or dispersions in a Brillouin zone, and how to operate on them. """ + import json from string import Template from typing import List, Optional diff --git a/src/aiida/orm/nodes/data/array/kpoints.py b/src/aiida/orm/nodes/data/array/kpoints.py index 7a43ca9886..ddf0cd6a96 100644 --- a/src/aiida/orm/nodes/data/array/kpoints.py +++ b/src/aiida/orm/nodes/data/array/kpoints.py @@ -10,6 +10,7 @@ lists and meshes of k-points (i.e., points in the reciprocal space of a periodic crystal structure). """ + from typing import List import numpy diff --git a/src/aiida/orm/nodes/data/array/projection.py b/src/aiida/orm/nodes/data/array/projection.py index a42c48f858..e58442d9c5 100644 --- a/src/aiida/orm/nodes/data/array/projection.py +++ b/src/aiida/orm/nodes/data/array/projection.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Data plugin to represet arrays of projected wavefunction components.""" + import copy import numpy as np diff --git a/src/aiida/orm/nodes/data/array/trajectory.py b/src/aiida/orm/nodes/data/array/trajectory.py index dd86f34b08..6381582b48 100644 --- a/src/aiida/orm/nodes/data/array/trajectory.py +++ b/src/aiida/orm/nodes/data/array/trajectory.py @@ -6,8 +6,8 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### -"""AiiDA class to deal with crystal structure trajectories. -""" +"""AiiDA class to deal with crystal structure trajectories.""" + import collections.abc from typing import List diff --git a/src/aiida/orm/nodes/data/array/xy.py b/src/aiida/orm/nodes/data/array/xy.py index 3ab3fda966..aa994bbd30 100644 --- a/src/aiida/orm/nodes/data/array/xy.py +++ b/src/aiida/orm/nodes/data/array/xy.py @@ -10,6 +10,7 @@ collections of y-arrays bound to a single x-array, and the methods to operate on them. """ + from __future__ import annotations from typing import TYPE_CHECKING, Any, Sequence diff --git a/src/aiida/orm/nodes/data/base.py b/src/aiida/orm/nodes/data/base.py index 4aecf7af9b..265a7acd5f 100644 --- a/src/aiida/orm/nodes/data/base.py +++ b/src/aiida/orm/nodes/data/base.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`Data` sub class to be used as a base for data containers that represent base python data types.""" + from functools import singledispatch from aiida.orm.fields import add_field diff --git a/src/aiida/orm/nodes/data/cif.py b/src/aiida/orm/nodes/data/cif.py index ad8fdc7827..9245d8d894 100644 --- a/src/aiida/orm/nodes/data/cif.py +++ b/src/aiida/orm/nodes/data/cif.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Tools for handling Crystallographic Information Files (CIF)""" + import re from typing import List diff --git a/src/aiida/orm/nodes/data/code/abstract.py b/src/aiida/orm/nodes/data/code/abstract.py index a42c063a5c..ef8aef920b 100644 --- a/src/aiida/orm/nodes/data/code/abstract.py +++ b/src/aiida/orm/nodes/data/code/abstract.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Abstract data plugin representing an executable code.""" + from __future__ import annotations import abc diff --git a/src/aiida/orm/nodes/data/code/containerized.py b/src/aiida/orm/nodes/data/code/containerized.py index 527087f8db..b2a8a8c439 100644 --- a/src/aiida/orm/nodes/data/code/containerized.py +++ b/src/aiida/orm/nodes/data/code/containerized.py @@ -11,6 +11,7 @@ The containerized code allows specifying a container image and the executable filepath within that container that is to be executed when a calculation job is run with this code. """ + from __future__ import annotations import pathlib diff --git a/src/aiida/orm/nodes/data/code/installed.py b/src/aiida/orm/nodes/data/code/installed.py index d56c611723..695d2fbac6 100644 --- a/src/aiida/orm/nodes/data/code/installed.py +++ b/src/aiida/orm/nodes/data/code/installed.py @@ -13,6 +13,7 @@ represented by an instance of :class:`aiida.orm.computers.Computer`. Each time a :class:`aiida.engine.CalcJob` is run using an ``InstalledCode``, it will run its executable on the associated computer. """ + from __future__ import annotations import pathlib diff --git a/src/aiida/orm/nodes/data/code/legacy.py b/src/aiida/orm/nodes/data/code/legacy.py index 377641c88c..30f04b8264 100644 --- a/src/aiida/orm/nodes/data/code/legacy.py +++ b/src/aiida/orm/nodes/data/code/legacy.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Data plugin represeting an executable code to be wrapped and called through a `CalcJob` plugin.""" + import os import pathlib from typing import Optional diff --git a/src/aiida/orm/nodes/data/code/portable.py b/src/aiida/orm/nodes/data/code/portable.py index 1d0bc48479..1008e460b3 100644 --- a/src/aiida/orm/nodes/data/code/portable.py +++ b/src/aiida/orm/nodes/data/code/portable.py @@ -16,6 +16,7 @@ :class:`aiida.engine.CalcJob` is run using a ``PortableCode``, the uploaded files will be automatically copied to the working directory on the selected computer and the executable will be run there. """ + from __future__ import annotations import pathlib diff --git a/src/aiida/orm/nodes/data/data.py b/src/aiida/orm/nodes/data/data.py index 084f242e9a..ec3118840a 100644 --- a/src/aiida/orm/nodes/data/data.py +++ b/src/aiida/orm/nodes/data/data.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class `Data` to be used as a base class for data structures.""" + from typing import Dict, Optional from aiida.common import exceptions diff --git a/src/aiida/orm/nodes/data/dict.py b/src/aiida/orm/nodes/data/dict.py index dfd4f1c47a..f6e6cc87ca 100644 --- a/src/aiida/orm/nodes/data/dict.py +++ b/src/aiida/orm/nodes/data/dict.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`Data` sub class to represent a dictionary.""" + from __future__ import annotations import copy diff --git a/src/aiida/orm/nodes/data/enum.py b/src/aiida/orm/nodes/data/enum.py index 541747ab58..c7311a271c 100644 --- a/src/aiida/orm/nodes/data/enum.py +++ b/src/aiida/orm/nodes/data/enum.py @@ -14,6 +14,7 @@ class Color(Enum): members (or enum members) and are functionally constants. The enum members have names and values: the name of ``Color.RED`` is ``RED`` and the value of ``Color.RED`` is ``1``. """ + import typing as t from enum import Enum diff --git a/src/aiida/orm/nodes/data/folder.py b/src/aiida/orm/nodes/data/folder.py index 2804fc5eec..86787e6c1d 100644 --- a/src/aiida/orm/nodes/data/folder.py +++ b/src/aiida/orm/nodes/data/folder.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`Data` sub class to represent a folder on a file system.""" + from __future__ import annotations import contextlib @@ -72,13 +73,11 @@ def list_object_names(self, path: str | None = None) -> list[str]: @t.overload @contextlib.contextmanager - def open(self, path: FilePath, mode: t.Literal['r']) -> t.Iterator[t.TextIO]: - ... + def open(self, path: FilePath, mode: t.Literal['r']) -> t.Iterator[t.TextIO]: ... @t.overload @contextlib.contextmanager - def open(self, path: FilePath, mode: t.Literal['rb']) -> t.Iterator[t.BinaryIO]: - ... + def open(self, path: FilePath, mode: t.Literal['rb']) -> t.Iterator[t.BinaryIO]: ... @contextlib.contextmanager def open(self, path: FilePath, mode: t.Literal['r', 'rb'] = 'r') -> t.Iterator[t.BinaryIO] | t.Iterator[t.TextIO]: @@ -120,12 +119,10 @@ def get_object(self, path: FilePath | None = None) -> File: return self.base.repository.get_object(path) @t.overload - def get_object_content(self, path: str, mode: t.Literal['r']) -> str: - ... + def get_object_content(self, path: str, mode: t.Literal['r']) -> str: ... @t.overload - def get_object_content(self, path: str, mode: t.Literal['rb']) -> bytes: - ... + def get_object_content(self, path: str, mode: t.Literal['rb']) -> bytes: ... def get_object_content(self, path: str, mode: t.Literal['r', 'rb'] = 'r') -> str | bytes: """Return the content of a object identified by key. diff --git a/src/aiida/orm/nodes/data/jsonable.py b/src/aiida/orm/nodes/data/jsonable.py index 5ce3bb64cd..90387f6fa7 100644 --- a/src/aiida/orm/nodes/data/jsonable.py +++ b/src/aiida/orm/nodes/data/jsonable.py @@ -1,4 +1,5 @@ """Data plugin that allows to easily wrap objects that are JSON-able.""" + import importlib import json import typing @@ -9,8 +10,7 @@ class JsonSerializableProtocol(typing.Protocol): - def as_dict(self) -> typing.MutableMapping[typing.Any, typing.Any]: - ... + def as_dict(self) -> typing.MutableMapping[typing.Any, typing.Any]: ... class JsonableData(Data): diff --git a/src/aiida/orm/nodes/data/list.py b/src/aiida/orm/nodes/data/list.py index 786e98cc31..9fdd6ec866 100644 --- a/src/aiida/orm/nodes/data/list.py +++ b/src/aiida/orm/nodes/data/list.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """`Data` sub class to represent a list.""" + from collections.abc import MutableSequence from .base import to_aiida_type diff --git a/src/aiida/orm/nodes/data/orbital.py b/src/aiida/orm/nodes/data/orbital.py index f9f5bd4335..21de55cf6c 100644 --- a/src/aiida/orm/nodes/data/orbital.py +++ b/src/aiida/orm/nodes/data/orbital.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Data plugin to model an atomic orbital.""" + import copy from aiida.common.exceptions import ValidationError diff --git a/src/aiida/orm/nodes/data/remote/base.py b/src/aiida/orm/nodes/data/remote/base.py index 6a9a1b54d8..797df38177 100644 --- a/src/aiida/orm/nodes/data/remote/base.py +++ b/src/aiida/orm/nodes/data/remote/base.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Data plugin that models a folder on a remote computer.""" + import os from aiida.orm import AuthInfo diff --git a/src/aiida/orm/nodes/data/remote/stash/folder.py b/src/aiida/orm/nodes/data/remote/stash/folder.py index 3a363ba978..2fe545af10 100644 --- a/src/aiida/orm/nodes/data/remote/stash/folder.py +++ b/src/aiida/orm/nodes/data/remote/stash/folder.py @@ -1,4 +1,5 @@ """Data plugin that models a stashed folder on a remote computer.""" + from typing import List, Tuple, Union from aiida.common.datastructures import StashMode diff --git a/src/aiida/orm/nodes/data/singlefile.py b/src/aiida/orm/nodes/data/singlefile.py index 11bf26678d..c0f3797f24 100644 --- a/src/aiida/orm/nodes/data/singlefile.py +++ b/src/aiida/orm/nodes/data/singlefile.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Data class that can be used to store a single file in its repository.""" + from __future__ import annotations import contextlib @@ -62,25 +63,21 @@ def filename(self) -> str: @t.overload @contextlib.contextmanager - def open(self, path: FilePath, mode: t.Literal['r'] = ...) -> t.Iterator[t.TextIO]: - ... + def open(self, path: FilePath, mode: t.Literal['r'] = ...) -> t.Iterator[t.TextIO]: ... @t.overload @contextlib.contextmanager - def open(self, path: FilePath, mode: t.Literal['rb']) -> t.Iterator[t.BinaryIO]: - ... + def open(self, path: FilePath, mode: t.Literal['rb']) -> t.Iterator[t.BinaryIO]: ... @t.overload @contextlib.contextmanager def open( # type: ignore[overload-overlap] self, path: None = None, mode: t.Literal['r'] = ... - ) -> t.Iterator[t.TextIO]: - ... + ) -> t.Iterator[t.TextIO]: ... @t.overload @contextlib.contextmanager - def open(self, path: None = None, mode: t.Literal['rb'] = ...) -> t.Iterator[t.BinaryIO]: - ... + def open(self, path: None = None, mode: t.Literal['rb'] = ...) -> t.Iterator[t.BinaryIO]: ... @contextlib.contextmanager def open( diff --git a/src/aiida/orm/nodes/data/structure.py b/src/aiida/orm/nodes/data/structure.py index d2489e2e23..f046898b52 100644 --- a/src/aiida/orm/nodes/data/structure.py +++ b/src/aiida/orm/nodes/data/structure.py @@ -9,6 +9,7 @@ """This module defines the classes for structures and all related functions to operate on them. """ + import copy import functools import itertools diff --git a/src/aiida/orm/nodes/data/upf.py b/src/aiida/orm/nodes/data/upf.py index 919de19f19..6c0f945c22 100644 --- a/src/aiida/orm/nodes/data/upf.py +++ b/src/aiida/orm/nodes/data/upf.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module of `Data` sub class to represent a pseudopotential single file in UPF format and related utilities.""" + import json import re diff --git a/src/aiida/orm/nodes/links.py b/src/aiida/orm/nodes/links.py index 316290ece2..2297792d53 100644 --- a/src/aiida/orm/nodes/links.py +++ b/src/aiida/orm/nodes/links.py @@ -1,4 +1,5 @@ """Interface for links of a node instance.""" + from __future__ import annotations import typing as t diff --git a/src/aiida/orm/nodes/node.py b/src/aiida/orm/nodes/node.py index 06afdf2a5b..fe501970be 100644 --- a/src/aiida/orm/nodes/node.py +++ b/src/aiida/orm/nodes/node.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Package for node ORM classes.""" + from datetime import datetime from functools import cached_property from logging import Logger diff --git a/src/aiida/orm/nodes/process/calculation/calcfunction.py b/src/aiida/orm/nodes/process/calculation/calcfunction.py index 95654989dd..5c4480cfb2 100644 --- a/src/aiida/orm/nodes/process/calculation/calcfunction.py +++ b/src/aiida/orm/nodes/process/calculation/calcfunction.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class for calculation function processes.""" + from typing import TYPE_CHECKING from aiida.common.links import LinkType diff --git a/src/aiida/orm/nodes/process/calculation/calcjob.py b/src/aiida/orm/nodes/process/calculation/calcjob.py index ea0b54140b..98479c000b 100644 --- a/src/aiida/orm/nodes/process/calculation/calcjob.py +++ b/src/aiida/orm/nodes/process/calculation/calcjob.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class for calculation job processes.""" + import datetime from typing import TYPE_CHECKING, Any, AnyStr, Dict, List, Optional, Sequence, Tuple, Type, Union diff --git a/src/aiida/orm/nodes/process/process.py b/src/aiida/orm/nodes/process/process.py index 914d02a4d5..e90dd4e27b 100644 --- a/src/aiida/orm/nodes/process/process.py +++ b/src/aiida/orm/nodes/process/process.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class for processes.""" + import enum from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union diff --git a/src/aiida/orm/nodes/process/workflow/workchain.py b/src/aiida/orm/nodes/process/workflow/workchain.py index 17cdb48817..8f52dff926 100644 --- a/src/aiida/orm/nodes/process/workflow/workchain.py +++ b/src/aiida/orm/nodes/process/workflow/workchain.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class for workchain processes.""" + from typing import Optional, Tuple from aiida.common.lang import classproperty diff --git a/src/aiida/orm/nodes/process/workflow/workflow.py b/src/aiida/orm/nodes/process/workflow/workflow.py index 2a158a56f1..54e2ac7a95 100644 --- a/src/aiida/orm/nodes/process/workflow/workflow.py +++ b/src/aiida/orm/nodes/process/workflow/workflow.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class for workflow processes.""" + from typing import TYPE_CHECKING from aiida.common.links import LinkType diff --git a/src/aiida/orm/nodes/process/workflow/workfunction.py b/src/aiida/orm/nodes/process/workflow/workfunction.py index 2d9ce1ff5e..8998091aa9 100644 --- a/src/aiida/orm/nodes/process/workflow/workfunction.py +++ b/src/aiida/orm/nodes/process/workflow/workfunction.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `Node` sub class for workflow function processes.""" + from typing import TYPE_CHECKING from aiida.common.links import LinkType diff --git a/src/aiida/orm/nodes/repository.py b/src/aiida/orm/nodes/repository.py index 65346150a5..a886c896cf 100644 --- a/src/aiida/orm/nodes/repository.py +++ b/src/aiida/orm/nodes/repository.py @@ -1,4 +1,5 @@ """Interface to the file repository of a node instance.""" + from __future__ import annotations import contextlib @@ -165,13 +166,11 @@ def list_object_names(self, path: str | None = None) -> list[str]: @t.overload @contextlib.contextmanager - def open(self, path: FilePath, mode: t.Literal['r']) -> t.Iterator[t.TextIO]: - ... + def open(self, path: FilePath, mode: t.Literal['r']) -> t.Iterator[t.TextIO]: ... @t.overload @contextlib.contextmanager - def open(self, path: FilePath, mode: t.Literal['rb']) -> t.Iterator[t.BinaryIO]: - ... + def open(self, path: FilePath, mode: t.Literal['rb']) -> t.Iterator[t.BinaryIO]: ... @contextlib.contextmanager def open(self, path: FilePath, mode: t.Literal['r', 'rb'] = 'r') -> t.Iterator[t.BinaryIO] | t.Iterator[t.TextIO]: @@ -232,12 +231,10 @@ def get_object(self, path: FilePath | None = None) -> File: return self._repository.get_object(path) @t.overload - def get_object_content(self, path: str, mode: t.Literal['r']) -> str: - ... + def get_object_content(self, path: str, mode: t.Literal['r']) -> str: ... @t.overload - def get_object_content(self, path: str, mode: t.Literal['rb']) -> bytes: - ... + def get_object_content(self, path: str, mode: t.Literal['rb']) -> bytes: ... def get_object_content(self, path: str, mode: t.Literal['r', 'rb'] = 'r') -> str | bytes: """Return the content of a object identified by key. diff --git a/src/aiida/orm/querybuilder.py b/src/aiida/orm/querybuilder.py index 6f21f5a2b0..1769714494 100644 --- a/src/aiida/orm/querybuilder.py +++ b/src/aiida/orm/querybuilder.py @@ -16,6 +16,7 @@ An instance of one of the implementation classes becomes a member of the :func:`QueryBuilder` instance when instantiated by the user. """ + from __future__ import annotations import warnings @@ -1032,12 +1033,10 @@ def _get_aiida_entity_res(value) -> Any: return value @overload - def first(self, flat: Literal[False] = False) -> Optional[list[Any]]: - ... + def first(self, flat: Literal[False] = False) -> Optional[list[Any]]: ... @overload - def first(self, flat: Literal[True]) -> Optional[Any]: - ... + def first(self, flat: Literal[True]) -> Optional[Any]: ... def first(self, flat: bool = False) -> Optional[list[Any] | Any]: """Return the first result of the query. diff --git a/src/aiida/orm/users.py b/src/aiida/orm/users.py index d9910c67ad..a7d9095842 100644 --- a/src/aiida/orm/users.py +++ b/src/aiida/orm/users.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for the ORM user class.""" + from typing import TYPE_CHECKING, Optional, Tuple, Type from aiida.common import exceptions diff --git a/src/aiida/orm/utils/builders/code.py b/src/aiida/orm/utils/builders/code.py index 21d637cfe5..3fb2f9160f 100644 --- a/src/aiida/orm/utils/builders/code.py +++ b/src/aiida/orm/utils/builders/code.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Manage code objects with lazy loading of the db env""" + import enum import pathlib diff --git a/src/aiida/orm/utils/builders/computer.py b/src/aiida/orm/utils/builders/computer.py index cf9e444bbd..cf2ba8e8c8 100644 --- a/src/aiida/orm/utils/builders/computer.py +++ b/src/aiida/orm/utils/builders/computer.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Manage computer objects with lazy loading of the db env""" + from aiida.common.exceptions import ValidationError from aiida.common.utils import ErrorAccumulator diff --git a/src/aiida/orm/utils/links.py b/src/aiida/orm/utils/links.py index 035a985016..56596b2e76 100644 --- a/src/aiida/orm/utils/links.py +++ b/src/aiida/orm/utils/links.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Utilities for dealing with links between nodes.""" + from collections import OrderedDict from collections.abc import Mapping from typing import TYPE_CHECKING, Generator, Iterator, List, NamedTuple, Optional diff --git a/src/aiida/orm/utils/loaders.py b/src/aiida/orm/utils/loaders.py index 846f9f28f7..d7a3f06b34 100644 --- a/src/aiida/orm/utils/loaders.py +++ b/src/aiida/orm/utils/loaders.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module with `OrmEntityLoader` and its sub classes that simplify loading entities through their identifiers.""" + from abc import abstractmethod from enum import Enum from typing import TYPE_CHECKING diff --git a/src/aiida/orm/utils/log.py b/src/aiida/orm/utils/log.py index 66de0730cc..a15fdcded1 100644 --- a/src/aiida/orm/utils/log.py +++ b/src/aiida/orm/utils/log.py @@ -7,6 +7,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """Module for logging methods/classes that need the ORM.""" + import logging diff --git a/src/aiida/orm/utils/managers.py b/src/aiida/orm/utils/managers.py index f7e415cc20..56f47d1d5d 100644 --- a/src/aiida/orm/utils/managers.py +++ b/src/aiida/orm/utils/managers.py @@ -10,6 +10,7 @@ to access members of other classes via TAB-completable attributes (e.g. the class underlying `calculation.inputs` to allow to do `calculation.inputs.