@@ -247,7 +247,9 @@ def download_wheel(name, version, environment, dest_dir=THIRDPARTY_DIR, repos=tu
247247 package = repo .get_package_version (name = name , version = version )
248248 if not package :
249249 if TRACE_DEEP :
250- print (f" download_wheel: No package in { repo .index_url } for { name } =={ version } " )
250+ print (
251+ f" download_wheel: No package in { repo .index_url } for { name } =={ version } "
252+ )
251253 continue
252254 supported_wheels = list (package .get_supported_wheels (environment = environment ))
253255 if not supported_wheels :
@@ -293,7 +295,9 @@ def download_sdist(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple()):
293295
294296 if not package :
295297 if TRACE_DEEP :
296- print (f" download_sdist: No package in { repo .index_url } for { name } =={ version } " )
298+ print (
299+ f" download_sdist: No package in { repo .index_url } for { name } =={ version } "
300+ )
297301 continue
298302 sdist = package .sdist
299303 if not sdist :
@@ -302,7 +306,9 @@ def download_sdist(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple()):
302306 continue
303307
304308 if TRACE_DEEP :
305- print (f" download_sdist: Getting sdist from index (or cache): { sdist .download_url } " )
309+ print (
310+ f" download_sdist: Getting sdist from index (or cache): { sdist .download_url } "
311+ )
306312 fetched_sdist_filename = package .sdist .download (dest_dir = dest_dir )
307313
308314 if fetched_sdist_filename :
@@ -1005,7 +1011,9 @@ def get_license_link_for_filename(filename, urls):
10051011 if not path_or_url :
10061012 raise Exception (f"Missing link to file: { filename } " )
10071013 if not len (path_or_url ) == 1 :
1008- raise Exception (f"Multiple links to file: { filename } : \n " + "\n " .join (path_or_url ))
1014+ raise Exception (
1015+ f"Multiple links to file: { filename } : \n " + "\n " .join (path_or_url )
1016+ )
10091017 return path_or_url [0 ]
10101018
10111019
@@ -1226,7 +1234,10 @@ def from_filename(cls, filename):
12261234
12271235 # All the tag combinations from this file
12281236 tags = {
1229- packaging_tags .Tag (x , y , z ) for x in python_versions for y in abis for z in platforms
1237+ packaging_tags .Tag (x , y , z )
1238+ for x in python_versions
1239+ for y in abis
1240+ for z in platforms
12301241 }
12311242
12321243 return cls (
@@ -1286,7 +1297,11 @@ def is_pure(self):
12861297 >>> Wheel.from_filename('future-0.16.0-py3-cp36m-any.whl').is_pure()
12871298 False
12881299 """
1289- return "py3" in self .python_versions and "none" in self .abis and "any" in self .platforms
1300+ return (
1301+ "py3" in self .python_versions
1302+ and "none" in self .abis
1303+ and "any" in self .platforms
1304+ )
12901305
12911306
12921307def is_pure_wheel (filename ):
@@ -1399,7 +1414,9 @@ def packages_from_dir(cls, directory):
13991414 """
14001415 base = os .path .abspath (directory )
14011416
1402- paths = [os .path .join (base , f ) for f in os .listdir (base ) if f .endswith (EXTENSIONS )]
1417+ paths = [
1418+ os .path .join (base , f ) for f in os .listdir (base ) if f .endswith (EXTENSIONS )
1419+ ]
14031420
14041421 if TRACE_ULTRA_DEEP :
14051422 print ("packages_from_dir: paths:" , paths )
@@ -1644,19 +1661,26 @@ def _get_package_versions_map(self, name):
16441661 assert name
16451662 normalized_name = NameVer .normalize_name (name )
16461663 versions = self .packages [normalized_name ]
1647- if not versions and normalized_name not in self .fetched_package_normalized_names :
1664+ if (
1665+ not versions
1666+ and normalized_name not in self .fetched_package_normalized_names
1667+ ):
16481668 self .fetched_package_normalized_names .add (normalized_name )
16491669 try :
16501670 links = self .fetch_links (normalized_name = normalized_name )
16511671 # note that thsi is sorted so the mapping is also sorted
16521672 versions = {
16531673 package .version : package
1654- for package in PypiPackage .packages_from_many_paths_or_urls (paths_or_urls = links )
1674+ for package in PypiPackage .packages_from_many_paths_or_urls (
1675+ paths_or_urls = links
1676+ )
16551677 }
16561678 self .packages [normalized_name ] = versions
16571679 except RemoteNotFetchedException as e :
16581680 if TRACE :
1659- print (f"failed to fetch package name: { name } from: { self .index_url } :\n { e } " )
1681+ print (
1682+ f"failed to fetch package name: { name } from: { self .index_url } :\n { e } "
1683+ )
16601684
16611685 if not versions and TRACE :
16621686 print (f"WARNING: package { name } not found in repo: { self .index_url } " )
@@ -1917,7 +1941,9 @@ def get_remote_file_content(
19171941 # several redirects and that we can ignore content there. A HEAD request may
19181942 # not get us this last header
19191943 print (f" DOWNLOADING: { url } " )
1920- with requests .get (url , allow_redirects = True , stream = True , headers = headers ) as response :
1944+ with requests .get (
1945+ url , allow_redirects = True , stream = True , headers = headers
1946+ ) as response :
19211947 status = response .status_code
19221948 if status != requests .codes .ok : # NOQA
19231949 if status == 429 and _delay < 20 :
@@ -1932,7 +1958,9 @@ def get_remote_file_content(
19321958 )
19331959
19341960 else :
1935- raise RemoteNotFetchedException (f"Failed HTTP request from { url } with { status } " )
1961+ raise RemoteNotFetchedException (
1962+ f"Failed HTTP request from { url } with { status } "
1963+ )
19361964
19371965 if headers_only :
19381966 return response .headers , None
@@ -2023,7 +2051,9 @@ def get_other_dists(_package, _dist):
20232051 # if has key data we may look to improve later, but we can move on
20242052 if local_dist .has_key_metadata ():
20252053 local_dist .save_about_and_notice_files (dest_dir = dest_dir )
2026- local_dist .fetch_license_files (dest_dir = dest_dir , use_cached_index = use_cached_index )
2054+ local_dist .fetch_license_files (
2055+ dest_dir = dest_dir , use_cached_index = use_cached_index
2056+ )
20272057 continue
20282058
20292059 # lets try to get from another dist of the same local package
@@ -2035,7 +2065,9 @@ def get_other_dists(_package, _dist):
20352065 # if has key data we may look to improve later, but we can move on
20362066 if local_dist .has_key_metadata ():
20372067 local_dist .save_about_and_notice_files (dest_dir = dest_dir )
2038- local_dist .fetch_license_files (dest_dir = dest_dir , use_cached_index = use_cached_index )
2068+ local_dist .fetch_license_files (
2069+ dest_dir = dest_dir , use_cached_index = use_cached_index
2070+ )
20392071 continue
20402072
20412073 # try to get another version of the same package that is not our version
@@ -2072,7 +2104,9 @@ def get_other_dists(_package, _dist):
20722104 # if has key data we may look to improve later, but we can move on
20732105 if local_dist .has_key_metadata ():
20742106 local_dist .save_about_and_notice_files (dest_dir = dest_dir )
2075- local_dist .fetch_license_files (dest_dir = dest_dir , use_cached_index = use_cached_index )
2107+ local_dist .fetch_license_files (
2108+ dest_dir = dest_dir , use_cached_index = use_cached_index
2109+ )
20762110 continue
20772111
20782112 # try to get a latest version of the same package that is not our version
@@ -2081,7 +2115,9 @@ def get_other_dists(_package, _dist):
20812115 lpn = local_package .name
20822116
20832117 other_remote_packages = [
2084- p for v , p in PYPI_SELFHOSTED_REPO .get_package_versions (lpn ).items () if v != lpv
2118+ p
2119+ for v , p in PYPI_SELFHOSTED_REPO .get_package_versions (lpn ).items ()
2120+ if v != lpv
20852121 ]
20862122
20872123 latest_version = other_remote_packages and other_remote_packages [- 1 ]
@@ -2113,7 +2149,9 @@ def get_other_dists(_package, _dist):
21132149 # if local_dist.has_key_metadata() or not local_dist.has_key_metadata():
21142150 local_dist .save_about_and_notice_files (dest_dir )
21152151
2116- lic_errs = local_dist .fetch_license_files (dest_dir , use_cached_index = use_cached_index )
2152+ lic_errs = local_dist .fetch_license_files (
2153+ dest_dir , use_cached_index = use_cached_index
2154+ )
21172155
21182156 if not local_dist .has_key_metadata ():
21192157 print (f"Unable to add essential ABOUT data for: { local_dist } " )
@@ -2215,12 +2253,20 @@ def download_wheels_with_pip(
22152253
22162254 if error :
22172255 print ()
2218- print ("###########################################################################" )
2219- print ("##################### Failed to fetch all wheels ##########################" )
2220- print ("###########################################################################" )
2256+ print (
2257+ "###########################################################################"
2258+ )
2259+ print (
2260+ "##################### Failed to fetch all wheels ##########################"
2261+ )
2262+ print (
2263+ "###########################################################################"
2264+ )
22212265 print (error )
22222266 print ()
2223- print ("###########################################################################" )
2267+ print (
2268+ "###########################################################################"
2269+ )
22242270
22252271 downloaded = existing ^ set (os .listdir (dest_dir ))
22262272 return sorted (downloaded ), error
0 commit comments