o
    NDiN                     @   s  d dl Z G dd de jZe de  dZdeeeZ	G dd de
Zejd	ejd
ejdejdejdejdejdejdejdejdejdie_ejejejejejejejejejejejde_dd ZG dd de
ZG dd de
Zejejejejej ej!ej"ej#de_dd ej$ D e_G dd de
Z%G d d! d!e
Z&G d"d# d#e
Z'G d$d% d%e'Z(G d&d' d'e'Z)G d(d) d)e*Z+G d*d+ d+e+Z,G d,d- d-e,Z-G d.d/ d/e,Z.G d0d1 d1e.Z/G d2d3 d3e.Z0G d4d5 d5e,Z1G d6d7 d7e,Z2G d8d9 d9e2Z3G d:d; d;e2Z4G d<d= d=e,Z5G d>d? d?e+Z6G d@dA dAe6Z7G dBdC dCe7Z8G dDdE dEe6Z9G dFdG dGe6Z:G dHdI dIe+Z;G dJdK dKe+Z<G dLdM dMe+Z=G dNdO dOe+Z>G dPdQ dQe*Z?dS )R    Nc                   @   s   e Zd Zdd ZdS )NullHandlerc                 C   s   d S N )selfrecordr   r   K/var/www/Datamplify/venv/lib/python3.10/site-packages/cassandra/__init__.pyemit   s   zNullHandler.emitN)__name__
__module____qualname__r   r   r   r   r   r      s    r   	cassandra)         .c                   @   s^   e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Z	 d
Z	 dZ	 dZ	 edd ZdS )ConsistencyLevelz
    Spcifies how many replicas must respond for an operation to be considered
    a success.  By default, ``ONE`` is used for all operations.
    r      r   r                  	   
   c                 C   s   | t jkp	| t jkS r   )r   SERIALLOCAL_SERIAL)clr   r   r   	is_serial_      zConsistencyLevel.is_serialN)r	   r
   r   __doc__ANYONETWOTHREEQUORUMALLLOCAL_QUORUMEACH_QUORUMr   r   	LOCAL_ONEstaticmethodr   r   r   r   r   r      s4    r   r    r!   r"   r#   r$   r%   r&   r'   r   r   r(   )r    r!   r"   r#   r$   r%   r&   r'   r   r   r(   c                 C   s   | d ur	t j|  S dS )NzNot Set)r   value_to_name)valuer   r   r   consistency_value_to_name      r,   c                   @   s   e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Z	 ee
e	eeeeefZ	 e	fZ	 eeZ	 eeZ	 ed
d Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd ZdS )ProtocolVersionzD
    Defines native protocol versions supported by this driver.
    r   r   r   r   r   r   A   B   c                    s@   zt  fddttjddD }W |S  ty   d}Y |S w )zY
        Return the lower supported protocol version. Beta versions are omitted.
        c                 3   s&    | ]}|t jvr| k r|V  qd S r   )r.   BETA_VERSIONS).0vprevious_versionr   r   	<genexpr>   s    z6ProtocolVersion.get_lower_supported.<locals>.<genexpr>T)reverser   )nextsortedr.   SUPPORTED_VERSIONSStopIteration)clsr5   versionr   r4   r   get_lower_supported   s   "z#ProtocolVersion.get_lower_supportedc                 C   
   || j kS r   V5r<   r=   r   r   r   uses_int_query_flags      
z$ProtocolVersion.uses_int_query_flagsc                 C      || j ko	|| jkS r   rA   DSE_V1rB   r   r   r   uses_prepare_flags   r   z"ProtocolVersion.uses_prepare_flagsc                 C   rE   r   rF   rB   r   r   r   uses_prepared_metadata   r   z&ProtocolVersion.uses_prepared_metadatac                 C   r?   r   r@   rB   r   r   r   uses_error_code_map   rD   z#ProtocolVersion.uses_error_code_mapc                 C   rE   r   rF   rB   r   r   r   uses_keyspace_flag   r   z"ProtocolVersion.uses_keyspace_flagc                 C   r?   r   )rG   rB   r   r   r   has_continuous_paging_support   rD   z-ProtocolVersion.has_continuous_paging_supportc                 C   r?   r   )DSE_V2rB   r   r   r    has_continuous_paging_next_pages   rD   z0ProtocolVersion.has_continuous_paging_next_pagesc                 C   s   | j |  ko| jk S   S r   rF   rB   r   r   r   has_checksumming_support      z(ProtocolVersion.has_checksumming_supportN)r	   r
   r   r   V1V2V3V4rA   V6rG   rM   r:   r1   minMIN_SUPPORTEDmaxMAX_SUPPORTEDclassmethodr>   rC   rH   rI   rJ   rK   rL   rN   rO   r   r   r   r   r.      sX    







r.   c                   @   s>   e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Zd
S )	WriteTypez\
    For usage with :class:`.RetryPolicy`, this describe a type
    of write operation.
    r   r   r   r   r   r   r   r   N)r	   r
   r   r   SIMPLEBATCHUNLOGGED_BATCHCOUNTER	BATCH_LOGCASVIEWCDCr   r   r   r   r[      s$    r[   )r\   r]   r^   r_   r`   ra   rb   rc   c                 C   s   i | ]\}}||qS r   r   )r2   kr3   r   r   r   
<dictcomp>:  s    re   c                   @   s   e Zd ZdZdZdZdS )SchemaChangeTypeDROPPEDCREATEDUPDATEDN)r	   r
   r   rg   rh   ri   r   r   r   r   rf   =  s    rf   c                   @   s    e Zd ZdZdZdZdZdZdS )SchemaTargetTypeKEYSPACETABLETYPEFUNCTION	AGGREGATEN)r	   r
   r   rk   rl   rm   rn   ro   r   r   r   r   rj   C  s    rj   c                   @   s4   e Zd Zdd Zedd Zedd Zdd Zd	S )
SignatureDescriptorc                 C   s   || _ || _d S r   nameargument_types)r   rr   rs   r   r   r   __init__M  s   
zSignatureDescriptor.__init__c                 C   s   |  | j| jS )z
        function signature string in the form 'name([type0[,type1[...]]])'

        can be used to uniquely identify overloaded function names within a keyspace
        )format_signaturerr   rs   r   r   r   r   	signatureQ  s   zSignatureDescriptor.signaturec                 C   s   d| d dd |D f S )Nz%s(%s),c                 s   s    | ]}|V  qd S r   r   )r2   tr   r   r   r6   \  s    z7SignatureDescriptor.format_signature.<locals>.<genexpr>)joinrq   r   r   r   ru   Z  rP   z$SignatureDescriptor.format_signaturec                 C   s   d| j j| j| jf S )Nz
%s(%s, %s))	__class__r	   rr   rs   rv   r   r   r   __repr__^  r-   zSignatureDescriptor.__repr__N)	r	   r
   r   rt   propertyrw   r)   ru   r|   r   r   r   r   rp   K  s    

rp   c                   @      e Zd ZdZdZ	 dZdS )UserFunctionDescriptorzB
    Describes a User function by name and argument signature
    Nr	   r
   r   r   rr   rs   r   r   r   r   r   b      r   c                   @   r~   )UserAggregateDescriptorzL
    Describes a User aggregate function by name and argument signature
    Nr   r   r   r   r   r   r  r   r   c                   @      e Zd ZdZdS )DriverExceptionzB
    Base for all exceptions explicitly raised by the driver.
    Nr	   r
   r   r   r   r   r   r   r         r   c                   @   r   )RequestExecutionExceptionzI
    Base for request execution exceptions returned from the server.
    Nr   r   r   r   r   r     r   r   c                   @   s,   e Zd ZdZdZ	 dZ	 dZ	 dddZdS )Unavailablez
    There were not enough live replicas to satisfy the requested consistency
    level, so the coordinator node immediately failed the request without
    forwarding it to any replicas.
    Nc              	   C   s:   || _ || _|| _t| |d tt|||d  d S )N info=)consistencyrequired_replicasalive_replicas)r   r   r   	Exceptionrt   reprr,   )r   summary_messager   r   r   r   r   r   rt     s   
zUnavailable.__init__NNN)r	   r
   r   r   r   r   r   rt   r   r   r   r   r     s    r   c                   @   s0   e Zd ZdZdZ	 dZ	 dZ	 		dddZdS )TimeoutzO
    Replicas failed to respond to the coordinator node before timing out.
    Nc                 K   sb   || _ || _|| _d|v rtj|d  |d< t|||d}|| t| |d t	|  d S )N
write_type)r   required_responsesreceived_responsesr   )
r   r   r   r[   r*   r,   updater   rt   r   )r   r   r   r   r   kwargsinfor   r   r   rt     s   
zTimeout.__init__r   )r	   r
   r   r   r   r   r   rt   r   r   r   r   r     s    r   c                   @       e Zd ZdZdZ	 dddZdS )ReadTimeouta<  
    A subclass of :exc:`Timeout` for read operations.

    This indicates that the replicas failed to respond to the coordinator
    node before the configured timeout. This timeout is configured in
    ``cassandra.yaml`` with the ``read_request_timeout_in_ms``
    and ``range_request_timeout_in_ms`` options.
    Nc                 K      t j| |fi | || _d S r   )r   rt   data_retrievedr   messager   r   r   r   r   rt        
zReadTimeout.__init__r   r	   r
   r   r   r   rt   r   r   r   r   r     s
    	r   c                   @   r   )WriteTimeouta  
    A subclass of :exc:`Timeout` for write operations.

    This indicates that the replicas failed to respond to the coordinator
    node before the configured timeout. This timeout is configured in
    ``cassandra.yaml`` with the ``write_request_timeout_in_ms``
    option.
    Nc                 K   s&   ||d< t j| |fi | || _d S )Nr   )r   rt   r   r   r   r   r   r   r   r   rt     s   
zWriteTimeout.__init__r   r	   r
   r   r   r   rt   r   r   r   r   r     s
    	r   c                   @   s   e Zd ZdZdd ZdS )CDCWriteFailurez>
    Hit limit on data in CDC folder, writes are rejected
    c                 C   s   t | | d S r   )r   rt   )r   r   r   r   r   rt     s   zCDCWriteFailure.__init__N)r	   r
   r   r   rt   r   r   r   r   r     s    r   c                   @   s<   e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 		dddZ	dS )CoordinationFailurez5
    Replicas sent a failure to the coordinator.
    Nc           	      C   sr   || _ || _|| _|| _|| _t||||d}|d ur+tdd | D }||d< t	| |d t
|  d S )N)r   r   r   failuresc                 s   s     | ]\}}|d | fV  qdS )z0x%04xNr   )r2   addrerr_coder   r   r   r6   ,  s    z/CoordinationFailure.__init__.<locals>.<genexpr>error_code_mapr   )r   r   r   r   r   r,   dictitemsr   rt   r   )	r   r   r   r   r   r   r   	info_dictformatted_mapr   r   r   rt     s    zCoordinationFailure.__init__)NNNNN)
r	   r
   r   r   r   r   r   r   r   rt   r   r   r   r   r     s    r   c                   @   r   )ReadFailurez
    A subclass of :exc:`CoordinationFailure` for read operations.

    This indicates that the replicas sent a failure message to the coordinator.
    Nc                 K   r   r   )r   rt   r   r   r   r   r   rt   A  r   zReadFailure.__init__r   r   r   r   r   r   r   3  s
    r   c                   @   r   )WriteFailurez
    A subclass of :exc:`CoordinationFailure` for write operations.

    This indicates that the replicas sent a failure message to the coordinator.
    Nc                 K   r   r   )r   rt   r   r   r   r   r   rt   R  r   zWriteFailure.__init__r   r   r   r   r   r   r   F  s
    r   c                   @   s*   e Zd ZdZdZ	 dZ	 dZ	 dd ZdS )FunctionFailurez7
    User Defined Function failed during execution
    Nc                 C   s"   || _ || _|| _t| | d S r   )keyspacefunction	arg_typesr   rt   )r   r   r   r   r   r   r   r   rt   k  s   zFunctionFailure.__init__)r	   r
   r   r   r   r   r   rt   r   r   r   r   r   W  s    r   c                   @   r   )RequestValidationExceptionz*
    Server request validation failed
    Nr   r   r   r   r   r   r  r   r   c                   @   r   )ConfigurationExceptionzE
    Server indicated request errro due to current configuration
    Nr   r   r   r   r   r   y  r   r   c                   @   &   e Zd ZdZdZ	 dZ	 dddZdS )AlreadyExistszP
    An attempt was made to create a keyspace or table that already exists.
    Nc                 C   s8   |r	d||f }nd|f }t | | || _|| _d S )NzTable '%s.%s' already existszKeyspace '%s' already exists)r   rt   r   table)r   r   r   r   r   r   r   rt     s   

zAlreadyExists.__init__NN)r	   r
   r   r   r   r   rt   r   r   r   r   r     s    r   c                   @   r   )InvalidRequestz
    A query was made that was invalid for some reason, such as trying to set
    the keyspace for a connection to a nonexistent keyspace.
    Nr   r   r   r   r   r     s    r   c                   @   r   )UnauthorizedzP
    The current user is not authorized to perform the requested operation.
    Nr   r   r   r   r   r     r   r   c                   @   r   )AuthenticationFailedz!
    Failed to authenticate.
    Nr   r   r   r   r   r     r   r   c                   @   r   )OperationTimedOutz
    The operation took longer than the specified (client-side) timeout
    to complete.  This is not an error generated by Cassandra, only
    the driver.
    Nc                 C   s,   || _ || _d| j | jf }t| | d S )Nzerrors=%s, last_host=%s)errors	last_hostr   rt   )r   r   r   r   r   r   r   rt     s   zOperationTimedOut.__init__r   )r	   r
   r   r   r   r   rt   r   r   r   r   r     s    r   c                   @   r   )UnsupportedOperationz
    An attempt was made to use a feature that is not supported by the
    selected protocol version.  See :attr:`Cluster.protocol_version`
    for more details.
    Nr   r   r   r   r   r     s    r   c                   @   r   )UnresolvableContactPointsz
    The driver was unable to resolve any provided hostnames.

    Note that this is *not* raised when a :class:`.Cluster` is created with no
    contact points, only when lookup fails for all hosts
    Nr   r   r   r   r   r     s    r   c                   @   s"   e Zd ZdZg Z	 g fddZdS )DependencyExceptionzO
    Specific exception class for handling issues with driver dependencies
    c                 C   s4   |}|r|dd dd |D  7 }t| | d S )Nz-
The following exceptions were observed: 
 - z
 - c                 s   s    | ]}t |V  qd S r   )str)r2   er   r   r   r6     s    z/DependencyException.__init__.<locals>.<genexpr>)rz   r   rt   )r   msgexcscomplete_msgr   r   r   rt     s   zDependencyException.__init__N)r	   r
   r   r   r   rt   r   r   r   r   r     s
    r   )@loggingHandlerr   	getLogger
addHandler__version_info__rz   mapr   __version__objectr   r    r!   r"   r#   r$   r%   r&   r'   r   r   r(   r*   name_to_valuer,   r.   r[   r\   r]   r^   r_   r`   ra   rb   rc   r   rf   rj   rp   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   s   Hs7"4		