Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/chardet/enums.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2All of the Enums that are used throughout the chardet package.
4:author: Dan Blanchard (dan.blanchard@gmail.com)
5"""
7from enum import Enum, Flag
10class InputState:
11 """
12 This enum represents the different states a universal detector can be in.
13 """
15 PURE_ASCII = 0
16 ESC_ASCII = 1
17 HIGH_BYTE = 2
20class LanguageFilter(Flag):
21 """
22 This enum represents the different language filters we can apply to a
23 ``UniversalDetector``.
24 """
26 NONE = 0x00
27 CHINESE_SIMPLIFIED = 0x01
28 CHINESE_TRADITIONAL = 0x02
29 JAPANESE = 0x04
30 KOREAN = 0x08
31 NON_CJK = 0x10
32 ALL = 0x1F
33 CHINESE = CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL
34 CJK = CHINESE | JAPANESE | KOREAN
37class ProbingState(Enum):
38 """
39 This enum represents the different states a prober can be in.
40 """
42 DETECTING = 0
43 FOUND_IT = 1
44 NOT_ME = 2
47class MachineState:
48 """
49 This enum represents the different states a state machine can be in.
50 """
52 START = 0
53 ERROR = 1
54 ITS_ME = 2
57class SequenceLikelihood:
58 """
59 This enum represents the likelihood of a character following the previous one.
60 """
62 NEGATIVE = 0
63 UNLIKELY = 1
64 LIKELY = 2
65 POSITIVE = 3
67 @classmethod
68 def get_num_categories(cls) -> int:
69 """:returns: The number of likelihood categories in the enum."""
70 return 4
73class CharacterCategory:
74 """
75 This enum represents the different categories language models for
76 ``SingleByteCharsetProber`` put characters into.
78 Anything less than CONTROL is considered a letter.
79 """
81 UNDEFINED = 255
82 LINE_BREAK = 254
83 SYMBOL = 253
84 DIGIT = 252
85 CONTROL = 251