o
    e	                     @   sb   d dl mZ zd dlZdZW n ey   dZY nw dZdd Zdd	 Zd
d ZG dd dZ	dS )    )GeocoderParseErrorNTF)Timezonec                   C   s   t stdd S )Nzpytz must be installed in order to locate timezones. If geopy has been installed with `pip`, then pytz can be installed with `pip install "geopy[timezone]"`.)pytz_availableImportError r   r   A/var/www/html/venv/lib/python3.10/site-packages/geopy/timezone.pyensure_pytz_is_installed   s
   r   c                 C   sT   t   zt| }W n tjy   td|   ty$   td| w t||S )NzJpytz could not parse the timezone identifier (%s) returned by the service.z4geopy could not find a timezone in this response: %s)r   pytztimezoneUnknownTimeZoneErrorr   KeyErrorr   )timezone_namerawpytz_timezoner   r   r   from_timezone_name   s"   
r   c                 C   s   t   t| d }t||S )N<   )r   r	   FixedOffsetr   )gmt_offset_hoursr   r   r   r   r   from_fixed_gmt_offset)   s   
r   c                   @   sd   e Zd ZdZdZdd Zedd Zedd Zd	d
 Z	dd Z
dd Zdd Zdd Zdd ZdS )r   z
    Contains a parsed response for a timezone request, which is
    implemented in few geocoders which provide such lookups.
    _pytz_timezone_rawc                 C   s   || _ || _d S Nr   )selfr   r   r   r   r   __init__7   s   
zTimezone.__init__c                 C      | j S )zZ
        pytz timezone instance.

        :rtype: :class:`pytz.tzinfo.BaseTzInfo`
        )r   r   r   r   r   r   ;   s   zTimezone.pytz_timezonec                 C   r   )z
        Timezone's raw, unparsed geocoder response. For details on this,
        consult the service's documentation.

        :rtype: dict
        )r   r   r   r   r   r   D   s   zTimezone.rawc                 C   s
   t | jS r   )strr   r   r   r   r   __str__N      
zTimezone.__str__c                 C   s   dt | j S )NzTimezone(%s))reprr   r   r   r   r   __repr__Q   s   zTimezone.__repr__c                 C   s   | j | jfS r   r   r   r   r   r   __getstate__T   s   zTimezone.__getstate__c                 C   s   |\| _ | _d S r   r   )r   stater   r   r   __setstate__W   s   zTimezone.__setstate__c                 C   s"   t |to| j|jko| j|jkS r   )
isinstancer   r   r   r   otherr   r   r   __eq__Z   s
   


zTimezone.__eq__c                 C   s
   | |k S r   r   r&   r   r   r   __ne__a   r   zTimezone.__ne__N)__name__
__module____qualname____doc__	__slots__r   propertyr   r   r   r!   r"   r$   r(   r)   r   r   r   r   r   /   s    

	r   )
	geopy.excr   r	   r   r   __all__r   r   r   r   r   r   r   r   <module>   s    	