a
    bg                     @  sh   d Z ddlmZ ddlmZ ddlmZmZmZ ddlm	Z	 ddl
mZ ddlmZ G dd	 d	eZd
S )z=Simple reader that reads weather data from OpenWeatherMap API    )annotations)datetime)IteratorOptionalSequence)Document)
BaseLoaderOpenWeatherMapAPIWrapperc                      sT   e Zd ZdZdddd fddZedd	dd
d dddZddddZ  ZS )WeatherDataLoaderzLoad weather data with `Open Weather Map` API.

    Reads the forecast & current weather of any location using OpenWeatherMap's free
    API. Checkout 'https://openweathermap.org/appid' for more on how to generate a free
    OpenWeatherMap API.
    r
   zSequence[str]None)clientplacesreturnc                   s   t    || _|| _dS )zInitialize with parameters.N)super__init__r   r   )selfr   r   	__class__ z/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/langchain_community/document_loaders/weather.pyr      s    
zWeatherDataLoader.__init__Nopenweathermap_api_keyzOptional[str])r   r   r   c                C  s   t |d}| ||S )Nr   r	   )clsr   r   r   r   r   r   from_params    s    
zWeatherDataLoader.from_paramszIterator[Document])r   c                 c  s6   | j D ]*}dt i}| j|}t||dV  qdS )z1Lazily load weather data for the given locations.Z
queried_at)Zpage_contentmetadataN)r   r   nowr   runr   )r   Zplacer   contentr   r   r   	lazy_load'   s    
zWeatherDataLoader.lazy_load)	__name__
__module____qualname____doc__r   classmethodr   r   __classcell__r   r   r   r   r      s   
r   N)r#   
__future__r   r   typingr   r   r   Zlangchain_core.documentsr   Z)langchain_community.document_loaders.baser   Z,langchain_community.utilities.openweathermapr
   r   r   r   r   r   <module>   s   