o
    ×èFhù
  ã                   @   sš   d Z z%ddlmZ eƒ  ¡ Zej ¡ D ]\ZZ	e 
d¡s%eevr%e	eƒ e< qW n ey2   edƒ‚w ddlmZ dZddejfd	d
„ZG dd„ dƒZdS )zÆCloud Firestore module.

This module contains utilities for accessing the Google Cloud Firestore databases associated with
Firebase apps. This requires the ``google-cloud-firestore`` Python module.
é    )Ú	firestoreÚ_zrFailed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.)Ú_utilsÚ
_firestoreNÚreturnc                 C   s   t  | ttj¡}| ¡ S )a  Returns a client that can be used to interact with Google Cloud Firestore.

    Args:
      app: An App instance (optional).

    Returns:
      google.cloud.firestore.Firestore: A `Firestore Client`_.

    Raises:
      ValueError: If a project ID is not specified either via options, credentials or
          environment variables, or if the specified project ID is not a valid string.

    .. _Firestore Client: https://googlecloudplatform.github.io/google-cloud-python/latest          /firestore/client.html
    )r   Úget_app_serviceÚ_FIRESTORE_ATTRIBUTEÚ_FirestoreClientÚfrom_appÚget)ÚappÚ	fs_client© r   úQ/var/www/html/loop/nvenv/lib/python3.10/site-packages/firebase_admin/firestore.pyÚclient%   s   r   c                   @   s,   e Zd ZdZdd„ Zdd„ Zedd„ ƒZdS )	r	   z/Holds a Google Cloud Firestore client instance.c                 C   s   t j||d�| _d S )N)ÚcredentialsÚproject)r   ÚClientÚ_client)Úselfr   r   r   r   r   Ú__init__<   s   z_FirestoreClient.__init__c                 C   s   | j S ©N)r   )r   r   r   r   r   ?   s   z_FirestoreClient.getc                 C   s&   |j  ¡ }|j}|stdƒ‚t||ƒS )z5Creates a new _FirestoreClient for the specified app.z²Project ID is required to access Firestore. Either set the projectId option, or use service account credentials. Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.)Ú
credentialÚget_credentialÚ
project_idÚ
ValueErrorr	   )Úclsr   r   r   r   r   r   r
   B   s   
ÿ
z_FirestoreClient.from_appN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úclassmethodr
   r   r   r   r   r	   9   s    r	   r   )r    Úgoogle.cloudr   ÚglobalsÚkeysÚexistingÚ__dict__ÚitemsÚkeyÚvalueÚ
startswithÚImportErrorÚfirebase_adminr   r   r   r   r	   r   r   r   r   Ú<module>   s    

€þÿ