3
¨ôÁg|
  ã               @   sF   d Z ddlZddlmZmZmZmZ G dd„ dƒZeddœdd„Z	dS )	a|  
Backport of PEP 562.
https://pypi.org/search/?q=pep562
Licensed under MIT
Copyright (c) 2018 Isaac Muse <isaacmuse@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
é    N)ÚAnyÚCallableÚListÚOptionalc               @   sB   e Zd ZdZeddœdd„Zee dœdd„Zeedœd	d
„Z	dS )ÚPep562a  
    Backport of PEP 562 <https://pypi.org/search/?q=pep562>.
    Wraps the module in a class that exposes the mechanics to override `__dir__` and `__getattr__`.
    The given module will be searched for overrides of `__dir__` and `__getattr__` and use them when needed.
    N)ÚnameÚreturnc             C   s:   t j| | _t| jddƒ| _t| jddƒ| _| t j|< dS )z_Acquire `__getattr__` and `__dir__`, but only replace module for versions less than Python 3.7.Ú__getattr__NÚ__dir__)ÚsysÚmodulesÚ_moduleÚgetattrÚ	_get_attrÚ_get_dir)Úselfr   © r   úM/var/www/tester-filtro-web/env/lib/python3.6/site-packages/asgiref/_pep562.pyÚ__init__   s
    zPep562.__init__)r   c             C   s   | j r| j ƒ S t| jƒS )zPReturn the overridden `dir` if one was provided, else apply `dir` to the module.)r   Údirr   )r   r   r   r   r
   '   s    zPep562.__dir__c             C   s8   yt | j|ƒS  tk
r2   | jr,| j|ƒS ‚ Y nX dS )z|
        Attempt to retrieve the attribute from the module, and if missing, use the overridden function if present.
        N)r   r   ÚAttributeErrorr   )r   r   r   r   r   r	   ,   s    
zPep562.__getattr__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r   r
   r   r	   r   r   r   r   r      s   
r   )Úmodule_namer   c             C   s   t jdk rt| ƒ dS )z!Helper function to apply PEP 562.é   é   N)r   r   )r   Úversion_infor   )r   r   r   r   Úpep5629   s    
r    )
r   r   Útypingr   r   r   r   r   r   r    r   r   r   r   Ú<module>   s   #