/opt/imh-python/lib/python3.9/site-packages/IPython/utils
NameSizeModeActions
tests/-0755rm
__pycache__/-0755rm
capture.py51610644editdlrm
colorable.py7860644editdlrm
coloransi.py69720644editdlrm
contexts.py16190644editdlrm
daemonize.py2000644editdlrm
data.py10150644editdlrm
decorators.py26800644editdlrm
dir2.py22320644editdlrm
docs.py860644editdlrm
encoding.py28430644editdlrm
eventful.py1380644editdlrm
frame.py30480644editdlrm
generics.py7060644editdlrm
importstring.py10500644editdlrm
io.py46310644editdlrm
ipstruct.py118560644editdlrm
jsonutil.py1480644editdlrm
localinterfaces.py1690644editdlrm
log.py1230644editdlrm
module_paths.py23270644editdlrm
openpy.py34170644editdlrm
path.py119370644editdlrm
process.py18780644editdlrm
py3compat.py16020644editdlrm
PyColorize.py108750644editdlrm
sentinel.py4210644editdlrm
shimmodule.py26690644editdlrm
signatures.py4740644editdlrm
strdispatch.py18380644editdlrm
sysinfo.py43650644editdlrm
syspathcontext.py19520644editdlrm
tempdir.py18670644editdlrm
terminal.py32060644editdlrm
text.py244280644editdlrm
timing.py42750644editdlrm
tokenutil.py50830644editdlrm
traitlets.py1430644editdlrm
tz.py13800644editdlrm
ulinecache.py6840644editdlrm
version.py12230644editdlrm
wildcard.py46120644editdlrm
_process_cli.py20200644editdlrm
_process_common.py70030644editdlrm
_process_posix.py86660644editdlrm
_process_win32.py61320644editdlrm
_process_win32_controller.py213290644editdlrm
_sysinfo.py450644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/IPython/utils/syspathcontext.py (1952B)
# encoding: utf-8 """ Context managers for adding things to sys.path temporarily. Authors: * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #----------------------------------------------------------------------------- import sys import warnings class appended_to_syspath(object): """ Deprecated since IPython 8.1, no replacements. A context for appending a directory to sys.path for a second.""" def __init__(self, dir): warnings.warn( "`appended_to_syspath` is deprecated since IPython 8.1, and has no replacements", DeprecationWarning, stacklevel=2, ) self.dir = dir def __enter__(self): if self.dir not in sys.path: sys.path.append(self.dir) self.added = True else: self.added = False def __exit__(self, type, value, traceback): if self.added: try: sys.path.remove(self.dir) except ValueError: pass # Returning False causes any exceptions to be re-raised. return False class prepended_to_syspath(object): """A context for prepending a directory to sys.path for a second.""" def __init__(self, dir): self.dir = dir def __enter__(self): if self.dir not in sys.path: sys.path.insert(0,self.dir) self.added = True else: self.added = False def __exit__(self, type, value, traceback): if self.added: try: sys.path.remove(self.dir) except ValueError: pass # Returning False causes any exceptions to be re-raised. return False