Back to module index
Go to module by name
pydoc
Generate Python documentation in HTML or text for interactive use.
At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.
Or, at the shell command line outside of Python:
Run "pydoc <name>" to show documentation on something. <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package. If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.
Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.
Run "pydoc -n <hostname>" to start an HTTP server with the given
hostname (default: localhost) on the local machine.
Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine. Port number 0 can be used to get an arbitrary unused port.
Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation. Combine with
the -n and -p options to control the hostname and port used.
Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".
Module docs for core modules are assumed to be in
https://docs.python.org/X.Y/library/
This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
Classes
Doc
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
document(self, object, name=None, *args)
Generate documentation for an object.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
getdocloc(self, object, basedir='/nix/store/hrq2jcbjdwkj39xzahvnnjk93ccrz1pr-python3-3.9.6/lib/python3.9')
Return the location of module docs or None
PYTHONDOCS = 'https://docs.python.org/3.9/library'
ErrorDuringImport
Errors that occurred while trying to import something to document it.
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
HTMLDoc
Formatter class for HTML documentation.
bigsection(self, title, *args)
Format a section with a big heading.
classlink(self, object, modname)
Make a link for a class.
docclass(self, object, name=None, mod=None, funcs={}, classes={}, *ignored)
Produce HTML documentation for a class object.
docdata(self, object, name=None, mod=None, cl=None)
Produce html documentation for a data descriptor.
docmodule(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a module object.
docother(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a data object.
docdata(self, object, name=None, mod=None, cl=None)
Produce html documentation for a data descriptor.
docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None)
Produce HTML documentation for a function or method object.
document(self, object, name=None, *args)
Generate documentation for an object.
escape(text)
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
filelink(self, url, path)
Make a link to source file.
formattree(self, tree, modname, parent=None)
Produce HTML for a class tree as given by inspect.getclasstree().
formatvalue(self, object)
Format an argument default value as text.
getdocloc(self, object, basedir='/nix/store/hrq2jcbjdwkj39xzahvnnjk93ccrz1pr-python3-3.9.6/lib/python3.9')
Return the location of module docs or None
grey(self, text)
heading(self, title, fgcol, bgcol, extras='')
Format a page heading.
index(self, dir, shadowed=None)
Generate an HTML index for a directory of modules.
markup(self, text, escape=None, funcs={}, classes={}, methods={})
Mark up some plain text, given a context of symbols to look for.
Each context dictionary maps object names to anchor names.
modpkglink(self, modpkginfo)
Make a link for a module or package to display in an index.
modulelink(self, object)
Make a link for a module.
multicolumn(self, list, format, cols=4)
Format a list of items into a multi-column list.
namelink(self, name, *dicts)
Make a link for an identifier, given name-to-URL mappings.
page(self, title, contents)
Format an HTML page.
preformat(self, text)
Format literal preformatted text.
repr(object)
section(self, title, fgcol, bgcol, contents, width=6, prelude='', marginalia=None, gap=' ')
Format a section with a heading.
PYTHONDOCS = 'https://docs.python.org/3.9/library'
HTMLRepr
Class for safely making an HTML representation of a Python object.
escape(self, text)
repr(self, object)
repr1(self, x, level)
repr_array(self, x, level)
repr_deque(self, x, level)
repr_dict(self, x, level)
repr_frozenset(self, x, level)
repr_instance(self, x, level)
repr_int(self, x, level)
repr_list(self, x, level)
repr_set(self, x, level)
repr_string(self, x, level)
repr_string(self, x, level)
repr_tuple(self, x, level)
repr_string(self, x, level)
Helper
getline(self, prompt)
Read one line, using input() when appropriate.
help(self, request)
interact(self)
intro(self)
list(self, items, columns=4, width=80)
listkeywords(self)
listmodules(self, key='')
listsymbols(self)
listtopics(self)
showsymbol(self, symbol)
showtopic(self, topic, more_xrefs='')
input = <property object at 0x7ff35fdf1b80>
keywords = {'False': '', 'None': '', 'True': '', '__peg_parser__': '', 'and': 'BOOLEAN', 'as': 'with', 'assert': ('assert', ''), 'async': ('async', ''), 'await': ('await', ''), 'break': ('break', 'while for'), 'class': ('class', 'CLASSES SPECIALMETHODS'), 'continue': ('continue', 'while for'), 'def': ('function', ''), 'del': ('del', 'BASICMETHODS'), 'elif': 'if', 'else': ('else', 'while for'), 'except': 'try', 'finally': 'try', 'for': ('for', 'break continue while'), 'from': 'import', 'global': ('global', 'nonlocal NAMESPACES'), 'if': ('if', 'TRUTHVALUE'), 'import': ('import', 'MODULES'), 'in': ('in', 'SEQUENCEMETHODS'), 'is': 'COMPARISON', 'lambda': ('lambda', 'FUNCTIONS'), 'nonlocal': ('nonlocal', 'global NAMESPACES'), 'not': 'BOOLEAN', 'or': 'BOOLEAN', 'pass': ('pass', ''), 'raise': ('raise', 'EXCEPTIONS'), 'return': ('return', 'FUNCTIONS'), 'try': ('try', 'EXCEPTIONS'), 'while': ('while', 'break continue if TRUTHVALUE'), 'with': ('with', 'CONTEXTMANAGERS EXCEPTIONS yield'), 'yield': ('yield', '')}
output = <property object at 0x7ff35fdf3040>
symbol = 'J'
symbols = {'%': 'OPERATORS FORMATTING', '**': 'POWER OPERATORS', ',': 'TUPLES LISTS FUNCTIONS', '.': 'ATTRIBUTES FLOAT MODULES OBJECTS', '...': 'ELLIPSIS', ':': 'SLICINGS DICTIONARYLITERALS', '@': 'def class', '\\': 'STRINGS', '_': 'PRIVATENAMES', '__': 'PRIVATENAMES SPECIALMETHODS', '`': 'BACKQUOTES', '(': 'TUPLES FUNCTIONS CALLS', ')': 'TUPLES FUNCTIONS CALLS', '[': 'LISTS SUBSCRIPTS SLICINGS', ']': 'LISTS SUBSCRIPTS SLICINGS', "'": 'STRINGS', "'''": 'STRINGS', '"': 'STRINGS', '"""': 'STRINGS', "b'": 'STRINGS', 'b"': 'STRINGS', "f'": 'STRINGS', 'f"': 'STRINGS', "r'": 'STRINGS', 'r"': 'STRINGS', "u'": 'STRINGS', 'u"': 'STRINGS', '+': 'OPERATORS', '-': 'OPERATORS UNARY', '*': 'OPERATORS', '/': 'OPERATORS', '//': 'OPERATORS', '<<': 'OPERATORS BITWISE', '>>': 'OPERATORS BITWISE', '&': 'OPERATORS BITWISE', '|': 'OPERATORS BITWISE', '^': 'OPERATORS BITWISE', '~': 'OPERATORS UNARY BITWISE', '<': 'OPERATORS COMPARISON', '>': 'OPERATORS COMPARISON', '<=': 'OPERATORS COMPARISON', '>=': 'OPERATORS COMPARISON', '==': 'OPERATORS COMPARISON', '!=': 'OPERATORS COMPARISON', '<>': 'OPERATORS COMPARISON', '+=': 'AUGMENTEDASSIGNMENT', '-=': 'AUGMENTEDASSIGNMENT', '*=': 'AUGMENTEDASSIGNMENT', '/=': 'AUGMENTEDASSIGNMENT', '%=': 'AUGMENTEDASSIGNMENT', '&=': 'AUGMENTEDASSIGNMENT', '|=': 'AUGMENTEDASSIGNMENT', '^=': 'AUGMENTEDASSIGNMENT', '<<=': 'AUGMENTEDASSIGNMENT', '>>=': 'AUGMENTEDASSIGNMENT', '**=': 'AUGMENTEDASSIGNMENT', '//=': 'AUGMENTEDASSIGNMENT', 'j': 'COMPLEX', 'J': 'COMPLEX'}
symbols_ = ('j', 'J')
topic = 'COMPLEX'
topics = {'TYPES': ('types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect'), 'STRINGS': ('strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES'), 'STRINGMETHODS': ('string-methods', 'STRINGS FORMATTING'), 'FORMATTING': ('formatstrings', 'OPERATORS'), 'UNICODE': ('strings', 'encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES'), 'NUMBERS': ('numbers', 'INTEGER FLOAT COMPLEX TYPES'), 'INTEGER': ('integers', 'int range'), 'FLOAT': ('floating', 'float math'), 'COMPLEX': ('imaginary', 'complex cmath'), 'SEQUENCES': ('typesseq', 'STRINGMETHODS FORMATTING range LISTS'), 'MAPPINGS': 'DICTIONARIES', 'FUNCTIONS': ('typesfunctions', 'def TYPES'), 'METHODS': ('typesmethods', 'class def CLASSES TYPES'), 'CODEOBJECTS': ('bltin-code-objects', 'compile FUNCTIONS TYPES'), 'TYPEOBJECTS': ('bltin-type-objects', 'types TYPES'), 'FRAMEOBJECTS': 'TYPES', 'TRACEBACKS': 'TYPES', 'NONE': ('bltin-null-object', ''), 'ELLIPSIS': ('bltin-ellipsis-object', 'SLICINGS'), 'SPECIALATTRIBUTES': ('specialattrs', ''), 'CLASSES': ('types', 'class SPECIALMETHODS PRIVATENAMES'), 'MODULES': ('typesmodules', 'import'), 'PACKAGES': 'import', 'EXPRESSIONS': ('operator-summary', 'lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES'), 'OPERATORS': 'EXPRESSIONS', 'PRECEDENCE': 'EXPRESSIONS', 'OBJECTS': ('objects', 'TYPES'), 'SPECIALMETHODS': ('specialnames', 'BASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES'), 'BASICMETHODS': ('customization', 'hash repr str SPECIALMETHODS'), 'ATTRIBUTEMETHODS': ('attribute-access', 'ATTRIBUTES SPECIALMETHODS'), 'CALLABLEMETHODS': ('callable-types', 'CALLS SPECIALMETHODS'), 'SEQUENCEMETHODS': ('sequence-types', 'SEQUENCES SEQUENCEMETHODS SPECIALMETHODS'), 'MAPPINGMETHODS': ('sequence-types', 'MAPPINGS SPECIALMETHODS'), 'NUMBERMETHODS': ('numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS'), 'EXECUTION': ('execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), 'NAMESPACES': ('naming', 'global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES'), 'DYNAMICFEATURES': ('dynamic-features', ''), 'SCOPING': 'NAMESPACES', 'FRAMES': 'NAMESPACES', 'EXCEPTIONS': ('exceptions', 'try except finally raise'), 'CONVERSIONS': ('conversions', ''), 'IDENTIFIERS': ('identifiers', 'keywords SPECIALIDENTIFIERS'), 'SPECIALIDENTIFIERS': ('id-classes', ''), 'PRIVATENAMES': ('atom-identifiers', ''), 'LITERALS': ('atom-literals', 'STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), 'TUPLES': 'SEQUENCES', 'TUPLELITERALS': ('exprlists', 'TUPLES LITERALS'), 'LISTS': ('typesseq-mutable', 'LISTLITERALS'), 'LISTLITERALS': ('lists', 'LISTS LITERALS'), 'DICTIONARIES': ('typesmapping', 'DICTIONARYLITERALS'), 'DICTIONARYLITERALS': ('dict', 'DICTIONARIES LITERALS'), 'ATTRIBUTES': ('attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), 'SUBSCRIPTS': ('subscriptions', 'SEQUENCEMETHODS'), 'SLICINGS': ('slicings', 'SEQUENCEMETHODS'), 'CALLS': ('calls', 'EXPRESSIONS'), 'POWER': ('power', 'EXPRESSIONS'), 'UNARY': ('unary', 'EXPRESSIONS'), 'BINARY': ('binary', 'EXPRESSIONS'), 'SHIFTING': ('shifting', 'EXPRESSIONS'), 'BITWISE': ('bitwise', 'EXPRESSIONS'), 'COMPARISON': ('comparisons', 'EXPRESSIONS BASICMETHODS'), 'BOOLEAN': ('booleans', 'EXPRESSIONS TRUTHVALUE'), 'ASSERTION': 'assert', 'ASSIGNMENT': ('assignment', 'AUGMENTEDASSIGNMENT'), 'AUGMENTEDASSIGNMENT': ('augassign', 'NUMBERMETHODS'), 'DELETION': 'del', 'RETURNING': 'return', 'IMPORTING': 'import', 'CONDITIONAL': 'if', 'LOOPING': ('compound', 'for while break continue'), 'TRUTHVALUE': ('truth', 'if while and or not BASICMETHODS'), 'DEBUGGING': ('debugger', 'pdb'), 'CONTEXTMANAGERS': ('context-managers', 'with')}
ModuleScanner
An interruptible scanner that searches module synopses.
run(self, callback, key=None, completer=None, onerror=None)
Repr
repr(self, x)
repr1(self, x, level)
repr_array(self, x, level)
repr_deque(self, x, level)
repr_dict(self, x, level)
repr_frozenset(self, x, level)
repr_instance(self, x, level)
repr_int(self, x, level)
repr_list(self, x, level)
repr_set(self, x, level)
repr_str(self, x, level)
repr_tuple(self, x, level)
TextDoc
Formatter class for text documentation.
bold(self, text)
Format a string in bold by overstriking.
docclass(self, object, name=None, mod=None, *ignored)
Produce text documentation for a given class object.
docdata(self, object, name=None, mod=None, cl=None)
Produce text documentation for a data descriptor.
docmodule(self, object, name=None, mod=None)
Produce text documentation for a given module object.
docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None)
Produce text documentation for a data object.
docdata(self, object, name=None, mod=None, cl=None)
Produce text documentation for a data descriptor.
docroutine(self, object, name=None, mod=None, cl=None)
Produce text documentation for a function or method object.
document(self, object, name=None, *args)
Generate documentation for an object.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
formattree(self, tree, modname, parent=None, prefix='')
Render in text a class tree as returned by inspect.getclasstree().
formatvalue(self, object)
Format an argument default value as text.
getdocloc(self, object, basedir='/nix/store/hrq2jcbjdwkj39xzahvnnjk93ccrz1pr-python3-3.9.6/lib/python3.9')
Return the location of module docs or None
indent(self, text, prefix=' ')
Indent text by prepending a given prefix to each line.
repr(x)
section(self, title, contents)
Format a section with a given heading.
PYTHONDOCS = 'https://docs.python.org/3.9/library'
TextRepr
Class for safely making a text representation of a Python object.
repr(self, x)
repr1(self, x, level)
repr_array(self, x, level)
repr_deque(self, x, level)
repr_dict(self, x, level)
repr_frozenset(self, x, level)
repr_instance(self, x, level)
repr_int(self, x, level)
repr_list(self, x, level)
repr_set(self, x, level)
repr_string(self, x, level)
repr_string(self, x, level)
repr_tuple(self, x, level)
deque
deque([iterable[, maxlen]]) --> deque object
A list-like sequence optimized for data accesses near its endpoints.
append(...)
Add an element to the right side of the deque.
appendleft(...)
Add an element to the left side of the deque.
clear(...)
Remove all elements from the deque.
copy(...)
Return a shallow copy of a deque.
count(...)
D.count(value) -> integer -- return number of occurrences of value
extend(...)
Extend the right side of the deque with elements from the iterable
extendleft(...)
Extend the left side of the deque with elements from the iterable
index(...)
D.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
insert(...)
D.insert(index, object) -- insert object before index
pop(...)
Remove and return the rightmost element.
popleft(...)
Remove and return the leftmost element.
remove(...)
D.remove(value) -- remove first occurrence of value.
reverse(...)
D.reverse() -- reverse *IN PLACE*
rotate(...)
Rotate the deque n steps to the right (default n=1). If n is negative, rotates left.
maxlen = <attribute 'maxlen' of 'collections.deque' objects>
maximum size of a deque or None if unbounded
Functions
allmethods
allmethods(cl)
apropos
apropos(key)
Print all the one-line module summaries that contain a substring.
browse
browse(port=0, *, open_browser=True, hostname='localhost')
Start the enhanced pydoc Web server and open a Web browser.
Use port '0' to start the server on an arbitrary port.
Set open_browser to False to suppress opening a browser.
classify_class_attrs
classify_class_attrs(object)
Wrap inspect.classify_class_attrs, with fixup for data descriptors.
classname
classname(object, modname)
Get a class name and qualify it with a module name if necessary.
cli
cli()
Command-line interface (looks at sys.argv to decide what to do).
cram
cram(text, maxlen)
Omit part of a string if needed to make it fit in a maximum length.
describe
describe(thing)
Produce a short description of the given thing.
doc
doc(thing, title='Python Library Documentation: %s', forceload=0, output=None)
Display text documentation, given an object or a path to an object.
format_exception_only
format_exception_only(etype, value)
Format the exception part of a traceback.
The arguments are the exception type and value such as given by
sys.last_type and sys.last_value. The return value is a list of
strings, each ending in a newline.
Normally, the list contains a single string; however, for
SyntaxError exceptions, it contains several lines that (when
printed) display detailed information about where the syntax
error occurred.
The message indicating which exception occurred is always the last
string in the list.
getdoc
getdoc(object)
Get the doc string or comments for an object.
getpager
getpager()
Decide what method to use for paging through text.
importfile
importfile(path)
Import a Python source file or compiled file given its path.
isdata
isdata(object)
Check if an object is of a type that probably means it's data.
ispackage
ispackage(path)
Guess whether a path refers to a package directory.
ispath
ispath(x)
locate
locate(path, forceload=0)
Locate an object by name or dotted path, importing as necessary.
pager
pager(text)
The first time this is called, determine what kind of pager to use.
pathdirs
pathdirs()
Convert sys.path into a list of absolute, existing, unique paths.
pipepager
pipepager(text, cmd)
Page through text by feeding it to another program.
plain
plain(text)
Remove boldface formatting from text.
plainpager
plainpager(text)
Simply print unformatted text. This is the ultimate fallback.
render_doc
render_doc(thing, title='Python Library Documentation: %s', forceload=0, renderer=None)
Render text documentation, given an object or a path to an object.
replace
replace(text, *pairs)
Do a series of global replacements on a string.
resolve
resolve(thing, forceload=0)
Given an object or a path to an object, get the object and its name.
safeimport
safeimport(path, forceload=0, cache={})
Import a module; handle errors; return None if the module isn't found.
If the module *is* found but an exception occurs, it's wrapped in an
ErrorDuringImport exception and reraised. Unlike __import__, if a
package path is specified, the module at the end of the path is returned,
not the package at the beginning. If the optional 'forceload' argument
is 1, we reload the module from disk (unless it's a dynamic extension).
sort_attributes
sort_attributes(attrs, object)
Sort the attrs list in-place by _fields and then alphabetically by name
source_synopsis
source_synopsis(file)
splitdoc
splitdoc(doc)
Split a doc string into a synopsis line (if any) and the rest.
stripid
stripid(text)
Remove the hexadecimal id from a Python object representation.
synopsis
synopsis(filename, cache={})
Get the one-line summary out of a module file.
tempfilepager
tempfilepager(text, cmd)
Page through text by invoking a program on a temporary file.
ttypager
ttypager(text)
Page through text on a text terminal.
visiblename
visiblename(name, all=None, obj=None)
Decide whether to show documentation on a variable.
writedoc
writedoc(thing, forceload=0)
Write HTML documentation to a file in the current directory.
writedocs
writedocs(dir, pkgpath='', done=None)
Write out HTML documentation for all modules in a directory tree.
Other members
help = <pydoc.Helper instance>
html = <pydoc.HTMLDoc object at 0x7ff35e80b070>
plaintext = <pydoc._PlainTextDoc object at 0x7ff35e80b040>
text = <pydoc.TextDoc object at 0x7ff35e80bcd0>
Modules
builtins
importlib
inspect
io
os
pkgutil
platform
re
sys
sysconfig
time
tokenize
urllib
warnings