@@ -104,15 +104,15 @@ def close(self):
104104
105105 class RequestsClient (requests .Session ):
106106 def __init__ (self , * args , ** kwargs ):
107- super (RequestsClient , self ).__init__ (* args , ** kwargs )
107+ super ().__init__ (* args , ** kwargs )
108108 adapter = DjangoTestAdapter ()
109109 self .mount ('http://' , adapter )
110110 self .mount ('https://' , adapter )
111111
112112 def request (self , method , url , * args , ** kwargs ):
113113 if not url .startswith ('http' ):
114114 raise ValueError ('Missing "http:" or "https:". Use a fully qualified URL, eg "http://testserver%s"' % url )
115- return super (RequestsClient , self ).request (method , url , * args , ** kwargs )
115+ return super ().request (method , url , * args , ** kwargs )
116116
117117else :
118118 def RequestsClient (* args , ** kwargs ):
@@ -124,7 +124,7 @@ class CoreAPIClient(coreapi.Client):
124124 def __init__ (self , * args , ** kwargs ):
125125 self ._session = RequestsClient ()
126126 kwargs ['transports' ] = [coreapi .transports .HTTPTransport (session = self .session )]
127- return super (CoreAPIClient , self ).__init__ (* args , ** kwargs )
127+ return super ().__init__ (* args , ** kwargs )
128128
129129 @property
130130 def session (self ):
@@ -144,7 +144,7 @@ def __init__(self, enforce_csrf_checks=False, **defaults):
144144 self .renderer_classes = {}
145145 for cls in self .renderer_classes_list :
146146 self .renderer_classes [cls .format ] = cls
147- super (APIRequestFactory , self ).__init__ (** defaults )
147+ super ().__init__ (** defaults )
148148
149149 def _encode_data (self , data , format = None , content_type = None ):
150150 """
@@ -166,7 +166,7 @@ def _encode_data(self, data, format=None, content_type=None):
166166 format = format or self .default_format
167167
168168 assert format in self .renderer_classes , (
169- "Invalid format '{0 }'. Available formats are {1 }. "
169+ "Invalid format '{}'. Available formats are {}. "
170170 "Set TEST_REQUEST_RENDERER_CLASSES to enable "
171171 "extra request formats." .format (
172172 format ,
@@ -179,7 +179,7 @@ def _encode_data(self, data, format=None, content_type=None):
179179 ret = renderer .render (data )
180180
181181 # Determine the content-type header from the renderer
182- content_type = "{0 }; charset={1 }" .format (
182+ content_type = "{}; charset={}" .format (
183183 renderer .media_type , renderer .charset
184184 )
185185
@@ -228,11 +228,11 @@ def generic(self, method, path, data='',
228228 if content_type is not None :
229229 extra ['CONTENT_TYPE' ] = str (content_type )
230230
231- return super (APIRequestFactory , self ).generic (
231+ return super ().generic (
232232 method , path , data , content_type , secure , ** extra )
233233
234234 def request (self , ** kwargs ):
235- request = super (APIRequestFactory , self ).request (** kwargs )
235+ request = super ().request (** kwargs )
236236 request ._dont_enforce_csrf_checks = not self .enforce_csrf_checks
237237 return request
238238
@@ -246,18 +246,18 @@ class ForceAuthClientHandler(ClientHandler):
246246 def __init__ (self , * args , ** kwargs ):
247247 self ._force_user = None
248248 self ._force_token = None
249- super (ForceAuthClientHandler , self ).__init__ (* args , ** kwargs )
249+ super ().__init__ (* args , ** kwargs )
250250
251251 def get_response (self , request ):
252252 # This is the simplest place we can hook into to patch the
253253 # request object.
254254 force_authenticate (request , self ._force_user , self ._force_token )
255- return super (ForceAuthClientHandler , self ).get_response (request )
255+ return super ().get_response (request )
256256
257257
258258class APIClient (APIRequestFactory , DjangoClient ):
259259 def __init__ (self , enforce_csrf_checks = False , ** defaults ):
260- super (APIClient , self ).__init__ (** defaults )
260+ super ().__init__ (** defaults )
261261 self .handler = ForceAuthClientHandler (enforce_csrf_checks )
262262 self ._credentials = {}
263263
@@ -280,49 +280,49 @@ def force_authenticate(self, user=None, token=None):
280280 def request (self , ** kwargs ):
281281 # Ensure that any credentials set get added to every request.
282282 kwargs .update (self ._credentials )
283- return super (APIClient , self ).request (** kwargs )
283+ return super ().request (** kwargs )
284284
285285 def get (self , path , data = None , follow = False , ** extra ):
286- response = super (APIClient , self ).get (path , data = data , ** extra )
286+ response = super ().get (path , data = data , ** extra )
287287 if follow :
288288 response = self ._handle_redirects (response , ** extra )
289289 return response
290290
291291 def post (self , path , data = None , format = None , content_type = None ,
292292 follow = False , ** extra ):
293- response = super (APIClient , self ).post (
293+ response = super ().post (
294294 path , data = data , format = format , content_type = content_type , ** extra )
295295 if follow :
296296 response = self ._handle_redirects (response , ** extra )
297297 return response
298298
299299 def put (self , path , data = None , format = None , content_type = None ,
300300 follow = False , ** extra ):
301- response = super (APIClient , self ).put (
301+ response = super ().put (
302302 path , data = data , format = format , content_type = content_type , ** extra )
303303 if follow :
304304 response = self ._handle_redirects (response , ** extra )
305305 return response
306306
307307 def patch (self , path , data = None , format = None , content_type = None ,
308308 follow = False , ** extra ):
309- response = super (APIClient , self ).patch (
309+ response = super ().patch (
310310 path , data = data , format = format , content_type = content_type , ** extra )
311311 if follow :
312312 response = self ._handle_redirects (response , ** extra )
313313 return response
314314
315315 def delete (self , path , data = None , format = None , content_type = None ,
316316 follow = False , ** extra ):
317- response = super (APIClient , self ).delete (
317+ response = super ().delete (
318318 path , data = data , format = format , content_type = content_type , ** extra )
319319 if follow :
320320 response = self ._handle_redirects (response , ** extra )
321321 return response
322322
323323 def options (self , path , data = None , format = None , content_type = None ,
324324 follow = False , ** extra ):
325- response = super (APIClient , self ).options (
325+ response = super ().options (
326326 path , data = data , format = format , content_type = content_type , ** extra )
327327 if follow :
328328 response = self ._handle_redirects (response , ** extra )
@@ -336,7 +336,7 @@ def logout(self):
336336 self .handler ._force_token = None
337337
338338 if self .session :
339- super (APIClient , self ).logout ()
339+ super ().logout ()
340340
341341
342342class APITransactionTestCase (testcases .TransactionTestCase ):
@@ -383,11 +383,11 @@ def setUpClass(cls):
383383 cls ._module .urlpatterns = cls .urlpatterns
384384
385385 cls ._override .enable ()
386- super (URLPatternsTestCase , cls ).setUpClass ()
386+ super ().setUpClass ()
387387
388388 @classmethod
389389 def tearDownClass (cls ):
390- super (URLPatternsTestCase , cls ).tearDownClass ()
390+ super ().tearDownClass ()
391391 cls ._override .disable ()
392392
393393 if hasattr (cls , '_module_urlpatterns' ):
0 commit comments