Skip to content

Commit cbb9a0e

Browse files
Comment out more validation and reference issue
1 parent d42d64f commit cbb9a0e

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

‎src/aiida/orm/nodes/data/code/abstract.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Model(Data.Model, defer_build=True):
102102
),
103103
)
104104

105-
# TODO the following fails serialization - rethink
105+
# TODO the following fails serialization - see https://github.com/aiidateam/aiida-core/issues/6821
106106
# @field_validator('label')
107107
# @classmethod
108108
# def validate_label_uniqueness(cls, value: str) -> str:

‎src/aiida/orm/nodes/data/code/installed.py‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import pathlib
2020

21-
from pydantic import field_serializer, field_validator
21+
from pydantic import field_serializer
2222

2323
from aiida.common import exceptions
2424
from aiida.common.lang import type_check
@@ -60,28 +60,30 @@ class Model(AbstractCode.Model):
6060
priority=1,
6161
)
6262

63-
@field_validator('label')
64-
@classmethod
65-
def validate_label_uniqueness(cls, value: str) -> str:
66-
"""Override the validator for the ``label`` of the base class since uniqueness is defined on full label."""
67-
return value
63+
# @field_validator('label')
64+
# @classmethod
65+
# def validate_label_uniqueness(cls, value: str) -> str:
66+
# """Override the validator for the ``label`` of the base class since uniqueness is defined on full label.
67+
# """
68+
# return value
6869

69-
@field_validator('computer')
70-
@classmethod
71-
def validate_computer(cls, value: str) -> Computer:
72-
"""Override the validator for the ``label`` of the base class since uniqueness is defined on full label."""
73-
from aiida.orm import load_computer
70+
# @field_validator('computer')
71+
# @classmethod
72+
# def validate_computer(cls, value: str) -> Computer:
73+
# """Override the validator for the ``label`` of the base class since uniqueness is defined on full label.
74+
# """
75+
# from aiida.orm import load_computer
7476

75-
try:
76-
return load_computer(value)
77-
except exceptions.NotExistent as exception:
78-
raise ValueError(exception) from exception
77+
# try:
78+
# return load_computer(value)
79+
# except exceptions.NotExistent as exception:
80+
# raise ValueError(exception) from exception
7981

8082
@field_serializer('computer')
8183
def serialize_computer(self, computer: Computer, _info):
8284
return computer.label
8385

84-
# TODO the following fails serialization - rethink
86+
# TODO the following fails serialization - see https://github.com/aiidateam/aiida-core/issues/6821
8587
# @model_validator(mode='after') # type: ignore[misc]
8688
# def validate_full_label_uniqueness(self) -> AbstractCode.Model:
8789
# """Validate that the full label does not already exist."""

‎src/aiida/orm/nodes/data/code/portable.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Model(AbstractCode.Model):
7171
def validate_filepath_files(cls, value: str) -> pathlib.Path:
7272
"""Validate that ``filepath_files`` is an existing directory."""
7373
filepath = pathlib.Path(value)
74-
# TODO the following fails serialization - rethink
74+
# TODO the following fails serialization - see https://github.com/aiidateam/aiida-core/issues/6821
7575
# if not filepath.exists():
7676
# raise ValueError(f'The filepath `{value}` does not exist.')
7777
# if not filepath.is_dir():

0 commit comments

Comments
 (0)