doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
reset(token)
Reset the context variable to the value it had before the ContextVar.set() that created the token was used. For example: var = ContextVar('var')
token = var.set('new value')
# code that uses 'var'; var.get() returns 'new value'.
var.reset(token)
# After the reset call the var has no value again, so
# v... | python.library.contextvars#contextvars.ContextVar.reset |
set(value)
Call to set a new value for the context variable in the current context. The required value argument is the new value for the context variable. Returns a Token object that can be used to restore the variable to its previous value via the ContextVar.reset() method. | python.library.contextvars#contextvars.ContextVar.set |
class contextvars.Token
Token objects are returned by the ContextVar.set() method. They can be passed to the ContextVar.reset() method to revert the value of the variable to what it was before the corresponding set.
Token.var
A read-only property. Points to the ContextVar object that created the token.
Token.... | python.library.contextvars#contextvars.contextvars.Token |
Token.MISSING
A marker object used by Token.old_value. | python.library.contextvars#contextvars.contextvars.Token.Token.MISSING |
Token.old_value
A read-only property. Set to the value the variable had before the ContextVar.set() method call that created the token. It points to Token.MISSING is the variable was not set before the call. | python.library.contextvars#contextvars.contextvars.Token.Token.old_value |
Token.var
A read-only property. Points to the ContextVar object that created the token. | python.library.contextvars#contextvars.contextvars.Token.Token.var |
contextvars.copy_context()
Returns a copy of the current Context object. The following snippet gets a copy of the current context and prints all variables and their values that are set in it: ctx: Context = copy_context()
print(list(ctx.items()))
The function has an O(1) complexity, i.e. works equally fast for conte... | python.library.contextvars#contextvars.copy_context |
copy — Shallow and deep copy operations Source code: Lib/copy.py Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without changing the other. This mod... | python.library.copy |
copy.copy(x)
Return a shallow copy of x. | python.library.copy#copy.copy |
copy.deepcopy(x[, memo])
Return a deep copy of x. | python.library.copy#copy.deepcopy |
exception copy.Error
Raised for module specific errors. | python.library.copy#copy.Error |
copyreg — Register pickle support functions Source code: Lib/copyreg.py The copyreg module offers a way to define functions used while pickling specific objects. The pickle and copy modules use those functions when pickling/copying those objects. The module provides configuration information about object constructors w... | python.library.copyreg |
copyreg.constructor(object)
Declares object to be a valid constructor. If object is not callable (and hence not valid as a constructor), raises TypeError. | python.library.copyreg#copyreg.constructor |
copyreg.pickle(type, function, constructor=None)
Declares that function should be used as a “reduction” function for objects of type type. function should return either a string or a tuple containing two or three elements. The optional constructor parameter, if provided, is a callable object which can be used to reco... | python.library.copyreg#copyreg.pickle |
copyright
credits
Objects that when printed or called, print the text of copyright or credits, respectively. | python.library.constants#copyright |
copyright
credits
Objects that when printed or called, print the text of copyright or credits, respectively. | python.library.constants#credits |
crypt — Function to check Unix passwords Source code: Lib/crypt.py This module implements an interface to the crypt(3) routine, which is a one-way hash function based upon a modified DES algorithm; see the Unix man page for further details. Possible uses include storing hashed passwords so you can check passwords witho... | python.library.crypt |
crypt.crypt(word, salt=None)
word will usually be a user’s password as typed at a prompt or in a graphical interface. The optional salt is either a string as returned from mksalt(), one of the crypt.METHOD_* values (though not all may be available on all platforms), or a full encrypted password including salt, as ret... | python.library.crypt#crypt.crypt |
crypt.methods
A list of available password hashing algorithms, as crypt.METHOD_* objects. This list is sorted from strongest to weakest. | python.library.crypt#crypt.methods |
crypt.METHOD_BLOWFISH
Another Modular Crypt Format method with 22 character salt and 31 character hash based on the Blowfish cipher. New in version 3.7. | python.library.crypt#crypt.METHOD_BLOWFISH |
crypt.METHOD_CRYPT
The traditional method with a 2 character salt and 13 characters of hash. This is the weakest method. | python.library.crypt#crypt.METHOD_CRYPT |
crypt.METHOD_MD5
Another Modular Crypt Format method with 8 character salt and 22 character hash based on the MD5 hash function. | python.library.crypt#crypt.METHOD_MD5 |
crypt.METHOD_SHA256
Another Modular Crypt Format method with 16 character salt and 43 character hash based on the SHA-256 hash function. | python.library.crypt#crypt.METHOD_SHA256 |
crypt.METHOD_SHA512
A Modular Crypt Format method with 16 character salt and 86 character hash based on the SHA-512 hash function. This is the strongest method. | python.library.crypt#crypt.METHOD_SHA512 |
crypt.mksalt(method=None, *, rounds=None)
Return a randomly generated salt of the specified method. If no method is given, the strongest method available as returned by methods() is used. The return value is a string suitable for passing as the salt argument to crypt(). rounds specifies the number of rounds for METHO... | python.library.crypt#crypt.mksalt |
csv — CSV File Reading and Writing Source code: Lib/csv.py The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in RFC 4180. The lack of a well-defin... | python.library.csv |
csvreader.dialect
A read-only description of the dialect in use by the parser. | python.library.csv#csv.csvreader.dialect |
csvreader.fieldnames
If not passed as a parameter when creating the object, this attribute is initialized upon first access or when the first record is read from the file. | python.library.csv#csv.csvreader.fieldnames |
csvreader.line_num
The number of lines read from the source iterator. This is not the same as the number of records returned, as records can span multiple lines. | python.library.csv#csv.csvreader.line_num |
csvreader.__next__()
Return the next row of the reader’s iterable object as a list (if the object was returned from reader()) or a dict (if it is a DictReader instance), parsed according to the current dialect. Usually you should call this as next(reader). | python.library.csv#csv.csvreader.__next__ |
csvwriter.dialect
A read-only description of the dialect in use by the writer. | python.library.csv#csv.csvwriter.dialect |
csvwriter.writerow(row)
Write the row parameter to the writer’s file object, formatted according to the current dialect. Return the return value of the call to the write method of the underlying file object. Changed in version 3.5: Added support of arbitrary iterables. | python.library.csv#csv.csvwriter.writerow |
csvwriter.writerows(rows)
Write all elements in rows (an iterable of row objects as described above) to the writer’s file object, formatted according to the current dialect. | python.library.csv#csv.csvwriter.writerows |
class csv.Dialect
The Dialect class is a container class relied on primarily for its attributes, which are used to define the parameters for a specific reader or writer instance. | python.library.csv#csv.Dialect |
Dialect.delimiter
A one-character string used to separate fields. It defaults to ','. | python.library.csv#csv.Dialect.delimiter |
Dialect.doublequote
Controls how instances of quotechar appearing inside a field should themselves be quoted. When True, the character is doubled. When False, the escapechar is used as a prefix to the quotechar. It defaults to True. On output, if doublequote is False and no escapechar is set, Error is raised if a quo... | python.library.csv#csv.Dialect.doublequote |
Dialect.escapechar
A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if doublequote is False. On reading, the escapechar removes any special meaning from the following character. It defaults to None, which disables escaping. | python.library.csv#csv.Dialect.escapechar |
Dialect.lineterminator
The string used to terminate lines produced by the writer. It defaults to '\r\n'. Note The reader is hard-coded to recognise either '\r' or '\n' as end-of-line, and ignores lineterminator. This behavior may change in the future. | python.library.csv#csv.Dialect.lineterminator |
Dialect.quotechar
A one-character string used to quote fields containing special characters, such as the delimiter or quotechar, or which contain new-line characters. It defaults to '"'. | python.library.csv#csv.Dialect.quotechar |
Dialect.quoting
Controls when quotes should be generated by the writer and recognised by the reader. It can take on any of the QUOTE_* constants (see section Module Contents) and defaults to QUOTE_MINIMAL. | python.library.csv#csv.Dialect.quoting |
Dialect.skipinitialspace
When True, whitespace immediately following the delimiter is ignored. The default is False. | python.library.csv#csv.Dialect.skipinitialspace |
Dialect.strict
When True, raise exception Error on bad CSV input. The default is False. | python.library.csv#csv.Dialect.strict |
class csv.DictReader(f, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)
Create an object that operates like a regular reader but maps the information in each row to a dict whose keys are given by the optional fieldnames parameter. The fieldnames parameter is a sequence. If fieldnames is o... | python.library.csv#csv.DictReader |
class csv.DictWriter(f, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)
Create an object which operates like a regular writer but maps dictionaries onto output rows. The fieldnames parameter is a sequence of keys that identify the order in which values in the dictionary passed to the wri... | python.library.csv#csv.DictWriter |
DictWriter.writeheader()
Write a row with the field names (as specified in the constructor) to the writer’s file object, formatted according to the current dialect. Return the return value of the csvwriter.writerow() call used internally. New in version 3.2. Changed in version 3.8: writeheader() now also returns t... | python.library.csv#csv.DictWriter.writeheader |
exception csv.Error
Raised by any of the functions when an error is detected. | python.library.csv#csv.Error |
class csv.excel
The excel class defines the usual properties of an Excel-generated CSV file. It is registered with the dialect name 'excel'. | python.library.csv#csv.excel |
class csv.excel_tab
The excel_tab class defines the usual properties of an Excel-generated TAB-delimited file. It is registered with the dialect name 'excel-tab'. | python.library.csv#csv.excel_tab |
csv.field_size_limit([new_limit])
Returns the current maximum field size allowed by the parser. If new_limit is given, this becomes the new limit. | python.library.csv#csv.field_size_limit |
csv.get_dialect(name)
Return the dialect associated with name. An Error is raised if name is not a registered dialect name. This function returns an immutable Dialect. | python.library.csv#csv.get_dialect |
csv.list_dialects()
Return the names of all registered dialects. | python.library.csv#csv.list_dialects |
csv.QUOTE_ALL
Instructs writer objects to quote all fields. | python.library.csv#csv.QUOTE_ALL |
csv.QUOTE_MINIMAL
Instructs writer objects to only quote those fields which contain special characters such as delimiter, quotechar or any of the characters in lineterminator. | python.library.csv#csv.QUOTE_MINIMAL |
csv.QUOTE_NONE
Instructs writer objects to never quote fields. When the current delimiter occurs in output data it is preceded by the current escapechar character. If escapechar is not set, the writer will raise Error if any characters that require escaping are encountered. Instructs reader to perform no special proc... | python.library.csv#csv.QUOTE_NONE |
csv.QUOTE_NONNUMERIC
Instructs writer objects to quote all non-numeric fields. Instructs the reader to convert all non-quoted fields to type float. | python.library.csv#csv.QUOTE_NONNUMERIC |
csv.reader(csvfile, dialect='excel', **fmtparams)
Return a reader object which will iterate over lines in the given csvfile. csvfile can be any object which supports the iterator protocol and returns a string each time its __next__() method is called — file objects and list objects are both suitable. If csvfile is a ... | python.library.csv#csv.reader |
csv.register_dialect(name[, dialect[, **fmtparams]])
Associate dialect with name. name must be a string. The dialect can be specified either by passing a sub-class of Dialect, or by fmtparams keyword arguments, or both, with keyword arguments overriding parameters of the dialect. For full details about the dialect an... | python.library.csv#csv.register_dialect |
class csv.Sniffer
The Sniffer class is used to deduce the format of a CSV file. The Sniffer class provides two methods:
sniff(sample, delimiters=None)
Analyze the given sample and return a Dialect subclass reflecting the parameters found. If the optional delimiters parameter is given, it is interpreted as a strin... | python.library.csv#csv.Sniffer |
has_header(sample)
Analyze the sample text (presumed to be in CSV format) and return True if the first row appears to be a series of column headers. | python.library.csv#csv.Sniffer.has_header |
sniff(sample, delimiters=None)
Analyze the given sample and return a Dialect subclass reflecting the parameters found. If the optional delimiters parameter is given, it is interpreted as a string containing possible valid delimiter characters. | python.library.csv#csv.Sniffer.sniff |
class csv.unix_dialect
The unix_dialect class defines the usual properties of a CSV file generated on UNIX systems, i.e. using '\n' as line terminator and quoting all fields. It is registered with the dialect name 'unix'. New in version 3.2. | python.library.csv#csv.unix_dialect |
csv.unregister_dialect(name)
Delete the dialect associated with name from the dialect registry. An Error is raised if name is not a registered dialect name. | python.library.csv#csv.unregister_dialect |
csv.writer(csvfile, dialect='excel', **fmtparams)
Return a writer object responsible for converting the user’s data into delimited strings on the given file-like object. csvfile can be any object with a write() method. If csvfile is a file object, it should be opened with newline='' 1. An optional dialect parameter c... | python.library.csv#csv.writer |
ctypes — A foreign function library for Python ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python. ctypes tutorial Note: The code samples in this tutorial use doctest to mak... | python.library.ctypes |
ctypes.addressof(obj)
Returns the address of the memory buffer as integer. obj must be an instance of a ctypes type. Raises an auditing event ctypes.addressof with argument obj. | python.library.ctypes#ctypes.addressof |
ctypes.alignment(obj_or_type)
Returns the alignment requirements of a ctypes type. obj_or_type must be a ctypes type or instance. | python.library.ctypes#ctypes.alignment |
exception ctypes.ArgumentError
This exception is raised when a foreign function call cannot convert one of the passed arguments. | python.library.ctypes#ctypes.ArgumentError |
class ctypes.Array(*args)
Abstract base class for arrays. The recommended way to create concrete array types is by multiplying any ctypes data type with a positive integer. Alternatively, you can subclass this type and define _length_ and _type_ class variables. Array elements can be read and written using standard s... | python.library.ctypes#ctypes.Array |
_length_
A positive integer specifying the number of elements in the array. Out-of-range subscripts result in an IndexError. Will be returned by len(). | python.library.ctypes#ctypes.Array._length_ |
_type_
Specifies the type of each element in the array. | python.library.ctypes#ctypes.Array._type_ |
class ctypes.BigEndianStructure(*args, **kw)
Abstract base class for structures in big endian byte order. | python.library.ctypes#ctypes.BigEndianStructure |
ctypes.byref(obj[, offset])
Returns a light-weight pointer to obj, which must be an instance of a ctypes type. offset defaults to zero, and must be an integer that will be added to the internal pointer value. byref(obj, offset) corresponds to this C code: (((char *)&obj) + offset)
The returned object can only be use... | python.library.ctypes#ctypes.byref |
ctypes.cast(obj, type)
This function is similar to the cast operator in C. It returns a new instance of type which points to the same memory block as obj. type must be a pointer type, and obj must be an object that can be interpreted as a pointer. | python.library.ctypes#ctypes.cast |
class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
Instances of this class represent loaded shared libraries. Functions in these libraries use the standard C calling convention, and are assumed to return int. On Windows creating a CDLL instance may fail even if t... | python.library.ctypes#ctypes.CDLL |
ctypes.CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
The returned function prototype creates functions that use the standard C calling convention. The function will release the GIL during the call. If use_errno is set to true, the ctypes private copy of the system errno variable is exchanged wi... | python.library.ctypes#ctypes.CFUNCTYPE |
ctypes.create_string_buffer(init_or_size, size=None)
This function creates a mutable character buffer. The returned object is a ctypes array of c_char. init_or_size must be an integer which specifies the size of the array, or a bytes object which will be used to initialize the array items. If a bytes object is specif... | python.library.ctypes#ctypes.create_string_buffer |
ctypes.create_unicode_buffer(init_or_size, size=None)
This function creates a mutable unicode character buffer. The returned object is a ctypes array of c_wchar. init_or_size must be an integer which specifies the size of the array, or a string which will be used to initialize the array items. If a string is specifie... | python.library.ctypes#ctypes.create_unicode_buffer |
class ctypes.c_bool
Represent the C bool datatype (more accurately, _Bool from C99). Its value can be True or False, and the constructor accepts any object that has a truth value. | python.library.ctypes#ctypes.c_bool |
class ctypes.c_byte
Represents the C signed char datatype, and interprets the value as small integer. The constructor accepts an optional integer initializer; no overflow checking is done. | python.library.ctypes#ctypes.c_byte |
class ctypes.c_char
Represents the C char datatype, and interprets the value as a single character. The constructor accepts an optional string initializer, the length of the string must be exactly one character. | python.library.ctypes#ctypes.c_char |
class ctypes.c_char_p
Represents the C char * datatype when it points to a zero-terminated string. For a general character pointer that may also point to binary data, POINTER(c_char) must be used. The constructor accepts an integer address, or a bytes object. | python.library.ctypes#ctypes.c_char_p |
class ctypes.c_double
Represents the C double datatype. The constructor accepts an optional float initializer. | python.library.ctypes#ctypes.c_double |
class ctypes.c_float
Represents the C float datatype. The constructor accepts an optional float initializer. | python.library.ctypes#ctypes.c_float |
class ctypes.c_int
Represents the C signed int datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where sizeof(int) == sizeof(long) it is an alias to c_long. | python.library.ctypes#ctypes.c_int |
class ctypes.c_int16
Represents the C 16-bit signed int datatype. Usually an alias for c_short. | python.library.ctypes#ctypes.c_int16 |
class ctypes.c_int32
Represents the C 32-bit signed int datatype. Usually an alias for c_int. | python.library.ctypes#ctypes.c_int32 |
class ctypes.c_int64
Represents the C 64-bit signed int datatype. Usually an alias for c_longlong. | python.library.ctypes#ctypes.c_int64 |
class ctypes.c_int8
Represents the C 8-bit signed int datatype. Usually an alias for c_byte. | python.library.ctypes#ctypes.c_int8 |
class ctypes.c_long
Represents the C signed long datatype. The constructor accepts an optional integer initializer; no overflow checking is done. | python.library.ctypes#ctypes.c_long |
class ctypes.c_longdouble
Represents the C long double datatype. The constructor accepts an optional float initializer. On platforms where sizeof(long double) ==
sizeof(double) it is an alias to c_double. | python.library.ctypes#ctypes.c_longdouble |
class ctypes.c_longlong
Represents the C signed long long datatype. The constructor accepts an optional integer initializer; no overflow checking is done. | python.library.ctypes#ctypes.c_longlong |
class ctypes.c_short
Represents the C signed short datatype. The constructor accepts an optional integer initializer; no overflow checking is done. | python.library.ctypes#ctypes.c_short |
class ctypes.c_size_t
Represents the C size_t datatype. | python.library.ctypes#ctypes.c_size_t |
class ctypes.c_ssize_t
Represents the C ssize_t datatype. New in version 3.2. | python.library.ctypes#ctypes.c_ssize_t |
class ctypes.c_ubyte
Represents the C unsigned char datatype, it interprets the value as small integer. The constructor accepts an optional integer initializer; no overflow checking is done. | python.library.ctypes#ctypes.c_ubyte |
class ctypes.c_uint
Represents the C unsigned int datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where sizeof(int) == sizeof(long) it is an alias for c_ulong. | python.library.ctypes#ctypes.c_uint |
class ctypes.c_uint16
Represents the C 16-bit unsigned int datatype. Usually an alias for c_ushort. | python.library.ctypes#ctypes.c_uint16 |
class ctypes.c_uint32
Represents the C 32-bit unsigned int datatype. Usually an alias for c_uint. | python.library.ctypes#ctypes.c_uint32 |
class ctypes.c_uint64
Represents the C 64-bit unsigned int datatype. Usually an alias for c_ulonglong. | python.library.ctypes#ctypes.c_uint64 |
class ctypes.c_uint8
Represents the C 8-bit unsigned int datatype. Usually an alias for c_ubyte. | python.library.ctypes#ctypes.c_uint8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.