id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
175,919
def _seg_79(): return [ (0x2F9F2, 'M', u'䧦'), (0x2F9F3, 'M', u'雃'), (0x2F9F4, 'M', u'嶲'), (0x2F9F5, 'M', u'霣'), (0x2F9F6, 'M', u'𩅅'), (0x2F9F7, 'M', u'𩈚'), (0x2F9F8, 'M', u'䩮'), (0x2F9F9, 'M', u'䩶'), (0x2F9FA, 'M', u'韠'), (0x2F9FB, 'M', u'𩐊'), (0x2F9FC, 'M', u'䪲'), ...
null
175,920
from .core import encode, decode, alabel, ulabel, IDNAError import codecs import re class Codec(codecs.Codec): def encode(self, data, errors='strict'): if errors != 'strict': raise IDNAError("Unsupported error handling \"{0}\"".format(errors)) if not data: return "", 0 ...
null
175,922
from .core import * from .codec import * def encode(s, strict=False, uts46=False, std3_rules=False, transitional=False): if isinstance(s, (bytes, bytearray)): s = s.decode("ascii") if uts46: s = uts46_remap(s, std3_rules, transitional) trailing_dot = False result = [] if strict: ...
null
175,923
from .core import * from .codec import * def decode(s, strict=False, uts46=False, std3_rules=False): if isinstance(s, (bytes, bytearray)): s = s.decode("ascii") if uts46: s = uts46_remap(s, std3_rules, False) trailing_dot = False result = [] if not strict: labels = _unicode...
null
175,924
from .core import * from .codec import * def nameprep(s): raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
null
175,952
from __future__ import absolute_import, print_function, unicode_literals import argparse import sys from pip._vendor.chardet import __version__ from pip._vendor.chardet.compat import PY2 from pip._vendor.chardet.universaldetector import UniversalDetector import sys assert "pydevd" in sys.modules class UniversalDetec...
Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str
175,953
import datetime import re import sys from decimal import Decimal from pip._vendor.toml.decoder import InlineTableDict def dumps(o, encoder=None): """Stringifies input dict as toml Args: o: Object to dump into toml encoder: The ``TomlEncoder`` to use for constructing the output string Returns...
Writes out dict as toml to a file Args: o: Object to dump into toml f: File descriptor where the toml should be stored encoder: The ``TomlEncoder`` to use for constructing the output string Returns: String containing the toml corresponding to dictionary Raises: TypeError: When anything other than file descriptor is pas...
175,954
import datetime import re import sys from decimal import Decimal from pip._vendor.toml.decoder import InlineTableDict if sys.version_info >= (3,): unicode = str import sys if sys.version_info >= (3, 6): _PathLike = StrPath elif sys.version_info >= (3, 4): import pathlib _PathLike = Union[StrPath, pat...
null
175,955
import datetime import re import sys from decimal import Decimal from pip._vendor.toml.decoder import InlineTableDict def _dump_float(v): return "{}".format(v).replace("e+0", "e+").replace("e-0", "e-")
null
175,956
import datetime import re import sys from decimal import Decimal from pip._vendor.toml.decoder import InlineTableDict def _dump_time(v): utcoffset = v.utcoffset() if utcoffset is None: return v.isoformat() # The TOML norm specifies that it's local time thus we drop the offset return v.isoformat...
null
175,957
import datetime import io from os import linesep import re import sys from pip._vendor.toml.tz import TomlTz def _strictly_valid_num(n): n = n.strip() if not n: return False if n[0] == '_': return False if n[-1] == '_': return False if "_." in n or "._" in n: return ...
null
175,958
import datetime import io from os import linesep import re import sys from pip._vendor.toml.tz import TomlTz def _ispath(p): if isinstance(p, (bytes, basestring)): return True return _detect_pathlib_path(p) def _getpath(p): if (3, 6) <= sys.version_info: import os return os.fspath(p)...
Parses named file or files as toml and returns a dictionary Args: f: Path to the file to open, array of files to read into single dict or a file descriptor _dict: (optional) Specifies the class of the returned toml dictionary decoder: The decoder to use Returns: Parsed toml file represented as a dictionary Raises: Type...
175,959
import datetime import io from os import linesep import re import sys from pip._vendor.toml.tz import TomlTz class TomlTz(tzinfo): def __init__(self, toml_offset): if toml_offset == "Z": self._raw_offset = "+00:00" else: self._raw_offset = toml_offset self._sign = -1...
null
175,960
import datetime import io from os import linesep import re import sys from pip._vendor.toml.tz import TomlTz def _load_unicode_escapes(v, hexbytes, prefix): skip = False i = len(v) - 1 while i > -1 and v[i] == '\\': skip = not skip i -= 1 for hx in hexbytes: if skip: ...
null
175,961
import datetime import io from os import linesep import re import sys from pip._vendor.toml.tz import TomlTz _escapes = ['0', 'b', 'f', 'n', 'r', 't', '"'] _escape_to_escapedchars = dict(zip(_escapes, _escapedchars)) The provided code snippet includes necessary dependencies for implementing the `_unescape` function. W...
Unescape characters in a TOML string.
175,962
import logging import re from .compat import string_types from .util import parse_requirement class UnsupportedVersionError(ValueError): """This is an unsupported version.""" pass PEP440_VERSION_RE = re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?' r'(\.(post)(\d+))?(\.(dev...
null
175,963
import logging import re from .compat import string_types from .util import parse_requirement def _match_prefix(x, y): x = str(x) y = str(y) if x == y: return True if not x.startswith(y): return False n = len(y) return x[n] == '.'
null
175,964
import logging import re from .compat import string_types from .util import parse_requirement _REPLACEMENTS = ( (re.compile('[.+-]$'), ''), # remove trailing puncts (re.compile(r'^[.](\d)'), r'0.\1'), # .N -> 0.N at start (re.compile('^[.-]'), ''), # remo...
Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything.
175,965
import logging import re from .compat import string_types from .util import parse_requirement class UnsupportedVersionError(ValueError): """This is an unsupported version.""" pass _normalized_key = _pep_440_key The provided code snippet includes necessary dependencies for implementing the `_suggest_normalized_...
Suggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on ...
175,966
import logging import re from .compat import string_types from .util import parse_requirement _VERSION_PART = re.compile(r'([a-z]+|\d+|[\.-])', re.I) _VERSION_REPLACE = { 'pre': 'c', 'preview': 'c', '-': 'final-', 'rc': 'c', 'dev': '@', '': None, '.': None, } def _legacy_key(s): def get...
null
175,967
import logging import re from .compat import string_types from .util import parse_requirement class UnsupportedVersionError(ValueError): """This is an unsupported version.""" pass def is_semver(s): return _SEMVER_RE.match(s) def _semantic_key(s): def make_tuple(s, absent): if s is None: ...
null
175,968
import gzip from io import BytesIO import json import logging import os import posixpath import re import zlib from . import DistlibException from .compat import (urljoin, urlparse, urlunparse, url2pathname, pathname2url, queue, quote, unescape, string_types, build_opener, HTTP...
Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names.
175,969
from __future__ import unicode_literals import base64 import codecs import contextlib import hashlib import logging import os import posixpath import sys import zipimport from . import DistlibException, resources from .compat import StringIO from .version import get_scheme, UnsupportedVersionError from .metadata import...
Recursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested
175,970
from __future__ import unicode_literals import base64 import codecs import contextlib import hashlib import logging import os import posixpath import sys import zipimport from . import DistlibException, resources from .compat import StringIO from .version import get_scheme, UnsupportedVersionError from .metadata import...
Recursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested
175,971
from __future__ import unicode_literals import base64 import codecs import contextlib import hashlib import logging import os import posixpath import sys import zipimport from . import DistlibException, resources from .compat import StringIO from .version import get_scheme, UnsupportedVersionError from .metadata import...
A convenience method for making a dist given just a name and version.
175,972
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement.
175,973
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Find destinations for resources files
175,974
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,975
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,976
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,977
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,978
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,979
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,980
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,981
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,982
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use the...
175,983
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,984
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent dir...
175,985
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended.
175,986
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,987
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,988
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,989
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,990
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Extract name, version, python version from a filename (no extension) Return name, version, pyver or None
175,991
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,992
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,993
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,994
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,995
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
zip a directory tree into a BytesIO object
175,996
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
null
175,997
import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket import subprocess import sys import tarfile import tempfile import textwrap import time from . import DistlibException fro...
Normalize a python package name a la PEP 503
175,998
from io import BytesIO import logging import os import re import struct import sys from .compat import sysconfig, detect_encoding, ZipFile from .resources import finder from .util import (FileOperator, get_export_entry, convert_path, get_executable, in_venv) def enquote_executable(executable): i...
null
175,999
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile def copyfile(src, dst): """Copy data from src to dst""" if _samefile(src, dst): raise Error("`%s` and `%s` are the same file" % (src, dst)) for fn in [src, dst]: try: st...
Copy data and mode bits ("cp src dst"). The destination may be a directory.
176,000
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile The provided code snippet includes necessary dependencies for implementing the `ignore_patterns` function. Write a Python function `def ignore_patterns(*patterns)` to solve the following problem: Function tha...
Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files
176,001
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile class Error(EnvironmentError): pass def _samefile(src, dst): # Macintosh, Unix. if hasattr(os.path, 'samefile'): try: return os.path.samefile(src, dst) except OSError: ...
Recursively move a file or directory to another location. This is similar to the Unix "mv" command. 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 exists but is not a directory, it may be ov...
176,002
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile def _get_gid(name): """Returns a gid, given a group name.""" if getgrnam is None or name is None: return None try: result = getgrnam(name) except KeyError: result = None...
Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", 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 will ...
176,003
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False): # XXX see if we want to keep an external call here if verbose: zipoptions = "-r" else: zipoptions = "-r...
Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises ExecError. Returns the name of the ...
176,004
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile _ARCHIVE_FORMATS = { 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), 'tar': (_make_tarball, [('compre...
Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description)
176,005
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile _ARCHIVE_FORMATS = { 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), 'tar': (_make_tarball, [('compre...
Registers an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_...
176,006
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile _ARCHIVE_FORMATS = { 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), 'tar': (_make_tarball, [('compre...
null
176,007
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile _ARCHIVE_FORMATS = { 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), 'tar': (_make_tarball, [('compre...
Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "bztar" or "gztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before cr...
176,008
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile _UNPACK_FORMATS = { 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), 'zip': (['.zip'], _unpack_zipfile, ...
Returns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description)
176,009
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile def _check_unpack_options(extensions, function, extra_args): """Checks what gets registered as an unpacker.""" # first make sure no other unpacker is registered for this extension existing_extensio...
Registers an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it needs to raise a ReadError exception. If ...
176,010
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile _UNPACK_FORMATS = { 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), 'zip': (['.zip'], _unpack_zipfile, ...
Removes the pack format from the registry.
176,011
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile class ReadError(EnvironmentError): """Raised when an archive cannot be read""" def _ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) ...
Unpack zip `filename` to `extract_dir`
176,012
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile class ReadError(EnvironmentError): """Raised when an archive cannot be read""" The provided code snippet includes necessary dependencies for implementing the `_unpack_tarfile` function. Write a Python fun...
Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`
176,013
import os import sys import stat from os.path import abspath import fnmatch import errno from . import tarfile class ReadError(EnvironmentError): """Raised when an archive cannot be read""" _UNPACK_FORMATS = { 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpa...
Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", or "gztar". Or any other registered format. If not provided, unpack_arc...
176,014
import os import sys def cache_from_source(py_file, debug=__debug__): ext = debug and 'c' or 'o' return py_file + ext
null
176,015
import os import sys def callable(obj): return isinstance(obj, Callable)
null
176,016
import os import sys def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, str): return filename.encode(sys.getfilesystemencoding()) else: raise TypeError("expect bytes or str, not %s" % ...
null
176,017
import codecs import os import re import sys from os.path import pardir, realpath if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir)) if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower(): _PROJECT_BASE = _safe_realpath(os...
null
176,018
import codecs import os import re import sys from os.path import pardir, realpath def _ensure_cfg_read(): global _cfg_read if not _cfg_read: from ..resources import finder backport_package = __name__.rsplit('.', 1)[0] _finder = finder(backport_package) _cfgfile = _finder.find('sy...
null
176,019
import codecs import os import re import sys from os.path import pardir, realpath _VAR_REPL = re.compile(r'\{([^{]*?)\}') def format_value(value, vars): def _replacer(matchobj): name = matchobj.group(1) if name in vars: return vars[name] return matchobj.group(0) return _VAR_...
null
176,020
import codecs import os import re import sys from os.path import pardir, realpath _SCHEMES = configparser.RawConfigParser() The provided code snippet includes necessary dependencies for implementing the `get_scheme_names` function. Write a Python function `def get_scheme_names()` to solve the following problem: Return...
Return a tuple containing the schemes names.
176,021
import codecs import os import re import sys from os.path import pardir, realpath _SCHEMES = configparser.RawConfigParser() The provided code snippet includes necessary dependencies for implementing the `get_path_names` function. Write a Python function `def get_path_names()` to solve the following problem: Return a t...
Return a tuple containing the paths names.
176,022
import codecs import os import re import sys from os.path import pardir, realpath def _get_default_scheme(): if os.name == 'posix': # the default scheme for posix is posix_prefix return 'posix_prefix' return os.name def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): """Retu...
Display all information sysconfig detains.
176,023
from __future__ import print_function import sys import os import stat import errno import time import struct import copy import re NUL = b"\0" The provided code snippet includes necessary dependencies for implementing the `stn` function. Write a Python function `def stn(s, length, encoding, errors)` to solve the foll...
Convert a string to a null-terminated bytes object.
176,024
from __future__ import print_function import sys import os import stat import errno import time import struct import copy import re def nts(s, encoding, errors): """Convert a null-terminated bytes object to a string. """ p = s.find(b"\0") if p != -1: s = s[:p] return s.decode(encoding, error...
Convert a number field to a python number.
176,025
from __future__ import print_function import sys import os import stat import errno import time import struct import copy import re NUL = b"\0" GNU_FORMAT = 1 DEFAULT_FORMAT = GNU_FORMAT The provided code snippet includes necessary dep...
Convert a python number to a number field.
176,026
from __future__ import print_function import sys import os import stat import errno import time import struct import copy import re The provided code snippet includes necessary dependencies for implementing the `calc_chksums` function. Write a Python function `def calc_chksums(buf)` to solve the following problem: Cal...
Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit...
176,027
from __future__ import print_function import sys import os import stat import errno import time import struct import copy import re filemode_table = ( ((S_IFLNK, "l"), (S_IFREG, "-"), (S_IFBLK, "b"), (S_IFDIR, "d"), (S_IFCHR, "c"), (S_IFIFO, "p")), ((TUREAD...
Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list()
176,028
from __future__ import print_function import sys import os import stat import errno import time import struct import copy import re class TarError(Exception): """Base exception.""" pass open = TarFile.open The provided code snippet includes necessary dependencies for implementing the `is_tarfile` function. Wri...
Return True if name points to a tar archive that we are able to handle, else return False.
176,029
import os import sys import platform import re from .compat import python_implementation, urlparse, string_types from .util import in_venv, parse_marker def _is_literal(o): if not isinstance(o, string_types) or not o: return False return o[0] in '\'"'
null
176,030
import os import sys import platform import re from .compat import python_implementation, urlparse, string_types from .util import in_venv, parse_marker def in_venv(): if hasattr(sys, 'real_prefix'): # virtualenv venvs result = True else: # PEP 405 venvs result = sys.prefix != g...
null
176,031
import os import sys import platform import re from .compat import python_implementation, urlparse, string_types from .util import in_venv, parse_marker DEFAULT_CONTEXT = default_context() evaluator = Evaluator() def parse_marker(marker_string): """ Parse a marker string and return a dictionary containing a ma...
Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping
176,032
from __future__ import unicode_literals import bisect import io import logging import os import pkgutil import shutil import sys import types import zipimport from . import DistlibException from .util import cached_property, get_cache_base, path_to_cache_dir, Cache _finder_registry = { type(None): ResourceFinder, ...
null
176,033
from __future__ import unicode_literals import bisect import io import logging import os import pkgutil import shutil import sys import types import zipimport from . import DistlibException from .util import cached_property, get_cache_base, path_to_cache_dir, Cache _finder_registry = { type(None): ResourceFinder, ...
Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path.
176,034
from __future__ import unicode_literals import base64 import codecs import datetime import distutils.util from email import message_from_file import hashlib import imp import json import logging import os import posixpath import re import shutil import sys import tempfile import zipfile from . import __version__, Distl...
null
176,035
from __future__ import unicode_literals import base64 import codecs import datetime import distutils.util from email import message_from_file import hashlib import imp import json import logging import os import posixpath import re import shutil import sys import tempfile import zipfile from . import __version__, Distl...
Return (pyver, abi, arch) tuples compatible with this Python.
176,036
from __future__ import unicode_literals import base64 import codecs import datetime import distutils.util from email import message_from_file import hashlib import imp import json import logging import os import posixpath import re import shutil import sys import tempfile import zipfile from . import __version__, Distl...
null
176,037
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile def quote(s): if isinstance(s, unicode): s = s.encode('utf-8') return _quote(s)
null
176,038
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile The provided code snippet includes necessary dependencies for implementing the `splituser` function. Write a Python function `def splituser(host)` to solve the following problem: splituser('user[:passwd]@ho...
splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.
176,039
from __future__ import absolute_import import os import re import sys try: from ssl import match_hostname, CertificateError except ImportError: # pragma: no cover class CertificateError(ValueError): pass def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, se...
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing.
176,040
from __future__ import absolute_import import os import re import sys if sys.version_info[0] < 3: # pragma: no cover from StringIO import StringIO string_types = basestring, text_type = unicode from types import FileType as file_type import __builtin__ as builtins import ConfigParser as configp...
Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path.
176,041
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile def callable(obj): return isinstance(obj, Callable)
null
176,042
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, text_type): return filename.encode(_fsencoding, _fserrors) e...
null
176,043
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile try: from tokenize import detect_encoding except ImportError: # pragma: no cover from codecs import BOM_UTF8, lookup import re cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)") def _get_n...
The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) ...
176,044
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile def get_ident() -> int: ... def get_ident() -> int: ... The provided code snippet includes necessary dependencies for implementing the `_recursive_repr` function. Write a Python function `def _recursive_r...
Decorator to make a repr function return fillvalue for a recursive call
176,045
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile def cache_from_source(path, debug_override=None): assert path.endswith('.py') if debug_override is None: debug_override = __debug__ if debug_override: ...
null
176,046
from __future__ import absolute_import import os import re import sys from zipfile import ZipFile as BaseZipFile def valid_ident(s): m = IDENTIFIER.match(s) if not m: raise ValueError('Not a valid Python identifier: %r' % s) return True
null