-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add chardet.universaldetector (#3734)
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from typing import Any | ||
from .universaldetector import UniversalDetector as UniversalDetector | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ... |