summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Corpet <pascal@bayesimpact.org>2021-02-03 14:05:45 +0100
committerPascal Corpet <pascal@bayesimpact.org>2021-02-03 14:05:45 +0100
commit4a1bf091cc65207704dbb6269603f0d174d229c7 (patch)
tree076fa479c554caa7ce18bf0ff58993b292865996
parent80625ee2a67c9654230bc0617c8911a3d26ea16c (diff)
downloadunidecode-4a1bf091cc65207704dbb6269603f0d174d229c7.tar.gz
Add Typing stubs for the main API.
See PEP 484 (for typing) and PEP 561 (for distributing types).
-rw-r--r--setup.py1
-rw-r--r--unidecode/__init__.pyi11
-rw-r--r--unidecode/py.typed0
3 files changed, 12 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 98c8728..d22aee4 100644
--- a/setup.py
+++ b/setup.py
@@ -19,6 +19,7 @@ setup(
author_email='tomaz.solc@tablix.org',
packages=['unidecode'],
+ package_data={'unidecode': ['py.typed', '__init__.pyi']},
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
test_suite='tests',
diff --git a/unidecode/__init__.pyi b/unidecode/__init__.pyi
new file mode 100644
index 0000000..5963674
--- /dev/null
+++ b/unidecode/__init__.pyi
@@ -0,0 +1,11 @@
+from typing import Any, Dict, Optional, Sequence
+
+Cache: Dict[int, Optional[Sequence[Optional[str]]]]
+
+class UnidecodeError(ValueError):
+ index: Optional[int] = ...
+ def __init__(self, message: str, index: Optional[int] = ...) -> None: ...
+
+def unidecode_expect_ascii(string: str, errors: str = ..., replace_str: str = ...) -> str: ...
+def unidecode_expect_nonascii(string: str, errors: str = ..., replace_str: str = ...) -> str: ...
+unidecode = unidecode_expect_ascii
diff --git a/unidecode/py.typed b/unidecode/py.typed
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/unidecode/py.typed