/opt/alt/python27/lib/python2.7/site-packages
NameSizeModeActions
alembic/-0755rm
alembic-0.8.3-py2.7.egg-info/-0755rm
argparse-1.2.1-py2.7.egg-info/-0755rm
babel/-0755rm
Babel-1.3-py2.7.egg-info/-0755rm
beaker/-0755rm
Beaker-1.5.4-py2.7.egg-info/-0755rm
chardet/-0755rm
chardet-2.3.0-py2.7.egg-info/-0755rm
contextlib2-0.5.4-py2.7.egg-info/-0755rm
dateutil/-0755rm
docopt-0.6.2-py2.7.egg-info/-0755rm
jinja2/-0755rm
Jinja2-2.7.2-py2.7.egg-info/-0755rm
lvestats/-0755rm
mako/-0755rm
Mako-0.7.3-py2.7.egg-info/-0755rm
nose/-0755rm
nose-1.3.4-py2.7.egg-info/-0755rm
paste/-0755rm
Paste-1.7.5.1-py2.7.egg-info/-0755rm
pip/-0755rm
pip-20.2.4.dist-info/-0755rm
pkg_resources/-0755rm
python_dateutil-1.4.1-py2.7.egg-info/-0755rm
python_editor-0.4-py2.7.egg-info/-0755rm
pytz/-0755rm
raven/-0755rm
raven-6.3.0-py2.7.egg-info/-0755rm
requests/-0755rm
requests-2.10.0-py2.7.egg-info/-0755rm
schema-0.3.1-py2.7.egg-info/-0755rm
setuptools/-0755rm
setuptools-36.3.0.post20231113.dist-info/-0755rm
svgwrite/-0755rm
svgwrite-1.1.5-py2.7.egg-info/-0755rm
tempita/-0755rm
Tempita-0.5.1-py2.7.egg-info/-0755rm
urllib3/-0755rm
urllib3-1.15.1-py2.7.egg-info/-0755rm
argparse.py877910644editdlrm
argparse.pyc686760644editdlrm
argparse.pyo685060644editdlrm
contextlib2.py148280644editdlrm
contextlib2.pyc160090644editdlrm
contextlib2.pyo160090644editdlrm
docopt.py199460644editdlrm
docopt.pyc246660644editdlrm
docopt.pyo250330644editdlrm
easy_install.py1260644editdlrm
easy_install.pyc3280644editdlrm
easy_install.pyo3280644editdlrm
editor.py25500755editdlrm
editor.pyc36850644editdlrm
editor.pyo36850644editdlrm
lprettytable.py238490644editdlrm
lprettytable.pyc196970644editdlrm
lprettytable.pyo197970644editdlrm
Paste-1.7.5.1-py2.7-nspkg.pth3040644editdlrm
pyparsing-1.5.6-py2.7.egg-info6700644editdlrm
pyparsing.py1554290644editdlrm
pyparsing.pyc1551950644editdlrm
pyparsing.pyo1551950644editdlrm
PySocks-1.5.7-py2.7.egg-info3220644editdlrm
pytz-2012d-py2.7.egg-info233090644editdlrm
schema.py62060644editdlrm
schema.pyc85320644editdlrm
schema.pyo86080644editdlrm
six-1.9.0-py2.7.egg-info14190644editdlrm
six.py296640644editdlrm
six.pyc307220644editdlrm
six.pyo307220644editdlrm
socks.py299520644editdlrm
socks.pyc256880644editdlrm
socks.pyo256880644editdlrm
sockshandler.py29130644editdlrm
sockshandler.pyc47370644editdlrm
sockshandler.pyo47370644editdlrm
typing-3.5.3.0-py2.7.egg-info14840644editdlrm
typing.py648950644editdlrm
typing.pyc790680644editdlrm
typing.pyo784070644editdlrm
Edit: /opt/alt/python27/lib/python2.7/site-packages/editor.py (2550B)
#!/usr/bin/env python """Tools for invoking editors programmatically.""" from __future__ import print_function import locale import os.path import subprocess import tempfile from distutils.spawn import find_executable __all__ = [ 'edit', 'get_editor', 'EditorError', ] __version__ = '0.4' class EditorError(RuntimeError): pass def get_default_editors(): # TODO: Make platform-specific return [ 'vim', 'emacs', 'nano', ] def get_editor_args(editor): if editor in ['vim', 'gvim']: return '-f -o' elif editor == 'emacs': return '-nw' elif editor == 'gedit': return '-w --new-window' elif editor == 'nano': return '-R' else: return '' def get_platform_editor_var(): # TODO: Make platform specific return "$EDITOR" def get_editor(): # Get the editor from the environment. Prefer VISUAL to EDITOR editor = os.environ.get('VISUAL') or os.environ.get('EDITOR') if editor: return editor # None found in the environment. Fallback to platform-specific defaults. for ed in get_default_editors(): path = find_executable(ed) if path is not None: return path raise EditorError("Unable to find a viable editor on this system." "Please consider setting your %s variable" % get_platform_editor_var()) def edit(filename=None, contents=None): editor = get_editor() args = get_editor_args(os.path.basename(editor)) args = [editor] + args.split(' ') if filename is None: tmp = tempfile.NamedTemporaryFile() filename = tmp.name if contents is not None: with open(filename, mode='wb') as f: f.write(contents) args += [filename] proc = subprocess.Popen(args, close_fds=True) proc.communicate() with open(filename, mode='rb') as f: return f.read() def _get_editor(ns): print(get_editor()) def _edit(ns): contents = ns.contents if contents is not None: contents = contents.encode(locale.getpreferredencoding()) print(edit(filename=ns.path, contents=contents)) if __name__ == '__main__': import argparse ap = argparse.ArgumentParser() sp = ap.add_subparsers() cmd = sp.add_parser('get-editor') cmd.set_defaults(cmd=_get_editor) cmd = sp.add_parser('edit') cmd.set_defaults(cmd=_edit) cmd.add_argument('path', type=str, nargs='?') cmd.add_argument('--contents', type=str) ns = ap.parse_args() ns.cmd(ns)