
    9h,                         S SK rS SKJr  S SKJr  / SQr " S S\\5      r " S S\	5      r
 " S	 S
\5      r " S S\	5      r " S S\	5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)    N)Enum)KafkaException)DeserializerIntegerDeserializerIntegerSerializerDoubleDeserializerDoubleSerializerStringDeserializerStringSerializerMessageFieldSerializationContextSerializationError
Serializerc                   2    \ rS rSrSrSrSrSrS\4S jr	Sr
g	)
r   $   zz
Enum like object for identifying Message fields.

Attributes:
    KEY (str): Message key

    VALUE (str): Message value
nonekeyvaluereturnc                 ,    [        U R                  5      $ N)strr   )selfs    kC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\confluent_kafka/serialization/__init__.py__str__MessageField.__str__2   s    4::     N)__name__
__module____qualname____firstlineno____doc__NONEKEYVALUEr   r   __static_attributes__r   r   r   r   r   $   s$     D
CE r   r   c                   "    \ rS rSrSrSS jrSrg)r   6   aj  
SerializationContext provides additional context to the
serializer/deserializer about the data it's serializing/deserializing.

Args:
    topic (str): Topic data is being produce to or consumed from.

    field (MessageField): Describes what part of the message is
        being serialized.

    headers (list): List of message header tuples. Defaults to None.
Nc                 (    Xl         X l        X0l        g r   )topicfieldheaders)r   r+   r,   r-   s       r   __init__SerializationContext.__init__D   s    

r   )r,   r-   r+   r   )r   r    r!   r"   r#   r.   r'   r   r   r   r   r   6   s    r   r   c                       \ rS rSrSrSrg)r   J   z%Generic error from serializer packager   N)r   r    r!   r"   r#   r'   r   r   r   r   r   J   s    /r   r   c                   &    \ rS rSrSr/ rSS jrSrg)r   O   a  
Extensible class from which all Serializer implementations derive.
Serializers instruct Kafka clients on how to convert Python objects
to bytes.

See built-in implementations, listed below, for an example of how to
extend this class.

Note:
    This class is not directly instantiable. The derived classes must be
    used instead.

The following implementations are provided by this module.

Note:
    Unless noted elsewhere all numeric types are signed and serialization
    is big-endian.

.. list-table::
    :header-rows: 1

    * - Name
      - Type
      - Binary Format
    * - DoubleSerializer
      - float
      - IEEE 764 binary64
    * - IntegerSerializer
      - int
      - int32
    * - StringSerializer
      - unicode
      - unicode(encoding)
Nc                     [         e)a!  
Converts obj to bytes.

Args:
    obj (object): object to be serialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Raises:
    SerializerError if an error occurs during serialization

Returns:
    bytes if obj is not None, otherwise None
NotImplementedError)r   objctxs      r   __call__Serializer.__call__u   
    " "!r   r   r   r   r    r!   r"   r#   	__slots__r9   r'   r   r   r   r   r   O   s    !F I"r   r   c                   &    \ rS rSrSr/ rSS jrSrg)r      a  
Extensible class from which all Deserializer implementations derive.
Deserializers instruct Kafka clients on how to convert bytes to objects.

See built-in implementations, listed below, for an example of how to
extend this class.

Note:
    This class is not directly instantiable. The derived classes must be
    used instead.

The following implementations are provided by this module.

Note:
    Unless noted elsewhere all numeric types are signed and
    serialization is big-endian.

.. list-table::
    :header-rows: 1

    * - Name
      - Type
      - Binary Format
    * - DoubleDeserializer
      - float
      - IEEE 764 binary64
    * - IntegerDeserializer
      - int
      - int32
    * - StringDeserializer
      - unicode
      - unicode(encoding)
Nc                     [         e)a(  
Convert bytes to object

Args:
    value (bytes): bytes to be deserialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Raises:
    SerializerError if an error occurs during deserialization

Returns:
    object if data is not None, otherwise None
r5   )r   r   r8   s      r   r9   Deserializer.__call__   r;   r   r   r   r<   r   r   r   r   r      s     D I"r   r   c                   "    \ rS rSrSrSS jrSrg)r	      z
Serializes float to IEEE 764 binary64.

See Also:
    `DoubleSerializer Javadoc <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/common/serialization/DoubleSerializer.html>`_

Nc                     Uc  g [         R                  " SU5      $ ! [         R                   a  n[        [	        U5      5      eSnAff = f)aS  
Args:
    obj (object): object to be serialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Note:
    None objects are represented as Kafka Null.

Raises:
    SerializerError if an error occurs during serialization.

Returns:
    IEEE 764 binary64 bytes if obj is not None, otherwise None
N>d_structpackerrorr   r   r   r7   r8   es       r   r9   DoubleSerializer.__call__   sE    $ ;	-<<c**}} 	-$SV,,	-    A
AA
r   r   r   r    r!   r"   r#   r9   r'   r   r   r   r	   r	      s    -r   r	   c                   "    \ rS rSrSrSS jrSrg)r      z
Deserializes float to IEEE 764 binary64.

See Also:
    `DoubleDeserializer Javadoc <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/common/serialization/DoubleDeserializer.html>`_
Nc                     Uc  g [         R                  " SU5      S   $ ! [         R                   a  n[        [	        U5      5      eSnAff = f)aA  
Deserializes float from IEEE 764 binary64 bytes.

Args:
    value (bytes): bytes to be deserialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Raises:
    SerializerError if an error occurs during deserialization.

Returns:
    float if data is not None, otherwise None
NrE   r   rG   unpackrI   r   r   r   r   r8   rK   s       r   r9   DoubleDeserializer.__call__   J    " =	->>$.q11}} 	-$SV,,	-     AAAr   r   rN   r   r   r   r   r          -r   r   c                   "    \ rS rSrSrSS jrSrg)r   i  z
Serializes int to int32 bytes.

See Also:
    `IntegerSerializer Javadoc <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/common/serialization/IntegerSerializer.html>`_
Nc                     Uc  g [         R                  " SU5      $ ! [         R                   a  n[        [	        U5      5      eSnAff = f)aa  
Serializes int as int32 bytes.

Args:
    obj (object): object to be serialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Note:
    None objects are represented as Kafka Null.

Raises:
    SerializerError if an error occurs during serialization

Returns:
    int32 bytes if obj is not None, else None
N>irF   rJ   s       r   r9   IntegerSerializer.__call__  sE    ( ;	-<<c**}} 	-$SV,,	-rM   r   r   rN   r   r   r   r   r     s    -r   r   c                   "    \ rS rSrSrSS jrSrg)r   i-  z
Deserializes int to int32 bytes.

See Also:
    `IntegerDeserializer Javadoc <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/common/serialization/IntegerDeserializer.html>`_
Nc                     Uc  g [         R                  " SU5      S   $ ! [         R                   a  n[        [	        U5      5      eSnAff = f)a1  
Deserializes int from int32 bytes.

Args:
    value (bytes): bytes to be deserialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Raises:
    SerializerError if an error occurs during deserialization.

Returns:
    int if data is not None, otherwise None
Nr[   r   rR   rT   s       r   r9   IntegerDeserializer.__call__5  rV   rW   r   r   rN   r   r   r   r   r   -  rX   r   r   c                   ,    \ rS rSrSrSS jrSS jrSrg)	r   iO  a  
Serializes unicode to bytes per the configured codec. Defaults to ``utf_8``.

Note:
    None objects are represented as Kafka Null.

Args:
    codec (str, optional): encoding scheme. Defaults to utf_8

See Also:
    `Supported encodings <https://docs.python.org/3/library/codecs.html#standard-encodings>`_

    `StringSerializer Javadoc <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/common/serialization/StringSerializer.html>`_
c                     Xl         g r   codecr   rc   s     r   r.   StringSerializer.__init___      
r   Nc                     Uc  g UR                  U R                  5      $ ! [        R                   a  n[	        [        U5      5      eSnAff = f)a  
Serializes a str(py2:unicode) to bytes.

Compatibility Note:
    Python 2 str objects must be converted to unicode objects.
    Python 3 all str objects are already unicode objects.

Args:
    obj (object): object to be serialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Raises:
    SerializerError if an error occurs during serialization.

Returns:
    serialized bytes if obj is not None, otherwise None
N)encoderc   rG   rI   r   r   rJ   s       r   r9   StringSerializer.__call__b  sG    * ;	-::djj))}} 	-$SV,,	-   ! AA		Arb   utf_8r   r   r    r!   r"   r#   r.   r9   r'   r   r   r   r   r   O  s    -r   r   c                   ,    \ rS rSrSrSS jrSS jrSrg)	r
   i  aq  
Deserializes a str(py2:unicode) from bytes.

Args:
    codec (str, optional): encoding scheme. Defaults to utf_8

See Also:
    `Supported encodings <https://docs.python.org/3/library/codecs.html#standard-encodings>`_

    `StringDeserializer Javadoc <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/common/serialization/StringDeserializer.html>`_
c                     Xl         g r   rb   rd   s     r   r.   StringDeserializer.__init__  rf   r   Nc                     Uc  g UR                  U R                  5      $ ! [        R                   a  n[	        [        U5      5      eSnAff = f)a$  
Serializes unicode to bytes per the configured codec. Defaults to ``utf_8``.

Compatibility Note:
    Python 2 str objects must be converted to unicode objects by the
    application prior to using this serializer.

    Python 3 all str objects are already unicode objects.

Args:
    value (bytes): bytes to be deserialized

    ctx (SerializationContext): Metadata pertaining to the serialization
        operation

Raises:
    SerializerError if an error occurs during deserialization.

Returns:
    unicode if data is not None, otherwise None
N)decoderc   rG   rI   r   r   rT   s       r   r9   StringDeserializer.__call__  sG    . =	-<<

++}} 	-$SV,,	-rj   rb   rk   r   rm   r   r   r   r
   r
     s    
-r   r
   )structrG   enumr   confluent_kafka.errorr   __all__r   r   objectr   r   r   r   r	   r   r   r   r   r
   r   r   r   <module>ry      s   $   0
3 $6 (	 	
7" 7"t6"6 6"r!-z !-H- -D"-
 "-J-, -D.-z .-b-- --r   