13
13
14
14
15
15
def get_hashed_slug (url , changes_with_content ):
16
- """Return a unique slug that is invariant to query parameters in the url"""
16
+ """Returns a unique slug that is invariant to query parameters in the url"""
17
17
parsed_url = urlparse (url )
18
18
stripped_url = urlunparse (
19
19
(parsed_url .scheme , parsed_url .netloc , parsed_url .path , "" , "" , "" )
@@ -34,13 +34,9 @@ def fetch_zipfile(session, url, dst_dir):
34
34
return dst_filename
35
35
36
36
37
- def handle_items (_ , item ):
38
- print (item )
39
-
40
-
41
37
def extract_validate_and_identify_bundle (zip_filename , dst_dir ):
42
38
if not os .path .exists (zip_filename ):
43
- raise RuntimeError ("Download MECA bundle not found" )
39
+ raise RuntimeError ("Downloaded MECA bundle not found" )
44
40
45
41
if not is_zipfile (zip_filename ):
46
42
raise RuntimeError ("MECA bundle is not a zip file" )
@@ -84,7 +80,7 @@ def __init__(self):
84
80
def detect (self , spec , ref = None , extra_args = None ):
85
81
"""`spec` contains a faux protocol of meca+http[s] for detection purposes
86
82
and we assume `spec` trusted as a reachable MECA bundle from an allowed origin
87
- (binderhub RepoProvider class already checking for this).
83
+ (binderhub RepoProvider class is already checking for this).
88
84
89
85
An other HEAD check in made here in order to get the content-length header
90
86
"""
@@ -94,8 +90,8 @@ def detect(self, spec, ref=None, extra_args=None):
94
90
parsed = parsed ._replace (scheme = parsed .scheme [:- 5 ])
95
91
url = urlunparse (parsed )
96
92
97
- r = self .session .head (url )
98
- changes_with_content = r . headers .get ("ETag" ) or r . headers .get ("Content-Length" )
93
+ headers = self .session .head (url ). headers
94
+ changes_with_content = headers .get ("ETag" ) or headers .get ("Content-Length" )
99
95
100
96
self .hashed_slug = get_hashed_slug (url , changes_with_content )
101
97
0 commit comments