mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Add stubs for docopt package (#5248)
* Add stubs for `docopt` package Add the single stub for the simple, but fairly well-used [docopt](https://github.com/docopt/docopt) package. It looks like that project is not very well maintained, so I thought it would be easier to add the type annotations here, as opposed to there, upstream. This has even been requested a few times in https://github.com/docopt/docopt/issues/471. It appeared to me that only the `docopt()` function is the public API, so I didn't include the rest of the module's functions and attributes.
This commit is contained in:
3
stubs/docopt/METADATA.toml
Normal file
3
stubs/docopt/METADATA.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Prior to v0.6, docopt() had only 3 optional args
|
||||
version = "0.6"
|
||||
python2 = true
|
||||
13
stubs/docopt/docopt.pyi
Normal file
13
stubs/docopt/docopt.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Iterable, Optional, Union
|
||||
|
||||
__version__: str
|
||||
|
||||
_Argv = Union[Iterable[str], str]
|
||||
|
||||
def docopt(
|
||||
doc: str,
|
||||
argv: Optional[_Argv] = ...,
|
||||
help: bool = ...,
|
||||
version: Optional[Any] = ...,
|
||||
options_first: bool = ...,
|
||||
) -> dict[str, Any]: ... # Really should be dict[str, Union[str, bool]]
|
||||
Reference in New Issue
Block a user