_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q27600 | PailgunHandler.handle | train | def handle(self):
"""Request handler for a single Pailgun request."""
# Parse the Nailgun request portion.
_, _, arguments, environment = NailgunProtocol.parse_request(self.request)
# N.B. the first and second nailgun request arguments (working_dir and command) are currently
# ignored in favor of a... | python | {
"resource": ""
} |
q27601 | IdeaPluginGen._generate_to_tempfile | train | def _generate_to_tempfile(self, generator):
"""Applies the specified generator to a temp file and returns the path to that file.
We generate into a temp file so that we don't lose any manual customizations on error."""
| python | {
"resource": ""
} |
q27602 | JavaThriftyGen._compute_include_paths | train | def _compute_include_paths(self, target):
"""Computes the set of paths that thrifty uses to lookup imports.
The IDL files under these paths are not compiled, but they are required to compile
downstream IDL files.
:param target: the JavaThriftyLibrary target to compile.
:return: an ordered set of d... | python | {
"resource": ""
} |
q27603 | ProcessGroup._instance_from_process | train | def _instance_from_process(self, process):
"""Default converter from psutil.Process to process instance classes for subclassing."""
return ProcessManager(name=process.name(),
pid=process.pid,
| python | {
"resource": ""
} |
q27604 | ProcessGroup.iter_processes | train | def iter_processes(self, proc_filter=None):
"""Yields processes from psutil.process_iter with an optional filter and swallows psutil errors.
If a psutil exception is raised during execution of the filter, that process will not be
yielded but subsequent processes will. On the other hand, if psutil.process_i... | python | {
"resource": ""
} |
q27605 | ProcessMetadataManager._maybe_init_metadata_dir_by_name | train | def _maybe_init_metadata_dir_by_name(self, name):
"""Initialize the metadata directory for a named identity if it doesn't exist."""
| python | {
"resource": ""
} |
q27606 | ProcessMetadataManager.read_metadata_by_name | train | def read_metadata_by_name(self, name, metadata_key, caster=None):
"""Read process metadata using a named identity.
:param string name: The ProcessMetadataManager identity/name (e.g. 'pantsd').
:param string metadata_key: The metadata | python | {
"resource": ""
} |
q27607 | ProcessMetadataManager.write_metadata_by_name | train | def write_metadata_by_name(self, name, metadata_key, metadata_value):
"""Write process metadata using a named identity.
:param string name: The ProcessMetadataManager identity/name (e.g. 'pantsd').
| python | {
"resource": ""
} |
q27608 | ProcessMetadataManager.await_metadata_by_name | train | def await_metadata_by_name(self, name, metadata_key, timeout, caster=None):
"""Block up to a timeout for process metadata to arrive on disk.
:param string name: The ProcessMetadataManager identity/name (e.g. 'pantsd').
:param string metadata_key: The metadata key (e.g. 'pid').
:param int timeout: The d... | python | {
"resource": ""
} |
q27609 | ProcessMetadataManager.purge_metadata_by_name | train | def purge_metadata_by_name(self, name):
"""Purge a processes metadata directory.
:raises: `ProcessManager.MetadataError` when OSError is encountered on metadata dir removal.
"""
meta_dir = self._get_metadata_dir_by_name(name, self._metadata_base_dir)
logger.debug('purging metadata directory: {}'.fo... | python | {
"resource": ""
} |
q27610 | ProcessManager.lifecycle_lock | train | def lifecycle_lock(self):
"""An identity-keyed inter-process lock for safeguarding lifecycle and other operations."""
safe_mkdir(self._metadata_base_dir)
return OwnerPrintingInterProcessFileLock(
# N.B. This lock can't key into the actual named metadata dir (e.g. `.pids/pantsd/lock`
| python | {
"resource": ""
} |
q27611 | ProcessManager.get_subprocess_output | train | def get_subprocess_output(cls, command, ignore_stderr=True, **kwargs):
"""Get the output of an executed command.
:param command: An iterable representing the command to execute (e.g. ['ls', '-al']).
:param ignore_stderr: Whether or not to ignore stderr output vs interleave it with stdout.
:raises: `Pro... | python | {
"resource": ""
} |
q27612 | ProcessManager.await_socket | train | def await_socket(self, timeout):
"""Wait up to a given timeout for a process to write socket info."""
return | python | {
"resource": ""
} |
q27613 | ProcessManager.write_pid | train | def write_pid(self, pid=None):
"""Write the current processes PID to the pidfile | python | {
"resource": ""
} |
q27614 | ProcessManager.read_named_socket | train | def read_named_socket(self, socket_name, socket_type):
"""A multi-tenant, named alternative | python | {
"resource": ""
} |
q27615 | ProcessManager._as_process | train | def _as_process(self):
"""Returns a psutil `Process` object wrapping our pid.
NB: Even with a process object in hand, subsequent method calls against it can always raise
`NoSuchProcess`. Care is needed to document the raises in the public API or else trap them and
do something sensible for the API.
... | python | {
"resource": ""
} |
q27616 | ProcessManager.is_alive | train | def is_alive(self, extended_check=None):
"""Return a boolean indicating whether the process is running or not.
:param func extended_check: An additional callable that will be invoked to perform an extended
liveness check. This callable should take a single argument of a
... | python | {
"resource": ""
} |
q27617 | ProcessManager._kill | train | def _kill(self, kill_sig):
"""Send a signal to | python | {
"resource": ""
} |
q27618 | ProcessManager.daemonize | train | def daemonize(self, pre_fork_opts=None, post_fork_parent_opts=None, post_fork_child_opts=None,
fork_context=None, write_pid=True):
"""Perform a double-fork, execute callbacks and write the child pid file.
The double-fork here is necessary to truly daemonize the subprocess such that it can never... | python | {
"resource": ""
} |
q27619 | ProcessManager.daemon_spawn | train | def daemon_spawn(self, pre_fork_opts=None, post_fork_parent_opts=None, post_fork_child_opts=None):
"""Perform a single-fork to run a subprocess and write the child pid file.
Use this if your post_fork_child block invokes a subprocess via subprocess.Popen(). In this
case, a second fork such as used in daemo... | python | {
"resource": ""
} |
q27620 | FingerprintedProcessManager.fingerprint | train | def fingerprint(self):
"""The fingerprint of the current process.
This can either read the current fingerprint from the running process's psutil.Process.cmdline
(if the managed process supports that) or from the `ProcessManager` metadata.
:returns: The fingerprint of the running process as read from t... | python | {
"resource": ""
} |
q27621 | FingerprintedProcessManager.parse_fingerprint | train | def parse_fingerprint(self, cmdline, key=None, sep=None):
"""Given a psutil.Process.cmdline, parse and return a fingerprint.
:param list cmdline: The psutil.Process.cmdline of the current process.
:param string key: The key for fingerprint discovery.
:param string sep: The key/value separator for finge... | python | {
"resource": ""
} |
q27622 | ManagedJarDependencies.library_specs | train | def library_specs(self):
"""Lists of specs to resolve to jar_libraries containing more | python | {
"resource": ""
} |
q27623 | GoDistribution.go_env | train | def go_env(self, gopath=None):
"""Return an env dict that represents a proper Go environment mapping for this distribution."""
# Forcibly nullify the GOPATH if the command does not need one - this can prevent bad user
# GOPATHs from erroring out commands; see: https://github.com/pantsbuild/pants/issues/2321... | python | {
"resource": ""
} |
q27624 | GoDistribution.create_go_cmd | train | def create_go_cmd(self, cmd, gopath=None, args=None):
"""Creates a Go command that is optionally targeted to a Go workspace.
:param string cmd: Go command to execute, e.g. 'test' for `go test`
:param string gopath: An optional $GOPATH which points to a valid | python | {
"resource": ""
} |
q27625 | GoDistribution.execute_go_cmd | train | def execute_go_cmd(self, cmd, gopath=None, args=None, env=None,
workunit_factory=None, workunit_name=None, workunit_labels=None, **kwargs):
"""Runs a Go command that is optionally targeted to a Go workspace.
If a `workunit_factory` is supplied the command will run in a work unit context.
... | python | {
"resource": ""
} |
q27626 | target_internal_dependencies | train | def target_internal_dependencies(target):
"""Returns internal Jarable dependencies that were "directly" declared.
Directly declared deps are those that are explicitly listed in the definition of a
target, rather than being depended on transitively. But in order to walk through
aggregator targets such as `targe... | python | {
"resource": ""
} |
q27627 | PushDb.load | train | def load(path):
"""Loads a pushdb maintained in a properties file at the given path.""" | python | {
"resource": ""
} |
q27628 | PushDb.get_entry | train | def get_entry(self, target):
"""Given an internal target, return a PushDb.Entry, which might contain defaults."""
db_get, _ = self._accessors_for_target(target)
major = int(db_get('revision.major', '0'))
minor = int(db_get('revision.minor', '0'))
patch = int(db_get('revision.patch', '0'))
snaps... | python | {
"resource": ""
} |
q27629 | PushDb.dump | train | def dump(self, path):
"""Saves the pushdb as a properties file to the given path."""
with | python | {
"resource": ""
} |
q27630 | PomWriter._as_versioned_jar | train | def _as_versioned_jar(self, internal_target):
"""Fetches the jar representation of the given target, and applies the latest pushdb version.""" | python | {
"resource": ""
} |
q27631 | JarPublish.confirm_push | train | def confirm_push(self, coord, version):
"""Ask the user if a push should be done for a particular version of a
particular coordinate. Return True if the push should be done"""
if not self.get_options().prompt:
return True
try:
isatty = os.isatty(sys.stdin.fileno())
except ValueError... | python | {
"resource": ""
} |
q27632 | JarPublish._ivy_jvm_options | train | def _ivy_jvm_options(self, repo):
"""Get the JVM options for ivy authentication, if needed."""
# Get authentication for the publish repo if needed.
if not repo.get('auth'):
# No need to copy here, as this list isn't modified by the caller.
return self._jvm_options
# Create a copy of the opt... | python | {
"resource": ""
} |
q27633 | JarPublish.create_doc_jar | train | def create_doc_jar(self, target, open_jar, version):
"""Returns a doc jar if either scala or java docs are available for the given target."""
javadoc = self._java_doc(target)
scaladoc = self._scala_doc(target)
if javadoc or scaladoc:
jar_path = self.artifact_path(open_jar, version, suffix='-javado... | python | {
"resource": ""
} |
q27634 | BuildConfiguration.registered_aliases | train | def registered_aliases(self):
"""Return the registered aliases exposed in BUILD files.
These returned aliases aren't so useful for actually parsing BUILD files.
They are useful for generating things like http://pantsbuild.github.io/build_dictionary.html.
:returns: A new BuildFileAliases instance conta... | python | {
"resource": ""
} |
q27635 | BuildConfiguration.register_aliases | train | def register_aliases(self, aliases):
"""Registers the given aliases to be exposed in parsed BUILD files.
:param aliases: The BuildFileAliases to register.
:type aliases: :class:`pants.build_graph.build_file_aliases.BuildFileAliases`
"""
if not isinstance(aliases, BuildFileAliases):
raise Type... | python | {
"resource": ""
} |
q27636 | BuildConfiguration.register_optionables | train | def register_optionables(self, optionables):
"""Registers the given subsystem types.
:param optionables: The Optionable types to register.
:type optionables: :class:`collections.Iterable` containing
:class:`pants.option.optionable.Optionable` subclasses.
"""
if not isinstance... | python | {
"resource": ""
} |
q27637 | BuildConfiguration.register_rules | train | def register_rules(self, rules):
"""Registers the given rules.
param rules: The rules to register.
:type rules: :class:`collections.Iterable` containing
:class:`pants.engine.rules.Rule` instances.
"""
if not isinstance(rules, Iterable):
raise TypeError('The rules must be an i... | python | {
"resource": ""
} |
q27638 | BuildConfiguration.initialize_parse_state | train | def initialize_parse_state(self, build_file):
"""Creates a fresh parse state for the given build file.
:param build_file: The BUILD file to set up a new ParseState for.
:type build_file: :class:`pants.base.build_file.BuildFile`
:returns: A fresh ParseState for parsing the given `build_file` with.
:... | python | {
"resource": ""
} |
q27639 | WorkUnit.end | train | def end(self):
"""Mark the time at which this workunit ended."""
self.end_time = time.time()
return self.path(), | python | {
"resource": ""
} |
q27640 | WorkUnit.set_outcome | train | def set_outcome(self, outcome):
"""Set the outcome of this work unit.
We can set the outcome on a work unit directly, but that outcome will also be affected by
those of its subunits. The right thing happens: The outcome of a work unit is the
worst outcome of any of its subunits and any outcome set on i... | python | {
"resource": ""
} |
q27641 | WorkUnit.start_delta_string | train | def start_delta_string(self):
"""A convenient string representation of how long after the run started we started.
:API: public
"""
delta | python | {
"resource": ""
} |
q27642 | WorkUnit.ancestors | train | def ancestors(self):
"""Returns a list consisting of this workunit and those enclosing it, up to the root.
| python | {
"resource": ""
} |
q27643 | WorkUnit.to_dict | train | def to_dict(self):
"""Useful for providing arguments to templates.
:API: public
"""
ret = {}
for key in ['name', 'cmd', 'id', 'start_time', 'end_time',
'outcome', 'start_time_string', 'start_delta_string']:
val = getattr(self, key)
ret[key] | python | {
"resource": ""
} |
q27644 | WorkUnit._self_time | train | def _self_time(self):
"""Returns the time spent in this workunit outside of any children."""
return self.duration() | python | {
"resource": ""
} |
q27645 | longest_dir_prefix | train | def longest_dir_prefix(path, prefixes):
"""Given a list of prefixes, return the one that is the longest prefix to the given path.
Returns None if there are no matches.
"""
longest_match, longest_prefix = 0, None
for prefix in prefixes:
| python | {
"resource": ""
} |
q27646 | safe_mkdir_for | train | def safe_mkdir_for(path, clean=False):
"""Ensure that the parent directory for a file | python | {
"resource": ""
} |
q27647 | safe_mkdir_for_all | train | def safe_mkdir_for_all(paths):
"""Make directories which would contain all of the passed paths.
This avoids attempting to re-make the same directories, which may be noticeably expensive if many
paths mostly fall in the | python | {
"resource": ""
} |
q27648 | safe_file_dump | train | def safe_file_dump(filename, payload='', mode='w'):
"""Write a string to a file.
This method is "safe" to the extent that `safe_open` is "safe". See the explanation on the method
doc there.
When `payload` is an empty string (the default), this method can be used as a concise way to
create an empty file alon... | python | {
"resource": ""
} |
q27649 | mergetree | train | def mergetree(src, dst, symlinks=False, ignore=None, file_filter=None):
"""Just like `shutil.copytree`, except the `dst` dir may exist.
The `src` directory will be walked and its contents copied into `dst`. If `dst` already exists the
`src` tree will be overlayed in it; ie: existing files in `dst` will be over-w... | python | {
"resource": ""
} |
q27650 | safe_mkdtemp | train | def safe_mkdtemp(cleaner=_mkdtemp_atexit_cleaner, **kw):
"""Create a temporary directory that is cleaned up on process exit.
Arguments are as to tempfile.mkdtemp.
:API: public
"""
# Proper lock sanitation on | python | {
"resource": ""
} |
q27651 | register_rmtree | train | def register_rmtree(directory, cleaner=_mkdtemp_atexit_cleaner):
"""Register an existing directory to be cleaned up at process exit."""
with _MKDTEMP_LOCK: | python | {
"resource": ""
} |
q27652 | safe_open | train | def safe_open(filename, *args, **kwargs):
"""Open a file safely, ensuring that its directory exists.
:API: public
| python | {
"resource": ""
} |
q27653 | safe_concurrent_rename | train | def safe_concurrent_rename(src, dst):
"""Rename src to dst, ignoring errors due to dst already existing.
Useful when concurrent processes may attempt to create dst, and it doesn't matter who wins.
"""
# Delete dst, in case it existed (with old content) even | python | {
"resource": ""
} |
q27654 | safe_concurrent_creation | train | def safe_concurrent_creation(target_path):
"""A contextmanager that yields a temporary path and renames it to a final target path when the
contextmanager exits.
Useful when concurrent processes may attempt to create a file, and it doesn't matter who wins.
:param target_path: The final | python | {
"resource": ""
} |
q27655 | absolute_symlink | train | def absolute_symlink(source_path, target_path):
"""Create a symlink at target pointing to source using the absolute path.
:param source_path: Absolute path to source file
:param target_path: Absolute path to intended symlink
:raises ValueError if source_path or link_path are not unique, absolute paths
:raise... | python | {
"resource": ""
} |
q27656 | relative_symlink | train | def relative_symlink(source_path, link_path):
"""Create a symlink at link_path pointing to relative source
:param source_path: Absolute path to source file
:param link_path: Absolute path to intended symlink
:raises ValueError if source_path or link_path are not unique, absolute paths
:raises OSError on fail... | python | {
"resource": ""
} |
q27657 | get_basedir | train | def get_basedir(path):
"""Returns the base directory of a path.
Examples:
get_basedir('foo/bar/baz') --> 'foo'
get_basedir('/foo/bar/baz') --> '' | python | {
"resource": ""
} |
q27658 | is_executable | train | def is_executable(path):
"""Returns whether a path names an existing executable file."""
| python | {
"resource": ""
} |
q27659 | check_no_overlapping_paths | train | def check_no_overlapping_paths(paths):
"""Given a list of paths, ensure that all are unique and do not have the same prefix."""
for path in paths:
list_copy_without_path = list(paths)
list_copy_without_path.remove(path)
| python | {
"resource": ""
} |
q27660 | is_readable_dir | train | def is_readable_dir(path):
"""Returns whether a path names an existing directory we can list and read files from."""
| python | {
"resource": ""
} |
q27661 | Scheduler._register_rules | train | def _register_rules(self, rule_index):
"""Record the given RuleIndex on `self._tasks`."""
registered = set()
for output_type, rules in rule_index.rules.items():
for rule in rules:
key = (output_type, rule)
if key in registered:
continue
| python | {
"resource": ""
} |
q27662 | Scheduler._register_task | train | def _register_task(self, output_type, rule, union_rules):
"""Register the given TaskRule with the native scheduler."""
func = Function(self._to_key(rule.func))
self._native.lib.tasks_task_begin(self._tasks, func, self._to_type(output_type), rule.cacheable)
for selector in rule.input_selectors:
sel... | python | {
"resource": ""
} |
q27663 | Scheduler.with_fork_context | train | def with_fork_context(self, func):
"""See the rustdocs for `scheduler_fork_context` for more information."""
| python | {
"resource": ""
} |
q27664 | Scheduler.capture_snapshots | train | def capture_snapshots(self, path_globs_and_roots):
"""Synchronously captures Snapshots for each matching PathGlobs rooted at a its root directory.
This is a blocking operation, and should be avoided where possible.
:param path_globs_and_roots tuple<PathGlobsAndRoot>: The PathGlobs to capture, and the root... | python | {
"resource": ""
} |
q27665 | Scheduler.merge_directories | train | def merge_directories(self, directory_digests):
"""Merges any number of directories.
:param directory_digests: Tuple of DirectoryDigests.
:return: A Digest.
"""
result = | python | {
"resource": ""
} |
q27666 | Scheduler.materialize_directories | train | def materialize_directories(self, directories_paths_and_digests):
"""Creates the specified directories on the file system.
:param directories_paths_and_digests tuple<DirectoryToMaterialize>: Tuple of the path and
digest of the directories to materialize.
:returns: Nothing or an error.
"""
... | python | {
"resource": ""
} |
q27667 | Scheduler.new_session | train | def new_session(self, zipkin_trace_v2, v2_ui=False):
"""Creates a new SchedulerSession for this Scheduler."""
return SchedulerSession(self, self._native.new_session(
| python | {
"resource": ""
} |
q27668 | SchedulerSession.trace | train | def trace(self, execution_request):
"""Yields a stringified 'stacktrace' starting from the scheduler's roots."""
for | python | {
"resource": ""
} |
q27669 | SchedulerSession.execution_request | train | def execution_request(self, products, subjects):
"""Create and return an ExecutionRequest for the given products and subjects.
The resulting ExecutionRequest object will contain keys tied to this scheduler's product Graph,
and so it will not be directly usable with other scheduler instances without being r... | python | {
"resource": ""
} |
q27670 | SchedulerSession.invalidate_files | train | def invalidate_files(self, direct_filenames):
"""Invalidates the given filenames in an internal product Graph instance."""
invalidated = | python | {
"resource": ""
} |
q27671 | SchedulerSession.execute | train | def execute(self, execution_request):
"""Invoke the engine for the given ExecutionRequest, returning Return and Throw states.
:return: A tuple of (root, Return) tuples and (root, Throw) tuples.
"""
start_time = time.time()
roots = list(zip(execution_request.roots,
self._schedul... | python | {
"resource": ""
} |
q27672 | SchedulerSession.product_request | train | def product_request(self, product, subjects):
"""Executes a request for a single product for some subjects, and returns the products.
:param class product: A product type for the request.
:param list subjects: A list of subjects or Params instances for the request.
:returns: A list of the requested pro... | python | {
"resource": ""
} |
q27673 | NodeResolverBase.parse_file_path | train | def parse_file_path(cls, file_path):
"""Parse a file address path without the file specifier"""
address = None
| python | {
"resource": ""
} |
q27674 | NodeResolverBase._copy_sources | train | def _copy_sources(self, target, results_dir):
"""Copy sources from a target to a results directory.
:param NodePackage target: A subclass of NodePackage
:param string results_dir: The results directory
"""
| python | {
"resource": ""
} |
q27675 | NodeResolverBase._get_target_from_package_name | train | def _get_target_from_package_name(self, target, package_name, file_path):
"""Get a dependent target given the package name and relative file path.
This will only traverse direct dependencies of the passed target. It is not necessary
to traverse further than that because transitive dependencies will be reso... | python | {
"resource": ""
} |
q27676 | Duplicate.validate_action | train | def validate_action(cls, action):
"""Verifies the given action is a valid duplicate jar rule action.
:returns: The action if it is valid.
:raises: ``ValueError`` if the action is invalid.
"""
if action not in | python | {
"resource": ""
} |
q27677 | JarRules.skip_signatures_and_duplicates_concat_well_known_metadata | train | def skip_signatures_and_duplicates_concat_well_known_metadata(cls, default_dup_action=None,
additional_rules=None):
"""Produces a rule set useful in many deploy jar creation contexts.
The rule set skips duplicate entries by default, retaining the ... | python | {
"resource": ""
} |
q27678 | JarRules.default | train | def default(cls):
"""Returns the default set of jar rules.
Can be set with `set_default` but otherwise defaults to
`skip_signatures_and_duplicates_concat_well_known_metadata`.
:API: public
"""
if cls._DEFAULT | python | {
"resource": ""
} |
q27679 | JarRules.set_default | train | def set_default(cls, rules):
"""Sets the default site-wide jar rules."""
if not isinstance(rules, JarRules):
raise | python | {
"resource": ""
} |
q27680 | BuildRoot.path | train | def path(self):
"""Returns the build root for the current workspace."""
if self._root_dir is None:
# This env variable is for testing purpose.
override_buildroot = os.environ.get('PANTS_BUILDROOT_OVERRIDE', None)
| python | {
"resource": ""
} |
q27681 | BuildRoot.path | train | def path(self, root_dir):
"""Manually establishes the build root for the current workspace."""
path = | python | {
"resource": ""
} |
q27682 | BuildRoot.temporary | train | def temporary(self, path):
"""Establishes a temporary build root, restoring the prior build root on exit."""
if path is None:
raise ValueError('Can only temporarily establish a build root given a path.')
| python | {
"resource": ""
} |
q27683 | HelpPrinter.print_help | train | def print_help(self):
"""Print help to the console.
:return: 0 on success, 1 on failure
"""
def print_hint():
print('Use `pants goals` to list goals.')
print('Use `pants help` to get help.')
if isinstance(self._help_request, VersionHelp):
print(pants_version())
elif isinstance... | python | {
"resource": ""
} |
q27684 | HelpPrinter._print_options_help | train | def _print_options_help(self):
"""Print a help screen.
Assumes that self._help_request is an instance of OptionsHelp.
Note: Ony useful if called after options have been registered.
"""
show_all_help = self._help_request.all_scopes
if show_all_help:
help_scopes = list(self._options.known_... | python | {
"resource": ""
} |
q27685 | HelpPrinter._format_help | train | def _format_help(self, scope_info):
"""Return a help message for the options registered on this object.
Assumes that self._help_request is an instance of OptionsHelp.
:param scope_info: Scope of the options.
"""
scope = scope_info.scope
| python | {
"resource": ""
} |
q27686 | generate_travis_yml | train | def generate_travis_yml():
"""Generates content for a .travis.yml file from templates."""
def get_mustache_file(file_name):
return pkg_resources.resource_string(__name__, file_name).decode('utf-8')
template = get_mustache_file('travis.yml.mustache')
before_install_linux = get_mustache_file('before_install_... | python | {
"resource": ""
} |
q27687 | JvmPlatformAnalysisMixin._unfiltered_jvm_dependency_map | train | def _unfiltered_jvm_dependency_map(self, fully_transitive=False):
"""Jvm dependency map without filtering out non-JvmTarget keys, exposed for testing.
Unfiltered because the keys in the resulting map include non-JvmTargets.
See the explanation in the jvm_dependency_map() docs for what this method produces... | python | {
"resource": ""
} |
q27688 | JvmPlatformAnalysisMixin.jvm_dependency_map | train | def jvm_dependency_map(self):
"""A map of each JvmTarget in the context to the set of JvmTargets it depends on "directly".
"Directly" is in quotes here because it isn't quite the same as its normal use, which would be
filter(self._is_jvm_target, target.dependencies).
For this method, we define the set... | python | {
"resource": ""
} |
q27689 | JvmPlatformValidate.validate_platform_dependencies | train | def validate_platform_dependencies(self):
"""Check all jvm targets in the context, throwing an error or warning if there are bad targets.
If there are errors, this method fails slow rather than fails fast -- that is, it continues
checking the rest of the targets before spitting error messages. This is usef... | python | {
"resource": ""
} |
q27690 | JvmPlatformExplain.possible_version_evaluation | train | def possible_version_evaluation(self):
"""Evaluate the possible range of versions for each target, yielding the output analysis."""
only_broken = self.get_options().only_broken
ranges = self._ranges
yield 'Allowable JVM platform ranges (* = anything):'
for target in sorted(filter(self._is_relevant, ... | python | {
"resource": ""
} |
q27691 | RscCompile._nailgunnable_combined_classpath | train | def _nailgunnable_combined_classpath(self):
"""Register all of the component tools of the rsc compile task as a "combined" jvm tool.
This allows us to invoke their combined classpath in a single nailgun instance (see #7089 and
#7092). We still invoke their classpaths separately when not using nailgun, howe... | python | {
"resource": ""
} |
q27692 | RscCompile._classify_target_compile_workflow | train | def _classify_target_compile_workflow(self, target):
"""Return the compile workflow to use for this target."""
if target.has_sources('.java') or target.has_sources('.scala'):
| python | {
"resource": ""
} |
q27693 | RscCompile._on_invalid_compile_dependency | train | def _on_invalid_compile_dependency(self, dep, compile_target, contexts):
"""Decide whether to continue searching for invalid targets to use in the execution graph.
If a necessary dep is a rsc-then-zinc dep and the root is a zinc-only one, continue to recurse
because otherwise we'll drop the path between Zi... | python | {
"resource": ""
} |
q27694 | TargetFilterTaskMixin.target_types_for_alias | train | def target_types_for_alias(self, alias):
"""Returns all the target types that might be produced by the given alias.
Normally there is 1 target type per alias, but macros can expand a single alias to several
target types.
:param string alias: The alias to look up associated target types for.
:retur... | python | {
"resource": ""
} |
q27695 | WorkerPool.submit_work_and_wait | train | def submit_work_and_wait(self, work, workunit_parent=None):
"""Submit work to be executed on this pool, but wait for it to complete.
- work: The work to execute.
- workunit_parent: If specified, work is accounted for under this workunit.
Returns a list of return values of each invocation, in order. T... | python | {
"resource": ""
} |
q27696 | command_gen | train | def command_gen(tool_installations, tool_executable, args=None, node_paths=None):
"""Generate a Command object with required tools installed and paths set up.
:param list tool_installations: A list of functions to install required tools. Those functions
should take no parameter and return an installation path... | python | {
"resource": ""
} |
q27697 | Command.run | train | def run(self, **kwargs):
"""Runs this command.
:param kwargs: Any extra keyword arguments to pass along to `subprocess.Popen`.
:returns: A handle to the running command.
:rtype: :class:`subprocess.Popen`
"""
| python | {
"resource": ""
} |
q27698 | Command.check_output | train | def check_output(self, **kwargs):
"""Runs this command returning its captured stdout.
:param kwargs: Any extra keyword arguments to pass along to `subprocess.Popen`.
:returns: The captured standard output stream of the command.
:rtype: string
| python | {
"resource": ""
} |
q27699 | JvmBinaryTask.add_main_manifest_entry | train | def add_main_manifest_entry(jar, binary):
"""Creates a jar manifest for the given binary.
If the binary declares a main then a 'Main-Class' manifest entry | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.