o
    Þ­j	  ã                   @   s`   d Z ddlmZ ddlZddlZe e¡ZdZej	 
ej	 ej	 e¡¡d¡Zdd„ Zdd	„ ZdS )
z+Caching utility for the discovery document.é    )Úabsolute_importNi€Q Ú	documentsc                  C   sj   dt jv rz
ddlm}  | jW S  ty   Y nw z
ddlm} |jW S  ty4   tjddd� Y dS w )	zÎDetects an appropriate cache module and returns it.

    Returns:
      googleapiclient.discovery_cache.base.Cache, a cache object which
      is auto detected, or None if no cache object is available.
    ÚGAE_ENVé   )Úappengine_memcache)Ú
file_cachez4file_cache is only supported with oauth2client<4.0.0F)Úexc_infoN)	ÚosÚenvironÚ r   ÚcacheÚ	Exceptionr   ÚLOGGERÚinfo)r   r   © r   úe/var/www/html/CropPilot/venv/lib/python3.10/site-packages/googleapiclient/discovery_cache/__init__.pyÚ
autodetect   s    
ÿÿür   c                 C   sl   d}d  | |¡}z#ttj t|¡dƒ�}| ¡ }W d  ƒ W |S 1 s$w   Y  W |S  ty5   Y |S w )až  Retrieves the discovery document from the directory defined in
    DISCOVERY_DOC_DIR corresponding to the serviceName and version provided.

    Args:
        serviceName: string, name of the service.
        version: string, the version of the service.

    Returns:
        A string containing the contents of the JSON discovery document,
        otherwise None if the JSON discovery document was not found.
    Nz
{}.{}.jsonÚr)ÚformatÚopenr	   ÚpathÚjoinÚDISCOVERY_DOC_DIRÚreadÚFileNotFoundError)ÚserviceNameÚversionÚcontentÚdoc_nameÚfr   r   r   Úget_static_doc7   s   
ÿúüür    )Ú__doc__Ú
__future__r   Úloggingr	   Ú	getLoggerÚ__name__r   ÚDISCOVERY_DOC_MAX_AGEr   r   ÚdirnameÚrealpathÚ__file__r   r   r    r   r   r   r   Ú<module>   s   
ÿ