@@ -226,9 +226,8 @@ def list(self, **kwargs: Any) -> Union[base.RESTObjectList, List[base.RESTObject
226
226
data .setdefault ("order_by" , self .gitlab .order_by )
227
227
228
228
# We get the attributes that need some special transformation
229
- types = getattr (self , "_types" , {})
230
- if types :
231
- for attr_name , type_cls in types .items ():
229
+ if self ._types :
230
+ for attr_name , type_cls in self ._types .items ():
232
231
if attr_name in data .keys ():
233
232
type_obj = type_cls (data [attr_name ])
234
233
data [attr_name ] = type_obj .get_for_api ()
@@ -311,17 +310,16 @@ def create(
311
310
files = {}
312
311
313
312
# We get the attributes that need some special transformation
314
- types = getattr (self , "_types" , {})
315
- if types :
313
+ if self ._types :
316
314
# Duplicate data to avoid messing with what the user sent us
317
315
data = data .copy ()
318
- for attr_name , type_cls in types .items ():
316
+ for attr_name , type_cls in self . _types .items ():
319
317
if attr_name in data .keys ():
320
318
type_obj = type_cls (data [attr_name ])
321
319
322
320
# if the type if FileAttribute we need to pass the data as
323
321
# file
324
- if issubclass ( type_cls , g_types .FileAttribute ):
322
+ if isinstance ( type_obj , g_types .FileAttribute ):
325
323
k = type_obj .get_file_name (attr_name )
326
324
files [attr_name ] = (k , data .pop (attr_name ))
327
325
else :
@@ -414,17 +412,16 @@ def update(
414
412
files = {}
415
413
416
414
# We get the attributes that need some special transformation
417
- types = getattr (self , "_types" , {})
418
- if types :
415
+ if self ._types :
419
416
# Duplicate data to avoid messing with what the user sent us
420
417
new_data = new_data .copy ()
421
- for attr_name , type_cls in types .items ():
418
+ for attr_name , type_cls in self . _types .items ():
422
419
if attr_name in new_data .keys ():
423
420
type_obj = type_cls (new_data [attr_name ])
424
421
425
422
# if the type if FileAttribute we need to pass the data as
426
423
# file
427
- if issubclass ( type_cls , g_types .FileAttribute ):
424
+ if isinstance ( type_obj , g_types .FileAttribute ):
428
425
k = type_obj .get_file_name (attr_name )
429
426
files [attr_name ] = (k , new_data .pop (attr_name ))
430
427
else :
0 commit comments