
    j6              	          d Z ddlZddlmZ ddlmZmZmZmZm	Z	m
Z
 ddlmZ ddlmZmZ ddlmZ 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 ern G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z e
d d!"      Zg d#Zee e f   Z! G d$ d%e ee&      Z"d'e d(e fd)Z# G d* d+ee         Z$efd,e%d-e d.ed(dfd/Z&d0 Z'y)1z{Customize generated code here.

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
    N)Enum)TYPE_CHECKINGAnyDictListOptionalTypeVar)CaseInsensitiveEnumMeta)	LROPollerPollingMethod   _models   )_deserialize)
StringFieldIntegerFieldNumberFieldBooleanField	DateField	TimeField
ArrayFieldObjectField	JsonFieldContentFieldc                   "    e Zd Zedefd       Zy)r   returnc                      y N selfs    l/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/azure/ai/contentunderstanding/models/_patch.pyvaluezContentField.value&   s     #    N)__name__
__module____qualname__propertyr   r$   r    r%   r#   r   r   %   s    	#3# 
#r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zStringField.value*       *-r%   Nr&   r'   r(   r)   r   strr$   r    r%   r#   r   r   )       	-8C=- 
-r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zIntegerField.value.   r,   r%   N)r&   r'   r(   r)   r   intr$   r    r%   r#   r   r   -   r/   r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zNumberField.value2   s    ,/r%   N)r&   r'   r(   r)   r   floatr$   r    r%   r#   r   r   1   s    	/8E?/ 
/r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zBooleanField.value6   s    +.r%   N)r&   r'   r(   r)   r   boolr$   r    r%   r#   r   r   5   s    	.8D>. 
.r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zDateField.value:   r,   r%   Nr-   r    r%   r#   r   r   9   r/   r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zTimeField.value>   r,   r%   Nr-   r    r%   r#   r   r   =   r/   r%   r   c                   .    e Zd Zedeee      fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zArrayField.valueB   s    03r%   N)r&   r'   r(   r)   r   r   r   r$   r    r%   r#   r   r   A   s    	38DI.3 
3r%   r   c                   2    e Zd Zedeeeef      fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zObjectField.valueF   s    58r%   N)	r&   r'   r(   r)   r   r   r.   r   r$   r    r%   r#   r   r   E   s"    	88DcN38 
8r%   r   c                   (    e Zd Zedee   fd       Zy)r   r   c                      y r   r    r!   s    r#   r$   zJsonField.valueJ   r,   r%   N)r&   r'   r(   r)   r   r   r$   r    r%   r#   r   r   I   r/   r%   r   PollingReturnType_coT)	covariant)RecordMergePatchUpdateAnalyzeLROPollerProcessingLocationr   r   r   r   r   r   r   r   r   r   c                        e Zd ZdZdZ	 dZ	 dZy)rG   z-The location where the data may be processed.	geographydataZoneglobalN)r&   r'   r(   __doc__	GEOGRAPHY	DATA_ZONEGLOBALr    r%   r#   rG   rG   i   s    7IFIFFBr%   rG   )	metaclassoperation_location_headerr   c                 t    d}t        j                  ||       }|st        d|        |j                  d      S )a6  Parse operation ID from Operation-Location header for analyze operations.

    :param operation_location_header: The Operation-Location header value
    :type operation_location_header: str
    :return: The extracted operation ID
    :rtype: str
    :raises ValueError: If operation ID cannot be extracted
    z.*/analyzerResults/([^?/]+)z%Could not extract operation ID from: r   )research
ValueErrorgroup)rQ   regexmatchs      r#   _parse_operation_idrY   t   sF     +EIIe67E34M3NO
 	
 ;;q>r%   c            	           e Zd ZdZedefd       Zeded   fd       Ze	de
e   ddfd       Ze	d	ee   d
ededd fd       Zy)rF   zCustom LROPoller for Content Understanding analyze operations.

    Provides access to the operation ID for tracking and diagnostics.
    r   c                     	 | j                         j                  j                  j                  d   }t	        |      S # t
        t        f$ r}t        dt        |             |d}~ww xY w)aC  Returns the operation ID for this long-running operation.

        The operation ID can be used with get_result_file() to retrieve
        intermediate or final result files from the service.

        :return: The operation ID
        :rtype: str
        :raises ValueError: If the operation ID cannot be extracted
        zOperation-Locationz Could not extract operation ID: N)polling_method_initial_responsehttp_responseheadersrY   KeyErrorrU   r.   )r"   operation_locationes      r#   operation_idzAnalyzeLROPoller.operation_id   sk    	Q!%!4!4!6!H!H!V!V!^!^_s!t&'9::*% 	Q?AxHIqP	Qs   ;> A*A%%A*z_models.UsageDetailsc                     | j                         sy| j                         j                  j                  }|j	                         j                  d      }|yt        t        j                  |      S )a  Returns the usage details from the completed analyze operation.

        This property is available after the operation has completed successfully.
        It provides information about the resources consumed during analysis,
        including document pages, contextualization tokens, and LLM token breakdown.

        :return: The usage details, or None if the operation is not yet complete
            or usage information is not available.
        :rtype: ~azure.ai.contentunderstanding.models.UsageDetails or None
        Nusage)	doner\   _pipeline_responser^   jsongetr   r   UsageDetails)r"   response
usage_datas      r#   re   zAnalyzeLROPoller.usage   s\     yy{&&(;;II]]_((1
G00*==r%   pollerz&AnalyzeLROPoller[PollingReturnType_co]c                 z    t         j                  |       }|j                  j                  |j                         |S )a  Wrap an existing LROPoller without re-initializing the polling method.

        This avoids duplicate HTTP requests that would occur if we created a new
        LROPoller instance (which calls polling_method.initialize() again).

        :param poller: The existing LROPoller to wrap
        :type poller: ~azure.core.polling.LROPoller
        :return: An AnalyzeLROPoller wrapping the same polling state
        :rtype: AnalyzeLROPoller
        )object__new____dict__update)clsrm   instances      r#   from_pollerzAnalyzeLROPoller.from_poller   s0     >D^^C=P  1r%   r\   continuation_tokenkwargsc                 F     |j                   |fi |\  }}} | ||||      S )a  Create a poller from a continuation token.

        :param polling_method: The polling strategy to adopt
        :type polling_method: ~azure.core.polling.PollingMethod
        :param continuation_token: An opaque continuation token
        :type continuation_token: str
        :return: An instance of AnalyzeLROPoller
        :rtype: AnalyzeLROPoller
        :raises ~azure.core.exceptions.HttpResponseError: If the continuation token is invalid.
        )from_continuation_token)rs   r\   rv   rw   clientinitial_responsedeserialization_callbacks          r#   ry   z(AnalyzeLROPoller.from_continuation_token   s=    * 3N223EPP		
$ 6+-E~VVr%   N)r&   r'   r(   rL   r)   r.   rc   r   re   classmethodr   rC   ru   r   r   ry   r    r%   r#   rF   rF      s    
 Qc Q Q  >x 67 > >& +?!@ Em  " W%&:;W  W 	W
 
W Wr%   rF   field_class
value_attrreturn_typec                     dt         dt         ffd}||j                  d<   t        |      }t        | d|       t	        | d      si | _        || j                  d<   y)a%  Add a .value property implementation at runtime.

    This function adds the actual property implementation so IntelliSense works.
    The type declarations in TYPE_CHECKING tell type checkers about the types.

    :param field_class: The field class to add the property to.
    :type field_class: type
    :param value_attr: The attribute name to read from (e.g., "value_string").
    :type value_attr: str
    :param return_type: The expected return type for better type checking.
    :type return_type: Any
    :return: None
    :rtype: None
    r"   r   c                     t        | d      S )zcGet the value of this field.

        :return: The value of the field.
        :rtype: Any
        N)getattr)r"   r   s    r#   value_getterz2_add_value_property_to_field.<locals>.value_getter   s     tZ..r%   r$   __annotations__N)r   r   r)   setattrhasattr)r~   r   r   r   value_propertys    `   r#   _add_value_property_to_fieldr      sg    $/3 /3 / .9L  * l+N K.1 ; 12&(#+6K(r%   c                     ddl m}  t        | _        t        t        dt
        t                  t        t        dt
        t                  t        t        dt
        t                  t        t        dt
        t                  t        t        dt
        t                  t        t        dt
        t                  t        t        d	t
        t         t"                     t        t$        d
t
        t&        t        t"        f             t        t(        dt
        t"                  dt*        dt"        fd}t"        |j,                  d<   t/        |      }t1        t*        d|       t3        t*        d      si t*        _        t"        t*        j,                  d<   | j4                  j6                  dt"        dt"        ddffd}|| j4                  _        y)z?Patch the SDK to add missing models and convenience properties.r   r   value_stringvalue_integervalue_numbervalue_boolean
value_date
value_timevalue_arrayvalue_object
value_jsonr"   r   c                 F    dD ]  }t        | |      st        | |      c S  y)zGet the value of this field regardless of its specific type.

        :param self: The ContentField instance.
        :type self: ContentField
        :return: The value of the field.
        :rtype: Any
        )	r   r   r   r   r   r   r   r   r   N)r   r   )r"   attrs     r#   _content_field_value_getterz.patch_sdk.<locals>._content_field_value_getter  s1    

 	+D tT"tT**	+ r%   r$   r   argsrw   Nc                     |r:t        |d   t              r't        |d         }d|v rd|vr|d   |d<   |f|dd z   } | g|i | y)ax  Patched __init__ that normalizes casing for KeyFrameTimesMs before calling parent.

        This patch is forward compatible: it only normalizes when the service returns incorrect casing.
        If the service returns the correct "keyFrameTimesMs" casing, the patch does nothing.

        :param args: Positional arguments passed to __init__.
        :type args: Any
        r   KeyFrameTimesMskeyFrameTimesMsr   N)
isinstancedict)r"   r   rw   mapping#_original_audio_visual_content_inits       r#   "_patched_audio_visual_content_initz5patch_sdk.<locals>._patched_audio_visual_content_initH  si     JtAw-47mG !G+0A0P-45F-G)*:QR(D+DB4B6Br%   ) r   rE   r   r   r   r.   r   r2   r   r5   r   r8   r   r   r   r   r   r   r   r   r   r   r)   r   r   AudioVisualContent__init__)r   r   content_field_valuer   r   s       @r#   	patch_sdkr   	  s[    &<G"
 !nhsmL N nhuoN O L(3-H L(3-H ]HT#Y<OP nhtCQTH~>VW L(3-H, 3 0 =@//9 ##>?L'#67 <!23')$,/L  ) +2*D*D*M*M'C Cs Ct C( +MG'r%   )(rL   rS   enumr   typingr   r   r   r   r   r	   
azure.corer
   azure.core.pollingr   r   r   r   _utils.model_baser   r   r   r   r   r   r   r   r   r   r   rC   __all__r.   rE   rG   rY   rF   typer   r   r    r%   r#   <module>r      sF  
 
  D D . 7  ,    $| $.k ..| .0k 0/| /.I ..I .4Z 49k 9.I .
 5F $ c3h Cd.E C3 3 *TWy!56 TWp <?&7&7#&&758&7	&7RSMr%   