_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q27200 | Config.load_file_contents | train | def load_file_contents(cls, file_contents, seed_values=None):
"""Loads config from the given string payloads.
A handful of seed values will be set to act as if specified in the loaded config file's DEFAULT
section, and be available for use in substitutions. The caller may override some of these
seed v... | python | {
"resource": ""
} |
q27201 | Config.load | train | def load(cls, config_paths, seed_values=None):
"""Loads config from the given paths.
A handful of seed values will be set to act as if specified in the loaded config file's DEFAULT
section, and be available for use in substitutions. The caller may override some of these
seed values.
:param list c... | python | {
"resource": ""
} |
q27202 | dlog | train | def dlog(msg, log_path=DEFAULT_LOG_PATH):
"""A handy log utility for debugging multi-process, multi-threaded activities."""
with open(log_path, 'a') as f:
| python | {
"resource": ""
} |
q27203 | TaskBase.get_passthru_args | train | def get_passthru_args(self):
"""Returns the passthru args for this task, if it supports them.
:API: public
"""
if not self.supports_passthru_args():
raise TaskError('{0} Does | python | {
"resource": ""
} |
q27204 | TaskBase.get_targets | train | def get_targets(self, predicate=None):
"""Returns the candidate targets this task should act on.
This method is a convenience for processing optional transitivity. Tasks may bypass it
and make their own decisions on which targets to act on.
NOTE: This method was introduced in 2018, so at the time of w... | python | {
"resource": ""
} |
q27205 | TaskBase.versioned_workdir | train | def versioned_workdir(self):
"""The Task.workdir suffixed with a fingerprint of the Task implementation version.
When choosing whether to store values directly in `self.workdir` or below it in
the directory returned by this property, you should generally prefer this value.
:API: public
"""
| python | {
"resource": ""
} |
q27206 | TaskBase.fingerprint | train | def fingerprint(self):
"""Returns a fingerprint for the identity of the task.
A task fingerprint is composed of the options the task is currently running under.
Useful for invalidating unchanging targets being executed beneath changing task
options that affect outputted artifacts.
A task's fingerp... | python | {
"resource": ""
} |
q27207 | TaskBase.invalidated | train | def invalidated(self,
targets,
invalidate_dependents=False,
silent=False,
fingerprint_strategy=None,
topological_order=False):
"""Checks targets for invalidation, first checking the artifact cache.
Subclasses call this to... | python | {
"resource": ""
} |
q27208 | TaskBase.do_check_artifact_cache | train | def do_check_artifact_cache(self, vts, post_process_cached_vts=None):
"""Checks the artifact cache for the specified list of VersionedTargetSets.
Returns a tuple (cached, uncached, uncached_causes) of VersionedTargets that were
satisfied/unsatisfied from the cache.
"""
if not vts:
return [], ... | python | {
"resource": ""
} |
q27209 | TaskBase.update_artifact_cache | train | def update_artifact_cache(self, vts_artifactfiles_pairs):
"""Write to the artifact cache, if we're configured to.
vts_artifactfiles_pairs - a list of pairs (vts, artifactfiles) where
- vts is single VersionedTargetSet.
- artifactfiles is a list of absolute paths to artifacts for the VersionedTarget... | python | {
"resource": ""
} |
q27210 | TaskBase._get_update_artifact_cache_work | train | def _get_update_artifact_cache_work(self, vts_artifactfiles_pairs):
"""Create a Work instance to update an artifact cache, if we're configured to.
vts_artifactfiles_pairs - a list of pairs (vts, artifactfiles) where
- vts is single VersionedTargetSet.
- artifactfiles is a list of paths to artifacts... | python | {
"resource": ""
} |
q27211 | TaskBase.require_single_root_target | train | def require_single_root_target(self):
"""If a single target was specified on the cmd line, returns that target.
Otherwise throws TaskError.
:API: public
"""
target_roots = self.context.target_roots
| python | {
"resource": ""
} |
q27212 | TaskBase.determine_target_roots | train | def determine_target_roots(self, goal_name):
"""Helper for tasks that scan for default target roots.
:param string goal_name: The goal name to use for any warning emissions.
"""
if not self.context.target_roots:
| python | {
"resource": ""
} |
q27213 | create_archiver | train | def create_archiver(typename):
"""Returns Archivers in common configurations.
:API: public
The typename must correspond to one of the following:
'tar' Returns a tar archiver that applies no compression and emits .tar files.
'tgz' Returns a tar archiver that applies gzip compression and emits .tar.gz fil... | python | {
"resource": ""
} |
q27214 | archiver_for_path | train | def archiver_for_path(path_name):
"""Returns an Archiver for the given path name.
:API: public
:param string path_name: The path name of the archive - need not exist.
:raises: :class:`ValueError` If the path name does not uniquely identify a supported archive type.
"""
if path_name.endswith('.tar.gz'):
... | python | {
"resource": ""
} |
q27215 | Archiver.extract | train | def extract(self, path, outdir, concurrency_safe=False, **kwargs):
"""Extracts an archive's contents to the specified outdir with an optional filter.
Keyword arguments are forwarded to the instance's self._extract() method.
:API: public
:param string path: path to the zipfile to extract from
:par... | python | {
"resource": ""
} |
q27216 | XZCompressedTarArchiver._invoke_xz | train | def _invoke_xz(self, xz_input_file):
"""Run the xz command and yield a file object for its stdout.
This allows streaming the decompressed tar archive directly into a tar decompression stream,
which is significantly faster in practice than making a temporary file.
"""
# TODO: --threads=0 is supposed... | python | {
"resource": ""
} |
q27217 | ZipArchiver._extract | train | def _extract(self, path, outdir, filter_func=None):
"""Extract from a zip file, with an optional filter.
:param function filter_func: optional filter with the filename as the parameter. Returns True
if the file should be extracted."""
with open_zip(path) as archive_file:
... | python | {
"resource": ""
} |
q27218 | JvmResolverBase.add_directory_digests_for_jars | train | def add_directory_digests_for_jars(self, targets_and_jars):
"""For each target, get DirectoryDigests for its jars and return them zipped with the jars.
:param targets_and_jars: List of tuples of the form (Target, [pants.java.jar.jar_dependency_utils.ResolveJar])
:return: list[tuple[(Target, list[pants.java... | python | {
"resource": ""
} |
q27219 | RunInfo.add_basic_info | train | def add_basic_info(self, run_id, timestamp):
"""Adds basic build info."""
datetime = time.strftime('%A %b %d, %Y %H:%M:%S', time.localtime(timestamp))
user = getpass.getuser()
machine = socket.gethostname()
buildroot = get_buildroot()
# TODO: Get rid of the redundant 'path' key once everyone | python | {
"resource": ""
} |
q27220 | RunInfo.add_scm_info | train | def add_scm_info(self):
"""Adds SCM-related info."""
scm = get_scm()
if scm:
revision = scm.commit_id
branch = scm.branch_name or revision
else:
| python | {
"resource": ""
} |
q27221 | PyThriftNamespaceClashCheck._get_python_thrift_library_sources | train | def _get_python_thrift_library_sources(self, py_thrift_targets):
"""Get file contents for python thrift library targets."""
target_snapshots = OrderedDict(
(t, t.sources_snapshot(scheduler=self.context._scheduler).directory_digest)
for t in py_thrift_targets)
filescontent_by_target = OrderedDict... | python | {
"resource": ""
} |
q27222 | JaxbGen._guess_package | train | def _guess_package(self, path):
"""Used in execute_codegen to actually invoke the compiler with the proper arguments, and in
_sources_to_be_generated to declare what the generated files will be.
"""
supported_prefixes = ('com', 'org', 'net',)
package = ''
slash = path.rfind(os.path.sep)
pref... | python | {
"resource": ""
} |
q27223 | Digest.load | train | def load(cls, directory):
"""Load a Digest from a `.digest` file adjacent to the given directory.
:return: A Digest, or None if the Digest did not exist.
"""
read_file = maybe_read_file(cls._path(directory))
| python | {
"resource": ""
} |
q27224 | Digest.dump | train | def dump(self, directory):
"""Dump this Digest object adjacent to the given directory.""" | python | {
"resource": ""
} |
q27225 | SourcesField.snapshot | train | def snapshot(self, scheduler=None):
"""
Returns a Snapshot containing the sources, relative to the build root.
This API is experimental, and subject to change.
"""
if isinstance(self._sources, EagerFilesetWithSpec): | python | {
"resource": ""
} |
q27226 | combine_hashes | train | def combine_hashes(hashes):
"""A simple helper function to combine other hashes. Sorts the hashes before rolling them in."""
hasher = sha1()
for h in sorted(hashes):
h = | python | {
"resource": ""
} |
q27227 | PayloadField.fingerprint | train | def fingerprint(self):
"""A memoized sha1 hexdigest hashing the contents of this PayloadField
The fingerprint returns either a string or None. If the return is None, consumers of the
fingerprint may choose to elide this PayloadField from their combined hash computation. | python | {
"resource": ""
} |
q27228 | parse_failed_targets | train | def parse_failed_targets(test_registry, junit_xml_path, error_handler):
"""Parses junit xml reports and maps targets to the set of individual tests that failed.
Targets with no failed tests are omitted from the returned mapping and failed tests with no
identifiable owning target are keyed under `None`.
:param... | python | {
"resource": ""
} |
q27229 | InjectablesMixin.injectables_specs_for_key | train | def injectables_specs_for_key(self, key):
"""Given a key, yield all relevant injectable spec addresses.
:API: public
"""
mapping = self.injectables_spec_mapping
if key not in mapping:
| python | {
"resource": ""
} |
q27230 | InjectablesMixin.injectables_spec_for_key | train | def injectables_spec_for_key(self, key):
"""Given a key, yield a singular spec representing that key.
:API: public
"""
specs = self.injectables_specs_for_key(key)
specs_len = len(specs)
if specs_len == 0:
return None
if specs_len != 1:
| python | {
"resource": ""
} |
q27231 | JvmDependencyCheck._skip | train | def _skip(options):
"""Return true if the task should be entirely skipped, and thus have no product requirements."""
values = | python | {
"resource": ""
} |
q27232 | JvmDependencyCheck.check | train | def check(self, src_tgt, actual_deps):
"""Check for missing deps.
See docstring for _compute_missing_deps for details.
"""
if self._check_missing_direct_deps or self._check_unnecessary_deps:
missing_file_deps, missing_direct_tgt_deps = \
self._compute_missing_deps(src_tgt, actual_deps)
... | python | {
"resource": ""
} |
q27233 | JvmDependencyCheck._compute_missing_deps | train | def _compute_missing_deps(self, src_tgt, actual_deps):
"""Computes deps that are used by the compiler but not specified in a BUILD file.
These deps are bugs waiting to happen: the code may happen to compile because the dep was
brought in some other way (e.g., by some other root target), but that is obvious... | python | {
"resource": ""
} |
q27234 | JvmDependencyCheck._compute_unnecessary_deps | train | def _compute_unnecessary_deps(self, target, actual_deps):
"""Computes unused deps for the given Target.
:returns: A dict of directly declared but unused targets, to sets of suggested replacements.
"""
# Flatten the product deps of this target.
product_deps = set()
for dep_entries in actual_deps... | python | {
"resource": ""
} |
q27235 | find_includes | train | def find_includes(basedirs, source, log=None):
"""Finds all thrift files included by the given thrift source.
:basedirs: A set of thrift source file base directories to look for includes in.
:source: The thrift source file to scan for includes.
:log: An optional logger
"""
all_basedirs = [os.path.dirname(... | python | {
"resource": ""
} |
q27236 | find_root_thrifts | train | def find_root_thrifts(basedirs, sources, log=None):
"""Finds the root thrift files in the graph formed by sources and their recursive includes.
:basedirs: A set of thrift source file base directories to look for includes in.
:sources: Seed thrift files to examine.
:log: | python | {
"resource": ""
} |
q27237 | calculate_include_paths | train | def calculate_include_paths(targets, is_thrift_target):
"""Calculates the set of import paths for the given targets.
:targets: The targets to examine.
:is_thrift_target: A predicate to pick out thrift targets for consideration in the analysis.
:returns: Include basedirs for the target.
| python | {
"resource": ""
} |
q27238 | Distribution.home | train | def home(self):
"""Returns the distribution JAVA_HOME."""
if not self._home:
home = self._get_system_properties(self.java)['java.home']
# The `jre/bin/java` executable in a JDK distribution will report `java.home` as the jre dir,
# so we check for this and re-locate to the containing jdk dir w... | python | {
"resource": ""
} |
q27239 | Distribution.binary | train | def binary(self, name):
"""Returns the path to the command of the given name for this distribution.
For example: ::
>>> d = Distribution()
>>> jar = d.binary('jar')
>>> jar
'/usr/bin/jar'
>>>
If this distribution has no valid command of the given name raises Distri... | python | {
"resource": ""
} |
q27240 | Distribution.validate | train | def validate(self):
"""Validates this distribution against its configured constraints.
Raises Distribution.Error if this distribution is not valid according to the configured
constraints.
"""
if self._validated_binaries:
return
with self._valid_executable('java') as java:
if self._... | python | {
"resource": ""
} |
q27241 | _Locator._scan_constraint_match | train | def _scan_constraint_match(self, minimum_version, maximum_version, jdk):
"""Finds a cached version matching the specified constraints
:param Revision minimum_version: minimum jvm version to look for (eg, 1.7).
:param Revision maximum_version: maximum jvm version to look for (eg, 1.7.9999).
:param bool ... | python | {
"resource": ""
} |
q27242 | _Locator._locate | train | def _locate(self, minimum_version=None, maximum_version=None, jdk=False):
"""Finds a java distribution that meets any given constraints and returns it.
:param minimum_version: minimum jvm version to look for (eg, 1.7).
:param maximum_version: maximum jvm version to look for (eg, 1.7.9999).
:param bool ... | python | {
"resource": ""
} |
q27243 | GoCompile._get_build_flags | train | def _get_build_flags(cls, build_flags_from_option, is_flagged, target):
"""Merge build flags with global < target < command-line order
Build flags can be defined as globals (in `pants.ini`), as arguments to a Target, and
via the command-line.
"""
# If self.get_options().build_flags returns a quoted... | python | {
"resource": ""
} |
q27244 | GoCompile._go_install | train | def _go_install(self, target, gopath, build_flags):
"""Create and execute a `go install` command."""
args = build_flags + [target.import_path]
result, go_cmd = self.go_dist.execute_go_cmd(
'install', gopath=gopath, args=args,
workunit_factory=self.context.new_workunit,
| python | {
"resource": ""
} |
q27245 | GoCompile._sync_binary_dep_links | train | def _sync_binary_dep_links(self, target, gopath, lib_binary_map):
"""Syncs symlinks under gopath to the library binaries of target's transitive dependencies.
:param Target target: Target whose transitive dependencies must be linked.
:param str gopath: $GOPATH of target whose "pkg/" directory must be popula... | python | {
"resource": ""
} |
q27246 | BuildFileAliases.target_types_by_alias | train | def target_types_by_alias(self):
"""Returns a mapping from target alias to the target types produced for that alias.
Normally there is 1 target type per alias, but macros can expand a single alias to several
target types.
:API: public
:rtype: dict
"""
target_types_by_alias = defaultdict(s... | python | {
"resource": ""
} |
q27247 | BuildFileAliases.merge | train | def merge(self, other):
"""Merges a set of build file aliases and returns a new set of aliases containing both.
Any duplicate aliases from `other` will trump.
:API: public
:param other: The BuildFileAliases to merge in.
:type other: :class:`BuildFileAliases`
:returns: A new BuildFileAliases c... | python | {
"resource": ""
} |
q27248 | PythonEval._compile_target | train | def _compile_target(self, vt):
"""'Compiles' a python target.
'Compiling' means forming an isolated chroot of its sources and transitive deps and then
attempting to import each of the target's sources in the case of a python library or else the
entry point in the case of a python binary.
For a lib... | python | {
"resource": ""
} |
q27249 | Xargs.subprocess | train | def subprocess(cls, cmd, **kwargs):
"""Creates an xargs engine that uses subprocess.call to execute the given cmd array with extra
arg chunks.
"""
| python | {
"resource": ""
} |
q27250 | Xargs.execute | train | def execute(self, args):
"""Executes the configured cmd passing args in one or more rounds xargs style.
:param list args: Extra arguments to pass to cmd.
"""
all_args = list(args)
try:
return self._cmd(all_args)
except OSError as e:
if errno.E2BIG == e.errno:
| python | {
"resource": ""
} |
q27251 | ZipkinReporter.close | train | def close(self):
"""End the report."""
endpoint = self.endpoint.replace("/api/v1/spans", "")
logger.debug("Zipkin trace may | python | {
"resource": ""
} |
q27252 | ZipkinReporter.bulk_record_workunits | train | def bulk_record_workunits(self, engine_workunits):
"""A collection of workunits from v2 engine part"""
for workunit in engine_workunits:
duration = workunit['end_timestamp'] - workunit['start_timestamp']
span = zipkin_span(
service_name="pants",
span_name=workunit['name'],
d... | python | {
"resource": ""
} |
q27253 | Payload.get_field_value | train | def get_field_value(self, key, default=None):
"""Retrieves the value in the payload field if the field exists, otherwise returns the default.
:API: public
"""
| python | {
"resource": ""
} |
q27254 | Payload.add_fields | train | def add_fields(self, field_dict):
"""Add a mapping of field names to PayloadField instances.
:API: public
"""
for | python | {
"resource": ""
} |
q27255 | Payload.add_field | train | def add_field(self, key, field):
"""Add a field to the Payload.
:API: public
:param string key: The key for the field. Fields can be accessed using attribute access as
well as `get_field` using `key`.
:param PayloadField field: A PayloadField instance. None is an allowable value for `field`,... | python | {
"resource": ""
} |
q27256 | Payload.fingerprint | train | def fingerprint(self, field_keys=None):
"""A memoizing fingerprint that rolls together the fingerprints of underlying PayloadFields.
If no fields were hashed (or all fields opted out of being hashed by returning `None`), then
`fingerprint()` also returns `None`.
:param iterable<string> field_keys: A s... | python | {
"resource": ""
} |
q27257 | Payload.mark_dirty | train | def mark_dirty(self):
"""Invalidates memoized fingerprints for this payload.
Exposed for testing.
:API: public
"""
| python | {
"resource": ""
} |
q27258 | ClasspathProducts.create_canonical_classpath | train | def create_canonical_classpath(cls, classpath_products, targets, basedir,
save_classpath_file=False,
internal_classpath_only=True,
excludes=None):
"""Create a stable classpath of symlinks with standardized names.
... | python | {
"resource": ""
} |
q27259 | ClasspathProducts.copy | train | def copy(self):
"""Returns a copy of this ClasspathProducts.
Edits to the copy's classpaths or exclude associations will not affect the classpaths or
excludes in the original. The copy is shallow though, so edits to the copy's product values
will mutate the original's product values. See `UnionProduct... | python | {
"resource": ""
} |
q27260 | ClasspathProducts.add_for_targets | train | def add_for_targets(self, targets, classpath_elements):
"""Adds classpath path elements to the products of all the provided targets."""
| python | {
"resource": ""
} |
q27261 | ClasspathProducts.add_for_target | train | def add_for_target(self, target, classpath_elements):
"""Adds classpath path elements to the products of the provided target.
:param target: The target for which to add the classpath elements.
:param classpath_elements: List of tuples, either (conf, filename) or
| python | {
"resource": ""
} |
q27262 | ClasspathProducts.add_jars_for_targets | train | def add_jars_for_targets(self, targets, conf, resolved_jars):
"""Adds jar classpath elements to the products of the provided targets.
The resolved jars are added in a way that works with excludes.
:param targets: The targets to add the jars for.
:param conf: The configuration.
:param resolved_jars:... | python | {
"resource": ""
} |
q27263 | ClasspathProducts.remove_for_target | train | def remove_for_target(self, target, classpath_elements):
"""Removes the given | python | {
"resource": ""
} |
q27264 | ClasspathProducts.get_product_target_mappings_for_targets | train | def get_product_target_mappings_for_targets(self, targets, respect_excludes=True):
"""Gets the classpath products-target associations for the given targets.
Product-target tuples are returned in order, optionally respecting target excludes.
:param targets: The targets to lookup classpath products for.
... | python | {
"resource": ""
} |
q27265 | ClasspathProducts.get_artifact_classpath_entries_for_targets | train | def get_artifact_classpath_entries_for_targets(self, targets, respect_excludes=True):
"""Gets the artifact classpath products for the given targets.
Products are returned in order, optionally respecting target excludes, and the products only
include external artifact classpath elements (ie: resolved jars).... | python | {
"resource": ""
} |
q27266 | ClasspathProducts.get_internal_classpath_entries_for_targets | train | def get_internal_classpath_entries_for_targets(self, targets, respect_excludes=True):
"""Gets the internal classpath products for the given targets.
Products are returned in order, optionally respecting target excludes, and the products only
include internal artifact classpath elements (ie: no resolved jar... | python | {
"resource": ""
} |
q27267 | ClasspathProducts.update | train | def update(self, other):
"""Adds the contents of other to this ClasspathProducts."""
if self._pants_workdir != other._pants_workdir:
raise ValueError('Other ClasspathProducts from a different pants workdir {}'.format(other._pants_workdir))
for target, products in other._classpaths._products_by_target.... | python | {
"resource": ""
} |
q27268 | ClasspathProducts._validate_classpath_tuples | train | def _validate_classpath_tuples(self, classpath, target):
"""Validates that all files are located within the working directory, to simplify relativization.
:param classpath: The list of classpath tuples. Each tuple is a 2-tuple of ivy_conf and
ClasspathEntry.
:param target: The target ... | python | {
"resource": ""
} |
q27269 | GoalOptionsRegistrar.registrar_for_scope | train | def registrar_for_scope(cls, goal):
"""Returns a subclass of this registrar suitable for registering on the specified goal.
Allows reuse of the same registrar for multiple goals, and also | python | {
"resource": ""
} |
q27270 | teardown_socket | train | def teardown_socket(s):
"""Shuts down and closes a socket."""
try:
s.shutdown(socket.SHUT_WR)
| python | {
"resource": ""
} |
q27271 | RecvBufferedSocket.recv | train | def recv(self, bufsize):
"""Buffers up to _chunk_size bytes when the internal buffer has less than `bufsize` bytes."""
assert bufsize > 0, 'a positive bufsize is required'
if len(self._buffer) < bufsize:
| python | {
"resource": ""
} |
q27272 | JavascriptStyleBase._install_eslint | train | def _install_eslint(self, bootstrap_dir):
"""Install the ESLint distribution.
:rtype: string
"""
with pushd(bootstrap_dir):
result, install_command = self.install_module(
package_manager=self.node_distribution.get_package_manager(package_manager=PACKAGE_MANAGER_YARNPKG),
workunit_... | python | {
"resource": ""
} |
q27273 | PantsDaemon.shutdown | train | def shutdown(self, service_thread_map):
"""Gracefully terminate all services and kill the main PantsDaemon loop."""
with self._services.lifecycle_lock:
for service, service_thread in service_thread_map.items():
self._logger.info('terminating pantsd service: {}'.format(service))
| python | {
"resource": ""
} |
q27274 | PantsDaemon._close_stdio | train | def _close_stdio():
"""Close stdio streams to avoid output in the tty that launched pantsd."""
| python | {
"resource": ""
} |
q27275 | PantsDaemon._pantsd_logging | train | def _pantsd_logging(self):
"""A context manager that runs with pantsd logging.
Asserts that stdio (represented by file handles 0, 1, 2) is closed to ensure that
we can safely reuse those fd numbers.
"""
# Ensure that stdio is closed so that we can safely reuse those file descriptors.
for fd in... | python | {
"resource": ""
} |
q27276 | PantsDaemon._run_services | train | def _run_services(self, pants_services):
"""Service runner main loop."""
if not pants_services.services:
self._logger.critical('no services to run, bailing!')
return
service_thread_map = {service: self._make_thread(service)
for service in pants_services.services}
... | python | {
"resource": ""
} |
q27277 | PantsDaemon._write_named_sockets | train | def _write_named_sockets(self, socket_map):
"""Write multiple named sockets using a socket mapping."""
for socket_name, socket_info | python | {
"resource": ""
} |
q27278 | PantsDaemon.run_sync | train | def run_sync(self):
"""Synchronously run pantsd."""
# Switch log output to the daemon's log stream from here forward.
self._close_stdio()
with self._pantsd_logging() as (log_stream, log_filename):
# Register an exiter using os._exit to ensure we only close stdio streams once.
ExceptionSink.... | python | {
"resource": ""
} |
q27279 | PantsDaemon.needs_launch | train | def needs_launch(self):
"""Determines if pantsd needs to be launched.
N.B. This should always be called under care of the `lifecycle_lock`.
:returns: True if the daemon needs launching, False otherwise.
:rtype: bool
"""
new_fingerprint = | python | {
"resource": ""
} |
q27280 | PantsDaemon.launch | train | def launch(self):
"""Launches pantsd in a subprocess.
N.B. This should always be called under care of the `lifecycle_lock`.
:returns: A Handle for the pantsd instance.
:rtype: PantsDaemon.Handle
"""
self.terminate(include_watchman=False)
self.watchman_launcher.maybe_launch()
self._logg... | python | {
"resource": ""
} |
q27281 | PantsDaemon.terminate | train | def terminate(self, include_watchman=True):
"""Terminates pantsd and watchman.
N.B. This should always be | python | {
"resource": ""
} |
q27282 | Scope._parse | train | def _parse(cls, scope):
"""Parses the input scope into a normalized set of strings.
:param scope: A string or tuple containing zero or more scope names.
:return: A set of scope name strings, or a tuple with the default scope name.
:rtype: set
"""
if not scope:
return ('default',) | python | {
"resource": ""
} |
q27283 | Scope.in_scope | train | def in_scope(self, exclude_scopes=None, include_scopes=None):
"""Whether this scope should be included by the given inclusion and exclusion rules.
:param Scope exclude_scopes: An optional Scope containing scope names to exclude. None (the
default value) indicates that no filtering should be done based on... | python | {
"resource": ""
} |
q27284 | Ivy.execute | train | def execute(self, jvm_options=None, args=None, executor=None,
workunit_factory=None, workunit_name=None, workunit_labels=None):
"""Executes the ivy commandline client with the given args.
Raises Ivy.Error if the command fails for any reason.
:param executor: Java executor to run ivy with.
... | python | {
"resource": ""
} |
q27285 | Ivy.runner | train | def runner(self, jvm_options=None, args=None, executor=None):
"""Creates an ivy commandline client runner for the given args."""
args = args or []
if self._ivy_settings and '-settings' not in args:
args = ['-settings', self._ivy_settings] + args
options = list(jvm_options) if jvm_options else []
... | python | {
"resource": ""
} |
q27286 | _get_runner | train | def _get_runner(classpath, main, jvm_options, args, executor,
cwd, distribution,
create_synthetic_jar, synthetic_jar_dir):
"""Gets the java runner for execute_java and execute_java_async."""
executor = executor or SubprocessExecutor(distribution)
safe_cp = classpath
if create_syn... | python | {
"resource": ""
} |
q27287 | execute_java | train | def execute_java(classpath, main, jvm_options=None, args=None, executor=None,
workunit_factory=None, workunit_name=None, workunit_labels=None,
cwd=None, workunit_log_config=None, distribution=None,
create_synthetic_jar=True, synthetic_jar_dir=None, stdin=None):
"""Ex... | python | {
"resource": ""
} |
q27288 | execute_java_async | train | def execute_java_async(classpath, main, jvm_options=None, args=None, executor=None,
workunit_factory=None, workunit_name=None, workunit_labels=None,
cwd=None, workunit_log_config=None, distribution=None,
create_synthetic_jar=True, synthetic_jar_dir=No... | python | {
"resource": ""
} |
q27289 | execute_runner | train | def execute_runner(runner, workunit_factory=None, workunit_name=None, workunit_labels=None,
workunit_log_config=None, stdin=None):
"""Executes the given java runner.
If `workunit_factory` is supplied, does so in the context of a workunit.
:param runner: the java runner to run
:param workuni... | python | {
"resource": ""
} |
q27290 | execute_runner_async | train | def execute_runner_async(runner, workunit_factory=None, workunit_name=None, workunit_labels=None,
workunit_log_config=None):
"""Executes the given java runner asynchronously.
We can't use 'with' here because the workunit_generator's __exit__ function
must be called after the process exit... | python | {
"resource": ""
} |
q27291 | relativize_classpath | train | def relativize_classpath(classpath, root_dir, followlinks=True):
"""Convert into classpath relative to a directory.
This is eventually used by a jar file located in this directory as its manifest
attribute Class-Path. See
https://docs.oracle.com/javase/7/docs/technotes/guides/extensions/spec.html#bundled
:p... | python | {
"resource": ""
} |
q27292 | safe_classpath | train | def safe_classpath(classpath, synthetic_jar_dir, custom_name=None):
"""Bundles classpath into one synthetic jar that includes original classpath in its manifest.
This is to ensure classpath length never exceeds platform ARG_MAX.
:param list classpath: Classpath to be bundled.
:param string synthetic_jar_dir: ... | python | {
"resource": ""
} |
q27293 | Shading.create_relocate | train | def create_relocate(cls, from_pattern, shade_pattern=None, shade_prefix=None):
"""Creates a rule which shades jar entries from one pattern to another.
Examples: ::
# Rename everything in the org.foobar.example package
# to __shaded_by_pants__.org.foobar.example.
shading_relocate('org.f... | python | {
"resource": ""
} |
q27294 | Shading.create_keep_package | train | def create_keep_package(cls, package_name, recursive=True):
"""Convenience constructor for a package keep rule.
Essentially equivalent to just using ``shading_keep('package_name.**')``.
:param string package_name: Package name to keep (eg, ``org.pantsbuild.example``).
:param bool recursive: Whether to... | python | {
"resource": ""
} |
q27295 | Shading.create_zap_package | train | def create_zap_package(cls, package_name, recursive=True):
"""Convenience constructor for a package zap rule.
Essentially equivalent to just using ``shading_zap('package_name.**')``.
:param string package_name: Package name to remove (eg, ``org.pantsbuild.example``).
:param bool recursive: Whether to ... | python | {
"resource": ""
} |
q27296 | Shading.create_relocate_package | train | def create_relocate_package(cls, package_name, shade_prefix=None, recursive=True):
"""Convenience constructor for a package relocation rule.
Essentially equivalent to just using ``shading_relocate('package_name.**')``.
:param string package_name: Package name to shade (eg, ``org.pantsbuild.example``).
... | python | {
"resource": ""
} |
q27297 | Shader.exclude_package | train | def exclude_package(cls, package_name=None, recursive=False):
"""Excludes the given fully qualified package name from shading.
:param unicode package_name: A fully qualified package_name; eg: `org.pantsbuild`; `None` for
the java default (root) package.
:param bool recursive... | python | {
"resource": ""
} |
q27298 | Shader.shade_package | train | def shade_package(cls, package_name=None, recursive=False):
"""Includes the given fully qualified package name in shading.
:param unicode package_name: A fully qualified package_name; eg: `org.pantsbuild`; `None` for
the java default (root) package.
:param bool recursive: `... | python | {
"resource": ""
} |
q27299 | Shader.assemble_binary_rules | train | def assemble_binary_rules(self, main, jar, custom_rules=None):
"""Creates an ordered list of rules suitable for fully shading the given binary.
The default rules will ensure the `main` class name is un-changed along with a minimal set of
support classes but that everything else will be shaded.
Any `cu... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.