U
    ÎZjÂ  ã                   @  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
   ú^/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/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>&   s     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    

ôr0   c                  C  sl   ddddddddd	d
ddddddddddg} |   ttƒ¡ i }| D ]$}t|dd�}|r^t|ƒnd||< qB|S )zK
    Returns dependency information as a JSON serializable dictionary.
    ZpandasÚnumpyZpytzZdateutilÚ
setuptoolsÚpipÚCythonZpytestZ
hypothesisZsphinxZbloscZfeatherZ
xlsxwriterz
lxml.etreeZhtml5libZpymysqlZpsycopg2Zjinja2ZIPythonZpandas_datareaderÚignore)ÚerrorsN)ÚextendÚlistr   r   r   )ÚdepsÚresultÚmodnameÚmodr
   r
   r   Ú_get_dependency_info4   s6    ær=   Fz
str | boolÚNone)Úas_jsonr   c           
   	   C  s:  t ƒ }tƒ }| rv||dœ}| dkr:tj tj|dd�¡ n:t| tƒsHt	‚t
j| ddd��}tj||dd� W 5 Q R X nÀt|d tƒsˆt	‚|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   r   r   r   r   c                 s  s   | ]}t |ƒV  qd S )N)Úlen)r   Úxr
   r
   r   Ú	<genexpr>   s     z show_versions.<locals>.<genexpr>z
INSTALLED VERSIONSz------------------ú<z: Ú N)r0   r=   r$   ÚstdoutÚ
writelinesÚjsonÚdumpsÚ
isinstancer   ÚAssertionErrorÚcodecsÚopenÚdumpÚdictÚmaxÚprintÚitems)
r?   Zsys_infor9   ÚjÚfr/   r   ÚmaxlenÚkÚvr
   r
   r   Úshow_versions]   s*    
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)r?   )Úoptparser^   Ú
add_optionÚ
parse_argsrL   r\   )r^   ÚparserÚoptionsÚargsr
   r
   r   Úmain‰   s    û
rk   Ú__main__)F)Ú
__future__r   rP   rL   r!   r+   r   r&   r$   Zpandas._typingr   Zpandas.compat._optionalr   r   r   r   r0   r=   r\   rk   Ú__name__Úexitr
   r
   r
   r   Ú<module>   s    ),