Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve shell tab completion for InlineCalculation #1008

Merged
merged 2 commits into from
Dec 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions aiida/orm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
###########################################################################

from aiida.orm.calculation.job import JobCalculation
from aiida.orm.implementation import *
from aiida.orm.implementation.calculation import *
from aiida.orm.calculation.work import WorkCalculation
from aiida.orm.calculation import *
from aiida.orm.data import *
from aiida.orm.utils import *
from aiida.orm.code import Code
from aiida.orm.computer import Computer, delete_computer
from aiida.orm.querybuilder import QueryBuilder
from aiida.orm.workflow import Workflow
from aiida.orm.user import User
from aiida.orm.group import Group

__all__ = ['JobCalculation', 'WorkCalculation', 'Code', 'Computer',
'CalculationFactory', 'DataFactory', 'WorkflowFactory',
'QueryBuilder', 'Workflow', 'User', 'Group', 'delete_computer'] + calculation.__all__, utils.__all__
4 changes: 2 additions & 2 deletions aiida/orm/calculation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
# For further information please visit http://www.aiida.net #
###########################################################################

from aiida.orm.implementation.calculation import Calculation

from aiida.orm.implementation.calculation import Calculation, JobCalculation, InlineCalculation, make_inline

__all__ = ['Calculation', 'JobCalculation', 'InlineCalculation', 'make_inline']
1 change: 1 addition & 0 deletions aiida/orm/implementation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from aiida.orm.implementation.general.group import get_group_type_mapping
from aiida.backends.profile import BACKEND_DJANGO, BACKEND_SQLA

__all__ = ['Node', 'Computer', 'Group', 'Lock', 'LockManager', 'Workflow', 'kill_all', 'get_all_running_steps', 'get_workflow_info', 'Code', 'delete_code', 'Comment', 'User']

if BACKEND == BACKEND_SQLA:
from aiida.orm.implementation.sqlalchemy.node import Node
Expand Down
7 changes: 4 additions & 3 deletions aiida/orm/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
###########################################################################

from aiida.orm.implementation import User
import aiida.orm.utils as utils
from aiida.orm.utils import BackendDelegateWithDefault

__all__ = ['User', 'Util']


class Util(utils.BackendDelegateWithDefault):
class Util(BackendDelegateWithDefault):
@classmethod
def create_default(cls):
# Fall back to Django
from aiida.orm.implementation.django.user import Util as UserUtil
return Util(UserUtil())

def delete_user(self, pk):
return self._backend.delete_user(pk)
return self._backend.delete_user(pk)
18 changes: 10 additions & 8 deletions aiida/orm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from aiida.common.pluginloader import BaseFactory
from aiida.common.utils import abstractclassmethod

__all__ = ['CalculationFactory', 'DataFactory', 'WorkflowFactory', 'load_node', 'load_workflow']


def CalculationFactory(module, from_abstract=False):
"""
Expand Down Expand Up @@ -52,19 +54,19 @@ def WorkflowFactory(module):
def create_node_id_qb(node_id=None, pk=None, uuid=None,
parent_class=None, query_with_dashes=True):
"""
Returns the QueryBuilder instance set to retrieve AiiDA objects given their
(parent)class and PK (in which case the object should be unique) or UUID
Returns the QueryBuilder instance set to retrieve AiiDA objects given their
(parent)class and PK (in which case the object should be unique) or UUID
or UUID starting pattern.

:param node_id: PK (integer) or UUID (string) or a node
:param pk: PK of a node
:param uuid: UUID of a node, or the beginning of the uuid
:param parent_class: if specified, looks only among objects that are instances of
a subclass of parent_class, otherwise among nodes
:param bool query_with_dashes: Specific if uuid is passed, allows to
:param bool query_with_dashes: Specific if uuid is passed, allows to
put the uuid in the correct form. Default=True

:return: a QueryBuilder instance
:return: a QueryBuilder instance
"""

from aiida.common.exceptions import InputValidationError
Expand All @@ -84,7 +86,7 @@ def create_node_id_qb(node_id=None, pk=None, uuid=None,
raise InputValidationError("only one of parameters 'node_id', 'pk' and 'uuid' "
"has to be supplied")

# In principle, I can use this function to fetch any kind of AiiDA object,
# In principle, I can use this function to fetch any kind of AiiDA object,
# but if I don't specify anything, I assume that I am looking for nodes
class_ = parent_class or Node

Expand Down Expand Up @@ -147,9 +149,9 @@ def load_node(node_id=None, pk=None, uuid=None, parent_class=None, query_with_da
subclass of parent_class
:param bool query_with_dashes: Specific if uuid is passed, allows to put the uuid in the correct form.
Default=True
:param bool return_node: lets the function return the AiiDA node referred by the input.
:param bool return_node: lets the function return the AiiDA node referred by the input.
Default=False
:return: the required AiiDA node if existing, unique, and (sub)instance
:return: the required AiiDA node if existing, unique, and (sub)instance
of parent_class
:raise InputValidationError: if none or more than one of parameters is supplied
:raise TypeError: I the wrong types are provided
Expand Down