Format: application/x-python-code
⬇ Download File (3.8 KB)
   1  o
   2  
   3  ��h�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
   4  mZmZde
   5  dee
   6  e
   7  ffdd	�Zde
   8  defd
   9  d�Zdefdd
  10  �Zde
  11  fdd�Zdd�ZdS)zQ
  12  Utilities for getting information about IPython and the system it's running in.
  13  �N)�Path)�release)�_sysinfo�encoding�pkg_path�returncCsRtjrdtjfStjd�d�tjtj|d�}|��\}}|r'd|���d�fSdS)a"Get short form of commit hash given directory `pkg_path`
  14  
  15      We get the commit hash from (in order of preference):
  16  
  17      * IPython.utils._sysinfo.commit
  18      * git output, if we are in a git repository
  19  
  20      If these fail, we return a not-found placeholder tuple
  21  
  22      Parameters
  23      ----------
  24      pkg_path : str
  25          directory containing package
  26          only used for getting commit from active repo
  27  
  28      Returns
  29      -------
  30      hash_from : str
  31          Where we got the hash from - description
  32      hash_str : str
  33          short form of hash
  34      Zinstallationzgit rev-parse --short HEAD� )�stdout�stderr�cwd�
  35  repository�ascii)z(none found)z<not found>)	r�commit�
  36  subprocess�Popen�split�PIPE�communicate�strip�decode)r�procZrepo_commit�_�r�Kc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/utils/sysinfo.py�pkg_commit_hash s
  37  �rcCs8t|�\}}ttj|||tjtjtjt��tjt	j
  38  d�
  39  S)z�Return dict describing the context of this package
  40  
  41      Parameters
  42      ----------
  43      pkg_path : str
  44          path containing __init__.py for package
  45  
  46      Returns
  47      -------
  48      context : dict
  49          with named parameters of interest
  50      )
  51  Zipython_versionZipython_pathZ
  52  commit_sourceZcommit_hash�sys_versionZsys_executable�sys_platform�platform�os_nameZdefault_encoding)r�dictr�version�sys�
  53  executabler�os�namerZDEFAULT_ENCODING)r�srcZhshrrr�pkg_infoFs
  54  �r&cCsttd���j}tt|��S)zBReturn useful information about IPython and the system, as a dict.z..)r�__file__�resolve�parentr&�str)�pathrrr�get_sys_infoasr,cCst�t��S)auReturn useful information about IPython and the system, as a string.
  55  
  56      Examples
  57      --------
  58      ::
  59      
  60          In [2]: print(sys_info())
  61          {'commit_hash': '144fdae',      # random
  62           'commit_source': 'repository',
  63           'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython',
  64           'ipython_version': '0.11.dev',
  65           'os_name': 'posix',
  66           'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick',
  67           'sys_executable': '/usr/bin/python',
  68           'sys_platform': 'linux2',
  69           'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \n[GCC 4.4.5]'}
  70      )�pprint�pformatr,rrrr�sys_infofsr/cCs$ddl}|jdtdd�t��pdS)a�DEPRECATED
  71  
  72      Return the effective number of CPUs in the system as an integer.
  73  
  74      This cross-platform function makes an attempt at finding the total number of
  75      available CPUs in the system, as returned by various underlying system and
  76      python calls.
  77  
  78      If it can't find a sensible answer, it returns 1 (though an error *may* make
  79      it return a large positive number that's actually incorrect).
  80      rNzG`num_cpus` is deprecated since IPython 8.0. Use `os.cpu_count` instead.�)�
  81  stacklevel�)�warnings�warn�DeprecationWarningr#�	cpu_count)r3rrr�num_cpus{s�r7)�__doc__r#rr-r!r�pathlibrZIPython.corerZ
  82  IPython.utilsrrr*�tuplerrr&r,r/r7rrrr�<module>s&