From aec4a35702ceff6d70cb95e36effd05b60f817df Mon Sep 17 00:00:00 2001 From: Sebastiaan Huber Date: Wed, 20 Mar 2024 15:51:20 +0100 Subject: [PATCH] Add `exclude_from_cli` field metadata key --- src/aiida/cmdline/commands/cmd_code.py | 4 +- src/aiida/cmdline/commands/cmd_profile.py | 4 +- src/aiida/cmdline/groups/dynamic.py | 17 ++++---- src/aiida/common/pydantic.py | 4 ++ src/aiida/orm/entities.py | 1 + src/aiida/orm/nodes/data/data.py | 4 +- src/aiida/orm/nodes/node.py | 39 +++++++++++++++---- ...fields_aiida.data.core.array.ArrayData.yml | 2 +- ..._aiida.data.core.array.bands.BandsData.yml | 2 +- ...da.data.core.array.kpoints.KpointsData.yml | 2 +- ...a.core.array.projection.ProjectionData.yml | 2 +- ...a.core.array.trajectory.TrajectoryData.yml | 2 +- ...fields_aiida.data.core.array.xy.XyData.yml | 2 +- .../fields_aiida.data.core.base.BaseType.yml | 2 +- .../fields_aiida.data.core.bool.Bool.yml | 2 +- .../fields_aiida.data.core.cif.CifData.yml | 2 +- .../fields_aiida.data.core.code.Code.yml | 2 +- ...e.code.containerized.ContainerizedCode.yml | 2 +- ...data.core.code.installed.InstalledCode.yml | 2 +- ...a.data.core.code.portable.PortableCode.yml | 2 +- .../fields_aiida.data.core.dict.Dict.yml | 2 +- .../fields_aiida.data.core.enum.EnumData.yml | 2 +- .../fields_aiida.data.core.float.Float.yml | 2 +- ...elds_aiida.data.core.folder.FolderData.yml | 2 +- .../fields_aiida.data.core.int.Int.yml | 2 +- ..._aiida.data.core.jsonable.JsonableData.yml | 2 +- .../fields_aiida.data.core.list.List.yml | 2 +- ...ds_aiida.data.core.numeric.NumericType.yml | 2 +- ...ds_aiida.data.core.orbital.OrbitalData.yml | 2 +- ...elds_aiida.data.core.remote.RemoteData.yml | 2 +- ...data.core.remote.stash.RemoteStashData.yml | 2 +- ...ote.stash.folder.RemoteStashFolderData.yml | 2 +- ...da.data.core.singlefile.SinglefileData.yml | 2 +- .../fields_aiida.data.core.str.Str.yml | 2 +- ...iida.data.core.structure.StructureData.yml | 2 +- .../fields_aiida.data.core.upf.UpfData.yml | 2 +- .../fields_aiida.node.data.Data.yml | 2 +- .../fields_aiida.node.process.ProcessNode.yml | 2 +- ...de.process.calculation.CalculationNode.yml | 2 +- ...culation.calcfunction.CalcFunctionNode.yml | 2 +- ...rocess.calculation.calcjob.CalcJobNode.yml | 2 +- ...ida.node.process.workflow.WorkflowNode.yml | 2 +- ...ocess.workflow.workchain.WorkChainNode.yml | 2 +- ...workflow.workfunction.WorkFunctionNode.yml | 2 +- 44 files changed, 86 insertions(+), 61 deletions(-) diff --git a/src/aiida/cmdline/commands/cmd_code.py b/src/aiida/cmdline/commands/cmd_code.py index f6365f5e34..ffb9df371d 100644 --- a/src/aiida/cmdline/commands/cmd_code.py +++ b/src/aiida/cmdline/commands/cmd_code.py @@ -26,10 +26,10 @@ def verdi_code(): """Setup and manage codes.""" -def create_code(ctx: click.Context, cls, non_interactive: bool, **kwargs): +def create_code(ctx: click.Context, cls, **kwargs): """Create a new `Code` instance.""" try: - instance = cls(**kwargs) + instance = cls.from_model(cls.Model(**kwargs)) except (TypeError, ValueError) as exception: echo.echo_critical(f'Failed to create instance `{cls}`: {exception}') diff --git a/src/aiida/cmdline/commands/cmd_profile.py b/src/aiida/cmdline/commands/cmd_profile.py index 8be4ed3bbf..639438c58f 100644 --- a/src/aiida/cmdline/commands/cmd_profile.py +++ b/src/aiida/cmdline/commands/cmd_profile.py @@ -25,9 +25,7 @@ def verdi_profile(): """Inspect and manage the configured profiles.""" -def command_create_profile( - ctx: click.Context, storage_cls, non_interactive: bool, profile: Profile, set_as_default: bool = True, **kwargs -): +def command_create_profile(ctx: click.Context, storage_cls, profile: Profile, set_as_default: bool = True, **kwargs): """Create a new profile, initialise its storage and create a default user. :param ctx: The context of the CLI command. diff --git a/src/aiida/cmdline/groups/dynamic.py b/src/aiida/cmdline/groups/dynamic.py index 35b5f206b7..4337c3b188 100644 --- a/src/aiida/cmdline/groups/dynamic.py +++ b/src/aiida/cmdline/groups/dynamic.py @@ -88,29 +88,25 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> click.Command | None command = super().get_command(ctx, cmd_name) return command - def call_command(self, ctx, cls, **kwargs): + def call_command(self, ctx, cls, non_interactive, **kwargs): """Call the ``command`` after validating the provided inputs.""" from pydantic import ValidationError if hasattr(cls, 'Model'): # The plugin defines a pydantic model: use it to validate the provided arguments try: - model = cls.Model(**kwargs) + cls.Model(**kwargs) except ValidationError as exception: param_hint = [ f'--{loc.replace("_", "-")}' # type: ignore[union-attr] for loc in exception.errors()[0]['loc'] ] - message = '\n'.join([str(e['ctx']['error']) for e in exception.errors()]) + message = '\n'.join([str(e['msg']) for e in exception.errors()]) raise click.BadParameter( message, - param_hint=param_hint or 'multiple parameters', # type: ignore[arg-type] + param_hint=param_hint or 'one or more parameters', # type: ignore[arg-type] ) from exception - # Update the arguments with the dictionary representation of the model. This will include any type coercions - # that may have been applied with validators defined for the model. - kwargs.update(**model.model_dump()) - return self._command(ctx, cls, **kwargs) def create_command(self, ctx: click.Context, entry_point: str) -> click.Command: @@ -154,6 +150,8 @@ def list_options(self, entry_point: str) -> list: """ from pydantic_core import PydanticUndefined + from aiida.common.pydantic import get_metadata + cls = self.factory(entry_point) if not hasattr(cls, 'Model'): @@ -170,6 +168,9 @@ def list_options(self, entry_point: str) -> list: options_spec = {} for key, field_info in cls.Model.model_fields.items(): + if get_metadata(field_info, 'exclude_from_cli'): + continue + default = field_info.default_factory if field_info.default is PydanticUndefined else field_info.default # If the annotation has the ``__args__`` attribute it is an instance of a type from ``typing`` and the real diff --git a/src/aiida/common/pydantic.py b/src/aiida/common/pydantic.py index 135e86b68b..6b03464a05 100644 --- a/src/aiida/common/pydantic.py +++ b/src/aiida/common/pydantic.py @@ -36,6 +36,7 @@ def MetadataField( # noqa: N802 orm_to_model: t.Callable[['Entity'], t.Any] | None = None, model_to_orm: t.Callable[['BaseModel'], t.Any] | None = None, exclude_to_orm: bool = False, + exclude_from_cli: bool = False, is_attribute: bool = True, is_subscriptable: bool = False, **kwargs, @@ -72,6 +73,8 @@ class Model(BaseModel): :param model_to_orm: Optional callable to convert the value of a field from a model instance to an ORM instance. :param exclude_to_orm: When set to ``True``, this field value will not be passed to the ORM entity constructor through ``Entity.from_model``. + :param exclude_to_orm: When set to ``True``, this field value will not be exposed on the CLI command that is + dynamically generated to create a new instance. :param is_attribute: Whether the field is stored as an attribute. :param is_subscriptable: Whether the field can be indexed like a list or dictionary. """ @@ -85,6 +88,7 @@ class Model(BaseModel): ('orm_to_model', orm_to_model), ('model_to_orm', model_to_orm), ('exclude_to_orm', exclude_to_orm), + ('exclude_from_cli', exclude_from_cli), ('is_attribute', is_attribute), ('is_subscriptable', is_subscriptable), ): diff --git a/src/aiida/orm/entities.py b/src/aiida/orm/entities.py index 8dd407f37c..1213667bc2 100644 --- a/src/aiida/orm/entities.py +++ b/src/aiida/orm/entities.py @@ -183,6 +183,7 @@ class Model(BaseModel): description='The primary key of the entity. Can be `None` if the entity is not yet stored.', is_attribute=False, exclude_to_orm=True, + exclude_from_cli=True, ) @classmethod diff --git a/src/aiida/orm/nodes/data/data.py b/src/aiida/orm/nodes/data/data.py index 167baeef4b..defdf60eb1 100644 --- a/src/aiida/orm/nodes/data/data.py +++ b/src/aiida/orm/nodes/data/data.py @@ -47,9 +47,7 @@ class Data(Node): class Model(Node.Model): source: Optional[dict] = MetadataField( - None, - description='Source of the data.', - is_subscriptable=True, + None, description='Source of the data.', is_subscriptable=True, exclude_from_cli=True ) def __init__(self, *args, source=None, **kwargs): diff --git a/src/aiida/orm/nodes/node.py b/src/aiida/orm/nodes/node.py index fafd9944c0..201d5eb029 100644 --- a/src/aiida/orm/nodes/node.py +++ b/src/aiida/orm/nodes/node.py @@ -188,13 +188,17 @@ def _query_type_string(cls) -> str: # noqa: N805 class Model(Entity.Model): uuid: Optional[str] = MetadataField( - None, description='The UUID of the node', is_attribute=False, exclude_to_orm=True + None, description='The UUID of the node', is_attribute=False, exclude_to_orm=True, exclude_from_cli=True ) node_type: Optional[str] = MetadataField( - None, description='The type of the node', is_attribute=False, exclude_to_orm=True + None, description='The type of the node', is_attribute=False, exclude_to_orm=True, exclude_from_cli=True ) process_type: Optional[str] = MetadataField( - None, description='The process type of the node', is_attribute=False, exclude_to_orm=True + None, + description='The process type of the node', + is_attribute=False, + exclude_to_orm=True, + exclude_from_cli=True, ) repository_metadata: Optional[Dict[str, Any]] = MetadataField( None, @@ -202,21 +206,35 @@ class Model(Entity.Model): is_attribute=False, orm_to_model=lambda node: node.base.repository.metadata, # type: ignore[attr-defined] exclude_to_orm=True, + exclude_from_cli=True, ) ctime: Optional[datetime.datetime] = MetadataField( - None, description='The creation time of the node', is_attribute=False, exclude_to_orm=True + None, + description='The creation time of the node', + is_attribute=False, + exclude_to_orm=True, + exclude_from_cli=True, ) mtime: Optional[datetime.datetime] = MetadataField( - None, description='The modification time of the node', is_attribute=False, exclude_to_orm=True + None, + description='The modification time of the node', + is_attribute=False, + exclude_to_orm=True, + exclude_from_cli=True, + ) + label: Optional[str] = MetadataField( + None, description='The node label', is_attribute=False, exclude_from_cli=True + ) + description: Optional[str] = MetadataField( + None, description='The node description', is_attribute=False, exclude_from_cli=True ) - label: Optional[str] = MetadataField(None, description='The node label', is_attribute=False) - description: Optional[str] = MetadataField(None, description='The node description', is_attribute=False) attributes: Optional[Dict[str, Any]] = MetadataField( None, description='The node attributes', is_attribute=False, orm_to_model=lambda node: node.base.attributes.all, # type: ignore[attr-defined] is_subscriptable=True, + exclude_from_cli=True, ) extras: Optional[Dict[str, Any]] = MetadataField( None, @@ -224,6 +242,7 @@ class Model(Entity.Model): is_attribute=False, orm_to_model=lambda node: node.base.extras.all, # type: ignore[attr-defined] is_subscriptable=True, + exclude_from_cli=True, ) computer: Optional[int] = MetadataField( None, @@ -231,12 +250,15 @@ class Model(Entity.Model): is_attribute=False, orm_to_model=lambda node: node.computer.pk if node.computer else None, # type: ignore[attr-defined] orm_class=Computer, + exclude_from_cli=True, ) - user: int = MetadataField( + user: Optional[int] = MetadataField( + None, description='The PK of the user who owns the node', is_attribute=False, orm_to_model=lambda node: node.user.pk, # type: ignore[attr-defined] orm_class=User, + exclude_from_cli=True, ) repository_content: Optional[dict[str, bytes]] = MetadataField( None, @@ -247,6 +269,7 @@ class Model(Entity.Model): key: base64.encodebytes(content) for key, content in node.base.repository.serialize_content().items() # type: ignore[attr-defined] }, + exclude_from_cli=True, ) def __init__( diff --git a/tests/orm/test_fields/fields_aiida.data.core.array.ArrayData.yml b/tests/orm/test_fields/fields_aiida.data.core.array.ArrayData.yml index 76d78e22dd..422f99cf93 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.array.ArrayData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.array.ArrayData.yml @@ -16,5 +16,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.array.bands.BandsData.yml b/tests/orm/test_fields/fields_aiida.data.core.array.bands.BandsData.yml index 80ba91f4ba..8b37200153 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.array.bands.BandsData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.array.bands.BandsData.yml @@ -26,5 +26,5 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) units: QbStrField('units', dtype=str, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.array.kpoints.KpointsData.yml b/tests/orm/test_fields/fields_aiida.data.core.array.kpoints.KpointsData.yml index 29853a5355..834f07337b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.array.kpoints.KpointsData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.array.kpoints.KpointsData.yml @@ -24,5 +24,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.array.projection.ProjectionData.yml b/tests/orm/test_fields/fields_aiida.data.core.array.projection.ProjectionData.yml index 1110ae27bd..10b5383d86 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.array.projection.ProjectionData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.array.projection.ProjectionData.yml @@ -14,5 +14,5 @@ process_type: QbStrField('process_type', dtype=Optional[str], is_attribute=False repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.array.trajectory.TrajectoryData.yml b/tests/orm/test_fields/fields_aiida.data.core.array.trajectory.TrajectoryData.yml index 0da9c09777..bdbb9bf6ab 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.array.trajectory.TrajectoryData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.array.trajectory.TrajectoryData.yml @@ -19,5 +19,5 @@ source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscr symbols: QbArrayField('symbols', dtype=List[str], is_attribute=True) units_positions: QbStrField('units_positions', dtype=str, is_attribute=True) units_times: QbStrField('units_times', dtype=str, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.array.xy.XyData.yml b/tests/orm/test_fields/fields_aiida.data.core.array.xy.XyData.yml index 1110ae27bd..10b5383d86 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.array.xy.XyData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.array.xy.XyData.yml @@ -14,5 +14,5 @@ process_type: QbStrField('process_type', dtype=Optional[str], is_attribute=False repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.base.BaseType.yml b/tests/orm/test_fields/fields_aiida.data.core.base.BaseType.yml index 1b49956377..4f2f318f8b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.base.BaseType.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.base.BaseType.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbField('value', dtype=Any, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.bool.Bool.yml b/tests/orm/test_fields/fields_aiida.data.core.bool.Bool.yml index 1b49956377..4f2f318f8b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.bool.Bool.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.bool.Bool.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbField('value', dtype=Any, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.cif.CifData.yml b/tests/orm/test_fields/fields_aiida.data.core.cif.CifData.yml index c59e0ba3dc..d0ae9ad39c 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.cif.CifData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.cif.CifData.yml @@ -21,5 +21,5 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) spacegroup_numbers: QbArrayField('spacegroup_numbers', dtype=Optional[List[str]], is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.code.Code.yml b/tests/orm/test_fields/fields_aiida.data.core.code.Code.yml index 4028ca8572..d3babc823b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.code.Code.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.code.Code.yml @@ -24,6 +24,6 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) use_double_quotes: QbField('use_double_quotes', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) with_mpi: QbField('with_mpi', dtype=Optional[bool], is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.code.containerized.ContainerizedCode.yml b/tests/orm/test_fields/fields_aiida.data.core.code.containerized.ContainerizedCode.yml index 417b3d82fd..040a5894f7 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.code.containerized.ContainerizedCode.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.code.containerized.ContainerizedCode.yml @@ -23,7 +23,7 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) use_double_quotes: QbField('use_double_quotes', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) with_mpi: QbField('with_mpi', dtype=Optional[bool], is_attribute=True) wrap_cmdline_params: QbField('wrap_cmdline_params', dtype=bool, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.code.installed.InstalledCode.yml b/tests/orm/test_fields/fields_aiida.data.core.code.installed.InstalledCode.yml index 0c3b41c723..5786fe0d48 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.code.installed.InstalledCode.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.code.installed.InstalledCode.yml @@ -21,6 +21,6 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) use_double_quotes: QbField('use_double_quotes', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) with_mpi: QbField('with_mpi', dtype=Optional[bool], is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.code.portable.PortableCode.yml b/tests/orm/test_fields/fields_aiida.data.core.code.portable.PortableCode.yml index 36aaee198b..d795e93289 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.code.portable.PortableCode.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.code.portable.PortableCode.yml @@ -22,6 +22,6 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) use_double_quotes: QbField('use_double_quotes', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) with_mpi: QbField('with_mpi', dtype=Optional[bool], is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.dict.Dict.yml b/tests/orm/test_fields/fields_aiida.data.core.dict.Dict.yml index 3901957556..14c60eda2d 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.dict.Dict.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.dict.Dict.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbDictField('value', dtype=Dict[str, Any], is_attribute=False, is_subscriptable=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.enum.EnumData.yml b/tests/orm/test_fields/fields_aiida.data.core.enum.EnumData.yml index 19813b7614..f6d117c54d 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.enum.EnumData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.enum.EnumData.yml @@ -16,5 +16,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.float.Float.yml b/tests/orm/test_fields/fields_aiida.data.core.float.Float.yml index 1b49956377..4f2f318f8b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.float.Float.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.float.Float.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbField('value', dtype=Any, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.folder.FolderData.yml b/tests/orm/test_fields/fields_aiida.data.core.folder.FolderData.yml index bbcbafa9e8..0d111f5076 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.folder.FolderData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.folder.FolderData.yml @@ -15,5 +15,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.int.Int.yml b/tests/orm/test_fields/fields_aiida.data.core.int.Int.yml index 1b49956377..4f2f318f8b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.int.Int.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.int.Int.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbField('value', dtype=Any, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.jsonable.JsonableData.yml b/tests/orm/test_fields/fields_aiida.data.core.jsonable.JsonableData.yml index 3ac5d4eb04..a9079bdb54 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.jsonable.JsonableData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.jsonable.JsonableData.yml @@ -16,5 +16,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.list.List.yml b/tests/orm/test_fields/fields_aiida.data.core.list.List.yml index a33167db9f..88fb4d65f5 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.list.List.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.list.List.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbArrayField('value', dtype=List[Any], is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.numeric.NumericType.yml b/tests/orm/test_fields/fields_aiida.data.core.numeric.NumericType.yml index 1b49956377..4f2f318f8b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.numeric.NumericType.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.numeric.NumericType.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbField('value', dtype=Any, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.orbital.OrbitalData.yml b/tests/orm/test_fields/fields_aiida.data.core.orbital.OrbitalData.yml index bbcbafa9e8..0d111f5076 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.orbital.OrbitalData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.orbital.OrbitalData.yml @@ -15,5 +15,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.remote.RemoteData.yml b/tests/orm/test_fields/fields_aiida.data.core.remote.RemoteData.yml index 59e126ec25..f867452b23 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.remote.RemoteData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.remote.RemoteData.yml @@ -16,5 +16,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.remote.stash.RemoteStashData.yml b/tests/orm/test_fields/fields_aiida.data.core.remote.stash.RemoteStashData.yml index 77d56517f7..a8f7ac7853 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.remote.stash.RemoteStashData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.remote.stash.RemoteStashData.yml @@ -16,5 +16,5 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) stash_mode: QbField('stash_mode', dtype=StashMode, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.remote.stash.folder.RemoteStashFolderData.yml b/tests/orm/test_fields/fields_aiida.data.core.remote.stash.folder.RemoteStashFolderData.yml index 592d626921..a4e4e382a7 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.remote.stash.folder.RemoteStashFolderData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.remote.stash.folder.RemoteStashFolderData.yml @@ -18,5 +18,5 @@ source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscr source_list: QbArrayField('source_list', dtype=List[str], is_attribute=True) stash_mode: QbField('stash_mode', dtype=StashMode, is_attribute=True) target_basepath: QbStrField('target_basepath', dtype=str, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.singlefile.SinglefileData.yml b/tests/orm/test_fields/fields_aiida.data.core.singlefile.SinglefileData.yml index 2d696b83e1..a197fbf30f 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.singlefile.SinglefileData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.singlefile.SinglefileData.yml @@ -17,5 +17,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.str.Str.yml b/tests/orm/test_fields/fields_aiida.data.core.str.Str.yml index 1b49956377..4f2f318f8b 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.str.Str.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.str.Str.yml @@ -15,6 +15,6 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) value: QbField('value', dtype=Any, is_attribute=True) diff --git a/tests/orm/test_fields/fields_aiida.data.core.structure.StructureData.yml b/tests/orm/test_fields/fields_aiida.data.core.structure.StructureData.yml index 2c912b8c6c..67b28c814d 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.structure.StructureData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.structure.StructureData.yml @@ -21,5 +21,5 @@ repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, is_attribute=False) sites: QbArrayField('sites', dtype=Optional[List[dict]], is_attribute=True) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.data.core.upf.UpfData.yml b/tests/orm/test_fields/fields_aiida.data.core.upf.UpfData.yml index 0475339826..91482ff6c2 100644 --- a/tests/orm/test_fields/fields_aiida.data.core.upf.UpfData.yml +++ b/tests/orm/test_fields/fields_aiida.data.core.upf.UpfData.yml @@ -15,5 +15,5 @@ process_type: QbStrField('process_type', dtype=Optional[str], is_attribute=False repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.data.Data.yml b/tests/orm/test_fields/fields_aiida.node.data.Data.yml index bbcbafa9e8..0d111f5076 100644 --- a/tests/orm/test_fields/fields_aiida.node.data.Data.yml +++ b/tests/orm/test_fields/fields_aiida.node.data.Data.yml @@ -15,5 +15,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) source: QbDictField('source', dtype=Optional[dict], is_attribute=True, is_subscriptable=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.ProcessNode.yml b/tests/orm/test_fields/fields_aiida.node.process.ProcessNode.yml index 4efe2add7d..cd69b8fb40 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.ProcessNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.ProcessNode.yml @@ -22,5 +22,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) sealed: QbField('sealed', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.calculation.CalculationNode.yml b/tests/orm/test_fields/fields_aiida.node.process.calculation.CalculationNode.yml index 4efe2add7d..cd69b8fb40 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.calculation.CalculationNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.calculation.CalculationNode.yml @@ -22,5 +22,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) sealed: QbField('sealed', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.calculation.calcfunction.CalcFunctionNode.yml b/tests/orm/test_fields/fields_aiida.node.process.calculation.calcfunction.CalcFunctionNode.yml index 4efe2add7d..cd69b8fb40 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.calculation.calcfunction.CalcFunctionNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.calculation.calcfunction.CalcFunctionNode.yml @@ -22,5 +22,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) sealed: QbField('sealed', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.calculation.calcjob.CalcJobNode.yml b/tests/orm/test_fields/fields_aiida.node.process.calculation.calcjob.CalcJobNode.yml index 025447edc5..a32083b1ff 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.calculation.calcjob.CalcJobNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.calculation.calcjob.CalcJobNode.yml @@ -34,5 +34,5 @@ scheduler_lastchecktime: QbStrField('scheduler_lastchecktime', dtype=Optional[st scheduler_state: QbStrField('scheduler_state', dtype=Optional[str], is_attribute=True) sealed: QbField('sealed', dtype=bool, is_attribute=True) state: QbStrField('state', dtype=Optional[str], is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.workflow.WorkflowNode.yml b/tests/orm/test_fields/fields_aiida.node.process.workflow.WorkflowNode.yml index 4efe2add7d..cd69b8fb40 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.workflow.WorkflowNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.workflow.WorkflowNode.yml @@ -22,5 +22,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) sealed: QbField('sealed', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.workflow.workchain.WorkChainNode.yml b/tests/orm/test_fields/fields_aiida.node.process.workflow.workchain.WorkChainNode.yml index 4efe2add7d..cd69b8fb40 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.workflow.workchain.WorkChainNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.workflow.workchain.WorkChainNode.yml @@ -22,5 +22,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) sealed: QbField('sealed', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False) diff --git a/tests/orm/test_fields/fields_aiida.node.process.workflow.workfunction.WorkFunctionNode.yml b/tests/orm/test_fields/fields_aiida.node.process.workflow.workfunction.WorkFunctionNode.yml index 4efe2add7d..cd69b8fb40 100644 --- a/tests/orm/test_fields/fields_aiida.node.process.workflow.workfunction.WorkFunctionNode.yml +++ b/tests/orm/test_fields/fields_aiida.node.process.workflow.workfunction.WorkFunctionNode.yml @@ -22,5 +22,5 @@ repository_content: QbDictField('repository_content', dtype=Optional[dict[str, b repository_metadata: QbDictField('repository_metadata', dtype=Optional[Dict[str, Any]], is_attribute=False) sealed: QbField('sealed', dtype=bool, is_attribute=True) -user: QbNumericField('user', dtype=int, is_attribute=False) +user: QbNumericField('user', dtype=Optional[int], is_attribute=False) uuid: QbStrField('uuid', dtype=Optional[str], is_attribute=False)