summaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/utils/sysinfo.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2023-11-14 19:18:07 +0300
committerrobot-piglet <[email protected]>2023-11-14 20:20:53 +0300
commit874ef51d3d3edfa25f5a505ec6ab50e172965d1e (patch)
tree620fb5e02063d23509d3aa3df2215c099ccde0b7 /contrib/python/ipython/py3/IPython/utils/sysinfo.py
parente356b34d3b0399e2f170881af15c91e4db9e3d11 (diff)
Intermediate changes
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils/sysinfo.py')
-rw-r--r--contrib/python/ipython/py3/IPython/utils/sysinfo.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/python/ipython/py3/IPython/utils/sysinfo.py b/contrib/python/ipython/py3/IPython/utils/sysinfo.py
index 857f0cf2d84..347123fd53c 100644
--- a/contrib/python/ipython/py3/IPython/utils/sysinfo.py
+++ b/contrib/python/ipython/py3/IPython/utils/sysinfo.py
@@ -20,6 +20,8 @@ import pprint
import sys
import subprocess
+from pathlib import Path
+
from IPython.core import release
from IPython.utils import _sysinfo, encoding
@@ -27,7 +29,7 @@ from IPython.utils import _sysinfo, encoding
# Code
#-----------------------------------------------------------------------------
-def pkg_commit_hash(pkg_path):
+def pkg_commit_hash(pkg_path: str) -> tuple[str, str]:
"""Get short form of commit hash given directory `pkg_path`
We get the commit hash from (in order of preference):
@@ -65,7 +67,7 @@ def pkg_commit_hash(pkg_path):
return '(none found)', '<not found>'
-def pkg_info(pkg_path):
+def pkg_info(pkg_path: str) -> dict:
"""Return dict describing the context of this package
Parameters
@@ -92,11 +94,10 @@ def pkg_info(pkg_path):
default_encoding=encoding.DEFAULT_ENCODING,
)
-def get_sys_info():
+def get_sys_info() -> dict:
"""Return useful information about IPython and the system, as a dict."""
- p = os.path
- path = p.realpath(p.dirname(p.abspath(p.join(__file__, '..'))))
- return pkg_info(path)
+ path = Path(__file__, "..").resolve().parent
+ return pkg_info(str(path))
def sys_info():
"""Return useful information about IPython and the system, as a string.