Spaces:
Running
Running
Update landmarkdiff/data_version.py to v0.3.2
Browse files
landmarkdiff/data_version.py
CHANGED
|
@@ -47,7 +47,7 @@ class FileEntry:
|
|
| 47 |
|
| 48 |
# Infer procedure from filename
|
| 49 |
proc = ""
|
| 50 |
-
for p in ["rhinoplasty", "blepharoplasty", "rhytidectomy", "orthognathic"]:
|
| 51 |
if p in filepath.name or p in str(filepath.parent):
|
| 52 |
proc = p
|
| 53 |
break
|
|
@@ -68,7 +68,9 @@ class DataManifest:
|
|
| 68 |
"""
|
| 69 |
|
| 70 |
version: str = "1.0"
|
| 71 |
-
created_at: str = field(
|
|
|
|
|
|
|
| 72 |
root_dir: str = ""
|
| 73 |
files: list[FileEntry] = field(default_factory=list)
|
| 74 |
metadata: dict[str, Any] = field(default_factory=dict)
|
|
@@ -235,7 +237,8 @@ class DataManifest:
|
|
| 235 |
actual_size = fp.stat().st_size
|
| 236 |
if actual_size != entry.size_bytes:
|
| 237 |
issues.append(
|
| 238 |
-
f"Size mismatch: {entry.path}
|
|
|
|
| 239 |
)
|
| 240 |
|
| 241 |
# Check checksum
|
|
@@ -262,7 +265,8 @@ class DataManifest:
|
|
| 262 |
added = sorted(other_paths - self_paths)
|
| 263 |
removed = sorted(self_paths - other_paths)
|
| 264 |
modified = sorted(
|
| 265 |
-
p for p in self_paths & other_paths
|
|
|
|
| 266 |
)
|
| 267 |
|
| 268 |
return {"added": added, "removed": removed, "modified": modified}
|
|
@@ -288,7 +292,6 @@ def _get_hostname() -> str:
|
|
| 288 |
"""Get hostname safely."""
|
| 289 |
try:
|
| 290 |
import socket
|
| 291 |
-
|
| 292 |
return socket.gethostname()
|
| 293 |
except Exception:
|
| 294 |
return "unknown"
|
|
|
|
| 47 |
|
| 48 |
# Infer procedure from filename
|
| 49 |
proc = ""
|
| 50 |
+
for p in ["rhinoplasty", "blepharoplasty", "rhytidectomy", "orthognathic", "brow_lift", "mentoplasty"]:
|
| 51 |
if p in filepath.name or p in str(filepath.parent):
|
| 52 |
proc = p
|
| 53 |
break
|
|
|
|
| 68 |
"""
|
| 69 |
|
| 70 |
version: str = "1.0"
|
| 71 |
+
created_at: str = field(
|
| 72 |
+
default_factory=lambda: datetime.now(timezone.utc).isoformat()
|
| 73 |
+
)
|
| 74 |
root_dir: str = ""
|
| 75 |
files: list[FileEntry] = field(default_factory=list)
|
| 76 |
metadata: dict[str, Any] = field(default_factory=dict)
|
|
|
|
| 237 |
actual_size = fp.stat().st_size
|
| 238 |
if actual_size != entry.size_bytes:
|
| 239 |
issues.append(
|
| 240 |
+
f"Size mismatch: {entry.path} "
|
| 241 |
+
f"(expected {entry.size_bytes}, got {actual_size})"
|
| 242 |
)
|
| 243 |
|
| 244 |
# Check checksum
|
|
|
|
| 265 |
added = sorted(other_paths - self_paths)
|
| 266 |
removed = sorted(self_paths - other_paths)
|
| 267 |
modified = sorted(
|
| 268 |
+
p for p in self_paths & other_paths
|
| 269 |
+
if self_files[p].checksum != other_files[p].checksum
|
| 270 |
)
|
| 271 |
|
| 272 |
return {"added": added, "removed": removed, "modified": modified}
|
|
|
|
| 292 |
"""Get hostname safely."""
|
| 293 |
try:
|
| 294 |
import socket
|
|
|
|
| 295 |
return socket.gethostname()
|
| 296 |
except Exception:
|
| 297 |
return "unknown"
|