Skip to content

Commit a4e60d9

Browse files
committed
Reformatting unrelated files as the tests keep failing
Signed-off-by: Bennati, Stefano <stefano.bennati@here.com>
1 parent 669cd4c commit a4e60d9

25 files changed

+1159
-779
lines changed

docs/source/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737

3838
intersphinx_mapping = {
3939
"aboutcode": ("https://aboutcode.readthedocs.io/en/latest/", None),
40-
"scancode-workbench": ("https://scancode-workbench.readthedocs.io/en/develop/", None),
40+
"scancode-workbench": (
41+
"https://scancode-workbench.readthedocs.io/en/develop/",
42+
None,
43+
),
4144
}
4245

4346

etc/scripts/fetch_thirdparty.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ def fetch_thirdparty(
187187
environments = None
188188
if wheels:
189189
evts = itertools.product(python_versions, operating_systems)
190-
environments = [utils_thirdparty.Environment.from_pyver_and_os(pyv, os) for pyv, os in evts]
190+
environments = [
191+
utils_thirdparty.Environment.from_pyver_and_os(pyv, os) for pyv, os in evts
192+
]
191193

192194
# Collect PyPI repos
193195
repos = []
@@ -258,7 +260,9 @@ def fetch_thirdparty(
258260
print(f" {sd}")
259261

260262
print(f"==> FETCHING OR CREATING ABOUT AND LICENSE FILES")
261-
utils_thirdparty.fetch_abouts_and_licenses(dest_dir=dest_dir, use_cached_index=use_cached_index)
263+
utils_thirdparty.fetch_abouts_and_licenses(
264+
dest_dir=dest_dir, use_cached_index=use_cached_index
265+
)
262266
utils_thirdparty.clean_about_files(dest_dir=dest_dir)
263267

264268
# check for problems

etc/scripts/test_utils_pip_compatibility_tags.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def test_manylinux2010_implies_manylinux1(self, manylinux2010, manylinux1):
9595
Specifying manylinux2010 implies manylinux1.
9696
"""
9797
groups = {}
98-
supported = utils_pip_compatibility_tags.get_supported(platforms=[manylinux2010])
98+
supported = utils_pip_compatibility_tags.get_supported(
99+
platforms=[manylinux2010]
100+
)
99101
for tag in supported:
100102
groups.setdefault((tag.interpreter, tag.abi), []).append(tag.platform)
101103

etc/scripts/utils_dejacode.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333

3434
def can_do_api_calls():
3535
if not DEJACODE_API_KEY and DEJACODE_API_URL:
36-
print("DejaCode DEJACODE_API_KEY and DEJACODE_API_URL not configured. Doing nothing")
36+
print(
37+
"DejaCode DEJACODE_API_KEY and DEJACODE_API_URL not configured. Doing nothing"
38+
)
3739
return False
3840
else:
3941
return True
@@ -153,7 +155,8 @@ def find_latest_dejacode_package(distribution):
153155
with_versions = sorted(with_versions)
154156
latest_version, latest_package_version = sorted(with_versions)[-1]
155157
print(
156-
f"Found DejaCode latest version: {latest_version} " f"for dist: {distribution.package_url}",
158+
f"Found DejaCode latest version: {latest_version} "
159+
f"for dist: {distribution.package_url}",
157160
)
158161

159162
return latest_package_version

etc/scripts/utils_pypi_supported_tags.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ def is_supported_platform_tag(platform_tag):
8282
if platform_tag in _allowed_platforms:
8383
return True
8484
m = _macosx_platform_re.match(platform_tag)
85-
if m and m.group("major") in _macosx_major_versions and m.group("arch") in _macosx_arches:
85+
if (
86+
m
87+
and m.group("major") in _macosx_major_versions
88+
and m.group("arch") in _macosx_arches
89+
):
8690
return True
8791
m = _manylinux_platform_re.match(platform_tag)
8892
if m and m.group("arch") in _manylinux_arches:

etc/scripts/utils_requirements.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def get_required_name_versions(requirement_lines, with_unpinned=False):
4242
if req_line.startswith("-") or (not with_unpinned and not "==" in req_line):
4343
print(f"Requirement line is not supported: ignored: {req_line}")
4444
continue
45-
yield get_required_name_version(requirement=req_line, with_unpinned=with_unpinned)
45+
yield get_required_name_version(
46+
requirement=req_line, with_unpinned=with_unpinned
47+
)
4648

4749

4850
def get_required_name_version(requirement, with_unpinned=False):
@@ -70,7 +72,9 @@ def get_required_name_version(requirement, with_unpinned=False):
7072
if with_unpinned:
7173
version = ""
7274
else:
73-
assert is_pinned and version, f"Requirement version must be pinned: {requirement}"
75+
assert (
76+
is_pinned and version
77+
), f"Requirement version must be pinned: {requirement}"
7478
return name, version
7579

7680

@@ -112,7 +116,9 @@ def get_installed_reqs(site_packages_dir):
112116
as a text.
113117
"""
114118
if not os.path.exists(site_packages_dir):
115-
raise Exception(f"site_packages directory: {site_packages_dir!r} does not exists")
119+
raise Exception(
120+
f"site_packages directory: {site_packages_dir!r} does not exists"
121+
)
116122
# Also include these packages in the output with --all: wheel, distribute,
117123
# setuptools, pip
118124
args = ["pip", "freeze", "--exclude-editable", "--all", "--path", site_packages_dir]

etc/scripts/utils_thirdparty.py

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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

12921307
def 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

Comments
 (0)