Python pydoc.pipepager() Examples
The following are 5
code examples of pydoc.pipepager().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pydoc
, or try the search function
.
Example #1
Source File: util.py From eg with MIT License | 6 votes |
def page_string(str_to_page, pager_cmd): """ Page str_to_page via the pager. """ # By default, we expect the command to be `less -R`. If that is the # pager_cmd, but they don't have less on their machine, odds are they're # just using the default value. In this case the pager will fail, so we'll # just go via pydoc.pager, which tries to do smarter checking that we don't # want to bother trying to replicate. use_fallback_page_function = False if pager_cmd is None: use_fallback_page_function = True elif pager_cmd == FLAG_FALLBACK: use_fallback_page_function = True try: if use_fallback_page_function: pydoc.pager(str_to_page) else: # Otherwise, obey the user. pydoc.pipepager(str_to_page, cmd=pager_cmd) except KeyboardInterrupt: pass
Example #2
Source File: test_pydoc.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_pipepager(self): # pipepager does not choke on unicode doc = pydoc.render_doc(self.Q) saved, os.popen = os.popen, open try: with test.test_support.temp_cwd(): pydoc.pipepager(doc, 'pipe') self.assertEqual(open('pipe').read(), pydoc._encode(doc)) finally: os.popen = saved
Example #3
Source File: test_pydoc.py From oss-ftp with MIT License | 5 votes |
def test_pipepager(self): # pipepager does not choke on unicode doc = pydoc.render_doc(self.Q) saved, os.popen = os.popen, open try: with test.test_support.temp_cwd(): pydoc.pipepager(doc, 'pipe') self.assertEqual(open('pipe').read(), pydoc._encode(doc)) finally: os.popen = saved
Example #4
Source File: test_pydoc.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_pipepager(self): # pipepager does not choke on unicode doc = pydoc.render_doc(self.Q) saved, os.popen = os.popen, open try: with test.test_support.temp_cwd(): pydoc.pipepager(doc, 'pipe') self.assertEqual(open('pipe').read(), pydoc._encode(doc)) finally: os.popen = saved
Example #5
Source File: explain.py From conary with Apache License 2.0 | 5 votes |
def _pageDoc(title, docString): docString = _formatDocString(docString) # pydoc is fooled by conary's wrapping of stdout. override it if needed. if sys.stdout.isatty(): if _useLess(): # -R parses CSR escape codes properly pydoc.pager = lambda x: pydoc.pipepager(x, 'less -R') else: # PAGER is set if _useLess returns False pydoc.pager = lambda x: pydoc.pipepager(x, os.environ['PAGER']) pydoc.pager("Conary API Documentation: %s\n" % _formatString('B{' + title + '}') + docString)