@@ -226,9 +226,8 @@ def list(self, **kwargs: Any) -> Union[base.RESTObjectList, List[base.RESTObject
226226 data .setdefault ("order_by" , self .gitlab .order_by )
227227
228228 # 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 ():
232231 if attr_name in data .keys ():
233232 type_obj = type_cls (data [attr_name ])
234233 data [attr_name ] = type_obj .get_for_api ()
@@ -311,17 +310,16 @@ def create(
311310 files = {}
312311
313312 # We get the attributes that need some special transformation
314- types = getattr (self , "_types" , {})
315- if types :
313+ if self ._types :
316314 # Duplicate data to avoid messing with what the user sent us
317315 data = data .copy ()
318- for attr_name , type_cls in types .items ():
316+ for attr_name , type_cls in self . _types .items ():
319317 if attr_name in data .keys ():
320318 type_obj = type_cls (data [attr_name ])
321319
322320 # if the type if FileAttribute we need to pass the data as
323321 # file
324- if issubclass ( type_cls , g_types .FileAttribute ):
322+ if isinstance ( type_obj , g_types .FileAttribute ):
325323 k = type_obj .get_file_name (attr_name )
326324 files [attr_name ] = (k , data .pop (attr_name ))
327325 else :
@@ -414,17 +412,16 @@ def update(
414412 files = {}
415413
416414 # We get the attributes that need some special transformation
417- types = getattr (self , "_types" , {})
418- if types :
415+ if self ._types :
419416 # Duplicate data to avoid messing with what the user sent us
420417 new_data = new_data .copy ()
421- for attr_name , type_cls in types .items ():
418+ for attr_name , type_cls in self . _types .items ():
422419 if attr_name in new_data .keys ():
423420 type_obj = type_cls (new_data [attr_name ])
424421
425422 # if the type if FileAttribute we need to pass the data as
426423 # file
427- if issubclass ( type_cls , g_types .FileAttribute ):
424+ if isinstance ( type_obj , g_types .FileAttribute ):
428425 k = type_obj .get_file_name (attr_name )
429426 files [attr_name ] = (k , new_data .pop (attr_name ))
430427 else :
0 commit comments