diff --git a/aiida/manage/external/postgres.py b/aiida/manage/external/postgres.py index 938bebf228..3a31d2248f 100644 --- a/aiida/manage/external/postgres.py +++ b/aiida/manage/external/postgres.py @@ -20,8 +20,6 @@ from pgsu import DEFAULT_DSN as DEFAULT_DBINFO # pylint: disable=no-name-in-module from pgsu import PGSU, PostgresConnectionMode -from aiida.cmdline.utils import echo - if TYPE_CHECKING: from aiida.manage.configuration import Profile @@ -218,6 +216,8 @@ def create_dbuser_db_safe(self, dbname, dbuser, dbpass): :param str dbpass: Password the user should be given. :returns: (dbuser, dbname) """ + from aiida.cmdline.utils import echo + if not self.dbuser_exists(dbuser): self.create_dbuser(dbuser=dbuser, dbpass=dbpass) elif not self.can_user_authenticate(dbuser, dbpass): diff --git a/aiida/orm/nodes/data/code/abstract.py b/aiida/orm/nodes/data/code/abstract.py index fcd54f0dd1..afd53ebfd1 100644 --- a/aiida/orm/nodes/data/code/abstract.py +++ b/aiida/orm/nodes/data/code/abstract.py @@ -17,7 +17,6 @@ import click -from aiida.cmdline.params.options.interactive import TemplateInteractiveOption from aiida.common import exceptions from aiida.common.folders import Folder from aiida.common.lang import type_check @@ -331,6 +330,8 @@ def get_cli_options(cls) -> collections.OrderedDict: @classmethod def _get_cli_options(cls) -> dict: """Return the CLI options that would allow to create an instance of this class.""" + from aiida.cmdline.params.options.interactive import TemplateInteractiveOption + return { 'label': { 'short_name': '-L', diff --git a/aiida/orm/nodes/data/code/installed.py b/aiida/orm/nodes/data/code/installed.py index b57d16f838..da0ea33876 100644 --- a/aiida/orm/nodes/data/code/installed.py +++ b/aiida/orm/nodes/data/code/installed.py @@ -20,7 +20,6 @@ import click -from aiida.cmdline.params.types import ComputerParamType from aiida.common import exceptions from aiida.common.lang import type_check from aiida.common.log import override_log_level @@ -179,6 +178,8 @@ def cli_validate_label_uniqueness(ctx, _, value): @classmethod def _get_cli_options(cls) -> dict: """Return the CLI options that would allow to create an instance of this class.""" + from aiida.cmdline.params.types import ComputerParamType + options = { 'computer': { 'short_name': '-Y',