8
8
import os .path
9
9
from typing import Union , Optional , List
10
10
import sys
11
-
12
11
from pydantic import BaseModel , Field , model_validator , field_validator , FilePath , DirectoryPath
13
12
from pydantic_core import PydanticCustomError
14
13
from typing_extensions import Self
15
14
from enum import Enum
16
-
17
15
from bim2sim .utilities import types
18
16
from bim2sim .utilities .types import LOD
19
17
from bim2sim .elements .base_elements import Material
@@ -68,7 +66,7 @@ def _create_settings(self):
68
66
self [name ] = setting
69
67
70
68
# Store predefined default values in the defaults dict,
71
- # so they can be set back to the default later
69
+ # so they can be set back to their defaults later
72
70
self .defaults [setting .name ] = setting .value
73
71
74
72
@property
@@ -84,12 +82,13 @@ def names(self):
84
82
85
83
86
84
class Setting (BaseModel , validate_assignment = True , validate_default = True ):
87
- """ Base class for all simulation settings.
88
- The attribute value which holds the payload of the setting is introduced in derived classes,
89
- e.g. NumberSetting(Setting).
85
+ """Base class for all simulation settings.
86
+
87
+ The attribute "value", which contains the payload of the simulation setting, is added in
88
+ the derived classes for the different data types (e.g. NumberSetting(Setting)).
90
89
91
- The value which is assigned to the attribute "value", when instancing the setting, serves
92
- as a default and can be changed according to the use case, if necessary.
90
+ The value, which is assigned to the attribute "value", when instancing the setting, serves
91
+ as a default value and can be changed according to the use case, if necessary.
93
92
94
93
Args:
95
94
name: Name of the setting. Is set automatically by AutoSettingNameMeta(type)
@@ -106,8 +105,8 @@ class Setting(BaseModel, validate_assignment=True, validate_default=True):
106
105
mandatory : bool = Field (default = False )
107
106
108
107
def __set__ (self , bound_simulation_settings , value ):
109
- """Creates a new attribute with name and value of the complete setting instance,
110
- stored in sim_settings. This makes it easier to access the value of a setting.
108
+ """Creates a new attribute with the name and value of the simulation setting instance,
109
+ stored in sim_settings. This makes it easier to access the setting's payload .
111
110
112
111
Example:
113
112
0 commit comments