Display text documentation, given an object or a path to an object.
(thing, title='Python Library Documentation: %s', forceload=0,
output=None, is_cli=False)
| 1861 | return title % desc + '\n\n' + renderer.document(object, name) |
| 1862 | |
| 1863 | def doc(thing, title='Python Library Documentation: %s', forceload=0, |
| 1864 | output=None, is_cli=False): |
| 1865 | """Display text documentation, given an object or a path to an object.""" |
| 1866 | if output is None: |
| 1867 | try: |
| 1868 | pager(render_doc(thing, title, forceload)) |
| 1869 | except ImportError as exc: |
| 1870 | if is_cli: |
| 1871 | raise |
| 1872 | print(exc) |
| 1873 | else: |
| 1874 | try: |
| 1875 | s = render_doc(thing, title, forceload, plaintext) |
| 1876 | except ImportError as exc: |
| 1877 | s = str(exc) |
| 1878 | output.write(s) |
| 1879 | |
| 1880 | def writedoc(thing, forceload=0): |
| 1881 | """Write HTML documentation to a file in the current directory.""" |