python (3.11.7)

(root)/
lib/
python3.11/
encodings/
raw_unicode_escape.py
       1  """ Python 'raw-unicode-escape' Codec
       2  
       3  
       4  Written by Marc-Andre Lemburg (mal@lemburg.com).
       5  
       6  (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
       7  
       8  """
       9  import codecs
      10  
      11  ### Codec APIs
      12  
      13  class ESC[4;38;5;81mCodec(ESC[4;38;5;149mcodecsESC[4;38;5;149m.ESC[4;38;5;149mCodec):
      14  
      15      # Note: Binding these as C functions will result in the class not
      16      # converting them to methods. This is intended.
      17      encode = codecs.raw_unicode_escape_encode
      18      decode = codecs.raw_unicode_escape_decode
      19  
      20  class ESC[4;38;5;81mIncrementalEncoder(ESC[4;38;5;149mcodecsESC[4;38;5;149m.ESC[4;38;5;149mIncrementalEncoder):
      21      def encode(self, input, final=False):
      22          return codecs.raw_unicode_escape_encode(input, self.errors)[0]
      23  
      24  class ESC[4;38;5;81mIncrementalDecoder(ESC[4;38;5;149mcodecsESC[4;38;5;149m.ESC[4;38;5;149mBufferedIncrementalDecoder):
      25      def _buffer_decode(self, input, errors, final):
      26          return codecs.raw_unicode_escape_decode(input, errors, final)
      27  
      28  class ESC[4;38;5;81mStreamWriter(ESC[4;38;5;149mCodec,ESC[4;38;5;149mcodecsESC[4;38;5;149m.ESC[4;38;5;149mStreamWriter):
      29      pass
      30  
      31  class ESC[4;38;5;81mStreamReader(ESC[4;38;5;149mCodec,ESC[4;38;5;149mcodecsESC[4;38;5;149m.ESC[4;38;5;149mStreamReader):
      32      def decode(self, input, errors='strict'):
      33          return codecs.raw_unicode_escape_decode(input, errors, False)
      34  
      35  ### encodings module API
      36  
      37  def getregentry():
      38      return codecs.CodecInfo(
      39          name='raw-unicode-escape',
      40          encode=Codec.encode,
      41          decode=Codec.decode,
      42          incrementalencoder=IncrementalEncoder,
      43          incrementaldecoder=IncrementalDecoder,
      44          streamwriter=StreamWriter,
      45          streamreader=StreamReader,
      46      )