forked from equinor/fmu-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_config.py
More file actions
39 lines (30 loc) · 1017 Bytes
/
Copy pathproject_config.py
File metadata and controls
39 lines (30 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""The model for config.json."""
import getpass
from datetime import UTC, datetime
from typing import Self
from pydantic import AwareDatetime, Field
from fmu.datamodels.fmu_results.fields import Masterdata, Model
from fmu.settings import __version__
from fmu.settings.types import ResettableBaseModel, VersionStr # noqa TC001
class ProjectConfig(ResettableBaseModel):
"""The configuration file in a .fmu directory.
Stored as config.json.
"""
version: VersionStr
created_at: AwareDatetime
created_by: str
masterdata: Masterdata | None = Field(default=None)
model: Model | None = Field(default=None)
@classmethod
def reset(cls: type[Self]) -> Self:
"""Resets the configuration to defaults.
Returns:
The new default Config object
"""
return cls(
version=__version__,
created_at=datetime.now(UTC),
created_by=getpass.getuser(),
masterdata=None,
model=None,
)