diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 814ae457..85039a48 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -16,4 +16,4 @@ jobs: python -m pip install --upgrade pip pip install mypy - name: Lint with mypy - run: mypy -m lark_stubs || true + run: mypy -p lark-stubs || true diff --git a/lark_stubs/__init__.pyi b/lark-stubs/__init__.pyi similarity index 100% rename from lark_stubs/__init__.pyi rename to lark-stubs/__init__.pyi diff --git a/lark_stubs/exceptions.pyi b/lark-stubs/exceptions.pyi similarity index 100% rename from lark_stubs/exceptions.pyi rename to lark-stubs/exceptions.pyi diff --git a/lark_stubs/indenter.pyi b/lark-stubs/indenter.pyi similarity index 100% rename from lark_stubs/indenter.pyi rename to lark-stubs/indenter.pyi diff --git a/lark_stubs/lark.pyi b/lark-stubs/lark.pyi similarity index 75% rename from lark_stubs/lark.pyi rename to lark-stubs/lark.pyi index 4dd36ab7..8e5e3dd0 100644 --- a/lark_stubs/lark.pyi +++ b/lark-stubs/lark.pyi @@ -9,11 +9,6 @@ from .lexer import Token, Lexer, TerminalDef from .tree import Tree _T = TypeVar('_T') -_Start = Union[None, str, List[str]] -_Parser = Literal["earley", "lalr", "cyk"] -_Lexer = Union[Literal["auto", "standard", "contextual", "dynamic", "dynamic_complete"], Lexer] -_Ambiguity = Literal["explicit", "resolve"] - class PostLex(Protocol): @@ -22,12 +17,12 @@ class PostLex(Protocol): class LarkOptions: - start: _Start - parser: _Parser - lexer: _Lexer + start: List[str] + parser: str + lexer: str transformer: Optional[Transformer] postlex: Optional[PostLex] - ambiguity: _Ambiguity + ambiguity: str debug: bool keep_all_tokens: bool propagate_positions: bool @@ -47,12 +42,12 @@ class Lark: self, grammar: Union[str, IO[str]], *, - start: _Start = ..., - parser: _Parser = ..., - lexer: _Lexer = ..., + start: Union[None, str, List[str]] = "start", + parser: Literal["earley", "lalr", "cyk"] = "auto", + lexer: Union[Literal["auto", "standard", "contextual", "dynamic", "dynamic_complete"], Lexer] = "auto", transformer: Optional[Transformer] = None, postlex: Optional[PostLex] = None, - ambiguity: _Ambiguity = ..., + ambiguity: Literal["explicit", "resolve"] = "resolve", debug: bool = False, keep_all_tokens: bool = False, propagate_positions: bool = False, @@ -62,7 +57,7 @@ class Lark: ): ... - def parse(self, text: str, start: _Start = None) -> Tree: + def parse(self, text: str, start: Optional[str] = None) -> Tree: ... @classmethod diff --git a/lark_stubs/lexer.pyi b/lark-stubs/lexer.pyi similarity index 100% rename from lark_stubs/lexer.pyi rename to lark-stubs/lexer.pyi diff --git a/lark_stubs/reconstruct.pyi b/lark-stubs/reconstruct.pyi similarity index 100% rename from lark_stubs/reconstruct.pyi rename to lark-stubs/reconstruct.pyi diff --git a/lark_stubs/tree.pyi b/lark-stubs/tree.pyi similarity index 100% rename from lark_stubs/tree.pyi rename to lark-stubs/tree.pyi diff --git a/lark_stubs/visitors.pyi b/lark-stubs/visitors.pyi similarity index 100% rename from lark_stubs/visitors.pyi rename to lark-stubs/visitors.pyi diff --git a/setup.py b/setup.py index cd66bd04..b962b7fc 100644 --- a/setup.py +++ b/setup.py @@ -6,12 +6,12 @@ setup( name = "lark-parser", version = __version__, - packages = ['lark', 'lark.parsers', 'lark.tools', 'lark.grammars', 'lark_stubs'], + packages = ['lark', 'lark.parsers', 'lark.tools', 'lark.grammars', 'lark-stubs'], requires = [], install_requires = [], - package_data = {'': ['*.md', '*.lark'], 'lark_stubs': ['*.pyi']}, + package_data = {'': ['*.md', '*.lark'], 'lark-stubs': ['*.pyi']}, test_suite = 'tests.__main__',