a
    oÝEbÂ  ã                   @  sÆ   d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
 d dlmZmZmZ ddœdd„Zd	dœd
d„Zd	dœdd„Zddddœdd„Zddœdd„ZedkrÂe eƒ ¡ dS )é    )ÚannotationsN)ÚJSONSerializable)ÚVERSIONSÚget_versionÚimport_optional_dependencyz
str | None)Úreturnc                  C  s   ddl m}  | ƒ }|d S )za
    Use vendored versioneer code to get git hash, which handles
    git worktree correctly.
    r   )Úget_versionszfull-revisionid)Zpandas._versionr   )r   Úversions© r
   ú[/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/pandas/util/_print_versions.pyÚ_get_commit_hash   s    r   zdict[str, JSONSerializable]c                  C  sr   t  ¡ } t ¡ \}}tƒ d dd„ tjD ƒ¡t 	d¡d | j
| j| j| j| jtjtj d¡tj d¡||dœd	œS )
zG
    Returns system information as a JSON serializable dictionary.
    Ú.c                 S  s   g | ]}t |ƒ‘qS r
   )Ústr)Ú.0Úir
   r
   r   Ú
<listcomp>&   ó    z!_get_sys_info.<locals>.<listcomp>ÚPé   ÚLC_ALLÚLANG)úlanguage-codeÚencoding)ÚcommitÚpythonzpython-bitsZOSz
OS-releaseÚVersionÚmachineÚ	processorÚ	byteorderr   r   ÚLOCALE)ÚplatformÚunameÚlocaleÚ	getlocaler   ÚjoinÚsysÚversion_infoÚstructÚcalcsizeÚsystemÚreleaseÚversionr   r   r   ÚosÚenvironÚget)Úuname_resultÚlanguage_coder   r
   r
   r   Ú_get_sys_info   s    

ôr1   c                  C  sH   g d¢} |   ttƒ¡ i }| D ]$}t|dd�}|r:t|ƒnd||< q|S )zK
    Returns dependency information as a JSON serializable dictionary.
    )ZpandasÚnumpyZpytzZdateutilÚpipÚ
setuptoolsÚCythonZpytestZ
hypothesisZsphinxZbloscZfeatherZ
xlsxwriterz
lxml.etreeÚhtml5libZpymysqlZpsycopg2Zjinja2ZIPythonZpandas_datareaderÚignore)ÚerrorsN)ÚextendÚlistr   r   r   )ÚdepsÚresultÚmodnameÚmodr
   r
   r   Ú_get_dependency_info4   s    r?   Fz
str | boolÚNone)Úas_jsonr   c           
      C  sN  t ƒ }tƒ }| rŠ||dœ}| du r:tj tj|dd�¡ nNt| tƒsHJ ‚t	j
| ddd�� }tj||dd� W d  ƒ n1 s~0    Y  nÀt|d	 tƒsœJ ‚|d	 d
 }|d	 d }|› d|› �|d	< tdd„ |D ƒƒ}tdƒ tdƒ | ¡ D ]"\}}	t|d|› �›d|	› �ƒ qðtdƒ | ¡ D ]$\}}	t|d|› �›d|	› �ƒ �q$dS )a  
    Provide useful information, important for bug reports.

    It comprises info about hosting operation system, pandas version,
    and versions of other installed relative packages.

    Parameters
    ----------
    as_json : str or bool, default False
        * If False, outputs info in a human readable form to the console.
        * If str, it will be considered as a path to a file.
          Info will be written to that file in JSON format.
        * If True, outputs info in JSON format to the console.
    )r)   ÚdependenciesTé   )ÚindentÚwbÚutf8)r   Nr   r   r   r   c                 s  s   | ]}t |ƒV  qd S )N)Úlen)r   Úxr
   r
   r   Ú	<genexpr>   r   z show_versions.<locals>.<genexpr>z
INSTALLED VERSIONSz------------------ú<z: Ú )r1   r?   r%   ÚstdoutÚ
writelinesÚjsonÚdumpsÚ
isinstancer   ÚcodecsÚopenÚdumpÚdictÚmaxÚprintÚitems)
rA   Zsys_infor;   ÚjÚfr0   r   ÚmaxlenÚkÚvr
   r
   r   Úshow_versions]   s*    
0r]   Úintc                  C  sR   ddl m}  | ƒ }|jdddddd� | ¡ \}}|jd	krBd
|_t|jd� dS )Nr   )ÚOptionParserz-jz--jsonÚFILEé   z>Save output as JSON into file, pass in '-' to output to stdout)ÚmetavarÚnargsÚhelpú-T)rA   )Úoptparser_   Ú
add_optionÚ
parse_argsrN   r]   )r_   ÚparserÚoptionsÚargsr
   r
   r   Úmain‰   s    û
rl   Ú__main__)F)Ú
__future__r   rQ   rN   r"   r,   r    r'   r%   Zpandas._typingr   Zpandas.compat._optionalr   r   r   r   r1   r?   r]   rl   Ú__name__Úexitr
   r
   r
   r   Ú<module>   s    ),