Skip to content

Commit

Permalink
Do not import aiida.cmdline in aiida.orm
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas authored and sphuber committed Aug 31, 2023
1 parent ebf3101 commit 0879a4e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions aiida/manage/external/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion aiida/orm/nodes/data/code/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion aiida/orm/nodes/data/code/installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 0879a4e

Please sign in to comment.