@@ -37,6 +37,7 @@ def get_schema(url: str | None = None) -> Dict[str, Any]:
37
37
-------
38
38
Dict[str, Any]
39
39
The loaded schema as a dictionary.
40
+
40
41
"""
41
42
if url is None :
42
43
return bst .schema .load_schema ()
@@ -69,6 +70,7 @@ def create_attrs_class(
69
70
-------
70
71
cls : type
71
72
The dynamically created attrs class.
73
+
72
74
"""
73
75
attributes = {}
74
76
for prop_name , prop_info in properties .items ():
@@ -133,6 +135,7 @@ def generate_attrs_classes_from_schema(
133
135
-------
134
136
cls : type
135
137
The root class created from the schema.
138
+
136
139
"""
137
140
if 'properties' not in schema :
138
141
raise ValueError ("Invalid schema: 'properties' field is required" )
@@ -145,14 +148,15 @@ def generate_attrs_classes_from_schema(
145
148
146
149
147
150
def populate_namespace (attrs_class : type , namespace : Dict [str , Any ]) -> None :
148
- """Populate a namespace with nested attrs classes
151
+ """Populate a namespace with nested attrs classes.
149
152
150
153
Parameters
151
154
----------
152
155
attrs_class : type
153
156
The root attrs class to add to the namespace.
154
157
namespace : Dict[str, Any]
155
158
The namespace to populate with nested classes.
159
+
156
160
"""
157
161
for attr in attrs_class .__attrs_attrs__ :
158
162
attr_type = attr .type
@@ -179,6 +183,7 @@ def load_schema_into_namespace(
179
183
The namespace to load the schema into.
180
184
root_class_name : str
181
185
The name of the root class to create.
186
+
182
187
"""
183
188
attrs_class = generate_attrs_classes_from_schema (schema , root_class_name )
184
189
namespace [root_class_name ] = attrs_class
0 commit comments