Skip to content

Commit

Permalink
Use default factory for techniques field.
Browse files Browse the repository at this point in the history
  • Loading branch information
YooSunYoung committed Aug 7, 2024
1 parent 3f3359e commit bc30a8a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/scicat_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pathlib
import uuid
from collections.abc import Callable, Iterable
from dataclasses import asdict, dataclass
from dataclasses import asdict, dataclass, field
from types import MappingProxyType
from typing import Any

Expand Down Expand Up @@ -108,7 +108,7 @@ def extract_variables_values(
class TechniqueDesc:
pid: str
"Technique PID"
names: str
name: str
"Technique Name"


Expand All @@ -130,7 +130,7 @@ class ScicatDataset:
creationTime: str
type: str = "raw"
sampleId: str
techniques: list[TechniqueDesc] | None = None
techniques: list[TechniqueDesc] = field(default_factory=list)
instrumentId: str | None = None
proposalId: str | None = None
ownerGroup: str | None = None
Expand Down Expand Up @@ -464,9 +464,6 @@ def create_scicat_dataset_instance(
"Access group is not provided. Setting to default value. %s",
scicat_dataset.accessGroup,
)
if scicat_dataset.techniques is None:
logger.info("Techniques are not provided. Setting to empty list.")
scicat_dataset.techniques = []

logger.info("Dataset instance is created successfully. %s", scicat_dataset)
return scicat_dataset
Expand Down

0 comments on commit bc30a8a

Please sign in to comment.