From cbd15f579d65b8caf0f195b53cebfb879b25f19c Mon Sep 17 00:00:00 2001 From: Matt Wala <wala1@illinois.edu> Date: Wed, 3 Jun 2020 00:57:34 -0500 Subject: [PATCH] Add stubs for pytools --- MANIFEST.in | 1 + pytato/stubs/pytools.pyi | 11 +++++++++++ run-mypy.sh | 1 + setup.cfg | 4 ---- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 MANIFEST.in create mode 100644 pytato/stubs/pytools.pyi diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d887c9f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include pytato *.pyi diff --git a/pytato/stubs/pytools.pyi b/pytato/stubs/pytools.pyi new file mode 100644 index 0000000..82531cc --- /dev/null +++ b/pytato/stubs/pytools.pyi @@ -0,0 +1,11 @@ +# FIXME: Should be in pytools +from typing import TypeVar, Iterable, Optional + +T = TypeVar("T") + +def memoize_method(f: T) -> T: ... +def is_single_valued(it: Iterable[T]) -> bool: ... + +class UniqueNameGenerator: + def __init__(self, existing_names: Optional[Iterable[str]], forced_prefix: str=""): ... + def __call__(self, based_on: str = "") -> str: ... diff --git a/run-mypy.sh b/run-mypy.sh index 14730b1..72b4e41 100755 --- a/run-mypy.sh +++ b/run-mypy.sh @@ -1,3 +1,4 @@ #! /bin/bash +export MYPYPATH=$MYPYPATH:pytato/stubs/ mypy --strict pytato diff --git a/setup.cfg b/setup.cfg index 9984342..7b0c351 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,3 @@ ignore_missing_imports = True [mypy-pyopencl] ignore_missing_imports = True - -[mypy-pytools] -ignore_missing_imports = True - -- GitLab