_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q25000
ImpalaClient.insert
train
def insert( self, table_name, obj=None, database=None, overwrite=False, partition=None, values=None, validate=True, ): """ Insert into existing table. See ImpalaTable.insert for other parameters. Parameters ---...
python
{ "resource": "" }
q25001
ImpalaClient.drop_table
train
def drop_table(self, table_name, database=None, force=False): """ Drop an Impala table Parameters ---------- table_name : string database : string, default None (optional) force : boolean, default False
python
{ "resource": "" }
q25002
ImpalaClient.cache_table
train
def cache_table(self, table_name, database=None, pool='default'): """ Caches a table in cluster memory in the given pool. Parameters ---------- table_name : string database : string default None (optional) pool : string, default 'default' The name of t...
python
{ "resource": "" }
q25003
ImpalaClient.create_function
train
def create_function(self, func, name=None, database=None): """ Creates a function within Impala Parameters ---------- func : ImpalaUDF or ImpalaUDA Created with wrap_udf or wrap_uda name : string (optional) database : string (optional) """ ...
python
{ "resource": "" }
q25004
ImpalaClient.drop_udf
train
def drop_udf( self, name, input_types=None, database=None, force=False, aggregate=False, ): """ Drops a UDF If only name is given, this will search for the relevant UDF and drop it. To delete an overloaded UDF, give only a name ...
python
{ "resource": "" }
q25005
ImpalaClient.drop_uda
train
def drop_uda(self, name, input_types=None, database=None, force=False): """ Drop aggregate function. See drop_udf for more
python
{ "resource": "" }
q25006
ImpalaClient.list_udfs
train
def list_udfs(self, database=None, like=None): """ Lists all UDFs associated with given database Parameters ---------- database : string like : string for searching (optional) """ if not database: database = self.current_database
python
{ "resource": "" }
q25007
ImpalaClient.list_udas
train
def list_udas(self, database=None, like=None): """ Lists all UDAFs associated with a given database Parameters ---------- database : string like : string for searching (optional) """ if not database: database = self.current_database
python
{ "resource": "" }
q25008
ImpalaClient.exists_udf
train
def exists_udf(self, name, database=None): """ Checks if a given UDF exists within a specified database Parameters ---------- name : string, UDF name database : string, database name Returns
python
{ "resource": "" }
q25009
ImpalaClient.exists_uda
train
def exists_uda(self, name, database=None): """ Checks if a given UDAF exists within a specified database Parameters ---------- name : string, UDAF name database : string, database name Returns
python
{ "resource": "" }
q25010
ImpalaClient.compute_stats
train
def compute_stats(self, name, database=None, incremental=False): """ Issue COMPUTE STATS command for a given table Parameters ---------- name : string Can be fully qualified (with database name) database : string, optional incremental : boolean, default...
python
{ "resource": "" }
q25011
ImpalaClient.invalidate_metadata
train
def invalidate_metadata(self, name=None, database=None): """ Issue INVALIDATE METADATA command, optionally only applying to a particular table. See Impala documentation. Parameters ---------- name : string, optional Table name. Can be fully qualified
python
{ "resource": "" }
q25012
ImpalaClient.refresh
train
def refresh(self, name, database=None): """ Reload HDFS block location metadata for a table, for example after ingesting data as part of an ETL pipeline. Related to INVALIDATE METADATA. See Impala documentation for more. Parameters ---------- name : string
python
{ "resource": "" }
q25013
ImpalaClient.describe_formatted
train
def describe_formatted(self, name, database=None): """ Retrieve results of DESCRIBE FORMATTED command. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with database) database : string, optional ...
python
{ "resource": "" }
q25014
ImpalaClient.show_files
train
def show_files(self, name, database=None): """ Retrieve results of SHOW FILES command for a table. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with
python
{ "resource": "" }
q25015
ImpalaClient.table_stats
train
def table_stats(self, name, database=None): """ Return results of SHOW TABLE STATS for indicated table. See also ImpalaTable.stats
python
{ "resource": "" }
q25016
ImpalaClient.column_stats
train
def column_stats(self, name, database=None): """ Return results of SHOW COLUMN STATS for indicated table. See also ImpalaTable.column_stats """ stmt = self._table_command(
python
{ "resource": "" }
q25017
GroupedTableExpr.projection
train
def projection(self, exprs): """ Like mutate, but do not include existing table columns """ w = self._get_window() windowed_exprs = [] exprs = self.table._resolve(exprs) for expr in exprs:
python
{ "resource": "" }
q25018
GroupedTableExpr.over
train
def over(self, window): """ Add a window clause to be applied to downstream analytic expressions """ return GroupedTableExpr( self.table, self.by,
python
{ "resource": "" }
q25019
bucket
train
def bucket( arg, buckets, closed='left', close_extreme=True, include_under=False, include_over=False, ): """ Compute a discrete binning of a numeric array Parameters ---------- arg : numeric array expression buckets : list closed : {'left', 'right'}, default 'left' ...
python
{ "resource": "" }
q25020
histogram
train
def histogram( arg, nbins=None, binwidth=None, base=None, closed='left', aux_hash=None ): """ Compute a histogram with fixed width bins Parameters ---------- arg : numeric array expression nbins : int, default None If supplied, will be used to compute the binwidth binwidth : numbe...
python
{ "resource": "" }
q25021
category_label
train
def category_label(arg, labels, nulls=None): """ Format a known number of categories as strings Parameters ---------- labels : list of string nulls : string, optional How to label any null values among the categories Returns -------
python
{ "resource": "" }
q25022
isolated
train
def isolated(): """Returns a chroot for third_party isolated from the ``sys.path``. PEX will typically be installed in site-packages flat alongside many other distributions; as such, adding the location of the pex distribution to the ``sys.path`` will typically expose many other distributions. An isolated chro...
python
{ "resource": "" }
q25023
expose
train
def expose(dists): """Exposes vendored code in isolated chroots. Any vendored distributions listed in ``dists`` will be unpacked to individual chroots for addition to the ``sys.path``; ie: ``expose(['setuptools', 'wheel'])`` will unpack these vendored distributions and yield the two chroot paths they were unpa...
python
{ "resource": "" }
q25024
VendorImporter.install_vendored
train
def install_vendored(cls, prefix, root=None, expose=None): """Install an importer for all vendored code with the given import prefix. All distributions listed in ``expose`` will also be made available for import in direct, un-prefixed form. :param str prefix: The import prefix the installed importer w...
python
{ "resource": "" }
q25025
VendorImporter.install
train
def install(cls, uninstallable, prefix, path_items, root=None, warning=None): """Install an importer for modules found under ``path_items`` at the given import ``prefix``. :param bool uninstallable: ``True`` if the installed importer should be uninstalled and any imports it perfo...
python
{ "resource": "" }
q25026
VendorImporter.uninstall
train
def uninstall(self): """Uninstall this importer if possible and un-import any modules imported by it.""" if not self._uninstallable: _tracer().log('Not uninstalling {}'.format(self), V=9) return if self in sys.meta_path: sys.meta_path.remove(self) maybe_exposed = frozenset(os.path.j...
python
{ "resource": "" }
q25027
bdist_wheel.wheel_dist_name
train
def wheel_dist_name(self): """Return distribution full name with - replaced with _""" components = (safer_name(self.distribution.get_name()),
python
{ "resource": "" }
q25028
bdist_wheel.egg2dist
train
def egg2dist(self, egginfo_path, distinfo_path): """Convert an .egg-info directory into a .dist-info directory""" def adios(p): """Appropriately delete directory, file or link.""" if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p): shutil.rmtree(p...
python
{ "resource": "" }
q25029
sign
train
def sign(wheelfile, replace=False, get_keyring=get_keyring): """Sign a wheel""" warn_signatures() WheelKeys, keyring = get_keyring() ed25519ll = signatures.get_ed25519ll() wf = WheelFile(wheelfile, append=True) wk = WheelKeys().load() name = wf.parsed_filename.group('name') sign_with ...
python
{ "resource": "" }
q25030
verify
train
def verify(wheelfile): """Verify a wheel. The signature will be verified for internal consistency ONLY and printed. Wheel's own unpack/install commands verify the manifest against the signature and file contents. """ warn_signatures() wf = WheelFile(wheelfile) sig_name = wf.distinfo_nam...
python
{ "resource": "" }
q25031
install_scripts
train
def install_scripts(distributions): """ Regenerate the entry_points console_scripts for the named distribution. """ try: if "__PEX_UNVENDORED__" in __import__("os").environ: from setuptools.command import easy_install # vendor:skip else: from pex.third_party.setuptoo...
python
{ "resource": "" }
q25032
Variables.from_rc
train
def from_rc(cls, rc=None): """Read pex runtime configuration variables from a pexrc file. :param rc: an absolute path to a pexrc file. :return: A dict of key value pairs found in processed pexrc files. :rtype: dict """ ret_vars = {} rc_locations = ['/etc/pexrc', '~/.pexr...
python
{ "resource": "" }
q25033
Variables.patch
train
def patch(self, **kw): """Update the environment for the duration of a context.""" old_environ = self._environ self._environ = self._environ.copy()
python
{ "resource": "" }
q25034
iter_pth_paths
train
def iter_pth_paths(filename): """Given a .pth file, extract and yield all inner paths without honoring imports. This shadows python's site.py behavior, which is invoked at interpreter startup.""" try: f = open(filename, 'rU') # noqa except IOError: return dirname = os.path.dirname(filename) known_...
python
{ "resource": "" }
q25035
merge_split
train
def merge_split(*paths): """Merge paths into a single path delimited by colons and split on colons to return a list of paths. :param paths: a variable length list of path strings :return: a list of paths from the merged path
python
{ "resource": "" }
q25036
DistributionHelper.walk_data
train
def walk_data(cls, dist, path='/'): """Yields filename, stream for files identified as data in the distribution""" for rel_fn in filter(None, dist.resource_listdir(path)): full_fn = os.path.join(path, rel_fn) if dist.resource_isdir(full_fn):
python
{ "resource": "" }
q25037
DistributionHelper.zipsafe
train
def zipsafe(dist): """Returns whether or not we determine a distribution is zip-safe.""" # zip-safety is only an attribute of eggs. wheels are considered never # zip safe per implications of PEP 427. if hasattr(dist, 'egg_info') and dist.egg_info.endswith('EGG-INFO'):
python
{ "resource": "" }
q25038
DistributionHelper.access_zipped_assets
train
def access_zipped_assets(cls, static_module_name, static_path, dir_location=None): """ Create a copy of static resource files as we can't serve them from within the pex file. :param static_module_name: Module name containing module to cache in a tempdir :type static_module_name: string, for example 'tw...
python
{ "resource": "" }
q25039
DistributionHelper.distribution_from_path
train
def distribution_from_path(cls, path, name=None): """Return a distribution from a path. If name is provided, find the distribution. If none is found matching the name, return None. If name is not provided and there is unambiguously a single distribution, return that distribution otherwise None. "...
python
{ "resource": "" }
q25040
CacheHelper.update_hash
train
def update_hash(cls, filelike, digest): """Update the digest of a single file in a memory-efficient manner."""
python
{ "resource": "" }
q25041
CacheHelper.hash
train
def hash(cls, path, digest=None, hasher=sha1): """Return the digest of a single file in a memory-efficient manner.""" if digest is None: digest = hasher()
python
{ "resource": "" }
q25042
CacheHelper.zip_hash
train
def zip_hash(cls, zf, prefix=''): """Return the hash of the contents of a zipfile, comparable with a cls.dir_hash.""" prefix_length = len(prefix) names = sorted(name[prefix_length:] for name in zf.namelist() if name.startswith(prefix) and not name.endswith('.pyc') and
python
{ "resource": "" }
q25043
CacheHelper.pex_hash
train
def pex_hash(cls, d): """Return a reproducible hash of the contents of a directory.""" names = sorted(f for f in cls._iter_files(d) if not (f.endswith('.pyc') or f.startswith('.'))) def stream_factory(name): return
python
{ "resource": "" }
q25044
CacheHelper.cache_distribution
train
def cache_distribution(cls, zf, source, target_dir): """Possibly cache an egg from within a zipfile into target_cache. Given a zipfile handle and a filename corresponding to an egg distribution within that zip, maybe write to the target cache and return a Distribution.""" dependency_basename = os...
python
{ "resource": "" }
q25045
Package.register
train
def register(cls, package_type): """Register a concrete implementation of a Package to be recognized by
python
{ "resource": "" }
q25046
Package.from_href
train
def from_href(cls, href, **kw): """Convert from a url to Package. :param href: The url to parse :type href: string :returns: A Package object if a valid concrete implementation exists, otherwise None. """ package = cls._HREF_TO_PACKAGE_CACHE.get(href) if package is not None: return pa...
python
{ "resource": "" }
q25047
Package.satisfies
train
def satisfies(self, requirement, allow_prereleases=None): """Determine whether this package matches the requirement. :param requirement: The requirement to compare this Package against :type requirement: string or :class:`pkg_resources.Requirement` :param Optional[bool] allow_prereleases: Whether to al...
python
{ "resource": "" }
q25048
_add_finder
train
def _add_finder(importer, finder): """Register a new pkg_resources path finder that does not replace the existing finder.""" existing_finder = _get_finder(importer) if not existing_finder:
python
{ "resource": "" }
q25049
_remove_finder
train
def _remove_finder(importer, finder): """Remove an existing finder from pkg_resources.""" existing_finder = _get_finder(importer) if not existing_finder: return if isinstance(existing_finder, ChainedFinder): try: existing_finder.finders.remove(finder)
python
{ "resource": "" }
q25050
register_finders
train
def register_finders(): """Register finders necessary for PEX to function properly.""" # If the previous finder is set, then we've already monkeypatched, so skip. global __PREVIOUS_FINDER if __PREVIOUS_FINDER: return # save previous finder so that it can be restored previous_finder = _get_finder(zipim...
python
{ "resource": "" }
q25051
unregister_finders
train
def unregister_finders(): """Unregister finders necessary for PEX to function properly.""" global __PREVIOUS_FINDER if not __PREVIOUS_FINDER: return pkg_resources.register_finder(zipimport.zipimporter, __PREVIOUS_FINDER) _remove_finder(pkgutil.ImpImporter, find_wheels_on_path) if
python
{ "resource": "" }
q25052
patched_packing_env
train
def patched_packing_env(env): """Monkey patch packaging.markers.default_environment""" old_env = pkg_resources.packaging.markers.default_environment new_env = lambda: env pkg_resources._vendor.packaging.markers.default_environment
python
{ "resource": "" }
q25053
platform_to_tags
train
def platform_to_tags(platform, interpreter): """Splits a "platform" like linux_x86_64-36-cp-cp36m into its components. If a simple platform without hyphens is specified, we will fall back to using the current interpreter's tags. """ if platform.count('-') >= 3: tags =
python
{ "resource": "" }
q25054
_ResolvableSet.merge
train
def merge(self, resolvable, packages, parent=None): """Add a resolvable and its resolved packages.""" self.__tuples.append(_ResolvedPackages(resolvable, OrderedSet(packages),
python
{ "resource": "" }
q25055
_ResolvableSet.get
train
def get(self, name): """Get the set of compatible packages given a resolvable name.""" resolvable, packages, parent, constraint_only = self._collapse().get(
python
{ "resource": "" }
q25056
_ResolvableSet.replace_built
train
def replace_built(self, built_packages): """Return a copy of this resolvable set but with built packages. :param dict built_packages: A mapping from a resolved package to its locally built package. :returns: A new resolvable set with built package replacements made.
python
{ "resource": "" }
q25057
get_ed25519ll
train
def get_ed25519ll(): """Lazy import-and-test of ed25519 module""" global ed25519ll if not ed25519ll: try: import ed25519ll
python
{ "resource": "" }
q25058
sign
train
def sign(payload, keypair): """Return a JWS-JS format signature given a JSON-serializable payload and an Ed25519 keypair.""" get_ed25519ll() # header = { "alg": ALG, "jwk": { "kty": ALG, # alg -> kty in jwk-08. "vk": native(url...
python
{ "resource": "" }
q25059
PEXEnvironment.load_internal_cache
train
def load_internal_cache(cls, pex, pex_info): """Possibly cache out the internal cache.""" internal_cache = os.path.join(pex, pex_info.internal_cache) with TRACER.timed('Searching dependency cache: %s' % internal_cache, V=2): if os.path.isdir(pex):
python
{ "resource": "" }
q25060
Context.read
train
def read(self, link): """Return the binary content associated with the link. :param link: The :class:`Link` to read. """ with
python
{ "resource": "" }
q25061
Context.fetch
train
def fetch(self, link, into=None): """Fetch the binary content associated with the link and write to a file. :param link: The :class:`Link` to fetch. :keyword into: If specified, write into the directory ``into``. If ``None``, creates a new temporary directory that persists for the duration of the in...
python
{ "resource": "" }
q25062
StreamFilelike.detect_algorithm
train
def detect_algorithm(cls, link): """Detect the hashing algorithm from the fragment in the link, if any.""" if any(link.fragment.startswith('%s=' % algorithm) for algorithm
python
{ "resource": "" }
q25063
pkginfo_to_metadata
train
def pkginfo_to_metadata(egg_info_path, pkginfo_path): """ Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format """ pkg_info = read_pkg_info(pkginfo_path) pkg_info.replace_header('Metadata-Version', '2.1') requires_path = os.path.join(egg_info_path, 'requires.txt') if os.path....
python
{ "resource": "" }
q25064
WheelKeys.trust
train
def trust(self, scope, vk): """Start trusting a particular key for given scope."""
python
{ "resource": "" }
q25065
WheelKeys.untrust
train
def untrust(self, scope, vk): """Stop trusting a particular key for given scope."""
python
{ "resource": "" }
q25066
PEXBuilder.clone
train
def clone(self, into=None): """Clone this PEX environment into a new PEXBuilder. :keyword into: (optional) An optional destination directory to clone this PEXBuilder into. If not specified, a temporary directory will be created. Clones PEXBuilder into a new location. This is useful if the PEXBuild...
python
{ "resource": "" }
q25067
PEXBuilder.add_source
train
def add_source(self, filename, env_filename): """Add a source to the PEX environment. :param filename: The source filename to add to the PEX; None to create an empty file
python
{ "resource": "" }
q25068
PEXBuilder.add_resource
train
def add_resource(self, filename, env_filename): """Add a resource to the PEX environment. :param filename: The source filename to add to the PEX; None to create an empty file
python
{ "resource": "" }
q25069
PEXBuilder.set_executable
train
def set_executable(self, filename, env_filename=None): """Set the executable for this environment. :param filename: The file that should be executed within the PEX environment when the PEX is invoked. :keyword env_filename: (optional) The name that the executable file should be stored as within ...
python
{ "resource": "" }
q25070
PEXBuilder.set_script
train
def set_script(self, script): """Set the entry point of this PEX environment based upon a distribution script. :param script: The script name as defined either by a console script or ordinary script within the setup.py of one of the distributions added to the PEX. :raises: :class:`PEXBuilder.InvalidE...
python
{ "resource": "" }
q25071
PEXBuilder._get_installer_paths
train
def _get_installer_paths(self, base): """Set up an overrides dict for WheelFile.install that installs the contents of a wheel into its own base in
python
{ "resource": "" }
q25072
PEXBuilder.add_dist_location
train
def add_dist_location(self, dist, name=None): """Add a distribution by its location on disk. :param dist: The path to the distribution to add. :keyword name: (optional) The name of the distribution, should the dist directory alone be ambiguous. Packages contained within site-packages directories may...
python
{ "resource": "" }
q25073
PEXBuilder.freeze
train
def freeze(self, bytecode_compile=True): """Freeze the PEX. :param bytecode_compile: If True, precompile .py files into .pyc files when freezing code. Freezing the PEX writes all the necessary metadata and environment bootstrapping code.
python
{ "resource": "" }
q25074
PEXBuilder.build
train
def build(self, filename, bytecode_compile=True): """Package the PEX into a zipfile. :param filename: The filename where the PEX should be stored. :param bytecode_compile: If True, precompile .py files into .pyc files. If the PEXBuilder is not yet frozen, it will be frozen by ``build``. This renders ...
python
{ "resource": "" }
q25075
resolvables_from_iterable
train
def resolvables_from_iterable(iterable, builder, interpreter=None): """Given an iterable of resolvable-like objects, return list of Resolvable objects. :param iterable: An iterable of :class:`Resolvable`, :class:`Requirement`, :class:`Package`, or `str` to map into an iterable of :class:`Resolvable` objects....
python
{ "resource": "" }
q25076
matched_interpreters
train
def matched_interpreters(interpreters, constraints): """Given some filters, yield any interpreter that matches at least one of them. :param interpreters: a list of PythonInterpreter objects for filtering :param constraints: A sequence of strings that constrain the interpreter compatibility for this pex. Each...
python
{ "resource": "" }
q25077
parse_version
train
def parse_version(version): """Use parse_version from pkg_resources or distutils as available.""" global parse_version try: if "__PEX_UNVENDORED__" in __import__("os").environ: from pkg_resources import parse_version # vendor:skip else:
python
{ "resource": "" }
q25078
WheelFile.compatibility_rank
train
def compatibility_rank(self, supported): """Rank the wheel against the supported tags. Smaller ranks are more compatible! :param supported: A list of compatibility tags that the current Python implemenation can run. """ preferences = [] for tag in self.compat...
python
{ "resource": "" }
q25079
PythonIdentity.matches
train
def matches(self, requirement): """Given a Requirement, check if this interpreter matches.""" try: requirement = self.parse_requirement(requirement, self._interpreter) except ValueError
python
{ "resource": "" }
q25080
PythonIdentity.pkg_resources_env
train
def pkg_resources_env(self, platform_str): """Returns a dict that can be used in place of packaging.default_environment.""" os_name = '' platform_machine = '' platform_release = '' platform_system = '' platform_version = '' sys_platform = '' if 'win' in platform_str: os_name = 'nt...
python
{ "resource": "" }
q25081
PythonInterpreter.from_binary
train
def from_binary(cls, binary): """Create an interpreter from the given `binary`. :param str binary: The path to the python interpreter binary. :return: an interpreter created from the given `binary` with only the specified extras. :rtype: :class:`PythonInterpreter` """ if binary not...
python
{ "resource": "" }
q25082
PythonInterpreter.find
train
def find(cls, paths): """ Given a list of files or directories, try to detect python interpreters amongst them. Returns a list of PythonInterpreter objects. """ pythons = [] for path in paths: for fn in cls.expand_path(path): basefile = os.path.basename(fn) if cls._matc...
python
{ "resource": "" }
q25083
Executor.execute
train
def execute(cls, cmd, stdin_payload=None, **kwargs): """Execute a command via subprocess.Popen and returns the stdio. :param string|list cmd: A list or string representing the command to run. :param string stdin_payload: A string representing the stdin payload, if any, to send. :param **kwargs: Additio...
python
{ "resource": "" }
q25084
ConfigHandler.parse
train
def parse(self): """Parses configuration file items from one or more related sections. """ for section_name, section_options in self.sections.items(): method_postfix = '' if section_name: # [section.option] variant method_postfix = '_%s' % secti...
python
{ "resource": "" }
q25085
_get_supported_for_any_abi
train
def _get_supported_for_any_abi(version=None, platform=None, impl=None, force_manylinux=False): """Generates supported tags for unspecified ABI types to support more intuitive cross-platform resolution.""" unique_tags = { tag for abi in _gen_all_abis(impl, version) for tag in _get_supported(version=vers...
python
{ "resource": "" }
q25086
Platform.supported_tags
train
def supported_tags(self, interpreter=None, force_manylinux=True): """Returns a list of supported PEP425 tags for the current platform.""" if interpreter and not self.is_extended: # N.B. If we don't get an extended platform specifier, we generate # all possible ABI permutations to mimic earlier pex v...
python
{ "resource": "" }
q25087
SourceTranslator.translate
train
def translate(self, package, into=None): """From a SourcePackage, translate to a binary distribution.""" if not isinstance(package, SourcePackage): return None if not package.local: raise ValueError('SourceTranslator cannot translate remote packages.') installer = None version = self._i...
python
{ "resource": "" }
q25088
BinaryTranslator.translate
train
def translate(self, package, into=None): """From a binary package, translate to a local binary distribution.""" if not package.local: raise ValueError('BinaryTranslator cannot translate remote packages.') if not isinstance(package, self._package_type): return None if not package.compatible(s...
python
{ "resource": "" }
q25089
setup_interpreter
train
def setup_interpreter(distributions, interpreter=None): """Return an interpreter configured with vendored distributions as extras. Any distributions that are present in the vendored set will be added to the interpreter as extras. :param distributions: The names of distributions to setup the interpreter with. ...
python
{ "resource": "" }
q25090
vendor_runtime
train
def vendor_runtime(chroot, dest_basedir, label, root_module_names): """Includes portions of vendored distributions in a chroot. The portion to include is selected by root module name. If the module is a file, just it is included. If the module represents a package, the package and all its sub-packages are added ...
python
{ "resource": "" }
q25091
VendorSpec.create_packages
train
def create_packages(self): """Create missing packages joining the vendor root to the base of the vendored distribution. For example, given a root at ``/home/jake/dev/pantsbuild/pex`` and a vendored distribution at ``pex/vendor/_vendored/requests`` this method would create the following package files:: ...
python
{ "resource": "" }
q25092
PageParser.rel_links
train
def rel_links(cls, page): """return rel= links that should be scraped, skipping obviously data links.""" for match in cls.REL_RE.finditer(page): href, rel = match.group(0), match.group(1) if rel not in cls.REL_TYPES: continue href_match = cls.HREF_RE.search(href) if href_match: ...
python
{ "resource": "" }
q25093
PageParser.links
train
def links(cls, page): """return all links on a page, including potentially rel= links.""" for match in
python
{ "resource": "" }
q25094
archive_wheelfile
train
def archive_wheelfile(base_name, base_dir): """Archive all files under `base_dir` in a whl file and name it like `base_name`. """ olddir = os.path.abspath(os.curdir) base_name = os.path.abspath(base_name)
python
{ "resource": "" }
q25095
make_wheelfile_inner
train
def make_wheelfile_inner(base_name, base_dir='.'): """Create a whl file from all the files under 'base_dir'. Places .dist-info at the end of the archive.""" zip_filename = base_name + ".whl" log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) # Some applications need reproduc...
python
{ "resource": "" }
q25096
open_with_auth
train
def open_with_auth(url, opener=urllib.request.urlopen): """Open a urllib2 request, handling HTTP authentication""" scheme, netloc, path, params, query, frag = urllib.parse.urlparse(url) # Double scheme does not raise on Mac OS X as revealed by a # failing test. We would expect "nonnumeric port". Refs ...
python
{ "resource": "" }
q25097
open_zip
train
def open_zip(path, *args, **kwargs): """A contextmanager for zip files. Passes through positional
python
{ "resource": "" }
q25098
safe_mkdir
train
def safe_mkdir(directory, clean=False): """Safely create a directory. Ensures a directory is present. If it's not there, it is created. If it is, it's a no-op. If clean is True, ensures the directory is empty.
python
{ "resource": "" }
q25099
safe_open
train
def safe_open(filename, *args, **kwargs): """Safely open a file. ``safe_open`` ensures that the directory components
python
{ "resource": "" }