@@ -301,7 +301,7 @@ def allow_credentials(self):
301
301
302
302
def set_default_headers (self ):
303
303
"""Add CORS headers, if defined"""
304
- super (IPythonHandler , self ).set_default_headers ()
304
+ super ().set_default_headers ()
305
305
if self .allow_origin :
306
306
self .set_header ("Access-Control-Allow-Origin" , self .allow_origin )
307
307
elif self .allow_origin_pat :
@@ -442,7 +442,7 @@ def check_xsrf_cookie(self):
442
442
# Servers without authentication are vulnerable to XSRF
443
443
return
444
444
try :
445
- return super (IPythonHandler , self ).check_xsrf_cookie ()
445
+ return super ().check_xsrf_cookie ()
446
446
except web .HTTPError as e :
447
447
if self .request .method in {'GET' , 'HEAD' }:
448
448
# Consider Referer a sufficient cross-origin check for GET requests
@@ -496,7 +496,7 @@ def check_host(self):
496
496
def prepare (self ):
497
497
if not self .check_host ():
498
498
raise web .HTTPError (403 )
499
- return super (IPythonHandler , self ).prepare ()
499
+ return super ().prepare ()
500
500
501
501
#---------------------------------------------------------------
502
502
# template rendering
@@ -591,7 +591,7 @@ class APIHandler(IPythonHandler):
591
591
def prepare (self ):
592
592
if not self .check_origin ():
593
593
raise web .HTTPError (404 )
594
- return super (APIHandler , self ).prepare ()
594
+ return super ().prepare ()
595
595
596
596
def write_error (self , status_code , ** kwargs ):
597
597
"""APIHandler errors are JSON, not human pages"""
@@ -618,7 +618,7 @@ def get_current_user(self):
618
618
# preserve _user_cache so we don't raise more than once
619
619
if hasattr (self , '_user_cache' ):
620
620
return self ._user_cache
621
- self ._user_cache = user = super (APIHandler , self ).get_current_user ()
621
+ self ._user_cache = user = super ().get_current_user ()
622
622
return user
623
623
624
624
def get_login_url (self ):
@@ -627,12 +627,12 @@ def get_login_url(self):
627
627
# instead of redirecting, raise 403 instead.
628
628
if not self .current_user :
629
629
raise web .HTTPError (403 )
630
- return super (APIHandler , self ).get_login_url ()
630
+ return super ().get_login_url ()
631
631
632
632
@property
633
633
def content_security_policy (self ):
634
634
csp = '; ' .join ([
635
- super (APIHandler , self ).content_security_policy ,
635
+ super ().content_security_policy ,
636
636
"default-src 'none'" ,
637
637
])
638
638
return csp
@@ -653,7 +653,7 @@ def update_api_activity(self):
653
653
def finish (self , * args , ** kwargs ):
654
654
self .update_api_activity ()
655
655
self .set_header ('Content-Type' , 'application/json' )
656
- return super (APIHandler , self ).finish (* args , ** kwargs )
656
+ return super ().finish (* args , ** kwargs )
657
657
658
658
def options (self , * args , ** kwargs ):
659
659
if 'Access-Control-Allow-Headers' in self .settings .get ('headers' , {}):
@@ -700,13 +700,12 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):
700
700
def content_security_policy (self ):
701
701
# In case we're serving HTML/SVG, confine any Javascript to a unique
702
702
# 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"
705
704
706
705
@web .authenticated
707
706
def head (self , path ):
708
707
self .check_xsrf_cookie ()
709
- return super (AuthenticatedFileHandler , self ).head (path )
708
+ return super ().head (path )
710
709
711
710
@web .authenticated
712
711
def get (self , path ):
@@ -731,10 +730,10 @@ def get_content_type(self):
731
730
if cur_mime == 'text/plain' :
732
731
return 'text/plain; charset=UTF-8'
733
732
else :
734
- return super (AuthenticatedFileHandler , self ).get_content_type ()
733
+ return super ().get_content_type ()
735
734
736
735
def set_headers (self ):
737
- super (AuthenticatedFileHandler , self ).set_headers ()
736
+ super ().set_headers ()
738
737
# disable browser caching, rely on 304 replies for savings
739
738
if "v" not in self .request .arguments :
740
739
self .add_header ("Cache-Control" , "no-cache" )
@@ -749,7 +748,7 @@ def validate_absolute_path(self, root, absolute_path):
749
748
750
749
Adding to tornado's own handling, forbids the serving of hidden files.
751
750
"""
752
- abs_path = super (AuthenticatedFileHandler , self ).validate_absolute_path (root , absolute_path )
751
+ abs_path = super ().validate_absolute_path (root , absolute_path )
753
752
abs_root = os .path .abspath (root )
754
753
if is_hidden (abs_path , abs_root ) and not self .contents_manager .allow_hidden :
755
754
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):
795
794
_static_paths = {}
796
795
797
796
def set_headers (self ):
798
- super (FileFindHandler , self ).set_headers ()
797
+ super ().set_headers ()
799
798
# disable browser caching, rely on 304 replies for savings
800
799
if "v" not in self .request .arguments or \
801
800
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):
842
841
if (absolute_path + os .sep ).startswith (root ):
843
842
break
844
843
845
- return super (FileFindHandler , self ).validate_absolute_path (root , absolute_path )
844
+ return super ().validate_absolute_path (root , absolute_path )
846
845
847
846
848
847
class APIVersionHandler (APIHandler ):
0 commit comments