Format: application/x-python-code
1 o
2
3 ��h � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
4 mZmZ de
5 dee
6 e
7 f fdd �Zde
8 defd
9 d�Zdefdd
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�returnc C sR t jrdt jfS tjd�d�tjtj| d�}|�� \}}|r'd|�� �d�fS dS )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 Zinstallationzgit 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 �r c C s8 t | �\}}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_versionZipython_pathZ
52 commit_sourceZcommit_hash�sys_versionZsys_executable�sys_platform�platform�os_nameZdefault_encoding)r �dictr �version�sys�
53 executabler �os�namer ZDEFAULT_ENCODING)r �srcZhshr r r �pkg_infoF s
54 �r&