1010from urllib .parse import urlparse , urlunparse
1111
1212def get_hashed_slug (url , changes_with_content ):
13- """Return a unique slug that is invariant to query parameters in the url"""
13+ """Returns a unique slug that is invariant to query parameters in the url"""
1414 parsed_url = urlparse (url )
1515 stripped_url = urlunparse (
1616 (parsed_url .scheme , parsed_url .netloc , parsed_url .path , "" , "" , "" )
@@ -30,13 +30,9 @@ def fetch_zipfile(session, url, dst_dir):
3030 return dst_filename
3131
3232
33- def handle_items (_ , item ):
34- print (item )
35-
36-
3733def extract_validate_and_identify_bundle (zip_filename , dst_dir ):
3834 if not os .path .exists (zip_filename ):
39- raise RuntimeError ("Download MECA bundle not found" )
35+ raise RuntimeError ("Downloaded MECA bundle not found" )
4036
4137 if not is_zipfile (zip_filename ):
4238 raise RuntimeError ("MECA bundle is not a zip file" )
@@ -80,7 +76,7 @@ def __init__(self):
8076 def detect (self , spec , ref = None , extra_args = None ):
8177 """`spec` contains a faux protocol of meca+http[s] for detection purposes
8278 and we assume `spec` trusted as a reachable MECA bundle from an allowed origin
83- (binderhub RepoProvider class already checking for this).
79+ (binderhub RepoProvider class is already checking for this).
8480
8581 An other HEAD check in made here in order to get the content-length header
8682 """
@@ -90,8 +86,8 @@ def detect(self, spec, ref=None, extra_args=None):
9086 parsed = parsed ._replace (scheme = parsed .scheme [:- 5 ])
9187 url = urlunparse (parsed )
9288
93- r = self .session .head (url )
94- changes_with_content = r . headers .get ("ETag" ) or r . headers .get ("Content-Length" )
89+ headers = self .session .head (url ). headers
90+ changes_with_content = headers .get ("ETag" ) or headers .get ("Content-Length" )
9591
9692 self .hashed_slug = get_hashed_slug (url , changes_with_content )
9793
0 commit comments