Skip to content

Commit b3e63e9

Browse files
committed
fixes for mypy
1 parent 1379c27 commit b3e63e9

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

packages/help/docfx_helper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@
1515
import argparse
1616
import pathlib
1717
import shutil
18+
from typing import Any, Dict, List, Union
1819
import yaml
1920
import pypandoc
2021

21-
def build_docfx(current_dir, repo_root, docs_map):
22+
def build_docfx(
23+
current_dir: Union[str, pathlib.Path],
24+
repo_root: Union[str, pathlib.Path],
25+
docs_map: Dict[str, str],
26+
) -> None:
2227
current_dir = pathlib.Path(current_dir)
2328
repo_root = pathlib.Path(repo_root)
2429
output_dir = current_dir / "docs" / "_build"

packages/help/mypy.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[mypy]
2-
python_version = 3.10
2+
python_version = 3.9
33
ignore_missing_imports = True
44
strict = True
5+
disallow_untyped_decorators = False
56
show_error_codes = True
7+
explicit_package_bases = True
8+
namespace_packages = True

packages/help/noxfile.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pathlib
1818
import nox
1919

20-
DEFAULT_PYTHON_VERSION = "3.14"
20+
DEFAULT_PYTHON_VERSION = "3.12"
2121
ALL_PYTHON = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
2222
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
2323
REPO_ROOT = CURRENT_DIRECTORY.parent.parent
@@ -43,27 +43,27 @@
4343
nox.options.error_on_missing_interpreters = True
4444

4545
@nox.session(python=DEFAULT_PYTHON_VERSION)
46-
def lint_setup_py(session):
46+
def lint_setup_py(session: nox.Session) -> None:
4747
"""Verify that setup.py is valid."""
4848
session.install("setuptools")
4949
session.run("python", "setup.py", "check", "--strict")
5050

5151
@nox.session(python=ALL_PYTHON)
52-
def unit(session):
52+
def unit(session: nox.Session) -> None:
5353
"""Run unit tests."""
5454
session.install("pytest", "pytest-cov")
5555
session.install("-e", ".")
5656
session.run("pytest", "tests")
5757

5858
@nox.session(python=DEFAULT_PYTHON_VERSION)
59-
def mypy(session):
59+
def mypy(session: nox.Session) -> None:
6060
"""Run mypy."""
6161
session.install("mypy", "types-PyYAML")
6262
session.install("-e", ".")
6363
session.run("mypy", "help", "tests", "noxfile.py", "docfx_helper.py")
6464

6565
@nox.session(python=DEFAULT_PYTHON_VERSION)
66-
def prerelease_deps(session):
66+
def prerelease_deps(session: nox.Session) -> None:
6767
"""Run unit tests with prerelease dependencies."""
6868
# Since we have no dependencies, this is just a normal unit test run
6969
# but with --pre enabled for any test tools.
@@ -72,21 +72,21 @@ def prerelease_deps(session):
7272
session.run("pytest", "tests")
7373

7474
@nox.session(python=DEFAULT_PYTHON_VERSION)
75-
def core_deps_from_source(session):
75+
def core_deps_from_source(session: nox.Session) -> None:
7676
"""Run unit tests with core dependencies installed from source."""
7777
# We don't depend on core, so we just run unit tests.
7878
session.install("pytest", "pytest-cov")
7979
session.install("-e", ".")
8080
session.run("pytest", "tests")
8181

8282
@nox.session(python=DEFAULT_PYTHON_VERSION)
83-
def lint(session):
83+
def lint(session: nox.Session) -> None:
8484
"""Run linters."""
8585
session.install("ruff")
8686
session.run("ruff", "check", ".")
8787

8888
@nox.session(python="3.10")
89-
def docfx(session):
89+
def docfx(session: nox.Session) -> None:
9090
"""Build the docfx yaml files for this library."""
9191
session.install("PyYAML", "pypandoc")
9292

@@ -101,6 +101,6 @@ def docfx(session):
101101
session.run("python", "docfx_helper.py", *args)
102102

103103
@nox.session(python=DEFAULT_PYTHON_VERSION)
104-
def docs(session):
104+
def docs(session: nox.Session) -> None:
105105
"""No-op session for docs."""
106106
session.log("This package does not have Sphinx documentation.")

packages/help/tests/test_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414

1515
from help import version
1616

17-
def test_version():
17+
def test_version() -> None:
1818
assert version.__version__ is not None

0 commit comments

Comments
 (0)