o
     i#  ã                   @   sH   d dl mZmZmZ d dlmZmZmZ edƒZG dd„ dee ƒZ	dS )é    )ÚExplainMetricsÚExplainOptionsÚQueryExplainError)ÚListÚOptionalÚTypeVarÚTc                       s`   e Zd ZdZ		ddedee dee f‡ fdd„Ze	dee fd	d
„ƒZ
defdd„Z‡  ZS )ÚQueryResultsLista\  A list of received query results from the query call.

    This is a subclass of the built-in list. A new property `explain_metrics`
    is added to return the query profile results.

    Args:
        docs (list):
            The list of query results.
        explain_options
            (Optional[:class:`~google.cloud.firestore_v1.query_profile.ExplainOptions`]):
            Options to enable query profiling for this query. When set,
            explain_metrics will be available on the returned generator.
        explain_metrics (Optional[ExplainMetrics]):
            Query profile results.
    NÚdocsÚexplain_optionsÚexplain_metricsc                    sL   t ƒ  |¡ |d ur|d u rtdƒ‚|d u r|d urtdƒ‚|| _|| _d S )Nz=If explain_options is set, explain_metrics must be non-empty.z;If explain_options is empty, explain_metrics must be empty.)ÚsuperÚ__init__Ú
ValueErrorÚ_explain_optionsÚ_explain_metrics)Úselfr
   r   r   ©Ú	__class__© ú‡/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/env/lib/python3.10/site-packages/google/cloud/firestore_v1/query_results.pyr   +   s   ÿÿ
zQueryResultsList.__init__Úreturnc                 C   s   | j S )z8Query profiling options for getting these query results.)r   ©r   r   r   r   r   @   s   z QueryResultsList.explain_optionsc                 C   s*   | j du r	tdƒ‚| jdu rtdƒ‚| jS )a@  
        Get the metrics associated with the query execution.
        Metrics are only available when explain_options is set on the query. If
        ExplainOptions.analyze is False, only plan_summary is available. If it is
        True, execution_stats is also available.
        :rtype: :class:`~google.cloud.firestore_v1.query_profile.ExplainMetrics`
        :returns: The metrics associated with the query execution.
        :raises: :class:`~google.cloud.firestore_v1.query_profile.QueryExplainError`
            if explain_metrics is not available on the query.
        Nz!explain_options not set on query.z8explain_metrics is empty despite explain_options is set.)r   r   r   r   r   r   r   Úget_explain_metricsE   s   

ÿz$QueryResultsList.get_explain_metrics)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   Úpropertyr   r   Ú__classcell__r   r   r   r   r	      s    üþýür	   N)
Ú'google.cloud.firestore_v1.query_profiler   r   r   Útypingr   r   r   r   r	   r   r   r   r   Ú<module>   s   