Skip to content

Commit 525c0b3

Browse files
authored
Type annotate release.py (#7951)
1 parent 46d2a94 commit 525c0b3

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

release.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
import os
88
import subprocess
99
import time
10+
import typing
1011
import zipfile
1112

1213
import click
1314
import requests
1415

1516

16-
def run(*args, **kwargs):
17+
def run(*args: str) -> None:
1718
print("[running] {0}".format(list(args)))
18-
subprocess.check_call(list(args), **kwargs)
19+
subprocess.check_call(list(args))
1920

2021

21-
def wait_for_build_complete_github_actions(session, token, run_url):
22+
def wait_for_build_complete_github_actions(
23+
session: requests.Session, token: str, run_url: str
24+
) -> None:
2225
while True:
2326
response = session.get(
2427
run_url,
@@ -33,7 +36,9 @@ def wait_for_build_complete_github_actions(session, token, run_url):
3336
time.sleep(3)
3437

3538

36-
def download_artifacts_github_actions(session, token, run_url):
39+
def download_artifacts_github_actions(
40+
session: requests.Session, token: str, run_url: str
41+
) -> typing.List[str]:
3742
response = session.get(
3843
run_url,
3944
headers={
@@ -76,7 +81,9 @@ def download_artifacts_github_actions(session, token, run_url):
7681
return paths
7782

7883

79-
def fetch_github_actions_artifacts(token, version):
84+
def fetch_github_actions_artifacts(
85+
token: str, version: str
86+
) -> typing.List[str]:
8087
session = requests.Session()
8188

8289
response = session.get(
@@ -90,14 +97,14 @@ def fetch_github_actions_artifacts(token, version):
9097
},
9198
)
9299
response.raise_for_status()
93-
run_url = response.json()["workflow_runs"][0]["url"]
100+
run_url: str = response.json()["workflow_runs"][0]["url"]
94101
wait_for_build_complete_github_actions(session, token, run_url)
95102
return download_artifacts_github_actions(session, token, run_url)
96103

97104

98105
@click.command()
99106
@click.argument("version")
100-
def release(version):
107+
def release(version: str) -> None:
101108
"""
102109
``version`` should be a string like '0.4' or '1.0'.
103110
"""

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ extras =
6262
deps =
6363
mypy
6464
types-pytz
65+
types-requests
6566
check-manifest
6667
commands =
6768
ruff .
6869
black --check .
6970
check-manifest
70-
mypy src/cryptography/ vectors/cryptography_vectors/ tests/
71+
mypy src/cryptography/ vectors/cryptography_vectors/ tests/ release.py
7172

7273
[testenv:rust]
7374
basepython = python3

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy