Skip to content

Commit 6ad334b

Browse files
authored
Merge pull request #10047 from DiddiLeija/noxfile.py-annotations-1
2 parents ad9d492 + 6069a3d commit 6ad334b

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

news/10047.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert type annotations into proper annotations in ``noxfile.py``.

noxfile.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
VERSION_FILE = "src/pip/__init__.py"
3434

3535

36-
def run_with_protected_pip(session, *arguments):
37-
# type: (nox.Session, *str) -> None
36+
def run_with_protected_pip(session: nox.Session, *arguments: str) -> None:
3837
"""Do a session.run("pip", *arguments), using a "protected" pip.
3938
4039
This invokes a wrapper script, that forwards calls to original virtualenv
@@ -48,8 +47,7 @@ def run_with_protected_pip(session, *arguments):
4847
session.run(*command, env=env, silent=True)
4948

5049

51-
def should_update_common_wheels():
52-
# type: () -> bool
50+
def should_update_common_wheels() -> bool:
5351
# If the cache hasn't been created, create it.
5452
if not os.path.exists(LOCATIONS["common-wheels"]):
5553
return True
@@ -73,8 +71,7 @@ def should_update_common_wheels():
7371
# `tox -e ...` until this note is removed.
7472
# -----------------------------------------------------------------------------
7573
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "pypy3"])
76-
def test(session):
77-
# type: (nox.Session) -> None
74+
def test(session: nox.Session) -> None:
7875
# Get the common wheels.
7976
if should_update_common_wheels():
8077
# fmt: off
@@ -122,8 +119,7 @@ def test(session):
122119

123120

124121
@nox.session
125-
def docs(session):
126-
# type: (nox.Session) -> None
122+
def docs(session: nox.Session) -> None:
127123
session.install("-e", ".")
128124
session.install("-r", REQUIREMENTS["docs"])
129125

@@ -150,8 +146,7 @@ def get_sphinx_build_command(kind):
150146

151147

152148
@nox.session(name="docs-live")
153-
def docs_live(session):
154-
# type: (nox.Session) -> None
149+
def docs_live(session: nox.Session) -> None:
155150
session.install("-e", ".")
156151
session.install("-r", REQUIREMENTS["docs"], "sphinx-autobuild")
157152

@@ -166,8 +161,7 @@ def docs_live(session):
166161

167162

168163
@nox.session
169-
def lint(session):
170-
# type: (nox.Session) -> None
164+
def lint(session: nox.Session) -> None:
171165
session.install("pre-commit")
172166

173167
if session.posargs:
@@ -179,8 +173,7 @@ def lint(session):
179173

180174

181175
@nox.session
182-
def vendoring(session):
183-
# type: (nox.Session) -> None
176+
def vendoring(session: nox.Session) -> None:
184177
session.install("vendoring>=0.3.0")
185178

186179
if "--upgrade" not in session.posargs:
@@ -238,8 +231,7 @@ def pinned_requirements(path):
238231
# Release Commands
239232
# -----------------------------------------------------------------------------
240233
@nox.session(name="prepare-release")
241-
def prepare_release(session):
242-
# type: (nox.Session) -> None
234+
def prepare_release(session: nox.Session) -> None:
243235
version = release.get_version_from_arguments(session)
244236
if not version:
245237
session.error("Usage: nox -s prepare-release -- <version>")
@@ -272,8 +264,7 @@ def prepare_release(session):
272264

273265

274266
@nox.session(name="build-release")
275-
def build_release(session):
276-
# type: (nox.Session) -> None
267+
def build_release(session: nox.Session) -> None:
277268
version = release.get_version_from_arguments(session)
278269
if not version:
279270
session.error("Usage: nox -s build-release -- YY.N[.P]")
@@ -304,8 +295,7 @@ def build_release(session):
304295
shutil.copy(dist, final)
305296

306297

307-
def build_dists(session):
308-
# type: (nox.Session) -> List[str]
298+
def build_dists(session: nox.Session) -> List[str]:
309299
"""Return dists with valid metadata."""
310300
session.log(
311301
"# Check if there's any Git-untracked files before building the wheel",
@@ -333,8 +323,7 @@ def build_dists(session):
333323

334324

335325
@nox.session(name="upload-release")
336-
def upload_release(session):
337-
# type: (nox.Session) -> None
326+
def upload_release(session: nox.Session) -> None:
338327
version = release.get_version_from_arguments(session)
339328
if not version:
340329
session.error("Usage: nox -s upload-release -- YY.N[.P]")

0 commit comments

Comments
 (0)