Exemplo n.º 1
0
def cmd_pydoc(args):
    import init
    init.init_pydoc()
    import pydoc, os
    try:
        oldargv = sys.argv
    except AttributeError:
        oldargv = None
    oldpath = sys.path
    oldterm = os.getenv("TERM")
    try:
        sys.argv = args
        sys.path = [''] + oldpath
        os.putenv("TERM", "dumb")
        pydoc.cli()
    finally:
        if oldargv is None:
            del sys.argv
        else:
            sys.argv = oldargv
        sys.path = oldpath
        if oldterm is None:
            os.unsetenv("TERM")
        else:
            os.putenv("TERM", oldterm)
Exemplo n.º 2
0
def main():
    """ main function.

    replace pydoc.visiblename(), and call pydoc.cli().
    pydoc.cli() is regarded as main() of pydoc
    """
    pydoc.visiblename = my_visiblename
    pydoc.cli()
Exemplo n.º 3
0
def run(server_info, inp, status):
  print("<pre>")
  sys.argv = ["libtbx.help"] + inp.query.split()
  s = StringIO()
  sys.stdout = s
  pydoc.cli()
  sys.stdout = sys.__stdout__
  s = s.getvalue()
  sys.stdout.write(cgi.escape(s))
  print("</pre>")
Exemplo n.º 4
0
def run(server_info, inp, status):
  print "<pre>"
  sys.argv = ["libtbx.help"] + inp.query.split()
  s = StringIO()
  sys.stdout = s
  pydoc.cli()
  sys.stdout = sys.__stdout__
  s = s.getvalue()
  sys.stdout.write(cgi.escape(s))
  print "</pre>"
Exemplo n.º 5
0
def run(server_info, inp, status):
    print("<pre>")
    sys.argv = ["libtbx.help"] + inp.query.split()
    s = StringIO()
    sys.stdout = s
    pydoc.cli()
    sys.stdout = sys.__stdout__
    s = s.getvalue()
    if sys.version_info.major >= 3:
        import html
        sys.stdout.write(html.escape(s))
    else:
        sys.stdout.write(cgi.escape(s))
    print("</pre>")
Exemplo n.º 6
0
def pydoc_cli_monkey_patched(port):
    """In Python 3, run pydoc.cli with builtins.input monkey-patched
    so that pydoc can be run as a process.
    """

    # Monkey-patch input so that input does not raise EOFError when
    # called by pydoc.cli
    def input(_):  # pylint: disable=W0622
        """Monkey-patched version of builtins.input"""
        while 1:
            time.sleep(1.0)

    import builtins
    builtins.input = input
    sys.argv += ["-p", port]
    pydoc.cli()
Exemplo n.º 7
0
#!/usr/bin/env python3

import pydoc
if __name__ == '__main__':
    pydoc.cli()
Exemplo n.º 8
0
#!E:\GH\Chazwa\Flaxample\Flaxample\env\Scripts\python.exe
if __name__ == '__main__':
    import sys, pydoc
    sys.exit(pydoc.cli())
Exemplo n.º 9
0
def run():
    pydoc.cli()
Exemplo n.º 10
0
#!C:\Python33\app\flask\Scripts\python.exe
if __name__ == '__main__':
    import sys, pydoc
    sys.exit(pydoc.cli())
Exemplo n.º 11
0
            result = result + self.bigsection(
                'Classes', '#ffffff', '#ee77aa', join(contents))
        if funcs:
            contents = []
            for key, value in funcs:
                contents.append(self.document(value, key, name, fdict, cdict))
            result = result + self.bigsection(
                'Functions', '#ffffff', '#eeaa77', join(contents))
        if data:
            contents = []
            for key, value in data:
                contents.append(self.document(value, key))
            result = result + self.bigsection(
                'Data', '#ffffff', '#55aa55', join(contents, '<br>\n'))
        if hasattr(object, '__author__'):
            contents = self.markup(str(object.__author__), self.preformat)
            result = result + self.bigsection(
                'Author', '#ffffff', '#7799ee', contents)
        if hasattr(object, '__credits__'):
            contents = self.markup(str(object.__credits__), self.preformat)
            result = result + self.bigsection(
                'Credits', '#ffffff', '#7799ee', contents)

        return result

# --------------------------------------- interactive interpreter interface

pydoc.html = MyHTMLDoc()

if __name__ == '__main__': pydoc.cli()
Exemplo n.º 12
0
def run():
  pydoc.cli()
Exemplo n.º 13
0
 def update_event(self, inp=-1):
     self.set_output_val(0, pydoc.cli())