U
    mdj                     @  s   d dl mZ d dlZd dlZd dlZd dlmZ dddddd	d
dddddgZdd eD ZdddddZ	d#dddddZ
eddd$dddddZeddd%dddd d!d"ZdS )&    )annotationsN)	lru_cachez2.6.9z2.7.9z3.2.6z3.3.6z3.4.3z3.5z3.6z3.7z3.8z3.9z3.10z3.11c                 C  s$   g | ]}d  |d dd qS ).N   )joinsplit.0x r   I/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/stdlib_list/base.py
<listcomp>   s     r   str)versionreturnc                 C  s<   | t kr"d| dd d } n| tkr8td|  | S )Nr   r   zNo such version: )long_versionsr   r   short_versions
ValueErrorr   r   r   r   get_canonical_version   s
    r   z
str | Nonez	list[str]c                 C  sr   | dk	rt | nddd tjdd D } tjd|  d}td| }d	d
 dd
 |	 D D }|S )a  
    Given a ``version``, return a ``list`` of names of the Python Standard
    Libraries for that version.

    :param str|None version: The version (as a string) whose list of libraries you want
        (formatted as ``X.Y``, e.g. ``"2.7"`` or ``"3.10"``).

        If not specified, the current version of Python will be used.

    :return: A list of standard libraries from the specified version of Python
    :rtype: list
    Nr   c                 s  s   | ]}t |V  qd S )N)r   r   r   r   r   	<genexpr>4   s     zstdlib_list.<locals>.<genexpr>r   listsz.txtstdlib_listc                 S  s   g | ]}|r|qS r   r   )r	   yr   r   r   r   ;   s      zstdlib_list.<locals>.<listcomp>c                 S  s   g | ]}|  qS r   )stripr   r   r   r   r   ;   s     )
r   r   sysversion_infoospathpkgutilget_datadecode
splitlines)r   Zmodule_list_filedataresultr   r   r   r   #   s    
r      )maxsizec                 C  s
   t | dS )z(Internal cached version of `stdlib_list`r   )r   r   r   r   r   _stdlib_list_with_cache@   s    r'      bool)module_namer   r   c                 C  s   t |d}| |kS )a  
    Return a ``bool`` indicating if module ``module_name`` is in the list of stdlib
    symbols for python version ``version``. If ``version`` is ``None`` (default), the
    version of current python interpreter is used.

    Note that ``True`` will be returned for built-in modules too, since this project
    considers they are part of stdlib. See :issue:21.

    It relies on ``@lru_cache`` to cache the stdlib list and query results for similar
    calls. Therefore it is much more efficient than ``module_name in stdlib_list()``
    especially if you wish to perform multiple checks.

    :param str|None module_name: The module name (as a string) to query for.
    :param str|None version: The version (as a string) whose list of libraries you want
        (formatted as ``X.Y``, e.g. ``"2.7"`` or ``"3.10"``).

        If not specified, the current version of Python will be used.

    :return: A bool indicating if the given module name is part of standard libraries
        for the specified version of Python.
    :rtype: list
    r   )r'   )r*   r   Zref_listr   r   r   	in_stdlibF   s    
r+   )N)N)N)
__future__r   r   r   r   	functoolsr   r   r   r   r   r'   r+   r   r   r   r   <module>   s0   	