Hackfut Security File Manager
Current Path:
/opt/alt/python27/lib/python2.7/site-packages
opt
/
alt
/
python27
/
lib
/
python2.7
/
site-packages
/
📁
..
📁
Babel-1.3-py2.7.egg-info
📁
Beaker-1.5.4-py2.7.egg-info
📁
Jinja2-2.7.2-py2.7.egg-info
📁
Mako-0.7.3-py2.7.egg-info
📄
Paste-1.7.5.1-py2.7-nspkg.pth
(304 B)
📁
Paste-1.7.5.1-py2.7.egg-info
📄
PySocks-1.5.7-py2.7.egg-info
(322 B)
📁
Tempita-0.5.1-py2.7.egg-info
📁
_markerlib
📁
alembic
📁
alembic-0.8.3-py2.7.egg-info
📁
argparse-1.2.1-py2.7.egg-info
📄
argparse.py
(85.73 KB)
📄
argparse.pyc
(67.07 KB)
📄
argparse.pyo
(66.9 KB)
📁
babel
📁
beaker
📁
chardet
📁
chardet-2.3.0-py2.7.egg-info
📁
contextlib2-0.5.4-py2.7.egg-info
📄
contextlib2.py
(14.48 KB)
📄
contextlib2.pyc
(15.63 KB)
📄
contextlib2.pyo
(15.63 KB)
📁
dateutil
📁
docopt-0.6.2-py2.7.egg-info
📄
docopt.py
(19.48 KB)
📄
docopt.pyc
(24.09 KB)
📄
docopt.pyo
(24.45 KB)
📄
easy_install.py
(126 B)
📄
easy_install.pyc
(328 B)
📄
easy_install.pyo
(328 B)
📄
editor.py
(2.49 KB)
📄
editor.pyc
(3.6 KB)
📄
editor.pyo
(3.6 KB)
📁
jinja2
📄
lprettytable.py
(23.29 KB)
📄
lprettytable.pyc
(19.24 KB)
📄
lprettytable.pyo
(19.33 KB)
📁
lvestats
📁
mako
📁
nose
📁
nose-1.3.4-py2.7.egg-info
📁
paste
📁
pip
📁
pip-20.2.4.dist-info
📁
pkg_resources
📄
pyparsing-1.5.6-py2.7.egg-info
(670 B)
📄
pyparsing.py
(151.79 KB)
📄
pyparsing.pyc
(151.56 KB)
📄
pyparsing.pyo
(151.56 KB)
📁
python_dateutil-1.4.1-py2.7.egg-info
📁
python_editor-0.4-py2.7.egg-info
📁
pytz
📄
pytz-2012d-py2.7.egg-info
(22.76 KB)
📁
raven
📁
raven-6.3.0-py2.7.egg-info
📁
requests
📁
requests-2.10.0-py2.7.egg-info
📁
schema-0.3.1-py2.7.egg-info
📄
schema.py
(6.06 KB)
📄
schema.pyc
(8.33 KB)
📄
schema.pyo
(8.41 KB)
📁
setuptools
📁
setuptools-20.1.1.dist-info
📄
six-1.9.0-py2.7.egg-info
(1.39 KB)
📄
six.py
(28.97 KB)
📄
six.pyc
(30 KB)
📄
six.pyo
(30 KB)
📄
socks.py
(29.25 KB)
📄
socks.pyc
(25.09 KB)
📄
socks.pyo
(25.09 KB)
📄
sockshandler.py
(2.84 KB)
📄
sockshandler.pyc
(4.63 KB)
📄
sockshandler.pyo
(4.63 KB)
📁
svgwrite
📁
svgwrite-1.1.5-py2.7.egg-info
📁
tempita
📄
typing-3.5.3.0-py2.7.egg-info
(1.45 KB)
📄
typing.py
(63.37 KB)
📄
typing.pyc
(77.21 KB)
📄
typing.pyo
(76.57 KB)
📁
urllib3
📁
urllib3-1.15.1-py2.7.egg-info
Editing: editor.py
#!/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)
Upload File
Create Folder