id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
186,672
import errno import io import logging import logging.handlers import re import struct import sys import threading import traceback from socketserver import ThreadingTCPServer, StreamRequestHandler DEFAULT_LOGGING_CONFIG_PORT = 9030 RESET_ERROR = errno.ECONNRESET _listener = None def fileConfig(fname, defaults=None, dis...
Start up a socket server on the specified port, and listen for new configurations. These will be sent as a file suitable for processing by fileConfig(). Returns a Thread object on which you can call start() to start the server, and which you can join() when appropriate. To stop the server, call stopListening(). Use the...
186,675
import os import sys import stat import fnmatch import collections import errno if os.name == 'posix': import posix elif _WINDOWS: import nt class Error(OSError): pass def _samefile(src, dst): # Macintosh, Unix. if isinstance(src, os.DirEntry) and hasattr(os.path, 'samestat'): try: ...
Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already...
186,676
import os import sys import stat import fnmatch import collections import errno if os.name == 'posix': import posix elif _WINDOWS: import nt def _get_gid(name): """Returns a gid, given a group name.""" if name is None: return None try: from grp import getgrnam except ImportError:...
Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file...
186,690
import os import sys import stat import fnmatch import collections import errno if os.name == 'posix': import posix elif _WINDOWS: import nt def _get_gid(name): """Returns a gid, given a group name.""" if name is None: return None try: from grp import getgrnam except ImportError:...
Change owner user and group of the given path. user and group can be the uid/gid or the user/group names, and in that case, they are converted to their respective uid/gid.
186,693
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias class TypeVar( _Final, _Immutable, _TypeVarL...
Collect all type variable contained in types in order of first appearance (lexicographic order). For example:: _collect_type_vars((T, List[S, T])) == (T, S)
186,694
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias def _is_param_expr(arg): return arg is ....
Prepares the parameters for a Generic containing ParamSpec variables (internal helper).
186,697
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias def _type_check(arg, msg, is_argument=True, ...
Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a higher order function which adds, removes or transforms parameters of a callable. For example:: Callable[Concatenate[int, P], int] See PEP 612 for detailed information.
186,698
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias def _type_check(arg, msg, is_argument=True, ...
Special typing form used to annotate the return type of a user-defined type guard function. ``TypeGuard`` only accepts a single type argument. At runtime, functions marked this way should return a boolean. ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static type checkers to determine a more pre...
186,702
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias sys.modules[io.__name__] = io sys.modules[re...
null
186,703
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias sys.modules[io.__name__] = io sys.modules[re...
Allow instance and class checks for special stdlib modules. The abc and functools modules indiscriminately call isinstance() and issubclass() on the whole MRO of a user class, which may contain protocols.
186,704
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias class Generic: """Abstract base class fo...
Mark a protocol class as a runtime protocol. Such protocol can be used with isinstance() and issubclass(). Raise TypeError if applied to a non-protocol class. This allows a simple-minded structural check very similar to one trick ponies in collections.abc such as Iterable. For example:: @runtime_checkable class Closabl...
186,705
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias class ParamSpecArgs(_Final, _Immutable, _roo...
Get the unsubscripted version of a type. This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar and Annotated. Return None for unsupported types. Examples:: get_origin(Literal[42]) is Literal get_origin(int) is None get_origin(ClassVar[int]) is ClassVar get_origin(Generic) is Generic get_origin(G...
186,706
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias def _is_param_expr(arg): return arg is ....
Get type arguments with all substitutions performed. For unions, basic simplifications used by Union constructor are performed. Examples:: get_args(Dict[str, int]) == (str, int) get_args(int) == () get_args(Union[int, Union[T, int], str][int]) == (int, str) get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, i...
186,707
from abc import abstractmethod, ABCMeta import collections import collections.abc import contextlib import functools import operator import re as stdlib_re import sys import types from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, GenericAlias class _TypedDictMeta(type): def __new__(...
Check if an annotation is a TypedDict class For example:: class Film(TypedDict): title: str year: int is_typeddict(Film) # => True is_typeddict(Union[list, str]) # => False
186,715
import os import sys from enum import Enum def _find_mac_near_keyword(command, args, keywords, get_word_index): """Searches a command's output for a MAC address near a keyword. Each line of words in the output is case-insensitively searched for any of the given keywords. Upon a match, get_word_index is inv...
Get the hardware address on Unix by running arp.
186,732
from types import FunctionType from copyreg import dispatch_table from copyreg import _extension_registry, _inverted_registry, _extension_cache from itertools import islice from functools import partial import sys from sys import maxsize from struct import pack, unpack import re import io import codecs import _compat_p...
null
186,739
import binascii, errno, random, re, socket, subprocess, sys, time, calendar from datetime import datetime, timezone, timedelta from io import DEFAULT_BUFFER_SIZE Months = ' Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ') class timedelta: """Represent the difference between two datetime objects. Su...
Convert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time, an instance of time.struct_time (as returned by time.loca...
186,742
import tkinter as TK import types import math import time import inspect import sys from os.path import isfile, split, join from copy import deepcopy from tkinter import simpledialog def __methodDict(cls, _dict): def __methods(cls): __stringBody = ( 'def %(method)s(self, *args, **kw): return ' + 'self.%(attribu...
null
186,751
import asyncore from collections import deque from warnings import warn def find_prefix_at_end(haystack, needle): l = len(needle) - 1 while l and not haystack.endswith(needle[:l]): l -= 1 return l
null
186,756
import datetime import time import collections.abc from _sqlite3 import * def enable_shared_cache(enable): from _sqlite3 import enable_shared_cache as _old_enable_shared_cache import warnings msg = ( "enable_shared_cache is deprecated and will be removed in Python 3.12. " "Shared cache is s...
null
186,758
import _frozen_importlib_external as _bootstrap_external from _frozen_importlib_external import _unpack_uint16, _unpack_uint32 import _frozen_importlib as _bootstrap import _imp import _io import marshal import sys import time import _warnings path_sep = _bootstrap_external.path_sep def _is_dir(self, path): ...
null
186,759
import _frozen_importlib_external as _bootstrap_external from _frozen_importlib_external import _unpack_uint16, _unpack_uint32 import _frozen_importlib as _bootstrap import _imp import _io import marshal import sys import time import _warnings _zip_searchorder = ( (path_sep + '__init__.pyc', True, True), ...
null
186,760
import _frozen_importlib_external as _bootstrap_external from _frozen_importlib_external import _unpack_uint16, _unpack_uint32 import _frozen_importlib as _bootstrap import _imp import _io import marshal import sys import time import _warnings path_sep = _bootstrap_external.path_sep class ZipImportError(ImportEr...
null
186,761
import _frozen_importlib_external as _bootstrap_external from _frozen_importlib_external import _unpack_uint16, _unpack_uint32 import _frozen_importlib as _bootstrap import _imp import _io import marshal import sys import time import _warnings path_sep = _bootstrap_external.path_sep class ZipImportError(ImportEr...
null
186,762
import sys import importlib.machinery import importlib.util import io import types import os def _run_code(code, run_globals, init_globals=None, mod_name=None, mod_spec=None, pkg_name=None, script_name=None): """Helper to run code in nominated namespace""" if init_globals is not None...
Runs the designated module in the __main__ namespace Note that the executed module will have full access to the __main__ namespace. If this is not desirable, the run_module() function should be used to run the module code in a fresh namespace. At the very least, these variables in __main__ will be overwritten: __name__...
186,763
import sys import importlib.machinery import importlib.util import io import types import os def _run_code(code, run_globals, init_globals=None, mod_name=None, mod_spec=None, pkg_name=None, script_name=None): """Helper to run code in nominated namespace""" if init_globals is not None...
Execute a module's code without importing it. mod_name -- an absolute module name or package name. Optional arguments: init_globals -- dictionary used to pre-populate the module’s globals dictionary before the code is executed. run_name -- if not None, this will be used for setting __name__; otherwise, __name__ will be...
186,764
import sys import importlib.machinery import importlib.util import io import types import os class _TempModule(object): """Temporarily replace a module in sys.modules with an empty namespace""" def __init__(self, mod_name): self.mod_name = mod_name self.module = types.ModuleType(mod_name) ...
Execute code located at the specified filesystem location. path_name -- filesystem location of a Python script, zipfile, or directory containing a top level __main__.py script. Optional arguments: init_globals -- dictionary used to pre-populate the module’s globals dictionary before the code is executed. run_name -- if...
186,766
import fnmatch import functools import io import ntpath import os import posixpath import re import sys import warnings from _collections_abc import Sequence from errno import EINVAL, ENOENT, ENOTDIR, EBADF, ELOOP from operator import attrgetter from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_...
null
186,767
import fnmatch import functools import io import ntpath import os import posixpath import re import sys import warnings from _collections_abc import Sequence from errno import EINVAL, ENOENT, ENOTDIR, EBADF, ELOOP from operator import attrgetter from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_...
null
186,774
import functools class AddressValueError(ValueError): """A Value Error related to the address.""" class NetmaskValueError(ValueError): """A Value Error related to the netmask.""" class IPv4Address(_BaseV4, _BaseAddress): """Represent and manipulate single IPv4 Addresses.""" __slots__ = ('_ip', '__weakre...
Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed...
186,775
import functools class AddressValueError(ValueError): """A Value Error related to the address.""" class NetmaskValueError(ValueError): """A Value Error related to the netmask.""" class IPv4Network(_BaseV4, _BaseNetwork): """This class represents and manipulates 32-bit IPv4 network + addresses.. Attribut...
Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn...
186,776
import functools class AddressValueError(ValueError): """A Value Error related to the address.""" class NetmaskValueError(ValueError): """A Value Error related to the netmask.""" class IPv4Interface(IPv4Address): def __init__(self, address): addr, mask = self._split_addr_prefix(address) IPv4...
Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passe...
186,779
import functools class AddressValueError(ValueError): """A Value Error related to the address.""" The provided code snippet includes necessary dependencies for implementing the `_split_optional_netmask` function. Write a Python function `def _split_optional_netmask(address)` to solve the following problem: Helper ...
Helper to split the netmask and raise AddressValueError if needed
186,785
import select import socket import sys import time import warnings import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \ ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \ errorcode try: socket_map except NameError: socket_map = {} _reraised_exceptions ...
null
186,787
import builtins import errno import io import os import time import signal import sys import threading import warnings import contextlib from time import monotonic as _time import types def _optim_args_from_interpreter_flags(): """Return a list of command-line arguments reproducing the current optimization sett...
Return a list of command-line arguments reproducing the current settings in sys.flags, sys.warnoptions and sys._xoptions.
186,791
import builtins import errno import io import os import time import signal import sys import threading import warnings import contextlib from time import monotonic as _time import types if _mswindows: else: # When select or poll has indicated that the file is writable, # we can write up to _PIPE_BUF bytes witho...
Check if posix_spawn() can be used for subprocess. subprocess requires a posix_spawn() implementation that properly reports errors to the parent process, & sets errno on the following failures: * Process attribute actions failed. * File actions failed. * exec() failed. Prefer an implementation which can use vfork() in ...
186,809
from turtle import * from math import cos, pi from time import perf_counter as clock, sleep def sun(l, n): def start(): def test(l=200, n=4, fun=sun, startpos=(0,0), th=2): def demo(fun=sun): start() for i in range(8): a = clock() test(300, i, fun) b = clock() t = b - a ...
null
186,815
from turtle import * from datetime import datetime def wochentag(t): wochentag = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] return wochentag[t.weekday()] def datum(z): monat = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "June", "July", "Aug.", "Sep.", "Oc...
null
186,826
import struct import builtins import warnings def _write_ushort(f, x): f.write(struct.pack('>H', x)) def _write_ulong(f, x): f.write(struct.pack('>L', x)) from chunk import Chunk from collections import namedtuple def _write_float(f, x): import math if x < 0: sign = 0x8000 x = x * -1 ...
null
186,827
import os as _os import re as _re import sys as _sys from gettext import gettext as _, ngettext def copy(x): """Shallow copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ cls = type(x) copier = _copy_dispatch.get(cls) if copier: return copi...
null
186,835
import email.parser import email.message import errno import http import io import re import socket import sys import collections.abc from urllib.parse import urlsplit The provided code snippet includes necessary dependencies for implementing the `_encode` function. Write a Python function `def _encode(data, name='dat...
Call data.encode("latin-1") but show a better error message.
186,836
import email.parser import email.message import errno import http import io import re import socket import sys import collections.abc from urllib.parse import urlsplit class HTTPMessage(email.message.Message): # XXX The only usage of this method is in # http.server.CGIHTTPRequestHandler. Maybe move the code th...
Parses only RFC2822 headers from a file pointer. email Parser wants to see strings rather than bytes. But a TextIOWrapper around self.rfile would buffer too many bytes from the stream, bytes which we later need to read as bytes. So we read the correct bytes here, as bytes, for email Parser to parse.
186,837
import copy import datetime import email.utils import html import http.client import io import mimetypes import os import posixpath import select import shutil import socket import socketserver import sys import time import urllib.parse from http import HTTPStatus The provided code snippet includes necessary dependenc...
Given a URL path, remove extra '/'s and '.' path elements and collapse any '..' references and returns a collapsed path. Implements something akin to RFC-2396 5.2 step 6 to parse relative paths. The utility of this function is limited to is_cgi method and helps preventing some security attacks. Returns: The reconstitut...
186,838
import copy import datetime import email.utils import html import http.client import io import mimetypes import os import posixpath import select import shutil import socket import socketserver import sys import time import urllib.parse from http import HTTPStatus nobody = None The provided code snippet includes neces...
Internal routine to get nobody's uid
186,839
import copy import datetime import email.utils import html import http.client import io import mimetypes import os import posixpath import select import shutil import socket import socketserver import sys import time import urllib.parse from http import HTTPStatus The provided code snippet includes necessary dependenc...
Test for executable file.
186,840
import copy import datetime import email.utils import html import http.client import io import mimetypes import os import posixpath import select import shutil import socket import socketserver import sys import time import urllib.parse from http import HTTPStatus def _get_best_family(*address): infos = socket.get...
null
186,874
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count _profile_hook = None from _thread import stack_size The provided code snippet includes necessary dependencies for implementing...
Get the profiler function as set by threading.setprofile().
186,876
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count _trace_hook = None from _thread import stack_size The provided code snippet includes necessary dependencies for implementing t...
Get the trace function as set by threading.settrace().
186,877
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count _counter = _count(1).__next__ from _thread import stack_size def _newname(name_template): return name_template % _counter(...
null
186,878
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count _shutdown_locks = set() from _thread import stack_size The provided code snippet includes necessary dependencies for implement...
Drop any shutdown locks that don't correspond to running threads anymore. Calling this from time to time avoids an ever-growing _shutdown_locks set when Thread objects are not joined explicitly. See bpo-37788. This must be called with _shutdown_locks_lock acquired.
186,880
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count def current_thread(): """Return the current Thread object, corresponding to the caller's thread of control. If the call...
Return the current Thread object, corresponding to the caller's thread of control. This function is deprecated, use current_thread() instead.
186,881
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count def active_count(): """Return the number of Thread objects currently alive. The returned count is equal to the length o...
Return the number of Thread objects currently alive. This function is deprecated, use active_count() instead.
186,883
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count get_ident = _thread.get_ident _shutdown_locks_lock = _allocate_lock() _shutdown_locks = set() _threading_atexits = [] _SHUTTING...
Wait until the Python thread state of all non-daemon threads get deleted.
186,885
import os as _os import sys as _sys import _thread import functools from time import monotonic as _time from _weakrefset import WeakSet from itertools import islice as _islice, count as _count _allocate_lock = _thread.allocate_lock get_ident = _thread.get_ident def RLock(*args, **kwargs): """Factory function that r...
Cleanup threading module state that should not exist after a fork.
186,886
import abc import sys import stat as st from _collections_abc import _check_methods __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", "defpath", "name", "path", "devnull", "SEEK_SET", "SEEK_CUR", "SEEK_END", "fsencode", "fsdecode", "get_exec_path", "fdopen", "extsep"...
null
186,889
import abc import sys import stat as st from _collections_abc import _check_methods sys.modules['os.path'] = path from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull) if {open, stat} <= supports_dir_fd and {scandir, stat} <= supports_fd: def _fwalk(topfd, toppath, isbytes, topdow...
Directory tree generator. This behaves exactly like walk(), except that it yields a 4-tuple dirpath, dirnames, filenames, dirfd `dirpath`, `dirnames` and `filenames` are identical to walk() output, and `dirfd` is a file descriptor referring to the directory `dirpath`. The advantage of fwalk() over walk() is that it's s...
186,893
import abc import sys import stat as st from _collections_abc import _check_methods sys.modules['os.path'] = path from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull) from _collections_abc import MutableMapping, Mapping class _Environ(MutableMapping): def __init__(self, data, enc...
null
186,896
import abc import sys import stat as st from _collections_abc import _check_methods sys.modules['os.path'] = path from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull) from _collections_abc import MutableMapping, Mapping fsencode, fsdecode = _fscodec() if sys.platform != 'vxworks': ...
null
186,901
import abc import sys import stat as st from _collections_abc import _check_methods from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull) from _collections_abc import MutableMapping, Mapping if sys.platform != 'vxworks': # Supply os.popen() # Helper for popen() -- a proxy for ...
null
186,902
import abc import sys import stat as st from _collections_abc import _check_methods from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull) if {open, stat} <= supports_dir_fd and {scandir, stat} <= supports_fd: __all__.append("fwalk") from _collections_abc import MutableMapping, Map...
null
186,905
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Convert sys.path into a list of absolute, existing, unique paths.
186,906
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Get the doc string or comments for an object.
186,907
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Split a doc string into a synopsis line (if any) and the rest.
186,908
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Get a class name and qualify it with a module name if necessary.
186,909
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Check if an object is of a type that probably means it's data.
186,910
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Do a series of global replacements on a string.
186,911
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Omit part of a string if needed to make it fit in a maximum length.
186,912
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Remove the hexadecimal id from a Python object representation.
186,913
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Returns True if fn is a bound method, regardless of whether fn was implemented in Python or in C.
186,914
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
null
186,915
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Split sequence s via predicate, and return pair ([true], [false]). The return value is a 2-tuple of lists, ([x for x in s if predicate(x)], [x for x in s if not predicate(x)])
186,916
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Decide whether to show documentation on a variable.
186,917
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Wrap inspect.classify_class_attrs, with fixup for data descriptors.
186,918
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Sort the attrs list in-place by _fields and then alphabetically by name
186,919
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Guess whether a path refers to a package directory.
186,920
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Get the one-line summary out of a module file.
186,921
import builtins import importlib._bootstrap import importlib._bootstrap_external import importlib.machinery import importlib.util import inspect import io import os import pkgutil import platform import re import sys import sysconfig import time import tokenize import types import urllib.parse import warnings from coll...
Command-line interface (looks at sys.argv to decide what to do).
186,935
from os import PathLike def what(file, h=None): f = None try: if h is None: if isinstance(file, (str, PathLike)): f = open(file, 'rb') h = f.read(32) else: location = file.tell() h = file.read(32) fil...
null
186,942
import sys import os import errno import getopt import time import socket import collections from warnings import warn from email._header_value_parser import get_addr_spec, get_angle_addr import asyncore import asynchat __version__ = 'Python SMTP proxy version 0.3' DEBUGSTREAM = Devnull() COMMASPACE = ', ' def usage(co...
null
186,948
import binascii import codecs import datetime import enum from io import BytesIO import itertools import os import re import struct from xml.parsers.expat import ParserCreate _dateParser = re.compile(r"(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?...
null
186,956
import functools as _functools import warnings as _warnings import io as _io import os as _os import shutil as _shutil import errno as _errno from random import Random as _Random import sys as _sys import types as _types import weakref as _weakref import _thread template = "tmp" if _os.name != 'posix' or _sys.platform ...
The default prefix for temporary directories as string.
186,957
import functools as _functools import warnings as _warnings import io as _io import os as _os import shutil as _shutil import errno as _errno from random import Random as _Random import sys as _sys import types as _types import weakref as _weakref import _thread template = "tmp" if _os.name != 'posix' or _sys.platform ...
The default prefix for temporary directories as bytes.
186,959
import functools as _functools import warnings as _warnings import io as _io import os as _os import shutil as _shutil import errno as _errno from random import Random as _Random import sys as _sys import types as _types import weakref as _weakref import _thread _bin_openflags = _text_openflags def _sanitize_params(pre...
Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to io.open (default "w+b"). 'buffering' -- the buffer size argument to io.open (default -1). 'encoding' -- the encoding argument to io.open (default None) 'newline' -- the newline argument to io.open ...
186,963
import sys from types import MappingProxyType, DynamicClassAttribute def _is_private(cls_name, name): # do not use `re` as `re` imports `enum` pattern = '_%s__' % (cls_name, ) pat_len = len(pattern) if ( len(name) > pat_len and name.startswith(pattern) and name[pat_l...
null
186,969
import linecache import os import sys import sysconfig import token import tokenize import inspect import gc import dis import pickle from time import monotonic as _time import threading from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull) The provided code snippet includes necessa...
Return a plausible module name for the path.
186,986
import sys import datetime import locale as _locale from itertools import repeat February = 2 mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def isleap(year): def _monthlen(year, month): return mdays[month] + (month == February and isleap(year))
null
186,992
import collections import itertools import linecache import sys def print_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \ file=None, chain=True): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) i...
Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.
186,993
import collections import itertools import linecache import sys def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \ chain=True): """Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_excep...
Like print_exc() but return a string.
186,994
import collections import itertools import linecache import sys def print_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \ file=None, chain=True): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) i...
This is a shorthand for 'print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file)'.
187,001
import _signal from _signal import * from enum import IntEnum as _IntEnum def _int_to_enum(value, enum_klass): """Convert a numeric value to an IntEnum member. If it's not a known member, return the numeric value itself. """ try: return enum_klass(value) except ValueError: return val...
null
187,002
import _signal from _signal import * from enum import IntEnum as _IntEnum def _int_to_enum(value, enum_klass): def sigpending(): return {_int_to_enum(x, Signals) for x in _signal.sigpending()}
null
187,006
import os import re import sys _unspecified = ['unspecified'] def translation(domain, localedir=None, languages=None, class_=None, fallback=False, codeset=_unspecified): def install(domain, localedir=None, codeset=_unspecified, names=None): t = translation(domain, localedir, fallback=True, codeset=...
null
187,013
import os, urllib.parse, urllib.request import io import codecs from . import handler from . import xmlreader if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ: default_parser_list = os.environ["PY_SAX_PARSER"].split(",") if sys.platform[:4] == "java" and sys.registry.containsKey(_key): de...
null
187,018
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath def _get_writer(file_or_filename, encoding): # returns text write method and release all resources after using try: write = file_or_filename.write except AttributeErr...
null
187,023
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath class ElementTree: """An XML element hierarchy. This class also provides support for serialization to and from standard XML. *element* is an optional root element node, ...
null
187,024
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath class ElementTree: """An XML element hierarchy. This class also provides support for serialization to and from standard XML. *element* is an optional root element node, ...
Indent an XML document by inserting newlines and indentation space after elements. *tree* is the ElementTree or Element to modify. The (root) element itself will not be changed, but the tail text of all elements in its subtree will be adapted. *space* is the whitespace to insert for each indentation level, two space ch...
187,025
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath class XMLPullParser: def __init__(self, events=None, *, _parser=None): # The _parser argument is for internal use only and must not be relied # upon in user code. It w...
Incrementally parse XML document into ElementTree. This class also reports what's going on to the user based on the *events* it is initialized with. The supported events are the strings "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get detailed namespace information). If *events* is omitted, only...
187,026
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath class TreeBuilder: """Generic element structure builder. This builder converts a sequence of start, data, and end method calls to a well-formed element structure. You can ...
Parse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance.
187,027
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath class TreeBuilder: """Generic element structure builder. This builder converts a sequence of start, data, and end method calls to a well-formed element structure. You can ...
Parse XML document from string constant for its IDs. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an (Element, dict) tuple, in which the dict maps element id:s to elements.
187,028
import sys import re import warnings import io import collections import collections.abc import contextlib from . import ElementPath class TreeBuilder: """Generic element structure builder. This builder converts a sequence of start, data, and end method calls to a well-formed element structure. You can ...
Parse XML document from sequence of string fragments. *sequence* is a list of other sequence, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance.