Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Nov 1, 2022
1 parent d63394b commit b53683e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/xdoctest/__main__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Union
from typing import List

__tests__: str


def main(argv: Union[List[str], None] = None):
...
2 changes: 1 addition & 1 deletion src/xdoctest/constants.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class _NOT_EVAL_TYPE:
__nonzero__: Incomplete


NOT_EVALED: Incomplete
NOT_EVALED: _NOT_EVAL_TYPE
17 changes: 15 additions & 2 deletions src/xdoctest/runner.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,36 @@ from types import ModuleType
from typing import List
from typing import Dict
from typing import Any
from typing import Set
from _typeshed import Incomplete


def log(msg: str, verbose: int) -> None:
def log(msg: str, verbose: int, level: int = 1) -> None:
...


def doctest_callable(func: Callable) -> None:
...


def gather_doctests(doctest_identifiers,
style: str = ...,
analysis: str = ...,
verbose: Incomplete | None = ...) -> None:
...


def doctest_module(module_identifier: Union[str, ModuleType, None] = None,
command: str = None,
argv: Union[List[str], None] = None,
exclude: List[str] = ...,
style: str = ...,
style: str = 'auto',
verbose: Union[int, None] = None,
config: Dict[str, object] = None,
durations: Union[int, None] = None,
analysis: str = 'auto') -> Dict[str, Any]:
...


def undefined_names(sourcecode: str) -> Set[str]:
...
7 changes: 5 additions & 2 deletions src/xdoctest/static_analysis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def parse_calldefs(source: Incomplete | None = ...,
...


def parse_static_value(key: str, source: str = None, fpath: str = None):
def parse_static_value(key: str,
source: str = None,
fpath: str = None) -> object:
...


Expand All @@ -101,7 +103,8 @@ def is_balanced_statement(lines: List[str],
...


def extract_comments(source: str) -> Generator[Any, None, Any]:
def extract_comments(
source: Union[str, List[str]]) -> Generator[Any, None, Any]:
...


Expand Down
22 changes: 14 additions & 8 deletions src/xdoctest/utils/util_import.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from typing import Union
from os import PathLike
from types import ModuleType
from typing import List
from typing import Tuple
from _typeshed import Incomplete


Expand All @@ -23,24 +26,27 @@ class PythonPathContext:
...


def import_module_from_path(modpath: PathLike, index: int = ...) -> ModuleType:
def import_module_from_path(modpath: Union[str, PathLike],
index: int = ...) -> ModuleType:
...


def import_module_from_name(modname: str) -> ModuleType:
...


def modname_to_modpath(modname: str,
hide_init: bool = True,
hide_main: bool = False,
sys_path: list = None) -> str:
def modname_to_modpath(
modname: str,
hide_init: bool = True,
hide_main: bool = False,
sys_path: Union[None, List[Union[str,
PathLike]]] = None) -> str | None:
...


def normalize_modpath(modpath: PathLike,
def normalize_modpath(modpath: Union[str, PathLike],
hide_init: bool = True,
hide_main: bool = False) -> PathLike:
hide_main: bool = False) -> str | PathLike:
...


Expand All @@ -52,5 +58,5 @@ def modpath_to_modname(modpath: str,
...


def split_modpath(modpath: str, check: bool = True) -> tuple:
def split_modpath(modpath: str, check: bool = True) -> Tuple[str, str]:
...

0 comments on commit b53683e

Please sign in to comment.