mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
add chardet.universaldetector (#3734)
This commit is contained in:
4
third_party/2and3/chardet/__init__.pyi
vendored
Normal file
4
third_party/2and3/chardet/__init__.pyi
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
from typing import Any
|
||||
from .universaldetector import UniversalDetector as UniversalDetector
|
||||
|
||||
def __getattr__(name: str) -> Any: ... # incomplete
|
||||
31
third_party/2and3/chardet/universaldetector.pyi
vendored
Normal file
31
third_party/2and3/chardet/universaldetector.pyi
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import sys
|
||||
from typing import Dict, Union, AnyStr, Pattern, Optional
|
||||
from typing_extensions import TypedDict
|
||||
from logging import Logger
|
||||
|
||||
class _FinalResultType(TypedDict):
|
||||
encoding: str
|
||||
confidence: float
|
||||
language: str
|
||||
|
||||
class _IntermediateResultType(TypedDict):
|
||||
encoding: Optional[str]
|
||||
confidence: float
|
||||
language: Optional[str]
|
||||
|
||||
class UniversalDetector(object):
|
||||
MINIMUM_THRESHOLD: float
|
||||
HIGH_BYTE_DETECTOR: Pattern[bytes]
|
||||
ESC_DETECTOR: Pattern[bytes]
|
||||
WIN_BYTE_DETECTOR: Pattern[bytes]
|
||||
ISO_WIN_MAP: Dict[str, str]
|
||||
|
||||
result: _IntermediateResultType
|
||||
done: bool
|
||||
lang_filter: int
|
||||
logger: Logger
|
||||
|
||||
def __init__(self, lang_filter: int) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def feed(self, byte_str: bytes) -> None: ...
|
||||
def close(self) -> _FinalResultType: ...
|
||||
Reference in New Issue
Block a user