Skip to content

Commit fd7706a

Browse files
committed
turning label into a property
1 parent fe14ad0 commit fd7706a

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/aind_data_schema/data_description.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DataRegex(Enum):
3636
f"{RegexParts.DATE.value})_(?P<c_time>{RegexParts.TIME.value})$"
3737
)
3838
NO_UNDERSCORES = "^[^_]+$"
39-
NO_SPECIAL_CHARS = "^[^<>:;\"/|? \\_]+$"
39+
NO_SPECIAL_CHARS = '^[^<>:;"/|? \\_]+$'
4040

4141

4242
class DataLevel(Enum):
@@ -455,22 +455,15 @@ class AnalysisDescription(DataDescription):
455455
...,
456456
regex=DataRegex.NO_SPECIAL_CHARS.value,
457457
description="Name of the project the analysis belongs to",
458-
title="Project name"
458+
title="Project name",
459459
)
460460
analysis_name: str = Field(
461-
...,
462-
regex=DataRegex.NO_SPECIAL_CHARS.value,
463-
description="Name of the analysis performed",
464-
title="Analysis name"
461+
..., regex=DataRegex.NO_SPECIAL_CHARS.value, description="Name of the analysis performed", title="Analysis name"
465462
)
466463

467-
def __init__(self, analysis_name, **kwargs):
468-
"""Construct an analysis data description"""
469-
470-
super().__init__(
471-
label=f"{kwargs.get('project_name')}_{analysis_name}",
472-
**kwargs,
473-
)
464+
@property
465+
def label(self):
466+
return f"{self.project_name}_{self.analysis_name}"
474467

475468
@classmethod
476469
def parse_name(cls, name):

0 commit comments

Comments
 (0)