id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
174,619 | import zipfile
import tarfile
import os
import shutil
import posixpath
import contextlib
from distutils.errors import DistutilsError
from pkg_resources import ensure_directory
class UnrecognizedFormat(DistutilsError):
"""Couldn't recognize the archive type"""
def default_filter(src, dst):
"""The default progres... | Unpack zip `filename` to `extract_dir` Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined by ``zipfile.is_zipfile()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. |
174,620 | import zipfile
import tarfile
import os
import shutil
import posixpath
import contextlib
from distutils.errors import DistutilsError
from pkg_resources import ensure_directory
class UnrecognizedFormat(DistutilsError):
"""Couldn't recognize the archive type"""
def default_filter(src, dst):
"""The default progres... | Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined by ``tarfile.open()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. |
174,621 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | null |
174,622 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Reads the metadata values from a file object. |
174,623 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Write the PKG-INFO format data to a file object. |
174,624 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | null |
174,625 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that namespace packages are valid |
174,626 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that extras_require mapping is valid |
174,627 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that value is True, False, 0, or 1 |
174,628 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that install_requires is a valid requirements list |
174,629 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that value is a valid version specifier |
174,630 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that entry_points map is parseable |
174,631 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | null |
174,632 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | Verify that value is a dictionary of package names to glob lists |
174,633 | import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
import itertools
from collections impo... | null |
174,634 | from __future__ import absolute_import, unicode_literals
import ast
import io
import os
import sys
import warnings
import functools
import importlib
from collections import defaultdict
from functools import partial
from functools import wraps
import contextlib
from distutils.errors import DistutilsOptionError, Distutil... | Add path to front of sys.path for the duration of the context. |
174,635 | from __future__ import absolute_import, unicode_literals
import ast
import io
import os
import sys
import warnings
import functools
import importlib
from collections import defaultdict
from functools import partial
from functools import wraps
import contextlib
from distutils.errors import DistutilsOptionError, Distutil... | Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other configuration files which could be on in various places. :param bool ignore_option_errors: Whether to silently ignore opt... |
174,636 | import os
import socket
import atexit
import re
import functools
from setuptools.extern.six.moves import urllib, http_client, map, filter
from pkg_resources import ResolutionError, ExtractionError
if not CertificateError:
class CertificateError(ValueError):
pass
if not match_hostname:
def _dnsname_match... | 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. |
174,637 | import os
import socket
import atexit
import re
import functools
from setuptools.extern.six.moves import urllib, http_client, map, filter
from pkg_resources import ResolutionError, ExtractionError
class VerifyingHTTPSHandler(HTTPSHandler):
"""Simple verifying handler: no auth, subclasses, timeouts, etc."""
def ... | Get a urlopen() replacement that uses ca_bundle for verification |
174,638 | import os
import socket
import atexit
import re
import functools
from setuptools.extern.six.moves import urllib, http_client, map, filter
from pkg_resources import ResolutionError, ExtractionError
def once(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
if not hasattr(func, 'always_returns'... | null |
174,639 | import os
import sys
import tempfile
import operator
import functools
import itertools
import re
import contextlib
import pickle
import textwrap
from setuptools.extern import six
from setuptools.extern.six.moves import builtins, map
import pkg_resources
from distutils.errors import DistutilsError
from pkg_resources imp... | Run a distutils setup script, sandboxed in its directory |
174,640 | import platform
import ctypes
def windows_only(func):
if platform.system() != 'Windows':
return lambda *args, **kwargs: None
return func | null |
174,641 | import platform
import ctypes
The provided code snippet includes necessary dependencies for implementing the `hide_file` function. Write a Python function `def hide_file(path)` to solve the following problem:
Set the hidden attribute on a file or directory. From http://stackoverflow.com/questions/19622133/ `path` must... | Set the hidden attribute on a file or directory. From http://stackoverflow.com/questions/19622133/ `path` must be text. |
174,642 | import re
import functools
import distutils.core
import distutils.errors
import distutils.extension
from setuptools.extern.six.moves import map
from .monkey import get_unpatched
The provided code snippet includes necessary dependencies for implementing the `_have_cython` function. Write a Python function `def _have_cy... | Return True if Cython can be imported. |
174,643 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | null |
174,644 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | Yield egg or source distribution objects that might be found at a URL |
174,645 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | Yield possible egg or source distribution objects based on a filename |
174,646 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. |
174,647 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | Find rel="homepage" and rel="download" links in `page`, yielding URLs |
174,648 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | null |
174,649 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | Open a urllib2 request, handling HTTP authentication |
174,650 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | null |
174,651 | import sys
import os
import re
import shutil
import socket
import base64
import hashlib
import itertools
import warnings
from functools import wraps
from setuptools.extern import six
from setuptools.extern.six.moves import urllib, http_client, configparser, map
import setuptools
from pkg_resources import (
CHECKOUT... | Read a local path, with special support for directories |
174,652 | import os
import sys
from distutils.debug import DEBUG
from distutils.errors import *
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand
from distutils.extension import Extension
def gen_usage (script_name):
script = os.path.basename(script_name)
... | The gateway to the Distutils: do everything your setup script needs to do, in a highly flexible and user-driven way. Briefly: create a Distribution instance; find and parse config files; parse the command line; run each Distutils command found there, customized by the options supplied to 'setup()' (as keyword arguments... |
174,657 | import os
import sys
import copy
from subprocess import Popen, PIPE, check_output
import re
from distutils.unixccompiler import UnixCCompiler
from distutils.file_util import write_file
from distutils.errors import (DistutilsExecError, CCompilerError,
CompileError, UnknownFileError)
from distutils.version import... | Try to determine if the gcc that would be used is from cygwin. |
174,659 | import os
import errno
from distutils.errors import DistutilsFileError, DistutilsInternalError
from distutils import log
def mkpath(name, mode=0o777, verbose=1, dry_run=0):
"""Create a directory and any missing ancestor directories.
If the directory already exists (or if 'name' is the empty string, which
me... | Copy an entire directory tree 'src' to a new location 'dst'. Both 'src' and 'dst' must be directory names. If 'src' is not a directory, raise DistutilsFileError. If 'dst' does not exist, it is created with 'mkpath()'. The end result of the copy is that every file in 'src' is copied to 'dst', and directories under 'src'... |
174,660 | import os
import errno
from distutils.errors import DistutilsFileError, DistutilsInternalError
from distutils import log
_path_created = {}
def _build_cmdtuple(path, cmdtuples):
"""Helper for remove_tree()."""
for f in os.listdir(path):
real_f = os.path.join(path,f)
if os.path.isdir(real_f) and ... | Recursively remove an entire directory tree. Any errors are ignored (apart from being reported to stdout if 'verbose' is true). |
174,665 | import os
import re
import importlib.util
import string
import sys
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import log
from distutils.errors import DistutilsByteCompileError
The provided code snippet includes necessary dep... | Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS. |
174,668 | import os
import re
import importlib.util
import string
import sys
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import log
from distutils.errors import DistutilsByteCompileError
_wordchars_re = _squote_re = _dquote_re = None
de... | Split a string up according to Unix shell-like rules for quotes and backslashes. In short: words are delimited by spaces, as long as those spaces are not escaped by a backslash, or inside a quoted string. Single and double quotes are equivalent, and the quote characters can be backslash-escaped. The backslash is stripp... |
174,670 | import os
import re
import importlib.util
import string
import sys
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import log
from distutils.errors import DistutilsByteCompileError
def execute (func, args, msg=None, verbose=0, dry... | Byte-compile a collection of Python source files to .pyc files in a __pycache__ subdirectory. 'py_files' is a list of files to compile; any files that don't end in ".py" are silently skipped. 'optimize' must be one of the following: 0 - don't optimize 1 - normal optimization (like "python -O") 2 - extra optimization (l... |
174,672 | import os
import re
import importlib.util
import string
import sys
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import log
from distutils.errors import DistutilsByteCompileError
def run_2to3(files, fixer_names=None, options=Non... | Recursively copy a directory, only copying new and changed files, running run_2to3 over all newly copied Python modules afterward. If you give a template string, it's parsed like a MANIFEST.in. |
174,673 | import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute
from distutils import log
compiler_class = { 'unix': ('unixcc... | Print list of available compilers (used by the "--help-compiler" options to "build", "build_ext", "build_clib"). |
174,680 | import os
from distutils.core import Command
from distutils.errors import *
from distutils.util import get_platform
class bdist(Command):
description = "create a built (binary) distribution"
user_options = [('bdist-base=', 'b',
"temporary directory for creating built distributions"),
... | Print list of available formats (arguments to "--format" option). |
174,682 | import os, re
from distutils.core import Command
from distutils.errors import DistutilsExecError
from distutils.sysconfig import customize_compiler
from distutils import log
The provided code snippet includes necessary dependencies for implementing the `dump_file` function. Write a Python function `def dump_file(filen... | Dumps a file content into log.info. If head is not None, will be dumped before the file content. |
174,684 | import os
import sys
from glob import glob
from warnings import warn
from distutils.core import Command
from distutils import dir_util
from distutils import file_util
from distutils import archive_util
from distutils.text_file import TextFile
from distutils.filelist import FileList
from distutils import log
from distut... | Print all possible values for the 'formats' option (used by the "--help-formats" command-line option). |
174,686 | import os, re
import fnmatch
import functools
from distutils.util import convert_path
from distutils.errors import DistutilsTemplateError, DistutilsInternalError
from distutils import log
def _find_all_simple(path):
"""
Find all files under 'path'
"""
results = (
os.path.join(base, file)
... | Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. |
174,688 | import os
from warnings import warn
import sys
from distutils.errors import DistutilsExecError
from distutils.spawn import spawn
from distutils.dir_util import mkpath
from distutils import log
def _get_gid(name):
"""Returns a gid, given a group name."""
if getgrnam is None or name is None:
return None
... | Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or None. ("compress" will be deprecated in Python 3.2) 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the... |
174,689 | import os
from warnings import warn
import sys
try:
import zipfile
except ImportError:
zipfile = None
from distutils.errors import DistutilsExecError
from distutils.spawn import spawn
from distutils.dir_util import mkpath
from distutils import log
The provided code snippet includes necessary dependencies for i... | 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 DistutilsExecError. Returns the nam... |
174,691 | import os
from warnings import warn
import sys
from distutils.errors import DistutilsExecError
from distutils.spawn import spawn
from distutils.dir_util import mkpath
from distutils import log
ARCHIVE_FORMATS = {
'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
'bztar': (make_tarball, [('com... | 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", "gztar", "bztar", "xztar", or "ztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'r... |
174,692 | import sys
import os
import re
from email import message_from_file
from distutils.errors import *
from distutils.fancy_getopt import FancyGetopt, translate_longopt
from distutils.util import check_environ, strtobool, rfc822_escape
from distutils import log
from distutils.debug import DEBUG
def _ensure_list(value, fiel... | null |
174,694 | import sys
import os
import subprocess
from distutils.errors import DistutilsPlatformError, DistutilsExecError
from distutils.debug import DEBUG
from distutils import log
if sys.platform == 'darwin':
_cfg_target = None
_cfg_target_split = None
def find_executable(executable, path=None):
"""Tries to find 'ex... | Run another program, specified as a command list 'cmd', in a new process. 'cmd' is just the argument list for the new process, ie. cmd[0] is the program to run and cmd[1:] are the rest of its arguments. There is no way to run a program with a name different from that of its executable. If 'search_path' is true (the def... |
174,697 | import _imp
import os
import re
import sys
from .errors import DistutilsPlatformError
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
if sys.executable:
project_base = os.path.dirname(os.path.abspath(sys.executable))
else:
# s... | Do any platform-specific customization of a CCompiler instance. Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile. |
174,698 | import _imp
import os
import re
import sys
from .errors import DistutilsPlatformError
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
if sys.executable:
project_base = os.path.dirname(os.path.abspath(sys.executable))
else:
# s... | Return full pathname of installed pyconfig.h file. |
174,700 | import _imp
import os
import re
import sys
from .errors import DistutilsPlatformError
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
if sys.executable:
project_base = os.path.dirname(os.path.abspath(sys.executable))
else:
# s... | Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. |
174,701 | import _imp
import os
import re
import sys
from .errors import DistutilsPlatformError
_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
The provided code snippet includes necessary dependencies for implementing the `expand_makefile_vars` function. Wri... | Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars' is the output of ... |
174,702 | import _imp
import os
import re
import sys
from .errors import DistutilsPlatformError
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
if sys.executable:
project_base = os.path.dirname(os.path.abspath(sys.executable))
else:
# s... | Initialize the module as appropriate for POSIX systems. |
174,703 | import _imp
import os
import re
import sys
from .errors import DistutilsPlatformError
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
if sys.executable:
project_base = os.path.dirname(os.path.abspath(sys.executable))
else:
# s... | Initialize the module as appropriate for NT |
174,704 | import sys, string, re
import getopt
from distutils.errors import *
class FancyGetopt:
"""Wrapper around the standard 'getopt()' module that provides some
handy extra functionality:
* short and long options are tied together
* options have help strings, and help text can be assembled
from th... | null |
174,707 | import os
import warnings
class Extension:
"""Just a collection of attributes that describes an extension
module and everything needed to build it (hopefully in a portable
way, but there are hooks that let you be as unportable as you need).
Instance attributes:
name : string
the full name ... | Reads a Setup file and returns Extension instances. |
174,714 | import os
from distutils.errors import DistutilsFileError
ST_MTIME: int
The provided code snippet includes necessary dependencies for implementing the `newer_group` function. Write a Python function `def newer_group (sources, target, missing='error')` to solve the following problem:
Return true if 'target' is out-of-... | Return true if 'target' is out-of-date with respect to any file listed in 'sources'. In other words, if 'target' exists and is newer than every file in 'sources', return false; otherwise return true. 'missing' controls what we do when a source file is missing; the default ("error") is to blow up with an OSError from in... |
174,717 | import os
import subprocess
import sys
import re
from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
from distutils.ccompiler import CCompiler, gen_lib_options
from distutils import log
from distutils.util import get_platform
import w... | Launch vcvarsall.bat and read the settings from its environment |
174,718 | import os
import subprocess
import contextlib
from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
from distutils.ccompiler import CCompiler, gen_lib_options
from distutils import log
from distutils.util import get_platform
from iterto... | null |
174,719 | import os
import subprocess
import contextlib
from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
from distutils.ccompiler import CCompiler, gen_lib_options
from distutils import log
from distutils.util import get_platform
from iterto... | Return path to an MSVC executable program. Tries to find the program in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute path that is known to exist. If none of them work, just return the origi... |
174,721 | import os
from distutils.errors import DistutilsFileError
from distutils import log
def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
link=None, verbose=1, dry_run=0):
"""Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is
copied there with the same name; otherwi... | Move a file 'src' to 'dst'. If 'dst' is a directory, the file will be moved into it with the same name; otherwise, 'src' is just renamed to 'dst'. Return the new full name of the file. Handles cross-device moves on Unix using 'copy_file()'. What about other systems??? |
174,723 | import sys
import platform
from setuptools.extern import six
The provided code snippet includes necessary dependencies for implementing the `get_all_headers` function. Write a Python function `def get_all_headers(message, key)` to solve the following problem:
Given an HTTPMessage, return all headers matching a given k... | Given an HTTPMessage, return all headers matching a given key. |
174,724 | import sys
import platform
from setuptools.extern import six
def get_all_headers(message, key): # noqa
return message.getheaders(key) | null |
174,727 | import string
from weakref import ref as wkref
import copy
import sys
import warnings
import re
import sre_constants
import collections
import pprint
import traceback
import types
from datetime import datetime
if PY_3:
_MAX_INT = sys.maxsize
basestring = str
unichr = chr
_ustr = str
# build list of ... | null |
174,748 | import string
from weakref import ref as wkref
import copy
import sys
import warnings
import re
import sre_constants
import collections
import pprint
import traceback
import types
from datetime import datetime
class ParserElement(object):
"""Abstract base level parser element class."""
DEFAULT_WHITE_CHARS = " \... | Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default=C{"("}); can also be a pyparsing expression - closer - closing character for a nested list (default=C{")"}); can also be a pyparsing expre... |
174,752 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
if sys.platform == "win32":
_moved_attributes += [
MovedModule("winreg", "_winreg"),
]
if sys.version_info[:2] == (3, 2):
exec_("""def raise_from(value, from_value):
if from_value is ... | Import module, returning the module after the last dot. |
174,777 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
def reraise(tp, value, tb=None):
if value is None:
value = tp()
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value | null |
174,778 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
if sys.platform == "win32":
_moved_attributes += [
MovedModule("winreg", "_winreg"),
]
if sys.version_info[:2] == (3, 2):
exec_("""def raise_from(value, from_value):
if from_value is ... | Execute code in a namespace. |
174,780 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
if sys.platform == "win32":
_moved_attributes += [
MovedModule("winreg", "_winreg"),
]
if sys.version_info[:2] == (3, 2):
exec_("""def raise_from(value, from_value):
if from_value is ... | The new-style print function for Python 2.4 and 2.5. |
174,781 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
if sys.platform == "win32":
_moved_attributes += [
MovedModule("winreg", "_winreg"),
]
if sys.version_info[:2] == (3, 2):
exec_("""def raise_from(value, from_value):
if from_value is ... | null |
174,782 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
updated=functools.WRAPPER_UPDATES):
def wrapper(f):
f = functools.wraps(wrapped, assigned, updated)(f)
... | null |
174,783 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
The provided code snippet includes necessary dependencies for implementing the `with_metaclass` function. Write a Python function `def with_metaclass(meta, *bases)` to solve the following problem:
Create a ... | Create a base class with a metaclass. |
174,784 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
The provided code snippet includes necessary dependencies for implementing the `add_metaclass` function. Write a Python function `def add_metaclass(metaclass)` to solve the following problem:
Class decorato... | Class decorator for creating a class with a metaclass. |
174,785 | from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
PY2 = sys.version_info[0] == 2
The provided code snippet includes necessary dependencies for implementing the `python_2_unicode_compatible` function. Write a Python function `def python_2_unicode_compatible... | A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class. |
174,786 | import itertools as it
from collections import deque
The provided code snippet includes necessary dependencies for implementing the `is_iterable` function. Write a Python function `def is_iterable(obj)` to solve the following problem:
Are we being asked to look up a list of things, instead of a single thing? We check ... | Are we being asked to look up a list of things, instead of a single thing? We check for the `__iter__` attribute so that this can cover types that don't have to be known by this module, such as NumPy arrays. Strings, however, should be considered as atomic values to look up, not iterables. The same goes for tuples, sin... |
174,787 | from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
class InvalidVersion(ValueError):
"""
An invalid version was found, users should refer to PEP 440.
"""
class LegacyVersion(_BaseVersion):
def __init__(self, ve... | Parse the given version string and return either a :class:`Version` object or a :class:`LegacyVersion` object depending on if the given version is a valid PEP 440 version or a legacy version. |
174,788 | from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
def _parse_version_parts(s):
def _legacy_cmpkey(version):
# We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch
# greater than or equal to 0. Thi... | null |
174,789 | from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
def _parse_letter_version(letter, number):
if letter:
# We consider there to be an implicit 0 in a pre-release if there is
# not a numeral associated with... | null |
174,790 | from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
_local_version_separators = re.compile(r"[\._-]")
The provided code snippet includes necessary dependencies for implementing the `_parse_local_version` function. Write a Pyth... | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). |
174,791 | from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
class Infinity(object):
def __repr__(self):
return "Infinity"
def __hash__(self):
return hash(repr(self))
def __lt__(self, other):
retur... | null |
174,792 | from __future__ import absolute_import, division, print_function
import re
from .version import InvalidVersion, Version
_canonicalize_regex = re.compile(r"[-_.]+")
def canonicalize_name(name):
# This is taken from PEP 503.
return _canonicalize_regex.sub("-", name).lower() | null |
174,793 | from __future__ import absolute_import, division, print_function
import re
from .version import InvalidVersion, Version
class InvalidVersion(ValueError):
"""
An invalid version was found, users should refer to PEP 440.
"""
class Version(_BaseVersion):
_regex = re.compile(r"^\s*" + VERSI... | This is very similar to Version.__str__, but has one subtle differences with the way it handles the release segment. |
174,794 | from __future__ import absolute_import
import distutils.util
import platform
import re
import sys
import sysconfig
import warnings
class Tag(object):
__slots__ = ["_interpreter", "_abi", "_platform"]
def __init__(self, interpreter, abi, platform):
self._interpreter = interpreter.lower()
self._ab... | null |
174,795 | from __future__ import absolute_import
import distutils.util
import platform
import re
import sys
import sysconfig
import warnings
def _cpython_interpreter(py_version):
# TODO: Is using py_version_nodot for interpreter version critical?
return "cp{major}{minor}".format(major=py_version[0], minor=py_version[1])
... | Returns the sequence of tag triples for the running interpreter. The order of the sequence corresponds to priority order for the interpreter, from most to least important. |
174,796 | from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from setuptools.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from setuptools.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from setuptools.extern.pypar... | null |
174,797 | from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from setuptools.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from setuptools.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from setuptools.extern.pypar... | null |
174,798 | from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from setuptools.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from setuptools.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from setuptools.extern.pypar... | null |
174,799 | from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from setuptools.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from setuptools.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from setuptools.extern.pypar... | null |
174,800 | from __future__ import absolute_import, division, print_function
import sys
The provided code snippet includes necessary dependencies for implementing the `with_metaclass` function. Write a Python function `def with_metaclass(meta, *bases)` to solve the following problem:
Create a base class with a metaclass.
Here is... | Create a base class with a metaclass. |
174,801 | from __future__ import absolute_import, division, print_function
import abc
import functools
import itertools
import re
from ._compat import string_types, with_metaclass
from .version import Version, LegacyVersion, parse
class Version(_BaseVersion):
_regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERB... | null |
174,802 | from __future__ import absolute_import, division, print_function
import abc
import functools
import itertools
import re
from ._compat import string_types, with_metaclass
from .version import Version, LegacyVersion, parse
_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
def _version_split(version):
res... | null |
174,803 | from __future__ import absolute_import, division, print_function
import abc
import functools
import itertools
import re
from ._compat import string_types, with_metaclass
from .version import Version, LegacyVersion, parse
def _pad_version(left, right):
left_split, right_split = [], []
# Get the release segment... | null |
174,804 | from distutils.dep_util import newer_group
The provided code snippet includes necessary dependencies for implementing the `newer_pairwise_group` function. Write a Python function `def newer_pairwise_group(sources_groups, targets)` to solve the following problem:
Walk both arguments in parallel, testing if each source ... | Walk both arguments in parallel, testing if each source group is newer than its corresponding target. Returns a pair of lists (sources_groups, targets) where sources is newer than target, according to the semantics of 'newer_group()'. |
174,805 | import sys
import distutils.filelist
import platform
import types
import functools
from importlib import import_module
import inspect
from setuptools.extern import six
import setuptools
def _patch_distribution_metadata():
"""Patch write_pkg_file and read_pkg_file for higher metadata standards"""
for attr in ('w... | null |
174,806 | import tokenize
import sys
if __name__ == '__main__':
run()
The provided code snippet includes necessary dependencies for implementing the `run` function. Write a Python function `def run()` to solve the following problem:
Run the script in sys.argv[1] as if it had been invoked naturally.
Here is the function:
d... | Run the script in sys.argv[1] as if it had been invoked naturally. |
174,807 | import glob
import os
import subprocess
import sys
from distutils import log
from distutils.errors import DistutilsError
import pkg_resources
from setuptools.command.easy_install import easy_install
from setuptools.extern import six
from setuptools.wheel import Wheel
from .py31compat import TemporaryDirectory
def _fixu... | Fetch an egg needed for building. Use pip/wheel to fetch/build a wheel. |
174,808 | from __future__ import print_function
import os,stat,time
import errno
import sys
def gethashfile(key):
return ("%02x" % abs(hash(key) % 256))[-2:] | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.