/
opt
/
imh-python
/
lib
/
python3.9
/
site-packages
/
IPython
/
utils
/
/opt/imh-python/lib/python3.9/site-packages/IPython/utils
mkdir
upload
Name
Size
Mode
Actions
tests/
-
0755
rm
__pycache__/
-
0755
rm
capture.py
5161
0644
edit
dl
rm
colorable.py
786
0644
edit
dl
rm
coloransi.py
6972
0644
edit
dl
rm
contexts.py
1619
0644
edit
dl
rm
daemonize.py
200
0644
edit
dl
rm
data.py
1015
0644
edit
dl
rm
decorators.py
2680
0644
edit
dl
rm
dir2.py
2232
0644
edit
dl
rm
docs.py
86
0644
edit
dl
rm
encoding.py
2843
0644
edit
dl
rm
eventful.py
138
0644
edit
dl
rm
frame.py
3048
0644
edit
dl
rm
generics.py
706
0644
edit
dl
rm
importstring.py
1050
0644
edit
dl
rm
io.py
4631
0644
edit
dl
rm
ipstruct.py
11856
0644
edit
dl
rm
jsonutil.py
148
0644
edit
dl
rm
localinterfaces.py
169
0644
edit
dl
rm
log.py
123
0644
edit
dl
rm
module_paths.py
2327
0644
edit
dl
rm
openpy.py
3417
0644
edit
dl
rm
path.py
11937
0644
edit
dl
rm
process.py
1878
0644
edit
dl
rm
py3compat.py
1602
0644
edit
dl
rm
PyColorize.py
10875
0644
edit
dl
rm
sentinel.py
421
0644
edit
dl
rm
shimmodule.py
2669
0644
edit
dl
rm
signatures.py
474
0644
edit
dl
rm
strdispatch.py
1838
0644
edit
dl
rm
sysinfo.py
4365
0644
edit
dl
rm
syspathcontext.py
1952
0644
edit
dl
rm
tempdir.py
1867
0644
edit
dl
rm
terminal.py
3206
0644
edit
dl
rm
text.py
24428
0644
edit
dl
rm
timing.py
4275
0644
edit
dl
rm
tokenutil.py
5083
0644
edit
dl
rm
traitlets.py
143
0644
edit
dl
rm
tz.py
1380
0644
edit
dl
rm
ulinecache.py
684
0644
edit
dl
rm
version.py
1223
0644
edit
dl
rm
wildcard.py
4612
0644
edit
dl
rm
_process_cli.py
2020
0644
edit
dl
rm
_process_common.py
7003
0644
edit
dl
rm
_process_posix.py
8666
0644
edit
dl
rm
_process_win32.py
6132
0644
edit
dl
rm
_process_win32_controller.py
21329
0644
edit
dl
rm
_sysinfo.py
45
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/site-packages/IPython/utils/terminal.py
(3206B)
# encoding: utf-8 """ Utilities for working with terminals. Authors: * Brian E. Granger * Fernando Perez * Alexander Belchenko (e-mail: bialix AT ukr.net) """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import sys import warnings from shutil import get_terminal_size as _get_terminal_size # This variable is part of the expected API of the module: ignore_termtitle = True if os.name == 'posix': def _term_clear(): os.system('clear') elif sys.platform == 'win32': def _term_clear(): os.system('cls') else: def _term_clear(): pass def toggle_set_term_title(val): """Control whether set_term_title is active or not. set_term_title() allows writing to the console titlebar. In embedded widgets this can cause problems, so this call can be used to toggle it on or off as needed. The default state of the module is for the function to be disabled. Parameters ---------- val : bool If True, set_term_title() actually writes to the terminal (using the appropriate platform-specific module). If False, it is a no-op. """ global ignore_termtitle ignore_termtitle = not(val) def _set_term_title(*args,**kw): """Dummy no-op.""" pass def _restore_term_title(): pass _xterm_term_title_saved = False def _set_term_title_xterm(title): """ Change virtual terminal title in xterm-workalikes """ global _xterm_term_title_saved # Only save the title the first time we set, otherwise restore will only # go back one title (probably undoing a %cd title change). if not _xterm_term_title_saved: # save the current title to the xterm "stack" sys.stdout.write("\033[22;0t") _xterm_term_title_saved = True sys.stdout.write('\033]0;%s\007' % title) def _restore_term_title_xterm(): # Make sure the restore has at least one accompanying set. global _xterm_term_title_saved assert _xterm_term_title_saved sys.stdout.write('\033[23;0t') _xterm_term_title_saved = False if os.name == 'posix': TERM = os.environ.get('TERM','') if TERM.startswith('xterm'): _set_term_title = _set_term_title_xterm _restore_term_title = _restore_term_title_xterm elif sys.platform == 'win32': import ctypes SetConsoleTitleW = ctypes.windll.kernel32.SetConsoleTitleW SetConsoleTitleW.argtypes = [ctypes.c_wchar_p] def _set_term_title(title): """Set terminal title using ctypes to access the Win32 APIs.""" SetConsoleTitleW(title) def set_term_title(title): """Set terminal title using the necessary platform-dependent calls.""" if ignore_termtitle: return _set_term_title(title) def restore_term_title(): """Restore, if possible, terminal title to the original state""" if ignore_termtitle: return _restore_term_title() def freeze_term_title(): warnings.warn("This function is deprecated, use toggle_set_term_title()") global ignore_termtitle ignore_termtitle = True def get_terminal_size(defaultx=80, defaulty=25): return _get_terminal_size((defaultx, defaulty))
Save
cmd:
run