Skip to content

add stubs for language models #3848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion third_party/2and3/chardet/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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 changes: 40 additions & 0 deletions third_party/2and3/chardet/enums.pyi
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions third_party/2and3/chardet/langbulgarianmodel.pyi
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions third_party/2and3/chardet/langcyrillicmodel.pyi
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions third_party/2and3/chardet/langgreekmodel.pyi
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions third_party/2and3/chardet/langhebrewmodel.pyi
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions third_party/2and3/chardet/langhungarianmodel.pyi
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions third_party/2and3/chardet/langthaimodel.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from typing import Tuple
from . import _LangModelType

TIS620CharToOrderMap: Tuple[int, ...]
ThaiLangModel: Tuple[int, ...]
TIS620ThaiModel: _LangModelType
6 changes: 6 additions & 0 deletions third_party/2and3/chardet/langturkishmodel.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from typing import Tuple
from . import _LangModelType

Latin5_TurkishCharToOrderMap: Tuple[int, ...]
TurkishLangModel: Tuple[int, ...]
Latin5TurkishModel: _LangModelType
2 changes: 1 addition & 1 deletion third_party/2and3/chardet/universaldetector.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions third_party/2and3/chardet/version.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from typing import List

__version__: str
VERSION: List[str]