o
    ðäj$  ã                   @   s¨   d Z ddlZddlZddlZddlmZ ddlZddlmZ ddl	m
Z g d¢ZdZdZdd	„ Zejd
eeƒ d� eZ
G dd„ deƒZg Zddd„Zdd„ Zdd„ ZdS )aÁ  
The ``dateutil.zoneinfo`` module was originally designed to work with a tarball
shipped with ``dateutil``. Since ``dateutil`` now uses data from the same
sources as :py:mod:`zoneinfo`, this module is no longer necessary.

.. caution::
    This module is deprecated, and its functionality has been dramatically
    curtailed. It is recommended that you adopt the standard library module
    :py:mod:`zoneinfo` or :func:`dateutil.tz.gettz` instead.

é    N)ÚTarFile)Ú_tzdata_impl)Útzfile)Úget_zonefile_instanceÚgettzÚgettz_db_metadataÚMETADATAc                  C   st   d} t  d¡}|jdur8|j}|jj}d|v r%d|v r%t jdk r$| d7 } q| d7 } |j d¡dvr3| S |jdusdS )	aO  The ``stacklevel`` that attributes a warning to the importing code.

    This module can be imported through ``dateutil.__getattr__`` (e.g. by
    ``from dateutil import zoneinfo``), which calls
    ``importlib.import_module``; the warnings machinery skips the import
    system's own frames, but not those two, so skip them here.
    é   NÚ	importlibÚ
_bootstrap)é   é   Ú__name__)r
   Údateutilé   )ÚsysÚ	_getframeÚf_backÚf_codeÚco_filenameÚversion_infoÚ	f_globalsÚget)ÚlevelÚframeÚfilename© r   ú^/var/www/ticemtrilhas/avaliacao_env/lib/python3.10/site-packages/dateutil/zoneinfo/__init__.pyÚ_importer_stacklevel   s   



ôr   zÝThe `dateutil.zoneinfo` module has been replaced with a wrapper around the tzdata package, and its use is deprecated, to be removed in a future version. Use the standard library module `zoneinfo` or `dateutil.tz` instead.)Ú
stacklevelc                   @   s0   e Zd Zd
dd„Zdd„ Zdd„ Zd
dd	„ZdS )ÚZoneInfoFileNc                 C   s"   |d ur|   |¡ d S |  ¡  d S ©N)Ú_load_legacy_zonefile_streamÚ_eager_load_tzdata)ÚselfÚzonefile_streamr   r   r   Ú__init__F   s   zZoneInfoFile.__init__c              
   C   s¦   zdd l }W n ty  } zt tdƒ|¡ W Y d }~nd }~ww i }t ¡ D ]}t |¡�}t||d�||< W d   ƒ n1 sAw   Y  q'|| _d|j	dœ| _
d S )Nr   z|The tzdata module is required to use ZoneInfoFile; either add a dependency on tzdata or migrate away from dateutil.zoneinfo.)Úkeyz3.0)Úmetadata_versionÚ	tzversion)ÚtzdataÚImportErrorÚsixÚ
raise_fromr   Ú_load_tzdata_keysÚ_load_tzdatar   ÚzonesÚIANA_VERSIONÚmetadata)r$   r*   ÚeÚ	zone_dictr'   Úfr   r   r   r#   L   s*   ÿû€ÿ	ÿ€þzZoneInfoFile._eager_load_tzdatac              	      sÄ   t j|d��R‰‡fdd„ˆ ¡ D ƒˆ _‡ fdd„ˆ ¡ D ƒ}ˆ j |¡ zˆ ˆ t¡¡}| ¡  	d¡}t
 |¡ˆ _W n tyG   d ˆ _Y n	w W d   ƒ d S W d   ƒ d S 1 s[w   Y  d S )N)Úfileobjc                    s6   i | ]}|  ¡ r|jtkr|jtˆ  |¡|jd �“qS ))r   )ÚisfileÚnameÚMETADATA_FNr   Úextractfile)Ú.0Úzf)Útfr   r   Ú
<dictcomp>f   s    ý
þz=ZoneInfoFile._load_legacy_zonefile_stream.<locals>.<dictcomp>c                    s,   i | ]}|  ¡ s| ¡ r|jˆ j|j “qS r   )ÚislnkÚissymr8   r0   Úlinkname)r;   Úzl)r$   r   r   r>   m   s    ýýÿzUTF-8)r   ÚopenÚ
getmembersr0   Úupdater:   Ú	getmemberr9   ÚreadÚdecodeÚjsonÚloadsr2   ÚKeyError)r$   r%   ÚlinksÚmetadata_jsonÚmetadata_strr   )r$   r=   r   r"   d   s&   
þ
þ
þÿï"ìz)ZoneInfoFile._load_legacy_zonefile_streamc                 C   s   | j  ||¡S )ak  
        Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method
        for retrieving zones from the zone dictionary.

        :param name:
            The name of the zone to retrieve. (Generally IANA zone names)

        :param default:
            The value to return in the event of a missing key.

        .. versionadded:: 2.6.0

        )r0   r   )r$   r8   Údefaultr   r   r   r   {   s   zZoneInfoFile.getr!   )r   Ú
__module__Ú__qualname__r&   r#   r"   r   r   r   r   r   r    E   s
    
r    Fc                 C   s.   | rd}nt tddƒ}|du rtƒ }|t_|S )a%  
    This is a convenience function which provides a :class:`ZoneInfoFile`
    instance using the data provided by the ``dateutil`` package. By default, it
    caches a single instance of the ZoneInfoFile object and returns that.

    :param new_instance:
        If ``True``, a new instance of :class:`ZoneInfoFile` is instantiated and
        used as the cached instance for the next call. Otherwise, new instances
        are created only as necessary.

    :return:
        Returns a :class:`ZoneInfoFile` object.

    .. versionadded:: 2.6
    NÚ_cached_instance)Úgetattrr   r    rR   )Únew_instanceÚzifr   r   r   r   •   s   r   c                 C   s4   t  dt¡ ttƒdkrt tƒ ¡ td j | ¡S )a  
    This retrieves a time zone from the ``tzdata`` package.

    :param name:
        An IANA-style time zone name, as found in the zoneinfo file.

    :return:
        Returns a :class:`dateutil.tz.tzfile` time zone object.

    .. warning::
        It is generally inadvisable to use this function, and it is only
        provided for API compatibility with earlier versions. This is *not*
        equivalent to ``dateutil.tz.gettz()``, which selects an appropriate
        time zone based on the inputs, favoring system zoneinfo. This is ONLY
        for accessing the dateutil-specific zoneinfo (which may be out of
        date compared to the system zoneinfo).

    .. deprecated:: 2.6
        If you need to use a specific zoneinfofile over the system zoneinfo,
        instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call
        :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead.

        Use :func:`get_zonefile_instance` to retrieve an instance of the
        dateutil-provided zoneinfo.
    zÐzoneinfo.gettz() will be removed in future versions, to use the dateutil-provided zoneinfo files, instantiate a ZoneInfoFile object and use ZoneInfoFile.zones.get() instead. See the documentation for details.r   )	ÚwarningsÚwarnÚDeprecationWarningÚlenÚ_CLASS_ZONE_INSTANCEÚappendr    r0   r   )r8   r   r   r   r   ²   s   ür   c                   C   s.   t  dt¡ ttƒdkrt tƒ ¡ td jS )a  Get the zonefile metadata

    :returns:
        A dictionary with the database metadata

    .. deprecated:: 2.6
        See deprecation warning in :func:`zoneinfo.gettz`. To get metadata,
        query the attribute ``zoneinfo.ZoneInfoFile.metadata``.
    zÐzoneinfo.gettz_db_metadata() will be removed in future versions, to use the dateutil-provided zoneinfo files, ZoneInfoFile object and query the 'metadata' attribute instead. See the documentation for details.r   )rV   rW   rX   rY   rZ   r[   r    r2   r   r   r   r   r   ×   s   
ü
r   )F)Ú__doc__rI   r   rV   Útarfiler   r,   r   r   Údateutil.tzr   Ú_tzfileÚ__all__ÚZONEFILENAMEr9   r   rW   rX   Úobjectr    rZ   r   r   r   r   r   r   r   Ú<module>   s.   ú
M
%