python (3.11.7)
       1  """
       2  All of the Enums that are used throughout the chardet package.
       3  
       4  :author: Dan Blanchard (dan.blanchard@gmail.com)
       5  """
       6  
       7  from enum import Enum, Flag
       8  
       9  
      10  class ESC[4;38;5;81mInputState:
      11      """
      12      This enum represents the different states a universal detector can be in.
      13      """
      14  
      15      PURE_ASCII = 0
      16      ESC_ASCII = 1
      17      HIGH_BYTE = 2
      18  
      19  
      20  class ESC[4;38;5;81mLanguageFilter(ESC[4;38;5;149mFlag):
      21      """
      22      This enum represents the different language filters we can apply to a
      23      ``UniversalDetector``.
      24      """
      25  
      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
      35  
      36  
      37  class ESC[4;38;5;81mProbingState(ESC[4;38;5;149mEnum):
      38      """
      39      This enum represents the different states a prober can be in.
      40      """
      41  
      42      DETECTING = 0
      43      FOUND_IT = 1
      44      NOT_ME = 2
      45  
      46  
      47  class ESC[4;38;5;81mMachineState:
      48      """
      49      This enum represents the different states a state machine can be in.
      50      """
      51  
      52      START = 0
      53      ERROR = 1
      54      ITS_ME = 2
      55  
      56  
      57  class ESC[4;38;5;81mSequenceLikelihood:
      58      """
      59      This enum represents the likelihood of a character following the previous one.
      60      """
      61  
      62      NEGATIVE = 0
      63      UNLIKELY = 1
      64      LIKELY = 2
      65      POSITIVE = 3
      66  
      67      @classmethod
      68      def get_num_categories(cls) -> int:
      69          """:returns: The number of likelihood categories in the enum."""
      70          return 4
      71  
      72  
      73  class ESC[4;38;5;81mCharacterCategory:
      74      """
      75      This enum represents the different categories language models for
      76      ``SingleByteCharsetProber`` put characters into.
      77  
      78      Anything less than CONTROL is considered a letter.
      79      """
      80  
      81      UNDEFINED = 255
      82      LINE_BREAK = 254
      83      SYMBOL = 253
      84      DIGIT = 252
      85      CONTROL = 251