o
    i6"                     @   sL  d dl mZmZmZmZmZmZmZ zd dlm	Z	 W n e
y)   d dlm	Z	 Y nw d dlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZ er`ddl m!Z! g dZ"d	ee#ef d
e#de#deee# ee f fddZ$deede#f  dee fddZ%d	ee#ef defddZ&d	ee#ef defddZ'd	ee#ef defddZ(d	ee#ef dee fddZ)d	ee#ef dee fddZ*d	ee#ef de#fddZ+dee# d	ee#ef dee# fd d!Z,d+d#eee#e#f  dee# fd$d%Z-d+d#eee#e#f  defd&d'Z.d(ee#ef dee fd)d*Z/d"S ),    )AnycastDictOptionalTupleUnionTYPE_CHECKING)quote)MatchConditions   )ArrowConfigurationBlobModifiedAccessConditionsBlobTagBlobTagsContainerCpkScopeInfoCpkScopeInfoDelimitedTextConfigurationJsonTextConfigurationLeaseAccessConditionsModifiedAccessConditionsQueryFormatQueryFormatTypeQuerySerializationSourceModifiedAccessConditions)ContainerEncryptionScopeDelimitedJsonDialect)BlobLeaseClient)z
2019-02-02z
2019-07-07z
2019-10-10z
2019-12-12z
2020-02-10z
2020-04-08z
2020-06-12z
2020-08-04z
2020-10-02z
2020-12-06z
2021-02-12z
2021-04-10z
2021-06-08z
2021-08-06z
2021-12-02z
2022-11-02z
2023-01-03z
2023-05-03z
2023-08-03z
2023-11-03z
2024-05-04z
2024-08-04z
2024-11-04z
2025-01-05z
2025-05-05z
2025-07-05z
2025-11-05z
2026-02-06kwargsmatch_param
etag_paramreturnc                 C   s   d }d }|  |d }|tjkr&|  |d }|s"td| d| d||fS |tjkr1d}||fS |tjkrM|  |d }|sItd| d| d||fS |tjkrXd}||fS |d u rp| |rltd| d| d||fS td| )N'z' specified without 'z'.*zInvalid match condition: )	popr
   ZIfNotModified
ValueErrorZ	IfPresentZ
IfModifiedZ	IfMissingget	TypeError)r   r   r   if_matchif_none_matchmatch_condition r*   T/home/app/Keep/.python/lib/python3.10/site-packages/azure/storage/blob/_serialize.py_get_match_headersE   s0   




r,   leaser   c                 C   s4   z| j }W n ty   | }Y nw |rt|dS d S )N)lease_id)idAttributeErrorr   )r-   r.   r*   r*   r+   get_access_conditionsa   s   
r1   c              	   C   R   t | dd\}}t| dd | dd |p| dd |p!| dd | dd dS )	Nr)   etagif_modified_sinceif_unmodified_sincer'   r(   Zif_tags_match_condition)r4   r5   r'   r(   Zif_tags)r,   r   r#   r   r'   r(   r*   r*   r+   get_modify_conditionsi      


r7   c                 C   sH   t | dd\}}t| dd | dd |p| dd |p!| dd dS )Nr)   r3   r4   r5   r'   r(   )r4   r5   r'   r(   )r,   r   r#   r6   r*   r*   r+   get_blob_modify_conditionst   s   

r9   c              	   C   r2   )	NZsource_match_conditionZsource_etagsource_if_modified_sincesource_if_unmodified_sincesource_if_matchsource_if_none_matchZsource_if_tags_match_condition)r:   r;   r<   r=   Zsource_if_tags)r,   r   r#   r6   r*   r*   r+   get_source_conditions~   r8   r>   c                 C   s   d| v rt | ddS d S )Nencryption_scope)r?   )r   r#   )r   r*   r*   r+   get_cpk_scope_info      r@   c                 C   sV   |  dd }|r)t|trt|j|jdS t|tr%t|d |ddS tdd S )NZcontainer_encryption_scope)default_encryption_scope!prevent_encryption_scope_overriderB   rC   zIContainer encryption scope must be dict or type ContainerEncryptionScope.)	r#   
isinstancer   r   rB   rC   dictr%   r&   )r   r?   r*   r*   r+   get_container_cpk_scope_info   s   

rF   c                 C   sB   |  dd }|r|tvrdt}td| d| |p td S )Napi_version
zUnsupported API version 'z'. Please select from:
)r%   _SUPPORTED_API_VERSIONSjoinr$   )r   rG   versionsr*   r*   r+   get_api_version   s
   
rM   self_vidc                 C   s   d|v rt t|dS | S )N
version_id)r   strr#   )rN   r   r*   r*   r+   get_version_id   rA   rQ   Ntagsc                 C   sr   | d u rd S g }| r/|   D ] \}}|t|dd |d |t|dd |d q|r4|d= d|S )Nz.-)safe=&rI    )itemsappendr	   rK   )rR   
componentskeyvaluer*   r*   r+   serialize_blob_tags_header   s   

r\   c                 C   s$   g }| rdd |   D }t|dS )Nc                 S   s   g | ]
\}}t ||d qS ))rZ   r[   )r   ).0kvr*   r*   r+   
<listcomp>   s    z'serialize_blob_tags.<locals>.<listcomp>)Zblob_tag_set)rW   r   )rR   Ztag_listr*   r*   r+   serialize_blob_tags   s   
ra   formaterc                 C   s   | dkrt tjdd}nat| trt| jd}t tj|d}nNt| drSz| j	}W n t
y4   d}Y nw t| tr>tdt| j| j| j| j|d	}t tj|d
}nt| tret| d}t tj|d}n| sid S tdt|dS )NZParquetDialect )typeZparquet_text_configuration)record_separator)rd   Zjson_text_configuration	quotecharFz>Unknown string value provided. Accepted values: ParquetDialect)Zcolumn_separatorZfield_quotere   escape_charZheaders_present)rd   Zdelimited_text_configuration)Zschema)rd   Zarrow_configurationzNFormat must be DelimitedTextDialect or DelimitedJsonDialect or ParquetDialect.)format)r   r   ZPARQUETrD   r   r   	delimiterJSONhasattr
has_headerr0   rP   r$   r   rf   lineterminator
escapecharZ	DELIMITEDlistr   arrowr&   r   )rb   Z	qq_formatZjson_serialization_settingsheadersZcsv_serialization_settingsZarrow_serialization_settingsr*   r*   r+   serialize_query_format   s>   






rr   )N)0typingr   r   r   r   r   r   r   urllib.parser	   ImportErrorurllib2Z
azure.corer
   Z_generated.modelsr   r   r   r   r   r   r   r   r   r   r   r   r   r   Z_modelsr   r   Z_leaser   rJ   rP   r,   r1   r7   r9   r>   r@   rF   rM   rQ   r\   ra   rr   r*   r*   r*   r+   <module>   s@   $@ 

"
&$ "