diff options
| -rw-r--r-- | unidecode/__init__.py | 7 | ||||
| -rw-r--r-- | unidecode/__init__.pyi | 5 |
2 files changed, 4 insertions, 8 deletions
diff --git a/unidecode/__init__.py b/unidecode/__init__.py index aeb24e0..20a8c43 100644 --- a/unidecode/__init__.py +++ b/unidecode/__init__.py @@ -18,11 +18,12 @@ b'Knosos' """ import warnings from sys import version_info +from typing import Optional Cache = {} class UnidecodeError(ValueError): - def __init__(self, message, index=None): + def __init__(self, message: str, index: Optional[int] = None) -> None: """Raised for Unidecode-related errors. The index attribute contains the index of the character that caused @@ -32,7 +33,7 @@ class UnidecodeError(ValueError): self.index = index -def unidecode_expect_ascii(string, errors='ignore', replace_str='?'): +def unidecode_expect_ascii(string: str, errors: str = 'ignore', replace_str: str = '?') -> str: """Transliterate an Unicode object into an ASCII string >>> unidecode("\u5317\u4EB0") @@ -65,7 +66,7 @@ def unidecode_expect_ascii(string, errors='ignore', replace_str='?'): return _unidecode(string, errors, replace_str) -def unidecode_expect_nonascii(string, errors='ignore', replace_str='?'): +def unidecode_expect_nonascii(string: str, errors: str = 'ignore', replace_str: str = '?') -> str: """Transliterate an Unicode object into an ASCII string >>> unidecode("\u5317\u4EB0") diff --git a/unidecode/__init__.pyi b/unidecode/__init__.pyi index 5963674..e3889ca 100644 --- a/unidecode/__init__.pyi +++ b/unidecode/__init__.pyi @@ -4,8 +4,3 @@ 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 |
