MCPcopy Index your code
hub / github.com/pyinvoke/invoke / typecheck

Function typecheck

tasks.py:109–129  ·  view source on GitHub ↗

Run type checking against the project.

(c: Context, opts: str = "")

Source from the content-addressed store, hash-verified

107# TODO: hoist up into invocations.checks once proven/needed elsewhere
108@task
109def typecheck(c: Context, opts: str = "") -> None:
110 """
111 Run type checking against the project.
112 """
113 # For now it seems easiest to just run a series of checks on the subtrees
114 # instead of forcing mypy to think about all the "duplicate" files across
115 # test vs integration vs main codebase (think _util.py or test fixtures)
116 # See also the exclude= key in pyproject.toml/mypy.ini.
117 root = Path(__file__).parent
118 exclude = ("sites", "docs", "build", "tests")
119 for path in root.iterdir():
120 if path.name in exclude:
121 continue
122 if not path.is_dir() and path.suffix != ".py":
123 continue
124 if path.is_dir():
125 if path.name.startswith("."):
126 continue
127 if not list(path.rglob("**/*.py")):
128 continue
129 c.run(f"mypy {opts} {path}", pty=True, echo=True)
130
131
132ns = Collection(

Callers

nothing calls this directly

Calls 2

PathClass · 0.85
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…