Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
uberzzr committed Jul 5, 2023
1 parent 8b9e8d6 commit 2e46381
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions bazelisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ def get_version_history(bazelisk_directory):
),
# This only handles versions with numeric components, but that is fine
# since prerelease versions have been excluded.
key=lambda version: tuple(int(component)
for component in version.split('.')),
key=lambda version: tuple(int(component) for component in version.split(".")),
reverse=True,
)

Expand Down Expand Up @@ -308,8 +307,8 @@ def download_bazel_into_directory(version, is_commit, directory):

sha256_path = destination_path + ".sha256"
expected_hash = ""
matcher=re.compile(r"(\d*\.\d*(?:\.\d*)?)(rc\d+)?")
matched=matcher.match(version)
matcher = re.compile(r"(\d*\.\d*(?:\.\d*)?)(rc\d+)?")
matched = matcher.match(version)
if not os.path.exists(sha256_path):
try:
download(bazel_url + ".sha256", sha256_path)
Expand All @@ -322,13 +321,13 @@ def download_bazel_into_directory(version, is_commit, directory):
return destination_path
if matched:
(version, rc) = matched.groups()
fallback_url="https://releases.bazel.build/{}/{}/{}".format(
fallback_url = "https://releases.bazel.build/{}/{}/{}".format(
version, rc if rc else "release", bazel_filename
)
try:
download("{}.sha256".format(fallback_url), sha256_path)
os.remove(destination_path)
download(fallback_url,destination_path)
download(fallback_url, destination_path)
except HTTPError:
return destination_path
os.chmod(destination_path, 0o755)
Expand All @@ -350,12 +349,12 @@ def download_bazel_into_directory(version, is_commit, directory):
)
if matched:
(version, rc) = matched.groups()
fallback_url="https://releases.bazel.build/{}/{}/{}".format(
fallback_url = "https://releases.bazel.build/{}/{}/{}".format(
version, rc if rc else "release", bazel_filename
)
try:
download("{}.sha256".format(fallback_url), sha256_path)
download(fallback_url,destination_path)
download(fallback_url, destination_path)
except HTTPError:
exit(22)
os.chmod(destination_path, 0o755)
Expand Down

0 comments on commit 2e46381

Please sign in to comment.