B
    Y0d                 @  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re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
   M/var/www/html/venv/lib/python3.7/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   | ]}t |V  qd S )N)str).0ir
   r
   r   	<genexpr>&   s    z _get_sys_info.<locals>.<genexpr>P   LC_ALLLANG)z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    

r/   c              C  sp   ddddddddd	d
ddddddddddg} |  tt i }x,| D ]$}t|dd}|r`t|nd||< qDW |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.etreeZhtml5libZpymysqlZpsycopg2Zjinja2ZIPythonZpandas_datareaderignore)errorsN)extendlistr   r   r   )depsresultmodnamemodr
   r
   r   _get_dependency_info4   s4    
r<   Fz
str | boolNone)as_jsonr   c       
   	   C  sB  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 dQ R X nt|d	 tst	|d	 d
 }|d	 d }| d| |d	< tdd |D }td td x.| D ]"\}}	t|d| d|	  qW td x0| D ]$\}}	t|d| d|	  qW 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   zlanguage-coder   r   c             s  s   | ]}t |V  qd S )N)len)r   xr
   r
   r   r      s    z show_versions.<locals>.<genexpr>z
INSTALLED VERSIONSz------------------<z:  )r/   r<   r#   stdout
writelinesjsondumps
isinstancer   AssertionErrorcodecsopendumpdictmaxprintitems)
r>   Zsys_infor8   jfr.   r   maxlenkvr
   r
   r   show_versions]   s*    
rZ   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_argsrJ   rZ   )r\   parseroptionsargsr
   r
   r   main   s    
ri   __main__)F)
__future__r   rN   rJ   r    r*   r   r%   r#   Zpandas._typingr   Zpandas.compat._optionalr   r   r   r   r/   r<   rZ   ri   __name__exitr
   r
   r
   r   <module>   s    ),