We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 417f766 commit 883b761Copy full SHA for 883b761
src/murfey/util/models.py
@@ -1,10 +1,11 @@
1
from __future__ import annotations
2
3
+import math
4
from datetime import datetime
5
from pathlib import Path
6
from typing import Any, Dict, List, Optional
7
-from pydantic import BaseModel
8
+from pydantic import BaseModel, field_validator
9
10
"""
11
General Models
@@ -46,6 +47,15 @@ class File(BaseModel):
46
47
timestamp: datetime
48
full_path: str
49
50
+ @field_validator("size", mode="before")
51
+ @classmethod
52
+ def round_file_size_correctly(cls, v: Any) -> int:
53
+ if isinstance(v, float):
54
+ if v - math.floor(v) == 0.5:
55
+ return math.ceil(v)
56
+ return round(v)
57
+ return v
58
+
59
60
class ConnectionFileParameters(BaseModel):
61
filename: str
0 commit comments