Provides all parameter types.
aiida.cmdline.params.types.
AbsolutePathParamType
Bases: click.types.Path
click.types.Path
The ParamType for identifying absolute Paths (derived from click.Path).
__module__
__repr__
Return repr(self).
convert
Converts the value. This is not invoked for values that are None (the missing value).
name
CalculationParamType
Bases: aiida.cmdline.params.types.identifier.IdentifierParamType
aiida.cmdline.params.types.identifier.IdentifierParamType
The ParamType for identifying Calculation entities or its subclasses
__abstractmethods__
_abc_impl
orm_class_loader
Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier
the orm entity loader class for this ParamType
CodeParamType
The ParamType for identifying Code entities or its subclasses
__init__
Construct the param type
sub_classes – specify a tuple of Code sub classes to narrow the query set
entry_point – specify an optional calculation entry point that the Code’s input plugin should match
complete
Return possible completions based on an incomplete value.
list of tuples of valid entry points (matching incomplete) and a description
Attempt to convert the given value to an instance of the orm class using the orm class loader.
the loaded orm entity
click.BadParameter – if the value is ambiguous and leads to multiple entities
click.BadParameter – if the value cannot be mapped onto any existing instance
RuntimeError – if the defined orm class loader is not a subclass of the OrmEntityLoader class
ComputerParamType
The ParamType for identifying Computer entities or its subclasses
__slotnames__
ConfigOptionParamType
Bases: click.types.StringParamType
click.types.StringParamType
ParamType for configuration options.
Return possible completions based on an incomplete value
DataParamType
The ParamType for identifying Data entities or its subclasses
FileOrUrl
Bases: click.types.File
click.types.File
Extension of click’s File-type to include URLs.
Returns handle either to local file or to remote file fetched from URL.
timeout_seconds (int) – Maximum timeout accepted for URL response. Must be an integer in the range [0;60].
Initialize self. See help(type(self)) for accurate signature.
Return file handle.
get_url
Retrieve file from URL.
GroupParamType
The ParamType for identifying Group entities or its subclasses.
Construct the parameter type.
The sub_classes argument can be used to narrow the set of subclasses of Group that should be matched. By default all subclasses of Group will be matched, otherwise it is restricted to the subclasses that correspond to the entry point names in the tuple of sub_classes.
To prevent having to load the database environment at import time, the actual loading of the entry points is deferred until the call to convert is made. This is to keep the command line autocompletion light and responsive. The entry point strings will be validated, however, to see if they correspond to known entry points.
create_if_not_exist – boolean, if True, will create the group if it does not yet exist. By default the group created will be of class Group, unless another subclass is specified through sub_classes. Note that in this case, only a single entry point name can be specified
sub_classes – a tuple of entry point strings from the aiida.groups entry point group.
Return the orm entity loader class, which should be a subclass of OrmEntityLoader.
This class is supposed to be used to load the entity for a given identifier.
IdentifierParamType
Bases: click.types.ParamType, abc.ABC
click.types.ParamType
abc.ABC
An extension of click.ParamType for a generic identifier parameter. In AiiDA, orm entities can often be identified by either their ID, UUID or optionally some LABEL identifier. This parameter type implements the convert method, which attempts to convert a value passed to the command for a parameter with this type, to an orm entity. The actual loading of the entity is delegated to the orm class loader. Subclasses of this parameter type should implement the orm_class_loader method to return the appropriate orm class loader, which should be a subclass of aiida.orm.utils.loaders.OrmEntityLoader for the corresponding orm class.
Construct the parameter type, optionally specifying a tuple of entry points that reference classes that should be a sub class of the base orm class of the orm class loader. The classes pointed to by these entry points will be passed to the OrmEntityLoader when converting an identifier and they will restrict the query set by demanding that the class of the corresponding entity matches these sub classes.
To prevent having to load the database environment at import time, the actual loading of the entry points is deferred until the call to convert is made. This is to keep the command line autocompletion light and responsive. The entry point strings will be validated, however, to see if the correspond to known entry points.
sub_classes – a tuple of entry point strings that can narrow the set of orm classes that values will be mapped upon. These classes have to be strict sub classes of the base orm class defined by the orm class loader
LazyChoice
Bases: click.types.ParamType
This is a delegate of click’s Choice ParamType that evaluates the set of choices lazily. This is useful if the choices set requires an import that is slow. Using the vanilla click.Choice will call this on import which will slow down verdi and its autocomplete. This type will generate the choices set lazily through the choices property
_click_choice
Get the internal click Choice object that we delegate functionality to. Will construct it lazily if necessary.
The click Choice
click.Choice
choices
get_metavar
Returns the metavar default for this param if it provides one.
get_missing_message
Optionally might return extra information about a missing parameter.
New in version 2.0.
MpirunCommandParamType
Custom click param type for mpirun-command
Note
requires also a scheduler to be provided, and the scheduler must be called first!
Validate that the provided ‘mpirun’ command only contains replacement fields (e.g. {tot_num_mpiprocs}) that are known.
{tot_num_mpiprocs}
Return a list of arguments (by using ‘value.strip().split(” “) on the input string)
MultipleValueParamType
An extension of click.ParamType that can parse multiple values for a given ParamType
NodeParamType
The ParamType for identifying Node entities or its subclasses
NonEmptyStringParamType
Parameter whose values have to be string and non-empty.
PathOrUrl
Extension of click’s Path-type to include URLs.
A PathOrUrl can either be a click.Path-type or a URL.
checks_url
Check whether URL is reachable within timeout.
Overwrite convert Check first if click.Path-type, then check if URL.
PluginParamType
Bases: aiida.cmdline.params.types.strings.EntryPointType
aiida.cmdline.params.types.strings.EntryPointType
AiiDA Plugin name parameter type.
group – string or tuple of strings, where each is a valid entry point group. Adding the aiida. prefix is optional. If it is not detected it will be prepended internally.
load – when set to True, convert will not return the entry point, but the loaded entry point
Usage:
click.option(... type=PluginParamType(group='aiida.calculations')
or:
click.option(... type=PluginParamType(group=('calculations', 'data'))
Validate that group is either a string or a tuple of valid entry point groups, or if it is not specified use the tuple of all recognized entry point groups.
_init_entry_points
Populate entry point information that will be used later on. This should only be called once in the constructor after setting self.groups because the groups should not be changed after instantiation
Convert the string value to an entry point instance, if the value can be successfully parsed into an actual entry point. Will raise click.BadParameter if validation fails.
get_entry_point_from_string
Validate a given entry point string, which means that it should have a valid entry point string format and that the entry point unambiguously corresponds to an entry point in the groups configured for this instance of PluginParameterType.
the entry point if valid
ValueError if the entry point string is invalid
get_possibilities
Return a list of plugins starting with incomplete
get_valid_arguments
Return a list of all available plugins for the groups configured for this PluginParamType instance. If the entry point names are not unique, because there are multiple groups that contain an entry point that has an identical name, we need to prefix the names with the full group name
list of valid entry point strings
groups
has_potential_ambiguity
Returns whether the set of supported entry point groups can lead to ambiguity when only an entry point name is specified. This will happen if one ore more groups share an entry point with a common name
ProcessParamType
The ParamType for identifying ProcessNode entities or its subclasses
ProfileParamType
Bases: aiida.cmdline.params.types.strings.LabelStringType
aiida.cmdline.params.types.strings.LabelStringType
The profile parameter type for click.
Attempt to match the given value to a valid profile.
deconvert_default
ShebangParamType
Custom click param type for shebang line
TestModuleParamType
Parameter type to represent a unittest module.
Defunct - remove when removing the “verdi devel tests” command.
UserParamType
The user parameter type for click. Can get or create a user.
create – If the user does not exist, create a new instance (unstored).
WorkflowParamType
The ParamType for identifying WorkflowNode entities or its subclasses
Module for the calculation parameter type
aiida.cmdline.params.types.calculation.
A custom click type that defines a lazy choice
aiida.cmdline.params.types.choice.
Module to define the custom click type for code.
aiida.cmdline.params.types.code.
Module for the custom click param type computer
aiida.cmdline.params.types.computer.
aiida.cmdline.params.types.config.
Module for the custom click param type for data
aiida.cmdline.params.types.data.
Module for custom click param type group.
aiida.cmdline.params.types.group.
Module for custom click param type identifier
aiida.cmdline.params.types.identifier.
Module to define custom click param type for multiple values
aiida.cmdline.params.types.multiple.
Module to define the custom click param type for node
aiida.cmdline.params.types.node.
Click parameter types for paths.
aiida.cmdline.params.types.path.
AbsolutePathOrEmptyParamType
Bases: aiida.cmdline.params.types.path.AbsolutePathParamType
aiida.cmdline.params.types.path.AbsolutePathParamType
The ParamType for identifying absolute Paths, accepting also empty paths.
_check_timeout_seconds
Raise if timeout is not within range [0;60]
Click parameter type for AiiDA Plugins.
aiida.cmdline.params.types.plugin.
Module for the process node parameter type
aiida.cmdline.params.types.process.
Profile param type for click.
aiida.cmdline.params.types.profile.
Module for various text-based string validation.
aiida.cmdline.params.types.strings.
EmailType
Parameter whose values have to correspond to a valid email address format.
For the moment, we do not require the domain suffix, i.e. ‘aiida@localhost’ is still valid.
EntryPointType
Bases: aiida.cmdline.params.types.strings.NonEmptyStringParamType
aiida.cmdline.params.types.strings.NonEmptyStringParamType
Parameter whose values have to be valid Python entry point strings.
See https://packaging.python.org/specifications/entry-points/
HostnameType
Parameter corresponding to a valid hostname (or empty) string.
Regex according to https://stackoverflow.com/a/3824105/1069467
LabelStringType
Parameter accepting valid label strings.
Non-empty string, made up of word characters (includes underscores [1]), dashes, and dots.
[1] See https://docs.python.org/3/library/re.html
ALPHABET
Test module parameter type for click.
aiida.cmdline.params.types.test_module.
User param type for click.
aiida.cmdline.params.types.user.
Module for the workflow parameter type
aiida.cmdline.params.types.workflow.