doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
token.DEDENT
python.library.token#token.DEDENT
token.DOT Token value for ".".
python.library.token#token.DOT
token.DOUBLESLASH Token value for "//".
python.library.token#token.DOUBLESLASH
token.DOUBLESLASHEQUAL Token value for "//=".
python.library.token#token.DOUBLESLASHEQUAL
token.DOUBLESTAR Token value for "**".
python.library.token#token.DOUBLESTAR
token.DOUBLESTAREQUAL Token value for "**=".
python.library.token#token.DOUBLESTAREQUAL
token.ELLIPSIS Token value for "...".
python.library.token#token.ELLIPSIS
token.ENCODING Token value that indicates the encoding used to decode the source bytes into text. The first token returned by tokenize.tokenize() will always be an ENCODING token.
python.library.token#token.ENCODING
token.ENDMARKER
python.library.token#token.ENDMARKER
token.EQEQUAL Token value for "==".
python.library.token#token.EQEQUAL
token.EQUAL Token value for "=".
python.library.token#token.EQUAL
token.ERRORTOKEN
python.library.token#token.ERRORTOKEN
token.GREATER Token value for ">".
python.library.token#token.GREATER
token.GREATEREQUAL Token value for ">=".
python.library.token#token.GREATEREQUAL
token.INDENT
python.library.token#token.INDENT
token.ISEOF(x) Return True if x is the marker indicating the end of input.
python.library.token#token.ISEOF
token.ISNONTERMINAL(x) Return True for non-terminal token values.
python.library.token#token.ISNONTERMINAL
token.ISTERMINAL(x) Return True for terminal token values.
python.library.token#token.ISTERMINAL
token.LBRACE Token value for "{".
python.library.token#token.LBRACE
token.LEFTSHIFT Token value for "<<".
python.library.token#token.LEFTSHIFT
token.LEFTSHIFTEQUAL Token value for "<<=".
python.library.token#token.LEFTSHIFTEQUAL
token.LESS Token value for "<".
python.library.token#token.LESS
token.LESSEQUAL Token value for "<=".
python.library.token#token.LESSEQUAL
token.LPAR Token value for "(".
python.library.token#token.LPAR
token.LSQB Token value for "[".
python.library.token#token.LSQB
token.MINEQUAL Token value for "-=".
python.library.token#token.MINEQUAL
token.MINUS Token value for "-".
python.library.token#token.MINUS
token.NAME
python.library.token#token.NAME
token.NEWLINE
python.library.token#token.NEWLINE
token.NL Token value used to indicate a non-terminating newline. The NEWLINE token indicates the end of a logical line of Python code; NL tokens are generated when a logical line of code is continued over multiple physical lines.
python.library.token#token.NL
token.NOTEQUAL Token value for "!=".
python.library.token#token.NOTEQUAL
token.NT_OFFSET
python.library.token#token.NT_OFFSET
token.NUMBER
python.library.token#token.NUMBER
token.N_TOKENS
python.library.token#token.N_TOKENS
token.OP
python.library.token#token.OP
token.PERCENT Token value for "%".
python.library.token#token.PERCENT
token.PERCENTEQUAL Token value for "%=".
python.library.token#token.PERCENTEQUAL
token.PLUS Token value for "+".
python.library.token#token.PLUS
token.PLUSEQUAL Token value for "+=".
python.library.token#token.PLUSEQUAL
token.RARROW Token value for "->".
python.library.token#token.RARROW
token.RBRACE Token value for "}".
python.library.token#token.RBRACE
token.RIGHTSHIFT Token value for ">>".
python.library.token#token.RIGHTSHIFT
token.RIGHTSHIFTEQUAL Token value for ">>=".
python.library.token#token.RIGHTSHIFTEQUAL
token.RPAR Token value for ")".
python.library.token#token.RPAR
token.RSQB Token value for "]".
python.library.token#token.RSQB
token.SEMI Token value for ";".
python.library.token#token.SEMI
token.SLASH Token value for "/".
python.library.token#token.SLASH
token.SLASHEQUAL Token value for "/=".
python.library.token#token.SLASHEQUAL
token.STAR Token value for "*".
python.library.token#token.STAR
token.STAREQUAL Token value for "*=".
python.library.token#token.STAREQUAL
token.STRING
python.library.token#token.STRING
token.TILDE Token value for "~".
python.library.token#token.TILDE
token.tok_name Dictionary mapping the numeric values of the constants defined in this module back to name strings, allowing more human-readable representation of parse trees to be generated.
python.library.token#token.tok_name
token.TYPE_COMMENT
python.library.token#token.TYPE_COMMENT
token.TYPE_IGNORE
python.library.token#token.TYPE_IGNORE
token.VBAR Token value for "|".
python.library.token#token.VBAR
token.VBAREQUAL Token value for "|=".
python.library.token#token.VBAREQUAL
tokenize — Tokenizer for Python source Source code: Lib/tokenize.py The tokenize module provides a lexical scanner for Python source code, implemented in Python. The scanner in this module returns comments as tokens as well, making it useful for implementing “pretty-printers”, including colorizers for on-screen display...
python.library.tokenize
tokenize.detect_encoding(readline) The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and...
python.library.tokenize#tokenize.detect_encoding
tokenize.generate_tokens(readline) Tokenize a source reading unicode strings instead of bytes. Like tokenize(), the readline argument is a callable returning a single line of input. However, generate_tokens() expects readline to return a str object rather than bytes. The result is an iterator yielding named tuples, e...
python.library.tokenize#tokenize.generate_tokens
tokenize.open(filename) Open a file in read only mode using the encoding detected by detect_encoding(). New in version 3.2.
python.library.tokenize#tokenize.open
exception tokenize.TokenError Raised when either a docstring or expression that may be split over several lines is not completed anywhere in the file, for example: """Beginning of docstring or: [1, 2, 3
python.library.tokenize#tokenize.TokenError
tokenize.tokenize(readline) The tokenize() generator requires one argument, readline, which must be a callable object which provides the same interface as the io.IOBase.readline() method of file objects. Each call to the function should return one line of input as bytes. The generator produces 5-tuples with these mem...
python.library.tokenize#tokenize.tokenize
tokenize.untokenize(iterable) Converts tokens back into Python source code. The iterable must return sequences with at least two elements, the token type and the token string. Any additional sequence elements are ignored. The reconstructed script is returned as a single string. The result is guaranteed to tokenize ba...
python.library.tokenize#tokenize.untokenize
trace — Trace or track Python statement execution Source code: Lib/trace.py The trace module allows you to trace program execution, generate annotated statement coverage listings, print caller/callee relationships and list functions executed during a program run. It can be used in another program or from the command li...
python.library.trace
class trace.CoverageResults A container for coverage results, created by Trace.results(). Should not be created directly by the user. update(other) Merge in data from another CoverageResults object. write_results(show_missing=True, summary=False, coverdir=None) Write coverage results. Set show_missing to sh...
python.library.trace#trace.CoverageResults
update(other) Merge in data from another CoverageResults object.
python.library.trace#trace.CoverageResults.update
write_results(show_missing=True, summary=False, coverdir=None) Write coverage results. Set show_missing to show lines that had no hits. Set summary to include in the output the coverage summary per module. coverdir specifies the directory into which the coverage result files will be output. If None, the results for e...
python.library.trace#trace.CoverageResults.write_results
class trace.Trace(count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None, timing=False) Create an object to trace execution of a single statement or expression. All parameters are optional. count enables counting of line numbers. trace enables line execution tracing. c...
python.library.trace#trace.Trace
results() Return a CoverageResults object that contains the cumulative results of all previous calls to run, runctx and runfunc for the given Trace instance. Does not reset the accumulated trace results.
python.library.trace#trace.Trace.results
run(cmd) Execute the command and gather statistics from the execution with the current tracing parameters. cmd must be a string or code object, suitable for passing into exec().
python.library.trace#trace.Trace.run
runctx(cmd, globals=None, locals=None) Execute the command and gather statistics from the execution with the current tracing parameters, in the defined global and local environments. If not defined, globals and locals default to empty dictionaries.
python.library.trace#trace.Trace.runctx
runfunc(func, /, *args, **kwds) Call func with the given arguments under control of the Trace object with the current tracing parameters.
python.library.trace#trace.Trace.runfunc
traceback — Print or retrieve a stack traceback Source code: Lib/traceback.py This module provides a standard interface to extract, format and print stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful when you want to print stack traces ...
python.library.traceback
traceback.clear_frames(tb) Clears the local variables of all the stack frames in a traceback tb by calling the clear() method of each frame object. New in version 3.4.
python.library.traceback#traceback.clear_frames
traceback.extract_stack(f=None, limit=None) Extract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional f and limit arguments have the same meaning as for print_stack().
python.library.traceback#traceback.extract_stack
traceback.extract_tb(tb, limit=None) Return a StackSummary object representing a list of “pre-processed” stack trace entries extracted from the traceback object tb. It is useful for alternate formatting of stack traces. The optional limit argument has the same meaning as for print_tb(). A “pre-processed” stack trace ...
python.library.traceback#traceback.extract_tb
traceback.format_exc(limit=None, chain=True) This is like print_exc(limit) but returns a string instead of printing to a file.
python.library.traceback#traceback.format_exc
traceback.format_exception(etype, value, tb, limit=None, chain=True) Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When ...
python.library.traceback#traceback.format_exception
traceback.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 SyntaxErr...
python.library.traceback#traceback.format_exception_only
traceback.format_list(extracted_list) Given a list of tuples or FrameSummary objects as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; the strin...
python.library.traceback#traceback.format_list
traceback.format_stack(f=None, limit=None) A shorthand for format_list(extract_stack(f, limit)).
python.library.traceback#traceback.format_stack
traceback.format_tb(tb, limit=None) A shorthand for format_list(extract_tb(tb, limit)).
python.library.traceback#traceback.format_tb
class traceback.FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None) Represent a single frame in the traceback or stack that is being formatted or printed. It may optionally have a stringified version of the frames locals included in it. If lookup_line is False, the source code is not looked...
python.library.traceback#traceback.FrameSummary
traceback.print_exc(limit=None, file=None, chain=True) This is a shorthand for print_exception(*sys.exc_info(), limit, file, chain).
python.library.traceback#traceback.print_exc
traceback.print_exception(etype, value, tb, limit=None, file=None, chain=True) Print exception information and stack trace entries from traceback object tb to file. This differs from print_tb() in the following ways: if tb is not None, it prints a header Traceback (most recent call last): it prints the exception et...
python.library.traceback#traceback.print_exception
traceback.print_last(limit=None, file=None, chain=True) This is a shorthand for print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file, chain). In general it will work only after an exception has reached an interactive prompt (see sys.last_type).
python.library.traceback#traceback.print_last
traceback.print_stack(f=None, limit=None, file=None) Print up to limit stack trace entries (starting from the invocation point) if limit is positive. Otherwise, print the last abs(limit) entries. If limit is omitted or None, all entries are printed. The optional f argument can be used to specify an alternate stack fr...
python.library.traceback#traceback.print_stack
traceback.print_tb(tb, limit=None, file=None) Print up to limit stack trace entries from traceback object tb (starting from the caller’s frame) if limit is positive. Otherwise, print the last abs(limit) entries. If limit is omitted or None, all entries are printed. If file is omitted or None, the output goes to sys.s...
python.library.traceback#traceback.print_tb
class traceback.StackSummary classmethod extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False) Construct a StackSummary object from a frame generator (such as is returned by walk_stack() or walk_tb()). If limit is supplied, only this many frames are taken from frame_gen. If lookup_lines is Fa...
python.library.traceback#traceback.StackSummary
classmethod extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False) Construct a StackSummary object from a frame generator (such as is returned by walk_stack() or walk_tb()). If limit is supplied, only this many frames are taken from frame_gen. If lookup_lines is False, the returned FrameSummary ob...
python.library.traceback#traceback.StackSummary.extract
format() Returns a list of strings ready for printing. Each string in the resulting list corresponds to a single frame from the stack. Each string ends in a newline; the strings may contain internal newlines as well, for those items with source text lines. For long sequences of the same frame and line, the first few ...
python.library.traceback#traceback.StackSummary.format
classmethod from_list(a_list) Construct a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples. Each tuple should be a 4-tuple with filename, lineno, name, line as the elements.
python.library.traceback#traceback.StackSummary.from_list
class traceback.TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False) Capture an exception for later rendering. limit, lookup_lines and capture_locals are as for the StackSummary class. Note that when locals are captured, they are also shown in the traceback. ...
python.library.traceback#traceback.TracebackException
exc_type The class of the original traceback.
python.library.traceback#traceback.TracebackException.exc_type
filename For syntax errors - the file name where the error occurred.
python.library.traceback#traceback.TracebackException.filename
format(*, chain=True) Format the exception. If chain is not True, __cause__ and __context__ will not be formatted. The return value is a generator of strings, each ending in a newline and some containing internal newlines. print_exception() is a wrapper around this method which just prints the lines to a file. The me...
python.library.traceback#traceback.TracebackException.format
format_exception_only() Format the exception part of the traceback. The return value is a generator of strings, each ending in a newline. Normally, the generator emits a single string; however, for SyntaxError exceptions, it emits several lines that (when printed) display detailed information about where the syntax e...
python.library.traceback#traceback.TracebackException.format_exception_only
classmethod from_exception(exc, *, limit=None, lookup_lines=True, capture_locals=False) Capture an exception for later rendering. limit, lookup_lines and capture_locals are as for the StackSummary class. Note that when locals are captured, they are also shown in the traceback.
python.library.traceback#traceback.TracebackException.from_exception
lineno For syntax errors - the line number where the error occurred.
python.library.traceback#traceback.TracebackException.lineno