@@ -53,6 +53,7 @@ def id(self):
53
53
54
54
55
55
class _CamelCaseMixin (BaseModel ):
56
+
56
57
class Config :
57
58
allow_population_by_field_name = True
58
59
alias_generator = camel_case
@@ -135,14 +136,18 @@ def _build_ontology(self):
135
136
f for f in self .fields if f .reserved
136
137
]
137
138
self .reserved_by_id = self ._make_id_index (self .reserved_fields )
138
- self .reserved_by_name : Dict [str , DataRowMetadataSchema ] = self ._make_name_index (self .reserved_fields )
139
+ self .reserved_by_name : Dict [
140
+ str ,
141
+ DataRowMetadataSchema ] = self ._make_name_index (self .reserved_fields )
139
142
140
143
# custom fields
141
144
self .custom_fields : List [DataRowMetadataSchema ] = [
142
145
f for f in self .fields if not f .reserved
143
146
]
144
147
self .custom_by_id = self ._make_id_index (self .custom_fields )
145
- self .custom_by_name : Dict [str , DataRowMetadataSchema ] = self ._make_name_index (self .custom_fields )
148
+ self .custom_by_name : Dict [
149
+ str ,
150
+ DataRowMetadataSchema ] = self ._make_name_index (self .custom_fields )
146
151
147
152
@staticmethod
148
153
def _make_name_index (fields : List [DataRowMetadataSchema ]):
@@ -158,7 +163,7 @@ def _make_name_index(fields: List[DataRowMetadataSchema]):
158
163
159
164
@staticmethod
160
165
def _make_id_index (
161
- fields : List [DataRowMetadataSchema ]
166
+ fields : List [DataRowMetadataSchema ]
162
167
) -> Dict [SchemaId , DataRowMetadataSchema ]:
163
168
index = {}
164
169
for f in fields :
@@ -209,9 +214,9 @@ def _parse_ontology(raw_ontology) -> List[DataRowMetadataSchema]:
209
214
return fields
210
215
211
216
def parse_metadata (
212
- self , unparsed : List [Dict [str ,
213
- List [Union [str ,
214
- Dict ]]]]) -> List [DataRowMetadata ]:
217
+ self , unparsed : List [Dict [str ,
218
+ List [Union [str ,
219
+ Dict ]]]]) -> List [DataRowMetadata ]:
215
220
""" Parse metadata responses
216
221
217
222
>>> mdo.parse_metadata([metdata])
@@ -272,7 +277,7 @@ def bulk_upsert(
272
277
raise ValueError ("Empty list passed" )
273
278
274
279
def _batch_upsert (
275
- upserts : List [_UpsertBatchDataRowMetadata ]
280
+ upserts : List [_UpsertBatchDataRowMetadata ]
276
281
) -> List [DataRowMetadataBatchResponse ]:
277
282
query = """mutation UpsertDataRowMetadataBetaPyApi($metadata: [DataRowCustomMetadataBatchUpsertInput!]!) {
278
283
upsertDataRowCustomMetadata(data: $metadata){
@@ -305,13 +310,13 @@ def _batch_upsert(
305
310
fields = list (
306
311
chain .from_iterable (
307
312
self ._parse_upsert (m ) for m in m .fields ))).dict (
308
- by_alias = True ))
313
+ by_alias = True ))
309
314
310
315
res = _batch_operations (_batch_upsert , items , self ._batch_size )
311
316
return res
312
317
313
318
def bulk_delete (
314
- self , deletes : List [DeleteDataRowMetadata ]
319
+ self , deletes : List [DeleteDataRowMetadata ]
315
320
) -> List [DataRowMetadataBatchResponse ]:
316
321
""" Delete metadata from a datarow by specifiying the fields you want to remove
317
322
@@ -338,7 +343,7 @@ def bulk_delete(
338
343
raise ValueError ("Empty list passed" )
339
344
340
345
def _batch_delete (
341
- deletes : List [_DeleteBatchDataRowMetadata ]
346
+ deletes : List [_DeleteBatchDataRowMetadata ]
342
347
) -> List [DataRowMetadataBatchResponse ]:
343
348
query = """mutation DeleteDataRowMetadataBetaPyApi($deletes: [DataRowCustomMetadataBatchDeleteInput!]!) {
344
349
deleteDataRowCustomMetadata(data: $deletes) {
@@ -459,9 +464,9 @@ def _batch_items(iterable: List[Any], size: int) -> Generator[Any, None, None]:
459
464
460
465
461
466
def _batch_operations (
462
- batch_function : _BatchFunction ,
463
- items : List ,
464
- batch_size : int = 100 ,
467
+ batch_function : _BatchFunction ,
468
+ items : List ,
469
+ batch_size : int = 100 ,
465
470
):
466
471
response = []
467
472
0 commit comments