22import requests
33from requests import exceptions as rexc
44
5- from wiremock ._compat import integer_types , float_types , array_types , string_types
65from wiremock .base .base_entity import BaseAbstractEntity
76from wiremock .constants import make_headers , Config , logger
87from wiremock .exceptions import *
@@ -194,9 +193,7 @@ def get_base_uri(cls, endpoint, **id_dict):
194193
195194 @staticmethod
196195 def get_entity_id (entity_id , entityClass ):
197- if not (isinstance (entity_id , integer_types ) or isinstance (entity_id , string_types )
198- or isinstance (entity_id , entityClass )):
199-
196+ if not (isinstance (entity_id , (int , str )) or isinstance (entity_id , entityClass )):
200197 raise InvalidInputException (422 , entity_id )
201198 if isinstance (entity_id , entityClass ):
202199 entity_id = entity_id .id
@@ -285,7 +282,7 @@ def _retreive_all(cls, parameters=None, ids={}): # pragma: no cover
285282 return response # pragma: no cover
286283 else :
287284 response_json = response .json ()
288- if isinstance (response_json , array_types ):
285+ if isinstance (response_json , ( tuple , list ) ):
289286 results = []
290287 for r in response_json :
291288 if isinstance (r , dict ):
@@ -296,7 +293,7 @@ def _retreive_all(cls, parameters=None, ids={}): # pragma: no cover
296293
297294 @classmethod
298295 def _retreive_one (cls , entity , parameters = None , ids = {}): # pragma: no cover
299- if isinstance (entity , integer_types ) or isinstance ( entity , float_types ):
296+ if isinstance (entity , ( int , float ) ):
300297 ids ['id' ] = entity
301298 response = cls .REST_CLIENT .get (
302299 cls .get_base_uri (cls .endpoint_single (), ** ids ), headers = make_headers (), params = parameters
@@ -321,7 +318,7 @@ def _retreive_one(cls, entity, parameters=None, ids={}): # pragma: no cover
321318
322319 @classmethod
323320 def _delete (cls , entity , parameters = None , ids = {}): # pragma: no cover
324- if isinstance (entity , integer_types ) or isinstance ( entity , float_types ):
321+ if isinstance (entity , ( int , float ) ):
325322 ids ['id' ] = entity
326323 response = cls .REST_CLIENT .delete (
327324 cls .get_base_uri (cls .endpoint_single (), ** ids ), headers = make_headers (), params = parameters
0 commit comments