doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
setup_scripts(context) Installs activation scripts appropriate to the platform into the virtual environment.
python.library.venv#venv.EnvBuilder.setup_scripts
upgrade_dependencies(context) Upgrades the core venv dependency packages (currently pip and setuptools) in the environment. This is done by shelling out to the pip executable in the environment. New in version 3.9.
python.library.venv#venv.EnvBuilder.upgrade_dependencies
exception Warning Base class for warning categories.
python.library.exceptions#Warning
warnings — Warning control Source code: Lib/warnings.py Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warrant raising an exception and terminating the program. For example, one might want to issue a warnin...
python.library.warnings
class warnings.catch_warnings(*, record=False, module=None) A context manager that copies and, upon exit, restores the warnings filter and the showwarning() function. If the record argument is False (the default) the context manager returns None on entry. If record is True, a list is returned that is progressively po...
python.library.warnings#warnings.catch_warnings
warnings.filterwarnings(action, message='', category=Warning, module='', lineno=0, append=False) Insert an entry into the list of warnings filter specifications. The entry is inserted at the front by default; if append is true, it is inserted at the end. This checks the types of the arguments, compiles the message an...
python.library.warnings#warnings.filterwarnings
warnings.formatwarning(message, category, filename, lineno, line=None) Format a warning the standard way. This returns a string which may contain embedded newlines and ends in a newline. line is a line of source code to be included in the warning message; if line is not supplied, formatwarning() will try to read the ...
python.library.warnings#warnings.formatwarning
warnings.resetwarnings() Reset the warnings filter. This discards the effect of all previous calls to filterwarnings(), including that of the -W command line options and calls to simplefilter().
python.library.warnings#warnings.resetwarnings
warnings.showwarning(message, category, filename, lineno, file=None, line=None) Write a warning to a file. The default implementation calls formatwarning(message, category, filename, lineno, line) and writes the resulting string to file, which defaults to sys.stderr. You may replace this function with any callable by...
python.library.warnings#warnings.showwarning
warnings.simplefilter(action, category=Warning, lineno=0, append=False) Insert a simple entry into the list of warnings filter specifications. The meaning of the function parameters is as for filterwarnings(), but regular expressions are not needed as the filter inserted always matches any message in any module as lo...
python.library.warnings#warnings.simplefilter
warnings.warn(message, category=None, stacklevel=1, source=None) Issue a warning, or maybe ignore it or raise an exception. The category argument, if given, must be a warning category class; it defaults to UserWarning. Alternatively, message can be a Warning instance, in which case category will be ignored and messag...
python.library.warnings#warnings.warn
warnings.warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None, source=None) This is a low-level interface to the functionality of warn(), passing in explicitly the message, category, filename and line number, and optionally the module name and the registry (which should b...
python.library.warnings#warnings.warn_explicit
wave — Read and write WAV files Source code: Lib/wave.py The wave module provides a convenient interface to the WAV sound format. It does not support compression/decompression, but it does support mono/stereo. The wave module defines the following function and exception: wave.open(file, mode=None) If file is a stri...
python.library.wave
exception wave.Error An error raised when something is impossible because it violates the WAV specification or hits an implementation deficiency.
python.library.wave#wave.Error
wave.open(file, mode=None) If file is a string, open the file by that name, otherwise treat it as a file-like object. mode can be: 'rb' Read only mode. 'wb' Write only mode. Note that it does not allow read/write WAV files. A mode of 'rb' returns a Wave_read object, while a mode of 'wb' returns a Wave_write...
python.library.wave#wave.open
Wave_read.close() Close the stream if it was opened by wave, and make the instance unusable. This is called automatically on object collection.
python.library.wave#wave.Wave_read.close
Wave_read.getcompname() Human-readable version of getcomptype(). Usually 'not compressed' parallels 'NONE'.
python.library.wave#wave.Wave_read.getcompname
Wave_read.getcomptype() Returns compression type ('NONE' is the only supported type).
python.library.wave#wave.Wave_read.getcomptype
Wave_read.getframerate() Returns sampling frequency.
python.library.wave#wave.Wave_read.getframerate
Wave_read.getmark(id) Raise an error.
python.library.wave#wave.Wave_read.getmark
Wave_read.getmarkers() Returns None.
python.library.wave#wave.Wave_read.getmarkers
Wave_read.getnchannels() Returns number of audio channels (1 for mono, 2 for stereo).
python.library.wave#wave.Wave_read.getnchannels
Wave_read.getnframes() Returns number of audio frames.
python.library.wave#wave.Wave_read.getnframes
Wave_read.getparams() Returns a namedtuple() (nchannels, sampwidth, framerate, nframes, comptype, compname), equivalent to output of the get*() methods.
python.library.wave#wave.Wave_read.getparams
Wave_read.getsampwidth() Returns sample width in bytes.
python.library.wave#wave.Wave_read.getsampwidth
Wave_read.readframes(n) Reads and returns at most n frames of audio, as a bytes object.
python.library.wave#wave.Wave_read.readframes
Wave_read.rewind() Rewind the file pointer to the beginning of the audio stream.
python.library.wave#wave.Wave_read.rewind
Wave_read.setpos(pos) Set the file pointer to the specified position.
python.library.wave#wave.Wave_read.setpos
Wave_read.tell() Return current file pointer position.
python.library.wave#wave.Wave_read.tell
Wave_write.close() Make sure nframes is correct, and close the file if it was opened by wave. This method is called upon object collection. It will raise an exception if the output stream is not seekable and nframes does not match the number of frames actually written.
python.library.wave#wave.Wave_write.close
Wave_write.setcomptype(type, name) Set the compression type and description. At the moment, only compression type NONE is supported, meaning no compression.
python.library.wave#wave.Wave_write.setcomptype
Wave_write.setframerate(n) Set the frame rate to n. Changed in version 3.2: A non-integral input to this method is rounded to the nearest integer.
python.library.wave#wave.Wave_write.setframerate
Wave_write.setnchannels(n) Set the number of channels.
python.library.wave#wave.Wave_write.setnchannels
Wave_write.setnframes(n) Set the number of frames to n. This will be changed later if the number of frames actually written is different (this update attempt will raise an error if the output stream is not seekable).
python.library.wave#wave.Wave_write.setnframes
Wave_write.setparams(tuple) The tuple should be (nchannels, sampwidth, framerate, nframes, comptype, compname), with values valid for the set*() methods. Sets all parameters.
python.library.wave#wave.Wave_write.setparams
Wave_write.setsampwidth(n) Set the sample width to n bytes.
python.library.wave#wave.Wave_write.setsampwidth
Wave_write.tell() Return current position in the file, with the same disclaimer for the Wave_read.tell() and Wave_read.setpos() methods.
python.library.wave#wave.Wave_write.tell
Wave_write.writeframes(data) Write audio frames and make sure nframes is correct. It will raise an error if the output stream is not seekable and the total number of frames that have been written after data has been written does not match the previously set value for nframes. Changed in version 3.4: Any bytes-like o...
python.library.wave#wave.Wave_write.writeframes
Wave_write.writeframesraw(data) Write audio frames, without correcting nframes. Changed in version 3.4: Any bytes-like object is now accepted.
python.library.wave#wave.Wave_write.writeframesraw
weakref — Weak references Source code: Lib/weakref.py The weakref module allows the Python programmer to create weak references to objects. In the following, the term referent means the object which is referred to by a weak reference. A weak reference to an object is not enough to keep the object alive: when the only r...
python.library.weakref
weakref.CallableProxyType The type object for proxies of callable objects.
python.library.weakref#weakref.CallableProxyType
class weakref.finalize(obj, func, /, *args, **kwargs) Return a callable finalizer object which will be called when obj is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management. A finalizer is considered a...
python.library.weakref#weakref.finalize
alive Property which is true if the finalizer is alive, false otherwise.
python.library.weakref#weakref.finalize.alive
atexit A writable boolean property which by default is true. When the program exits, it calls all remaining live finalizers for which atexit is true. They are called in reverse order of creation.
python.library.weakref#weakref.finalize.atexit
detach() If self is alive then mark it as dead and return the tuple (obj, func, args, kwargs). If self is dead then return None.
python.library.weakref#weakref.finalize.detach
peek() If self is alive then return the tuple (obj, func, args, kwargs). If self is dead then return None.
python.library.weakref#weakref.finalize.peek
__call__() If self is alive then mark it as dead and return the result of calling func(*args, **kwargs). If self is dead then return None.
python.library.weakref#weakref.finalize.__call__
weakref.getweakrefcount(object) Return the number of weak references and proxies which refer to object.
python.library.weakref#weakref.getweakrefcount
weakref.getweakrefs(object) Return a list of all weak reference and proxy objects which refer to object.
python.library.weakref#weakref.getweakrefs
weakref.proxy(object[, callback]) Return a proxy to object which uses a weak reference. This supports use of the proxy in most contexts instead of requiring the explicit dereferencing used with weak reference objects. The returned object will have a type of either ProxyType or CallableProxyType, depending on whether ...
python.library.weakref#weakref.proxy
weakref.ProxyType The type object for proxies of objects which are not callable.
python.library.weakref#weakref.ProxyType
weakref.ProxyTypes Sequence containing all the type objects for proxies. This can make it simpler to test if an object is a proxy without being dependent on naming both proxy types.
python.library.weakref#weakref.ProxyTypes
class weakref.ref(object[, callback]) Return a weak reference to object. The original object can be retrieved by calling the reference object if the referent is still alive; if the referent is no longer alive, calling the reference object will cause None to be returned. If callback is provided and not None, and the r...
python.library.weakref#weakref.ref
__callback__ This read-only attribute returns the callback currently associated to the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value None.
python.library.weakref#weakref.ref.__callback__
weakref.ReferenceType The type object for weak references objects.
python.library.weakref#weakref.ReferenceType
class weakref.WeakKeyDictionary([dict]) Mapping class that references keys weakly. Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those o...
python.library.weakref#weakref.WeakKeyDictionary
WeakKeyDictionary.keyrefs() Return an iterable of the weak references to the keys.
python.library.weakref#weakref.WeakKeyDictionary.keyrefs
class weakref.WeakMethod(method) A custom ref subclass which simulates a weak reference to a bound method (i.e., a method defined on a class and looked up on an instance). Since a bound method is ephemeral, a standard weak reference cannot keep hold of it. WeakMethod has special code to recreate the bound method unti...
python.library.weakref#weakref.WeakMethod
class weakref.WeakSet([elements]) Set class that keeps weak references to its elements. An element will be discarded when no strong reference to it exists any more.
python.library.weakref#weakref.WeakSet
class weakref.WeakValueDictionary([dict]) Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists any more. Changed in version 3.9: Added support for | and |= operators, as specified in PEP 584.
python.library.weakref#weakref.WeakValueDictionary
WeakValueDictionary.valuerefs() Return an iterable of the weak references to the values.
python.library.weakref#weakref.WeakValueDictionary.valuerefs
webbrowser — Convenient Web-browser controller Source code: Lib/webbrowser.py The webbrowser module provides a high-level interface to allow displaying Web-based documents to users. Under most circumstances, simply calling the open() function from this module will do the right thing. Under Unix, graphical browsers are ...
python.library.webbrowser
controller.open(url, new=0, autoraise=True) Display url using the browser handled by this controller. If new is 1, a new browser window is opened if possible. If new is 2, a new browser page (“tab”) is opened if possible.
python.library.webbrowser#webbrowser.controller.open
controller.open_new(url) Open url in a new window of the browser handled by this controller, if possible, otherwise, open url in the only browser window. Alias open_new().
python.library.webbrowser#webbrowser.controller.open_new
controller.open_new_tab(url) Open url in a new page (“tab”) of the browser handled by this controller, if possible, otherwise equivalent to open_new().
python.library.webbrowser#webbrowser.controller.open_new_tab
exception webbrowser.Error Exception raised when a browser control error occurs.
python.library.webbrowser#webbrowser.Error
webbrowser.get(using=None) Return a controller object for the browser type using. If using is None, return a controller for a default browser appropriate to the caller’s environment.
python.library.webbrowser#webbrowser.get
webbrowser.open(url, new=0, autoraise=True) Display url using the default browser. If new is 0, the url is opened in the same browser window if possible. If new is 1, a new browser window is opened if possible. If new is 2, a new browser page (“tab”) is opened if possible. If autoraise is True, the window is raised i...
python.library.webbrowser#webbrowser.open
webbrowser.open_new(url) Open url in a new window of the default browser, if possible, otherwise, open url in the only browser window.
python.library.webbrowser#webbrowser.open_new
webbrowser.open_new_tab(url) Open url in a new page (“tab”) of the default browser, if possible, otherwise equivalent to open_new().
python.library.webbrowser#webbrowser.open_new_tab
webbrowser.register(name, constructor, instance=None, *, preferred=False) Register the browser type name. Once a browser type is registered, the get() function can return a controller for that browser type. If instance is not provided, or is None, constructor will be called without parameters to create an instance wh...
python.library.webbrowser#webbrowser.register
exception WindowsError Only available on Windows.
python.library.exceptions#WindowsError
winreg — Windows registry access These functions expose the Windows registry API to Python. Instead of using an integer as the registry handle, a handle object is used to ensure that the handles are closed correctly, even if the programmer neglects to explicitly close them. Changed in version 3.3: Several functions in...
python.library.winreg
winreg.CloseKey(hkey) Closes a previously opened registry key. The hkey argument specifies a previously opened key. Note If hkey is not closed using this method (or via hkey.Close()), it is closed when the hkey object is destroyed by Python.
python.library.winreg#winreg.CloseKey
winreg.ConnectRegistry(computer_name, key) Establishes a connection to a predefined registry handle on another computer, and returns a handle object. computer_name is the name of the remote computer, of the form r"\\computername". If None, the local computer is used. key is the predefined handle to connect to. The re...
python.library.winreg#winreg.ConnectRegistry
winreg.CreateKey(key, sub_key) Creates or opens the specified key, returning a handle object. key is an already open key, or one of the predefined HKEY_* constants. sub_key is a string that names the key this method opens or creates. If key is one of the predefined keys, sub_key may be None. In that case, the handle ...
python.library.winreg#winreg.CreateKey
winreg.CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE) Creates or opens the specified key, returning a handle object. key is an already open key, or one of the predefined HKEY_* constants. sub_key is a string that names the key this method opens or creates. reserved is a reserved integer, and must be zero. Th...
python.library.winreg#winreg.CreateKeyEx
winreg.DeleteKey(key, sub_key) Deletes the specified key. key is an already open key, or one of the predefined HKEY_* constants. sub_key is a string that must be a subkey of the key identified by the key parameter. This value must not be None, and the key may not have subkeys. This method can not delete keys with sub...
python.library.winreg#winreg.DeleteKey
winreg.DeleteKeyEx(key, sub_key, access=KEY_WOW64_64KEY, reserved=0) Deletes the specified key. Note The DeleteKeyEx() function is implemented with the RegDeleteKeyEx Windows API function, which is specific to 64-bit versions of Windows. See the RegDeleteKeyEx documentation. key is an already open key, or one of th...
python.library.winreg#winreg.DeleteKeyEx
winreg.DeleteValue(key, value) Removes a named value from a registry key. key is an already open key, or one of the predefined HKEY_* constants. value is a string that identifies the value to remove. Raises an auditing event winreg.DeleteValue with arguments key, value.
python.library.winreg#winreg.DeleteValue
winreg.DisableReflectionKey(key) Disables registry reflection for 32-bit processes running on a 64-bit operating system. key is an already open key, or one of the predefined HKEY_* constants. Will generally raise NotImplementedError if executed on a 32-bit operating system. If the key is not on the reflection list, t...
python.library.winreg#winreg.DisableReflectionKey
winreg.EnableReflectionKey(key) Restores registry reflection for the specified disabled key. key is an already open key, or one of the predefined HKEY_* constants. Will generally raise NotImplementedError if executed on a 32-bit operating system. Restoring reflection for a key does not affect reflection of any subkey...
python.library.winreg#winreg.EnableReflectionKey
winreg.EnumKey(key, index) Enumerates subkeys of an open registry key, returning a string. key is an already open key, or one of the predefined HKEY_* constants. index is an integer that identifies the index of the key to retrieve. The function retrieves the name of one subkey each time it is called. It is typically ...
python.library.winreg#winreg.EnumKey
winreg.EnumValue(key, index) Enumerates values of an open registry key, returning a tuple. key is an already open key, or one of the predefined HKEY_* constants. index is an integer that identifies the index of the value to retrieve. The function retrieves the name of one subkey each time it is called. It is typicall...
python.library.winreg#winreg.EnumValue
winreg.ExpandEnvironmentStrings(str) Expands environment variable placeholders %NAME% in strings like REG_EXPAND_SZ: >>> ExpandEnvironmentStrings('%windir%') 'C:\\Windows' Raises an auditing event winreg.ExpandEnvironmentStrings with argument str.
python.library.winreg#winreg.ExpandEnvironmentStrings
winreg.FlushKey(key) Writes all the attributes of a key to the registry. key is an already open key, or one of the predefined HKEY_* constants. It is not necessary to call FlushKey() to change a key. Registry changes are flushed to disk by the registry using its lazy flusher. Registry changes are also flushed to disk...
python.library.winreg#winreg.FlushKey
winreg.HKEY_CLASSES_ROOT Registry entries subordinate to this key define types (or classes) of documents and the properties associated with those types. Shell and COM applications use the information stored under this key.
python.library.winreg#winreg.HKEY_CLASSES_ROOT
winreg.HKEY_CURRENT_CONFIG Contains information about the current hardware profile of the local computer system.
python.library.winreg#winreg.HKEY_CURRENT_CONFIG
winreg.HKEY_CURRENT_USER Registry entries subordinate to this key define the preferences of the current user. These preferences include the settings of environment variables, data about program groups, colors, printers, network connections, and application preferences.
python.library.winreg#winreg.HKEY_CURRENT_USER
winreg.HKEY_DYN_DATA This key is not used in versions of Windows after 98.
python.library.winreg#winreg.HKEY_DYN_DATA
winreg.HKEY_LOCAL_MACHINE Registry entries subordinate to this key define the physical state of the computer, including data about the bus type, system memory, and installed hardware and software.
python.library.winreg#winreg.HKEY_LOCAL_MACHINE
winreg.HKEY_PERFORMANCE_DATA Registry entries subordinate to this key allow you to access performance data. The data is not actually stored in the registry; the registry functions cause the system to collect the data from its source.
python.library.winreg#winreg.HKEY_PERFORMANCE_DATA
winreg.HKEY_USERS Registry entries subordinate to this key define the default user configuration for new users on the local computer and the user configuration for the current user.
python.library.winreg#winreg.HKEY_USERS
winreg.KEY_ALL_ACCESS Combines the STANDARD_RIGHTS_REQUIRED, KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, and KEY_CREATE_LINK access rights.
python.library.winreg#winreg.KEY_ALL_ACCESS
winreg.KEY_CREATE_LINK Reserved for system use.
python.library.winreg#winreg.KEY_CREATE_LINK
winreg.KEY_CREATE_SUB_KEY Required to create a subkey of a registry key.
python.library.winreg#winreg.KEY_CREATE_SUB_KEY
winreg.KEY_ENUMERATE_SUB_KEYS Required to enumerate the subkeys of a registry key.
python.library.winreg#winreg.KEY_ENUMERATE_SUB_KEYS
winreg.KEY_EXECUTE Equivalent to KEY_READ.
python.library.winreg#winreg.KEY_EXECUTE
winreg.KEY_NOTIFY Required to request change notifications for a registry key or for subkeys of a registry key.
python.library.winreg#winreg.KEY_NOTIFY
winreg.KEY_QUERY_VALUE Required to query the values of a registry key.
python.library.winreg#winreg.KEY_QUERY_VALUE