Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/model/SchemaConcepts/TOMO_Image.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from datetime import datetime

from pydantic import BeforeValidator, BaseModel, computed_field
from pydantic import BeforeValidator, BaseModel, computed_field, model_validator
from typing_extensions import Annotated

from src.config import MappingConfig
Expand Down Expand Up @@ -57,4 +57,11 @@ def match_by_path(self, other):
if not other.localPath: return False
if not os.path.exists(self.absolutePath()): return False
if not os.path.exists(other.absolutePath()): return False
return os.path.samefile(self.absolutePath(), other.absolutePath())
return os.path.samefile(self.absolutePath(), other.absolutePath())

@model_validator(mode="after")
def set_fileLink(self):
# Automatically populate fileLink from filePath if not set.
if not self.fileLink and self.localPath:
self.fileLink = Identifier(identifierValue=self.filePath)
return self
Loading