forked from pandas-dev/pandas-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
45 lines (36 loc) · 1.03 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import dataclasses
from functools import partial
from typing import Literal
from scripts._job import run_job
from scripts.test import _step
_SRC_STEPS = [_step.mypy_src, _step.pyright_src, _step.pytest, _step.style]
_DIST_STEPS = [
_step.build_dist,
_step.install_dist,
_step.rename_src,
_step.mypy_dist,
_step.pyright_dist,
]
def test(
src: bool = False,
dist: bool = False,
type_checker: Literal["", "mypy", "pyright"] = "",
):
steps = []
if src:
steps.extend(_SRC_STEPS)
if dist:
steps.extend(_DIST_STEPS)
if type_checker:
# either pyright or mypy
remove = "mypy" if type_checker == "pyright" else "pyright"
steps = [step for step in steps if remove not in step.name]
run_job(steps)
def stubtest(allowlist: str, check_missing: bool):
stubtest = dataclasses.replace(
_step.stubtest,
run=partial(
_step.stubtest.run, allowlist=allowlist, check_missing=check_missing
),
)
run_job(_DIST_STEPS[:2] + [stubtest])