doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
class bdb.Bdb(skip=None) The Bdb class acts as a generic Python debugger base class. This class takes care of the details of the trace facility; a derived class should implement user interaction. The standard debugger class (pdb.Pdb) is an example. The skip argument, if given, must be an iterable of glob-style module...
python.library.bdb#bdb.Bdb
break_anywhere(frame) This method checks if there is a breakpoint in the filename of the current frame.
python.library.bdb#bdb.Bdb.break_anywhere
break_here(frame) This method checks if there is a breakpoint in the filename and line belonging to frame or, at least, in the current function. If the breakpoint is a temporary one, this method deletes it.
python.library.bdb#bdb.Bdb.break_here
canonic(filename) Auxiliary method for getting a filename in a canonical form, that is, as a case-normalized (on case-insensitive filesystems) absolute path, stripped of surrounding angle brackets.
python.library.bdb#bdb.Bdb.canonic
clear_all_breaks() Delete all existing breakpoints.
python.library.bdb#bdb.Bdb.clear_all_breaks
clear_all_file_breaks(filename) Delete all breakpoints in filename. If none were set, an error message is returned.
python.library.bdb#bdb.Bdb.clear_all_file_breaks
clear_bpbynumber(arg) Delete the breakpoint which has the index arg in the Breakpoint.bpbynumber. If arg is not numeric or out of range, return an error message.
python.library.bdb#bdb.Bdb.clear_bpbynumber
clear_break(filename, lineno) Delete the breakpoints in filename and lineno. If none were set, an error message is returned.
python.library.bdb#bdb.Bdb.clear_break
dispatch_call(frame, arg) If the debugger should stop on this function call, invoke the user_call() method (which should be overridden in subclasses). Raise a BdbQuit exception if the Bdb.quitting flag is set (which can be set from user_call()). Return a reference to the trace_dispatch() method for further tracing in...
python.library.bdb#bdb.Bdb.dispatch_call
dispatch_exception(frame, arg) If the debugger should stop at this exception, invokes the user_exception() method (which should be overridden in subclasses). Raise a BdbQuit exception if the Bdb.quitting flag is set (which can be set from user_exception()). Return a reference to the trace_dispatch() method for furthe...
python.library.bdb#bdb.Bdb.dispatch_exception
dispatch_line(frame) If the debugger should stop on the current line, invoke the user_line() method (which should be overridden in subclasses). Raise a BdbQuit exception if the Bdb.quitting flag is set (which can be set from user_line()). Return a reference to the trace_dispatch() method for further tracing in that s...
python.library.bdb#bdb.Bdb.dispatch_line
dispatch_return(frame, arg) If the debugger should stop on this function return, invoke the user_return() method (which should be overridden in subclasses). Raise a BdbQuit exception if the Bdb.quitting flag is set (which can be set from user_return()). Return a reference to the trace_dispatch() method for further tr...
python.library.bdb#bdb.Bdb.dispatch_return
do_clear(arg) Handle how a breakpoint must be removed when it is a temporary one. This method must be implemented by derived classes.
python.library.bdb#bdb.Bdb.do_clear
format_stack_entry(frame_lineno, lprefix=': ') Return a string with information about a stack entry, identified by a (frame, lineno) tuple: The canonical form of the filename which contains the frame. The function name, or "<lambda>". The input arguments. The return value. The line of code (if it exists).
python.library.bdb#bdb.Bdb.format_stack_entry
get_all_breaks() Return all breakpoints that are set.
python.library.bdb#bdb.Bdb.get_all_breaks
get_bpbynumber(arg) Return a breakpoint specified by the given number. If arg is a string, it will be converted to a number. If arg is a non-numeric string, if the given breakpoint never existed or has been deleted, a ValueError is raised. New in version 3.2.
python.library.bdb#bdb.Bdb.get_bpbynumber
get_break(filename, lineno) Check if there is a breakpoint for lineno of filename.
python.library.bdb#bdb.Bdb.get_break
get_breaks(filename, lineno) Return all breakpoints for lineno in filename, or an empty list if none are set.
python.library.bdb#bdb.Bdb.get_breaks
get_file_breaks(filename) Return all breakpoints in filename, or an empty list if none are set.
python.library.bdb#bdb.Bdb.get_file_breaks
get_stack(f, t) Get a list of records for a frame and all higher (calling) and lower frames, and the size of the higher part.
python.library.bdb#bdb.Bdb.get_stack
reset() Set the botframe, stopframe, returnframe and quitting attributes with values ready to start debugging.
python.library.bdb#bdb.Bdb.reset
run(cmd, globals=None, locals=None) Debug a statement executed via the exec() function. globals defaults to __main__.__dict__, locals defaults to globals.
python.library.bdb#bdb.Bdb.run
runcall(func, /, *args, **kwds) Debug a single function call, and return its result.
python.library.bdb#bdb.Bdb.runcall
runctx(cmd, globals, locals) For backwards compatibility. Calls the run() method.
python.library.bdb#bdb.Bdb.runctx
runeval(expr, globals=None, locals=None) Debug an expression executed via the eval() function. globals and locals have the same meaning as in run().
python.library.bdb#bdb.Bdb.runeval
set_break(filename, lineno, temporary=0, cond, funcname) Set a new breakpoint. If the lineno line doesn’t exist for the filename passed as argument, return an error message. The filename should be in canonical form, as described in the canonic() method.
python.library.bdb#bdb.Bdb.set_break
set_continue() Stop only at breakpoints or when finished. If there are no breakpoints, set the system trace function to None.
python.library.bdb#bdb.Bdb.set_continue
set_next(frame) Stop on the next line in or below the given frame.
python.library.bdb#bdb.Bdb.set_next
set_quit() Set the quitting attribute to True. This raises BdbQuit in the next call to one of the dispatch_*() methods.
python.library.bdb#bdb.Bdb.set_quit
set_return(frame) Stop when returning from the given frame.
python.library.bdb#bdb.Bdb.set_return
set_step() Stop after one line of code.
python.library.bdb#bdb.Bdb.set_step
set_trace([frame]) Start debugging from frame. If frame is not specified, debugging starts from caller’s frame.
python.library.bdb#bdb.Bdb.set_trace
set_until(frame) Stop when the line with the line no greater than the current one is reached or when returning from current frame.
python.library.bdb#bdb.Bdb.set_until
stop_here(frame) This method checks if the frame is somewhere below botframe in the call stack. botframe is the frame in which debugging started.
python.library.bdb#bdb.Bdb.stop_here
trace_dispatch(frame, event, arg) This function is installed as the trace function of debugged frames. Its return value is the new trace function (in most cases, that is, itself). The default implementation decides how to dispatch a frame, depending on the type of event (passed as a string) that is about to be execut...
python.library.bdb#bdb.Bdb.trace_dispatch
user_call(frame, argument_list) This method is called from dispatch_call() when there is the possibility that a break might be necessary anywhere inside the called function.
python.library.bdb#bdb.Bdb.user_call
user_exception(frame, exc_info) This method is called from dispatch_exception() when stop_here() yields True.
python.library.bdb#bdb.Bdb.user_exception
user_line(frame) This method is called from dispatch_line() when either stop_here() or break_here() yields True.
python.library.bdb#bdb.Bdb.user_line
user_return(frame, return_value) This method is called from dispatch_return() when stop_here() yields True.
python.library.bdb#bdb.Bdb.user_return
exception bdb.BdbQuit Exception raised by the Bdb class for quitting the debugger.
python.library.bdb#bdb.BdbQuit
class bdb.Breakpoint(self, file, line, temporary=0, cond=None, funcname=None) This class implements temporary breakpoints, ignore counts, disabling and (re-)enabling, and conditionals. Breakpoints are indexed by number through a list called bpbynumber and by (file, line) pairs through bplist. The former points to a s...
python.library.bdb#bdb.Breakpoint
bpformat() Return a string with all the information about the breakpoint, nicely formatted: The breakpoint number. If it is temporary or not. Its file,line position. The condition that causes a break. If it must be ignored the next N times. The breakpoint hit count. New in version 3.2.
python.library.bdb#bdb.Breakpoint.bpformat
bpprint(out=None) Print the output of bpformat() to the file out, or if it is None, to standard output.
python.library.bdb#bdb.Breakpoint.bpprint
deleteMe() Delete the breakpoint from the list associated to a file/line. If it is the last breakpoint in that position, it also deletes the entry for the file/line.
python.library.bdb#bdb.Breakpoint.deleteMe
disable() Mark the breakpoint as disabled.
python.library.bdb#bdb.Breakpoint.disable
enable() Mark the breakpoint as enabled.
python.library.bdb#bdb.Breakpoint.enable
bdb.checkfuncname(b, frame) Check whether we should break here, depending on the way the breakpoint b was set. If it was set via line number, it checks if b.line is the same as the one in the frame also passed as argument. If the breakpoint was set via function name, we have to check we are in the right frame (the ri...
python.library.bdb#bdb.checkfuncname
bdb.effective(file, line, frame) Determine if there is an effective (active) breakpoint at this line of code. Return a tuple of the breakpoint and a boolean that indicates if it is ok to delete a temporary breakpoint. Return (None, None) if there is no matching breakpoint.
python.library.bdb#bdb.effective
bdb.set_trace() Start debugging with a Bdb instance from caller’s frame.
python.library.bdb#bdb.set_trace
bin(x) Convert an integer number to a binary string prefixed with “0b”. The result is a valid Python expression. If x is not a Python int object, it has to define an __index__() method that returns an integer. Some examples: >>> bin(3) '0b11' >>> bin(-10) '-0b1010' If prefix “0b” is desired or not, you can use eithe...
python.library.functions#bin
binascii — Convert between binary and ASCII The binascii module contains a number of methods to convert between binary and various ASCII-encoded binary representations. Normally, you will not use these functions directly but use wrapper modules like uu, base64, or binhex instead. The binascii module contains low-level ...
python.library.binascii
binascii.a2b_base64(string) Convert a block of base64 data back to binary and return the binary data. More than one line may be passed at a time.
python.library.binascii#binascii.a2b_base64
binascii.a2b_hex(hexstr) binascii.unhexlify(hexstr) Return the binary data represented by the hexadecimal string hexstr. This function is the inverse of b2a_hex(). hexstr must contain an even number of hexadecimal digits (which can be upper or lower case), otherwise an Error exception is raised. Similar functionali...
python.library.binascii#binascii.a2b_hex
binascii.a2b_hqx(string) Convert binhex4 formatted ASCII data to binary, without doing RLE-decompression. The string should contain a complete number of binary bytes, or (in case of the last portion of the binhex4 data) have the remaining bits zero. Deprecated since version 3.9.
python.library.binascii#binascii.a2b_hqx
binascii.a2b_qp(data, header=False) Convert a block of quoted-printable data back to binary and return the binary data. More than one line may be passed at a time. If the optional argument header is present and true, underscores will be decoded as spaces.
python.library.binascii#binascii.a2b_qp
binascii.a2b_uu(string) Convert a single line of uuencoded data back to binary and return the binary data. Lines normally contain 45 (binary) bytes, except for the last line. Line data may be followed by whitespace.
python.library.binascii#binascii.a2b_uu
binascii.b2a_base64(data, *, newline=True) Convert binary data to a line of ASCII characters in base64 coding. The return value is the converted line, including a newline char if newline is true. The output of this function conforms to RFC 3548. Changed in version 3.6: Added the newline parameter.
python.library.binascii#binascii.b2a_base64
binascii.b2a_hex(data[, sep[, bytes_per_sep=1]]) binascii.hexlify(data[, sep[, bytes_per_sep=1]]) Return the hexadecimal representation of the binary data. Every byte of data is converted into the corresponding 2-digit hex representation. The returned bytes object is therefore twice as long as the length of data. S...
python.library.binascii#binascii.b2a_hex
binascii.b2a_hqx(data) Perform hexbin4 binary-to-ASCII translation and return the resulting string. The argument should already be RLE-coded, and have a length divisible by 3 (except possibly the last fragment). Deprecated since version 3.9.
python.library.binascii#binascii.b2a_hqx
binascii.b2a_qp(data, quotetabs=False, istext=True, header=False) Convert binary data to a line(s) of ASCII characters in quoted-printable encoding. The return value is the converted line(s). If the optional argument quotetabs is present and true, all tabs and spaces will be encoded. If the optional argument istext i...
python.library.binascii#binascii.b2a_qp
binascii.b2a_uu(data, *, backtick=False) Convert binary data to a line of ASCII characters, the return value is the converted line, including a newline char. The length of data should be at most 45. If backtick is true, zeros are represented by '`' instead of spaces. Changed in version 3.7: Added the backtick parame...
python.library.binascii#binascii.b2a_uu
binascii.crc32(data[, value]) Compute CRC-32, the 32-bit checksum of data, starting with an initial CRC of value. The default initial CRC is zero. The algorithm is consistent with the ZIP file checksum. Since the algorithm is designed for use as a checksum algorithm, it is not suitable for use as a general hash algor...
python.library.binascii#binascii.crc32
binascii.crc_hqx(data, value) Compute a 16-bit CRC value of data, starting with value as the initial CRC, and return the result. This uses the CRC-CCITT polynomial x16 + x12 + x5 + 1, often represented as 0x1021. This CRC is used in the binhex4 format.
python.library.binascii#binascii.crc_hqx
exception binascii.Error Exception raised on errors. These are usually programming errors.
python.library.binascii#binascii.Error
binascii.b2a_hex(data[, sep[, bytes_per_sep=1]]) binascii.hexlify(data[, sep[, bytes_per_sep=1]]) Return the hexadecimal representation of the binary data. Every byte of data is converted into the corresponding 2-digit hex representation. The returned bytes object is therefore twice as long as the length of data. S...
python.library.binascii#binascii.hexlify
exception binascii.Incomplete Exception raised on incomplete data. These are usually not programming errors, but may be handled by reading a little more data and trying again.
python.library.binascii#binascii.Incomplete
binascii.rlecode_hqx(data) Perform binhex4 style RLE-compression on data and return the result. Deprecated since version 3.9.
python.library.binascii#binascii.rlecode_hqx
binascii.rledecode_hqx(data) Perform RLE-decompression on the data, as per the binhex4 standard. The algorithm uses 0x90 after a byte as a repeat indicator, followed by a count. A count of 0 specifies a byte value of 0x90. The routine returns the decompressed data, unless data input data ends in an orphaned repeat in...
python.library.binascii#binascii.rledecode_hqx
binascii.a2b_hex(hexstr) binascii.unhexlify(hexstr) Return the binary data represented by the hexadecimal string hexstr. This function is the inverse of b2a_hex(). hexstr must contain an even number of hexadecimal digits (which can be upper or lower case), otherwise an Error exception is raised. Similar functionali...
python.library.binascii#binascii.unhexlify
binhex — Encode and decode binhex4 files Source code: Lib/binhex.py Deprecated since version 3.9. This module encodes and decodes files in binhex4 format, a format allowing representation of Macintosh files in ASCII. Only the data fork is handled. The binhex module defines the following functions: binhex.binhex(inp...
python.library.binhex
binhex.binhex(input, output) Convert a binary file with filename input to binhex file output. The output parameter can either be a filename or a file-like object (any object supporting a write() and close() method).
python.library.binhex#binhex.binhex
exception binhex.Error Exception raised when something can’t be encoded using the binhex format (for example, a filename is too long to fit in the filename field), or when input is not properly encoded binhex data.
python.library.binhex#binhex.Error
binhex.hexbin(input, output) Decode a binhex file input. input may be a filename or a file-like object supporting read() and close() methods. The resulting file is written to a file named output, unless the argument is None in which case the output filename is read from the binhex file.
python.library.binhex#binhex.hexbin
bisect — Array bisection algorithm Source code: Lib/bisect.py This module provides support for maintaining a list in sorted order without having to sort the list after each insertion. For long lists of items with expensive comparison operations, this can be an improvement over the more common approach. The module is ca...
python.library.bisect
bisect.bisect_right(a, x, lo=0, hi=len(a)) bisect.bisect(a, x, lo=0, hi=len(a)) Similar to bisect_left(), but returns an insertion point which comes after (to the right of) any existing entries of x in a. The returned insertion point i partitions the array a into two halves so that all(val <= x for val in a[lo:i]) ...
python.library.bisect#bisect.bisect
bisect.bisect_left(a, x, lo=0, hi=len(a)) Locate the insertion point for x in a to maintain sorted order. The parameters lo and hi may be used to specify a subset of the list which should be considered; by default the entire list is used. If x is already present in a, the insertion point will be before (to the left o...
python.library.bisect#bisect.bisect_left
bisect.bisect_right(a, x, lo=0, hi=len(a)) bisect.bisect(a, x, lo=0, hi=len(a)) Similar to bisect_left(), but returns an insertion point which comes after (to the right of) any existing entries of x in a. The returned insertion point i partitions the array a into two halves so that all(val <= x for val in a[lo:i]) ...
python.library.bisect#bisect.bisect_right
bisect.insort_right(a, x, lo=0, hi=len(a)) bisect.insort(a, x, lo=0, hi=len(a)) Similar to insort_left(), but inserting x in a after any existing entries of x.
python.library.bisect#bisect.insort
bisect.insort_left(a, x, lo=0, hi=len(a)) Insert x in a in sorted order. This is equivalent to a.insert(bisect.bisect_left(a, x, lo, hi), x) assuming that a is already sorted. Keep in mind that the O(log n) search is dominated by the slow O(n) insertion step.
python.library.bisect#bisect.insort_left
bisect.insort_right(a, x, lo=0, hi=len(a)) bisect.insort(a, x, lo=0, hi=len(a)) Similar to insort_left(), but inserting x in a after any existing entries of x.
python.library.bisect#bisect.insort_right
exception BlockingIOError Raised when an operation would block on an object (e.g. socket) set for non-blocking operation. Corresponds to errno EAGAIN, EALREADY, EWOULDBLOCK and EINPROGRESS. In addition to those of OSError, BlockingIOError can have one more attribute: characters_written An integer containing the n...
python.library.exceptions#BlockingIOError
characters_written An integer containing the number of characters written to the stream before it blocked. This attribute is available when using the buffered I/O classes from the io module.
python.library.exceptions#BlockingIOError.characters_written
class bool([x]) Return a Boolean value, i.e. one of True or False. x is converted using the standard truth testing procedure. If x is false or omitted, this returns False; otherwise it returns True. The bool class is a subclass of int (see Numeric Types — int, float, complex). It cannot be subclassed further. Its onl...
python.library.functions#bool
breakpoint(*args, **kws) This function drops you into the debugger at the call site. Specifically, it calls sys.breakpointhook(), passing args and kws straight through. By default, sys.breakpointhook() calls pdb.set_trace() expecting no arguments. In this case, it is purely a convenience function so you don’t have to...
python.library.functions#breakpoint
exception BrokenPipeError A subclass of ConnectionError, raised when trying to write on a pipe while the other end has been closed, or trying to write on a socket which has been shutdown for writing. Corresponds to errno EPIPE and ESHUTDOWN.
python.library.exceptions#BrokenPipeError
exception BufferError Raised when a buffer related operation cannot be performed.
python.library.exceptions#BufferError
builtins — Built-in objects This module provides direct access to all ‘built-in’ identifiers of Python; for example, builtins.open is the full name for the built-in function open(). See Built-in Functions and Built-in Constants for documentation. This module is not normally accessed explicitly by most applications, but...
python.library.builtins
class bytearray([source[, encoding[, errors]]]) Return a new array of bytes. The bytearray class is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods of mutable sequences, described in Mutable Sequence Types, as well as most methods that the bytes type has, see Bytes and Bytea...
python.library.functions#bytearray
class bytearray([source[, encoding[, errors]]]) There is no dedicated literal syntax for bytearray objects, instead they are always created by calling the constructor: Creating an empty instance: bytearray() Creating a zero-filled instance with a given length: bytearray(10) From an iterable of integers: bytearray(...
python.library.stdtypes#bytearray
bytes.capitalize() bytearray.capitalize() Return a copy of the sequence with each byte interpreted as an ASCII character, and the first byte capitalized and the rest lowercased. Non-ASCII byte values are passed through unchanged. Note The bytearray version of this method does not operate in place - it always produ...
python.library.stdtypes#bytearray.capitalize
bytes.center(width[, fillbyte]) bytearray.center(width[, fillbyte]) Return a copy of the object centered in a sequence of length width. Padding is done using the specified fillbyte (default is an ASCII space). For bytes objects, the original sequence is returned if width is less than or equal to len(s). Note The b...
python.library.stdtypes#bytearray.center
bytes.count(sub[, start[, end]]) bytearray.count(sub[, start[, end]]) Return the number of non-overlapping occurrences of subsequence sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation. The subsequence to search for may be any bytes-like object or an integer in the ...
python.library.stdtypes#bytearray.count
bytes.decode(encoding="utf-8", errors="strict") bytearray.decode(encoding="utf-8", errors="strict") Return a string decoded from the given bytes. Default encoding is 'utf-8'. errors may be given to set a different error handling scheme. The default for errors is 'strict', meaning that encoding errors raise a Unicod...
python.library.stdtypes#bytearray.decode
bytes.endswith(suffix[, start[, end]]) bytearray.endswith(suffix[, start[, end]]) Return True if the binary data ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. With optional end, stop comparing at that...
python.library.stdtypes#bytearray.endswith
bytes.expandtabs(tabsize=8) bytearray.expandtabs(tabsize=8) Return a copy of the sequence where all ASCII tab characters are replaced by one or more ASCII spaces, depending on the current column and the given tab size. Tab positions occur every tabsize bytes (default is 8, giving tab positions at columns 0, 8, 16 a...
python.library.stdtypes#bytearray.expandtabs
bytes.find(sub[, start[, end]]) bytearray.find(sub[, start[, end]]) Return the lowest index in the data where the subsequence sub is found, such that sub is contained in the slice s[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 if sub is not found. The subsequence to s...
python.library.stdtypes#bytearray.find
classmethod fromhex(string) This bytearray class method returns bytearray object, decoding the given string object. The string must contain two hexadecimal digits per byte, with ASCII whitespace being ignored. >>> bytearray.fromhex('2Ef0 F1f2 ') bytearray(b'.\xf0\xf1\xf2') Changed in version 3.7: bytearray.fromhex...
python.library.stdtypes#bytearray.fromhex
hex([sep[, bytes_per_sep]]) Return a string object containing two hexadecimal digits for each byte in the instance. >>> bytearray(b'\xf0\xf1\xf2').hex() 'f0f1f2' New in version 3.5. Changed in version 3.8: Similar to bytes.hex(), bytearray.hex() now supports optional sep and bytes_per_sep parameters to insert sep...
python.library.stdtypes#bytearray.hex
bytes.index(sub[, start[, end]]) bytearray.index(sub[, start[, end]]) Like find(), but raise ValueError when the subsequence is not found. The subsequence to search for may be any bytes-like object or an integer in the range 0 to 255. Changed in version 3.3: Also accept an integer in the range 0 to 255 as the subs...
python.library.stdtypes#bytearray.index
bytes.isalnum() bytearray.isalnum() Return True if all bytes in the sequence are alphabetical ASCII characters or ASCII decimal digits and the sequence is not empty, False otherwise. Alphabetic ASCII characters are those byte values in the sequence b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. ASCII deci...
python.library.stdtypes#bytearray.isalnum