@@ -301,7 +301,7 @@ def allow_credentials(self):
301301
302302 def set_default_headers (self ):
303303 """Add CORS headers, if defined"""
304- super (IPythonHandler , self ).set_default_headers ()
304+ super ().set_default_headers ()
305305 if self .allow_origin :
306306 self .set_header ("Access-Control-Allow-Origin" , self .allow_origin )
307307 elif self .allow_origin_pat :
@@ -442,7 +442,7 @@ def check_xsrf_cookie(self):
442442 # Servers without authentication are vulnerable to XSRF
443443 return
444444 try :
445- return super (IPythonHandler , self ).check_xsrf_cookie ()
445+ return super ().check_xsrf_cookie ()
446446 except web .HTTPError as e :
447447 if self .request .method in {'GET' , 'HEAD' }:
448448 # Consider Referer a sufficient cross-origin check for GET requests
@@ -496,7 +496,7 @@ def check_host(self):
496496 def prepare (self ):
497497 if not self .check_host ():
498498 raise web .HTTPError (403 )
499- return super (IPythonHandler , self ).prepare ()
499+ return super ().prepare ()
500500
501501 #---------------------------------------------------------------
502502 # template rendering
@@ -591,7 +591,7 @@ class APIHandler(IPythonHandler):
591591 def prepare (self ):
592592 if not self .check_origin ():
593593 raise web .HTTPError (404 )
594- return super (APIHandler , self ).prepare ()
594+ return super ().prepare ()
595595
596596 def write_error (self , status_code , ** kwargs ):
597597 """APIHandler errors are JSON, not human pages"""
@@ -618,7 +618,7 @@ def get_current_user(self):
618618 # preserve _user_cache so we don't raise more than once
619619 if hasattr (self , '_user_cache' ):
620620 return self ._user_cache
621- self ._user_cache = user = super (APIHandler , self ).get_current_user ()
621+ self ._user_cache = user = super ().get_current_user ()
622622 return user
623623
624624 def get_login_url (self ):
@@ -627,12 +627,12 @@ def get_login_url(self):
627627 # instead of redirecting, raise 403 instead.
628628 if not self .current_user :
629629 raise web .HTTPError (403 )
630- return super (APIHandler , self ).get_login_url ()
630+ return super ().get_login_url ()
631631
632632 @property
633633 def content_security_policy (self ):
634634 csp = '; ' .join ([
635- super (APIHandler , self ).content_security_policy ,
635+ super ().content_security_policy ,
636636 "default-src 'none'" ,
637637 ])
638638 return csp
@@ -653,7 +653,7 @@ def update_api_activity(self):
653653 def finish (self , * args , ** kwargs ):
654654 self .update_api_activity ()
655655 self .set_header ('Content-Type' , 'application/json' )
656- return super (APIHandler , self ).finish (* args , ** kwargs )
656+ return super ().finish (* args , ** kwargs )
657657
658658 def options (self , * args , ** kwargs ):
659659 if 'Access-Control-Allow-Headers' in self .settings .get ('headers' , {}):
@@ -700,13 +700,12 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):
700700 def content_security_policy (self ):
701701 # In case we're serving HTML/SVG, confine any Javascript to a unique
702702 # origin so it can't interact with the notebook server.
703- return super (AuthenticatedFileHandler , self ).content_security_policy + \
704- "; sandbox allow-scripts"
703+ return super ().content_security_policy + "; sandbox allow-scripts"
705704
706705 @web .authenticated
707706 def head (self , path ):
708707 self .check_xsrf_cookie ()
709- return super (AuthenticatedFileHandler , self ).head (path )
708+ return super ().head (path )
710709
711710 @web .authenticated
712711 def get (self , path ):
@@ -731,10 +730,10 @@ def get_content_type(self):
731730 if cur_mime == 'text/plain' :
732731 return 'text/plain; charset=UTF-8'
733732 else :
734- return super (AuthenticatedFileHandler , self ).get_content_type ()
733+ return super ().get_content_type ()
735734
736735 def set_headers (self ):
737- super (AuthenticatedFileHandler , self ).set_headers ()
736+ super ().set_headers ()
738737 # disable browser caching, rely on 304 replies for savings
739738 if "v" not in self .request .arguments :
740739 self .add_header ("Cache-Control" , "no-cache" )
@@ -749,7 +748,7 @@ def validate_absolute_path(self, root, absolute_path):
749748
750749 Adding to tornado's own handling, forbids the serving of hidden files.
751750 """
752- abs_path = super (AuthenticatedFileHandler , self ).validate_absolute_path (root , absolute_path )
751+ abs_path = super ().validate_absolute_path (root , absolute_path )
753752 abs_root = os .path .abspath (root )
754753 if is_hidden (abs_path , abs_root ) and not self .contents_manager .allow_hidden :
755754 self .log .info ("Refusing to serve hidden file, via 404 Error, use flag 'ContentsManager.allow_hidden' to enable" )
@@ -795,7 +794,7 @@ class FileFindHandler(IPythonHandler, web.StaticFileHandler):
795794 _static_paths = {}
796795
797796 def set_headers (self ):
798- super (FileFindHandler , self ).set_headers ()
797+ super ().set_headers ()
799798 # disable browser caching, rely on 304 replies for savings
800799 if "v" not in self .request .arguments or \
801800 any (self .request .path .startswith (path ) for path in self .no_cache_paths ):
@@ -842,7 +841,7 @@ def validate_absolute_path(self, root, absolute_path):
842841 if (absolute_path + os .sep ).startswith (root ):
843842 break
844843
845- return super (FileFindHandler , self ).validate_absolute_path (root , absolute_path )
844+ return super ().validate_absolute_path (root , absolute_path )
846845
847846
848847class APIVersionHandler (APIHandler ):
0 commit comments