add stubs for language models (#3848)

* add stubs for language models

* fix syntax error in __init__.pyi

* fix syntax error in universaldetector.pyi

* remove erroneous imports

* delete cli directory

* make tuple types variable length
This commit is contained in:
Julin S
2020-05-28 08:13:04 +05:30
committed by GitHub
parent a1c6566abe
commit 851efa550e
11 changed files with 126 additions and 2 deletions

View File

@@ -1,4 +1,26 @@
from typing import Any
import sys
from typing import Any, Tuple
from .universaldetector import UniversalDetector as UniversalDetector
def __getattr__(name: str) -> Any: ... # incomplete
if sys.version_info >= (3, 8):
from typing import TypedDict
else:
from typing_extensions import TypedDict
class _LangModelType(TypedDict):
char_to_order_map: Tuple[int, ...]
precedence_matrix: Tuple[int, ...]
typical_positive_ratio: float
keep_english_letter: bool
charset_name: str
language: str
class _SMModelType(TypedDict):
class_table: Tuple[int, ...]
class_factor: int
state_table: Tuple[int, ...]
char_len_table: Tuple[int, ...]
name: str

40
third_party/2and3/chardet/enums.pyi vendored Normal file
View File

@@ -0,0 +1,40 @@
class InputState(object):
PURE_ASCII: int
ESC_ASCII: int
HIGH_BYTE: int
class LanguageFilter(object):
CHINESE_SIMPLIFIED: int
CHINESE_TRADITIONAL: int
JAPANESE: int
KOREAN: int
NON_CJK: int
ALL: int
CHINESE: int
CJK: int
class ProbingState(object):
DETECTING: int
FOUND_IT: int
NOT_ME: int
class MachineState(object):
START: int
ERROR: int
ITS_ME: int
class SequenceLikelihood(object):
NEGATIVE: int
UNLIKELY: int
LIKELY: int
POSITIVE: int
@classmethod
def get_num_categories(cls) -> int: ...
class CharacterCategory(object):
UNDEFINED: int
LINE_BREAK: int
SYMBOL: int
DIGIT: int
CONTROL: int

View File

@@ -0,0 +1,8 @@
from typing import Tuple
from . import _LangModelType
Latin5_BulgarianCharToOrderMap: Tuple[int, ...]
win1251BulgarianCharToOrderMap: Tuple[int, ...]
BulgarianLangModel: Tuple[int, ...]
Latin5BulgarianModel: _LangModelType
Win1251BulgarianModel: _LangModelType

View File

@@ -0,0 +1,16 @@
from typing import Tuple
from . import _LangModelType
KOI8R_char_to_order_map: Tuple[int, ...]
win1251_char_to_order_map: Tuple[int, ...]
latin5_char_to_order_map: Tuple[int, ...]
macCyrillic_char_to_order_map: Tuple[int, ...]
IBM855_char_to_order_map: Tuple[int, ...]
IBM866_char_to_order_map: Tuple[int, ...]
RussianLangModel: Tuple[int, ...]
Koi8rModel: _LangModelType
Win1251CyrillicModel: _LangModelType
Latin5CyrillicModel: _LangModelType
MacCyrillicModel: _LangModelType
Ibm866Model: _LangModelType
Ibm855Model: _LangModelType

View File

@@ -0,0 +1,8 @@
from typing import Tuple
from . import _LangModelType
Latin7_char_to_order_map: Tuple[int, ...]
win1253_char_to_order_map: Tuple[int, ...]
GreekLangModel: Tuple[int, ...]
Latin7GreekModel: _LangModelType
Win1253GreekModel: _LangModelType

View File

@@ -0,0 +1,6 @@
from typing import Tuple
from . import _LangModelType
WIN1255_CHAR_TO_ORDER_MAP: Tuple[int, ...]
HEBREW_LANG_MODEL: Tuple[int, ...]
Win1255HebrewModel: _LangModelType

View File

@@ -0,0 +1,8 @@
from typing import Tuple
from . import _LangModelType
Latin2_HungarianCharToOrderMap: Tuple[int, ...]
win1250HungarianCharToOrderMap: Tuple[int, ...]
HungarianLangModel: Tuple[int, ...]
Latin2HungarianModel: _LangModelType
Win1250HungarianModel: _LangModelType

View File

@@ -0,0 +1,6 @@
from typing import Tuple
from . import _LangModelType
TIS620CharToOrderMap: Tuple[int, ...]
ThaiLangModel: Tuple[int, ...]
TIS620ThaiModel: _LangModelType

View File

@@ -0,0 +1,6 @@
from typing import Tuple
from . import _LangModelType
Latin5_TurkishCharToOrderMap: Tuple[int, ...]
TurkishLangModel: Tuple[int, ...]
Latin5TurkishModel: _LangModelType

View File

@@ -1,5 +1,5 @@
import sys
from typing import Dict, Union, AnyStr, Pattern, Optional
from typing import Dict, Pattern, Optional
from typing_extensions import TypedDict
from logging import Logger

4
third_party/2and3/chardet/version.pyi vendored Normal file
View File

@@ -0,0 +1,4 @@
from typing import List
__version__: str
VERSION: List[str]