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

♻️ REFACTOR: Make __all__ imports explicit (via pre-commit) #5061

Merged
merged 14 commits into from
Aug 11, 2021
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ repos:

hooks:

- id: imports
name: imports
entry: python utils/make_all.py
language: python
types: [python]
require_serial: true
pass_filenames: false
files: aiida/.*py

- id: mypy
name: mypy
entry: mypy
Expand Down
47 changes: 39 additions & 8 deletions aiida/cmdline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,47 @@
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
# pylint: disable=wildcard-import,undefined-variable
"""The command line interface of AiiDA."""

from .params.arguments import *
from .params.options import *
from .params.types import *
from .utils.decorators import *
from .utils.echo import *
# AUTO-GENERATED

# yapf: disable
# pylint: disable=wildcard-import

from .params import *
from .utils import *

__all__ = (
params.arguments.__all__ + params.options.__all__ + params.types.__all__ + utils.decorators.__all__ +
utils.echo.__all__
'AbsolutePathParamType',
'CalculationParamType',
'CodeParamType',
'ComputerParamType',
'ConfigOptionParamType',
'DataParamType',
'EmailType',
'EntryPointType',
'FileOrUrl',
'GroupParamType',
'HostnameType',
'IdentifierParamType',
'LabelStringType',
'LazyChoice',
'MpirunCommandParamType',
'MultipleValueParamType',
'NodeParamType',
'NonEmptyStringParamType',
'PathOrUrl',
'PluginParamType',
'ProcessParamType',
'ProfileParamType',
'ShebangParamType',
'TestModuleParamType',
'UserParamType',
'WorkflowParamType',
'dbenv',
'format_call_graph',
'only_if_daemon_running',
'with_dbenv',
)

# yapf: enable
39 changes: 39 additions & 0 deletions aiida/cmdline/params/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,42 @@
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
"""Commandline parameters."""

# AUTO-GENERATED

# yapf: disable
# pylint: disable=wildcard-import

from .types import *

__all__ = (
'AbsolutePathParamType',
'CalculationParamType',
'CodeParamType',
'ComputerParamType',
'ConfigOptionParamType',
'DataParamType',
'EmailType',
'EntryPointType',
'FileOrUrl',
'GroupParamType',
'HostnameType',
'IdentifierParamType',
'LabelStringType',
'LazyChoice',
'MpirunCommandParamType',
'MultipleValueParamType',
'NodeParamType',
'NonEmptyStringParamType',
'PathOrUrl',
'PluginParamType',
'ProcessParamType',
'ProfileParamType',
'ShebangParamType',
'TestModuleParamType',
'UserParamType',
'WorkflowParamType',
)

# yapf: enable
81 changes: 29 additions & 52 deletions aiida/cmdline/params/arguments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,37 @@
# yapf: disable
"""Module with pre-defined reusable commandline arguments that can be used as `click` decorators."""

import click
# AUTO-GENERATED

from .. import types
from .overridable import OverridableArgument
# yapf: disable
# pylint: disable=wildcard-import

from .main import *

__all__ = (
'PROFILE', 'PROFILES', 'CALCULATION', 'CALCULATIONS', 'CODE', 'CODES', 'COMPUTER', 'COMPUTERS', 'DATUM', 'DATA',
'GROUP', 'GROUPS', 'NODE', 'NODES', 'PROCESS', 'PROCESSES', 'WORKFLOW', 'WORKFLOWS', 'INPUT_FILE', 'OUTPUT_FILE',
'LABEL', 'USER', 'CONFIG_OPTION'
'CALCULATION',
'CALCULATIONS',
'CODE',
'CODES',
'COMPUTER',
'COMPUTERS',
'CONFIG_OPTION',
'DATA',
'DATUM',
'GROUP',
'GROUPS',
'INPUT_FILE',
'LABEL',
'NODE',
'NODES',
'OUTPUT_FILE',
'PROCESS',
'PROCESSES',
'PROFILE',
'PROFILES',
'USER',
'WORKFLOW',
'WORKFLOWS',
)


PROFILE = OverridableArgument('profile', type=types.ProfileParamType())

PROFILES = OverridableArgument('profiles', type=types.ProfileParamType(), nargs=-1)

CALCULATION = OverridableArgument('calculation', type=types.CalculationParamType())

CALCULATIONS = OverridableArgument('calculations', nargs=-1, type=types.CalculationParamType())

CODE = OverridableArgument('code', type=types.CodeParamType())

CODES = OverridableArgument('codes', nargs=-1, type=types.CodeParamType())

COMPUTER = OverridableArgument('computer', type=types.ComputerParamType())

COMPUTERS = OverridableArgument('computers', nargs=-1, type=types.ComputerParamType())

DATUM = OverridableArgument('datum', type=types.DataParamType())

DATA = OverridableArgument('data', nargs=-1, type=types.DataParamType())

GROUP = OverridableArgument('group', type=types.GroupParamType())

GROUPS = OverridableArgument('groups', nargs=-1, type=types.GroupParamType())

NODE = OverridableArgument('node', type=types.NodeParamType())

NODES = OverridableArgument('nodes', nargs=-1, type=types.NodeParamType())

PROCESS = OverridableArgument('process', type=types.ProcessParamType())

PROCESSES = OverridableArgument('processes', nargs=-1, type=types.ProcessParamType())

WORKFLOW = OverridableArgument('workflow', type=types.WorkflowParamType())

WORKFLOWS = OverridableArgument('workflows', nargs=-1, type=types.WorkflowParamType())

INPUT_FILE = OverridableArgument('input_file', metavar='INPUT_FILE', type=click.Path(exists=True))

OUTPUT_FILE = OverridableArgument('output_file', metavar='OUTPUT_FILE', type=click.Path())

LABEL = OverridableArgument('label', type=click.STRING)

USER = OverridableArgument('user', metavar='USER', type=types.UserParamType())

CONFIG_OPTION = OverridableArgument('option', type=types.ConfigOptionParamType())
# yapf: enable
69 changes: 69 additions & 0 deletions aiida/cmdline/params/arguments/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
# yapf: disable
"""Module with pre-defined reusable commandline arguments that can be used as `click` decorators."""

import click

from .. import types
from .overridable import OverridableArgument

__all__ = (
'PROFILE', 'PROFILES', 'CALCULATION', 'CALCULATIONS', 'CODE', 'CODES', 'COMPUTER', 'COMPUTERS', 'DATUM', 'DATA',
'GROUP', 'GROUPS', 'NODE', 'NODES', 'PROCESS', 'PROCESSES', 'WORKFLOW', 'WORKFLOWS', 'INPUT_FILE', 'OUTPUT_FILE',
'LABEL', 'USER', 'CONFIG_OPTION'
)


PROFILE = OverridableArgument('profile', type=types.ProfileParamType())

PROFILES = OverridableArgument('profiles', type=types.ProfileParamType(), nargs=-1)

CALCULATION = OverridableArgument('calculation', type=types.CalculationParamType())

CALCULATIONS = OverridableArgument('calculations', nargs=-1, type=types.CalculationParamType())

CODE = OverridableArgument('code', type=types.CodeParamType())

CODES = OverridableArgument('codes', nargs=-1, type=types.CodeParamType())

COMPUTER = OverridableArgument('computer', type=types.ComputerParamType())

COMPUTERS = OverridableArgument('computers', nargs=-1, type=types.ComputerParamType())

DATUM = OverridableArgument('datum', type=types.DataParamType())

DATA = OverridableArgument('data', nargs=-1, type=types.DataParamType())

GROUP = OverridableArgument('group', type=types.GroupParamType())

GROUPS = OverridableArgument('groups', nargs=-1, type=types.GroupParamType())

NODE = OverridableArgument('node', type=types.NodeParamType())

NODES = OverridableArgument('nodes', nargs=-1, type=types.NodeParamType())

PROCESS = OverridableArgument('process', type=types.ProcessParamType())

PROCESSES = OverridableArgument('processes', nargs=-1, type=types.ProcessParamType())

WORKFLOW = OverridableArgument('workflow', type=types.WorkflowParamType())

WORKFLOWS = OverridableArgument('workflows', nargs=-1, type=types.WorkflowParamType())

INPUT_FILE = OverridableArgument('input_file', metavar='INPUT_FILE', type=click.Path(exists=True))

OUTPUT_FILE = OverridableArgument('output_file', metavar='OUTPUT_FILE', type=click.Path())

LABEL = OverridableArgument('label', type=click.STRING)

USER = OverridableArgument('user', metavar='USER', type=types.UserParamType())

CONFIG_OPTION = OverridableArgument('option', type=types.ConfigOptionParamType())
Loading