_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q27300
ChangedRequest.from_options
train
def from_options(cls, options): """Given an `Options` object, produce a `ChangedRequest`.""" return cls(options.changes_since,
python
{ "resource": "" }
q27301
ensure_arg
train
def ensure_arg(args, arg, param=None): """Make sure the arg is present in the list of args. If arg is not present, adds the arg and the optional param. If present and param != None, sets the parameter following the arg to param. :param list args: strings representing an argument list. :param string arg: arg...
python
{ "resource": "" }
q27302
remove_arg
train
def remove_arg(args, arg, has_param=False): """Removes the first instance of the specified arg from the list of args. If the arg is present and has_param is set, also removes the parameter that follows the arg. :param list args: strings representing an argument list. :param staring arg: argument to remove fr...
python
{ "resource": "" }
q27303
setup_logging_to_stderr
train
def setup_logging_to_stderr(python_logger, level): """ We setup logging as loose as possible from the Python side, and let Rust do the filtering. """ native = Native() levelno = get_numeric_level(level) handler = create_native_stderr_log_handler(levelno, native, stream=sys.stderr)
python
{ "resource": "" }
q27304
setup_logging
train
def setup_logging(level, console_stream=None, log_dir=None, scope=None, log_name=None, native=None): """Configures logging for a given scope, by default the global scope. :param str level: The logging level to enable, must be one of the level names listed here: https://docs.python.org/2/library...
python
{ "resource": "" }
q27305
ProtobufGen._jars_to_directories
train
def _jars_to_directories(self, target): """Extracts and maps jars to directories containing their contents. :returns: a set of filepaths to directories containing the contents of jar. """ files = set()
python
{ "resource": "" }
q27306
PythonInterpreterCache.partition_targets_by_compatibility
train
def partition_targets_by_compatibility(self, targets): """Partition targets by their compatibility constraints. :param targets: a list of `PythonTarget` objects :returns: (tgts_by_compatibilities, filters): a dict that maps compatibility constraints to a list of matching targets, the aggregate set of...
python
{ "resource": "" }
q27307
PythonInterpreterCache._setup_cached
train
def _setup_cached(self, filters=()): """Find all currently-cached interpreters.""" for interpreter_dir in os.listdir(self._cache_dir): pi = self._interpreter_from_relpath(interpreter_dir, filters=filters) if pi:
python
{ "resource": "" }
q27308
PythonInterpreterCache._setup_paths
train
def _setup_paths(self, paths, filters=()): """Find interpreters under paths, and cache them.""" for interpreter in self._matching(PythonInterpreter.all(paths), filters=filters): identity_str = str(interpreter.identity) pi = self._interpreter_from_relpath(identity_str, filters=filters)
python
{ "resource": "" }
q27309
PythonInterpreterCache.setup
train
def setup(self, filters=()): """Sets up a cache of python interpreters. :param filters: A sequence of strings that constrain the interpreter compatibility for this cache, using the Requirement-style format, e.g. ``'CPython>=3', or just ['>=2.7','<3']`` for requirements agnostic to interpreter class...
python
{ "resource": "" }
q27310
BaseZincCompile.validate_arguments
train
def validate_arguments(log, whitelisted_args, args): """Validate that all arguments match whitelisted regexes.""" valid_patterns = {re.compile(p): v for p, v in whitelisted_args.items()} def validate(idx): arg = args[idx] for pattern, has_argument in valid_patterns.items(): if pattern.m...
python
{ "resource": "" }
q27311
BaseZincCompile._format_zinc_arguments
train
def _format_zinc_arguments(settings, distribution): """Extracts and formats the zinc arguments given in the jvm platform settings. This is responsible for the symbol substitution which replaces $JAVA_HOME with the path to an appropriate jvm distribution. :param settings: The jvm platform settings from...
python
{ "resource": "" }
q27312
BaseZincCompile.scalac_classpath_entries
train
def scalac_classpath_entries(self): """Returns classpath entries for the scalac classpath."""
python
{ "resource": "" }
q27313
BaseZincCompile.write_extra_resources
train
def write_extra_resources(self, compile_context): """Override write_extra_resources to produce plugin and annotation processor files.""" target = compile_context.target if isinstance(target, ScalacPlugin): self._write_scalac_plugin_info(compile_context.classes_dir.path, target) elif isinstance(tar...
python
{ "resource": "" }
q27314
BaseZincCompile._find_scalac_plugins
train
def _find_scalac_plugins(self, scalac_plugins, classpath): """Returns a map from plugin name to list of plugin classpath entries. The first entry in each list is the classpath entry containing the plugin metadata. The rest are the internal transitive deps of the plugin. This allows us to have in-repo ...
python
{ "resource": "" }
q27315
BaseZincCompile._maybe_get_plugin_name
train
def _maybe_get_plugin_name(cls, classpath_element): """If classpath_element is a scalac plugin, returns its name. Returns None otherwise. """ def process_info_file(cp_elem, info_file): plugin_info = ElementTree.parse(info_file).getroot() if plugin_info.tag != 'plugin': raise TaskErr...
python
{ "resource": "" }
q27316
clean_global_runtime_state
train
def clean_global_runtime_state(reset_subsystem=False): """Resets the global runtime state of a pants runtime for cleaner forking. :param bool reset_subsystem: Whether or not to clean Subsystem global state. """ if reset_subsystem:
python
{ "resource": "" }
q27317
find_paths_breadth_first
train
def find_paths_breadth_first(from_target, to_target, log): """Yields the paths between from_target to to_target if they exist. The paths are returned ordered by length, shortest first. If there are cycles, it checks visited edges to prevent recrossing them.""" log.debug('Looking for all paths from {} to {}'.fo...
python
{ "resource": "" }
q27318
BuildGraph.apply_injectables
train
def apply_injectables(self, targets): """Given an iterable of `Target` instances, apply their transitive injectables.""" target_types = {type(t) for t in targets} target_subsystem_deps = {s for s in itertools.chain(*(t.subsystems() for t in target_types))} for subsystem in target_subsystem_deps:
python
{ "resource": "" }
q27319
BuildGraph.reset
train
def reset(self): """Clear out the state of the BuildGraph, in particular Target mappings and dependencies. :API: public """ self._target_by_address = OrderedDict() self._target_dependencies_by_address =
python
{ "resource": "" }
q27320
BuildGraph.get_target_from_spec
train
def get_target_from_spec(self, spec, relative_to=''): """Converts `spec` into an address and returns the result of `get_target` :API: public """
python
{ "resource": "" }
q27321
BuildGraph.dependencies_of
train
def dependencies_of(self, address): """Returns the dependencies of the Target at `address`. This method asserts that the address given is actually in the BuildGraph.
python
{ "resource": "" }
q27322
BuildGraph.dependents_of
train
def dependents_of(self, address): """Returns the addresses of the targets that depend on the target at `address`. This method asserts that the address given is actually in the BuildGraph.
python
{ "resource": "" }
q27323
BuildGraph.get_derived_from
train
def get_derived_from(self, address): """Get the target the specified target was derived from. If a Target was injected programmatically, e.g. from codegen, this allows
python
{ "resource": "" }
q27324
BuildGraph.get_direct_derivatives
train
def get_direct_derivatives(self, address): """Get all targets derived directly from the specified target. Note that the specified target itself is not returned. :API: public """
python
{ "resource": "" }
q27325
BuildGraph.get_all_derivatives
train
def get_all_derivatives(self, address): """Get all targets derived directly or indirectly from the specified target. Note that the specified target itself is not returned. :API: public """
python
{ "resource": "" }
q27326
BuildGraph.inject_target
train
def inject_target(self, target, dependencies=None, derived_from=None, synthetic=False): """Injects a fully realized Target into the BuildGraph. :API: public :param Target target: The Target to inject. :param list<Address> dependencies: The Target addresses that `target` depends on. :param Target d...
python
{ "resource": "" }
q27327
BuildGraph.inject_dependency
train
def inject_dependency(self, dependent, dependency): """Injects a dependency from `dependent` onto `dependency`. It is an error to inject a dependency if the dependent doesn't already exist, but the reverse is not an error. :API: public :param Address dependent: The (already injected) address of a...
python
{ "resource": "" }
q27328
BuildGraph._walk_factory
train
def _walk_factory(self, dep_predicate): """Construct the right context object for managing state during a transitive walk.""" walk = None if dep_predicate:
python
{ "resource": "" }
q27329
BuildGraph.walk_transitive_dependency_graph
train
def walk_transitive_dependency_graph(self, addresses, work, predicate=None, postorder=False, dep_predicate=None, ...
python
{ "resource": "" }
q27330
BuildGraph.transitive_dependees_of_addresses
train
def transitive_dependees_of_addresses(self, addresses, predicate=None, postorder=False): """Returns all transitive dependees of `addresses`. Note that this uses `walk_transitive_dependee_graph` and the predicate is passed through, hence it trims graphs rather than just filtering out Targets that do not mat...
python
{ "resource": "" }
q27331
BuildGraph.transitive_subgraph_of_addresses
train
def transitive_subgraph_of_addresses(self, addresses, *vargs, **kwargs): """Returns all transitive dependencies of `addresses`. Note that this uses `walk_transitive_dependencies_graph` and the predicate is passed through, hence it trims graphs rather than just filtering out Targets that do not match the pr...
python
{ "resource": "" }
q27332
BuildGraph.transitive_subgraph_of_addresses_bfs
train
def transitive_subgraph_of_addresses_bfs(self, addresses, predicate=None, dep_predicate=None): """Returns the transitive dependency closure of `addresses` using BFS. :API: public ...
python
{ "resource": "" }
q27333
IndexableJavaTargets.get
train
def get(self, context): """Return the indexable targets in the given context. Computes them lazily from the given context. They are then fixed for the duration of the run, even if this method is called again with a different context. """ if self.get_options().recursive: requested_targets = c...
python
{ "resource": "" }
q27334
OptionsBootstrapper.get_config_file_paths
train
def get_config_file_paths(env, args): """Get the location of the config files. The locations are specified by the --pants-config-files option. However we need to load the config in order to process the options. This method special-cases --pants-config-files in order to solve this chicken-and-egg prob...
python
{ "resource": "" }
q27335
OptionsBootstrapper.create
train
def create(cls, env=None, args=None): """Parses the minimum amount of configuration necessary to create an OptionsBootstrapper. :param env: An environment dictionary, or None to use `os.environ`. :param args: An args array, or None to use `sys.argv`. """ env = {k: v for k, v in (os.environ if env i...
python
{ "resource": "" }
q27336
OptionsBootstrapper.bootstrap_options
train
def bootstrap_options(self): """The post-bootstrap options, computed from the env, args, and fully discovered Config. Re-computing options after Config has been fully expanded allows us to pick up bootstrap values (such as backends) from a config override file, for example.
python
{ "resource": "" }
q27337
OptionsBootstrapper.verify_configs_against_options
train
def verify_configs_against_options(self, options): """Verify all loaded configs have correct scopes and options. :param options: Fully bootstrapped valid options. :return: None. """ error_log = [] for config in self.config.configs(): for section in config.sections(): if section ==...
python
{ "resource": "" }
q27338
CmdLineSpecParser.parse_spec
train
def parse_spec(self, spec): """Parse the given spec into a `specs.Spec` object. :param spec: a single spec string. :return: a single specs.Specs object. :raises: CmdLineSpecParser.BadSpecError if the address selector could not be parsed. """ if spec.endswith('::'): spec_path = spec[:-len...
python
{ "resource": "" }
q27339
MutexTaskMixin._require_homogeneous_roots
train
def _require_homogeneous_roots(self, accept_predicate, reject_predicate): """Ensures that there is no ambiguity in the context according to the given predicates. If any targets in the context satisfy the accept_predicate, and no targets satisfy the reject_predicate, returns the accepted targets. If no...
python
{ "resource": "" }
q27340
check_header
train
def check_header(filename, is_newly_created=False): """Raises `HeaderCheckFailure` if the header doesn't match.""" try: with open(filename, 'r') as pyfile: buf = "" for lineno in range(1,7): line = pyfile.readline() # Skip shebang line if lineno == 1 and line.startswith('#!')...
python
{ "resource": "" }
q27341
check_dir
train
def check_dir(directory, newly_created_files): """Returns list of files that fail the check.""" header_parse_failures = [] for root, dirs, files in os.walk(directory): for f in files: if f.endswith('.py') and os.path.basename(f) != '__init__.py': filename = os.path.join(root, f) try: ...
python
{ "resource": "" }
q27342
NodeTask.get_package_manager
train
def get_package_manager(self, target=None): """Returns package manager for target argument or global config.""" package_manager = None if target: target_package_manager_field = target.payload.get_field('package_manager') if target_package_manager_field:
python
{ "resource": "" }
q27343
NodeTask.execute_node
train
def execute_node(self, args, workunit_name, workunit_labels=None, node_paths=None): """Executes node passing the given args. :param list args: The command line args to pass to `node`. :param string workunit_name: A name for the execution's work unit; defaults to 'node'. :param list workunit_labels: Any...
python
{ "resource": "" }
q27344
NodeTask.add_package
train
def add_package( self, target=None, package_manager=None, package=None, type_option=None, version_option=None, node_paths=None, workunit_name=None, workunit_labels=None): """Add an additional package using requested package_manager."""
python
{ "resource": "" }
q27345
NodeTask.install_module
train
def install_module( self, target=None, package_manager=None, install_optional=False, production_only=False, force=False, node_paths=None, frozen_lockfile=None, workunit_name=None, workunit_labels=None): """Installs node module using requested package_manager.""" package_manager = package_manager o...
python
{ "resource": "" }
q27346
NodeTask._execute_command
train
def _execute_command(self, command, workunit_name=None, workunit_labels=None): """Executes a node or npm command via self._run_node_distribution_command. :param NodeDistribution.Command command: The command to run. :param string workunit_name: A name for the execution's work unit; default command.executabl...
python
{ "resource": "" }
q27347
NodeTask._run_node_distribution_command
train
def _run_node_distribution_command(self, command, workunit): """Runs a NodeDistribution.Command for _execute_command and returns its return code. Passes any additional kwargs to command.run (which passes them, modified, to subprocess.Popen). Override this in a Task subclass to do something more complicated...
python
{ "resource": "" }
q27348
load_config
train
def load_config(json_path): """Load config info from a .json file and return it.""" with open(json_path, 'r') as json_file: config =
python
{ "resource": "" }
q27349
load_soups
train
def load_soups(config): """Generate BeautifulSoup AST for each page listed in config.""" soups = {} for page, path in config['sources'].items(): with open(path, 'r') as orig_file:
python
{ "resource": "" }
q27350
fixup_internal_links
train
def fixup_internal_links(config, soups): """Find href="..." links that link to pages in our docset; fix them up. We don't preserve relative paths between files as we copy-transform them from source to dest. So adjust the paths to work with new locations. """ # Pages can come from different dirs; they can go ...
python
{ "resource": "" }
q27351
transform_soups
train
def transform_soups(config, soups, precomputed): """Mutate our soups to be better when we write them out later.""" fixup_internal_links(config, soups) ensure_headings_linkable(soups) # Do
python
{ "resource": "" }
q27352
get_title
train
def get_title(soup): """Given a soup, pick out a title""" if soup.title: return soup.title.string
python
{ "resource": "" }
q27353
hdepth
train
def hdepth(tag): """Compute an h tag's "outline depth". E.g., h1 at top level is 1, h1 in a section is 2, h2 at top level is 2. """ if not _heading_re.search(tag.name): raise TaskError("Can't compute heading depth of non-heading {}".format(tag)) depth = int(tag.name[1], 10)
python
{ "resource": "" }
q27354
CoursierMixin._compute_jars_to_resolve_and_pin
train
def _compute_jars_to_resolve_and_pin(raw_jars, artifact_set, manager): """ This method provides settled lists of jar dependencies and coordinates based on conflict management. :param raw_jars: a collection of `JarDependencies` :param artifact_set: PinnedJarArtifactSet :param manager: JarDepende...
python
{ "resource": "" }
q27355
CoursierMixin.resolve
train
def resolve(self, targets, compile_classpath, sources, javadoc, executor): """ This is the core function for coursier resolve. Validation strategy: 1. All targets are going through the `invalidated` to get fingerprinted in the target level. No cache is fetched at this stage because it is disabl...
python
{ "resource": "" }
q27356
CoursierMixin._prepare_vts_results_dir
train
def _prepare_vts_results_dir(self, vts): """ Given a `VergetTargetSet`, prepare its results dir. """ vt_set_results_dir = os.path.join(self.versioned_workdir, 'results',
python
{ "resource": "" }
q27357
CoursierMixin._prepare_workdir
train
def _prepare_workdir(self): """Prepare the location in our task workdir to store all the hardlinks to coursier cache dir.""" pants_jar_base_dir =
python
{ "resource": "" }
q27358
CoursierMixin._get_result_from_coursier
train
def _get_result_from_coursier(self, jars_to_resolve, global_excludes, pinned_coords, coursier_cache_path, sources, javadoc, executor): """ Calling coursier and return the result per invocation. If coursier was called once for classifier '' and once for classifier 'tests', th...
python
{ "resource": "" }
q27359
CoursierMixin._load_json_result
train
def _load_json_result(self, conf, compile_classpath, coursier_cache_path, invalidation_check, pants_jar_path_base, result, override_classifiers=None): """ Given a coursier run result, load it into compile_classpath by target. :param compile_classpath: `ClasspathProducts` that will b...
python
{ "resource": "" }
q27360
CoursierMixin._load_from_results_dir
train
def _load_from_results_dir(self, compile_classpath, vts_results_dir, coursier_cache_path, invalidation_check, pants_jar_path_base): """ Given vts_results_dir, load the results which can be from multiple runs of coursier into compile_classpath. :return: True if success; False if...
python
{ "resource": "" }
q27361
CoursierMixin._extract_dependencies_by_root
train
def _extract_dependencies_by_root(cls, result): """ Only extracts the transitive dependencies for the given coursier resolve. Note the "dependencies" field is already transitive. Example: { "conflict_resolution": {}, "dependencies": [ { "coord": "a", "depende...
python
{ "resource": "" }
q27362
GoalRunnerFactory._determine_v1_goals
train
def _determine_v1_goals(self, address_mapper, options): """Check and populate the requested goals for a given run.""" v1_goals, ambiguous_goals, _ = options.goals_by_version requested_goals = v1_goals + ambiguous_goals spec_parser = CmdLineSpecParser(self._root_dir) for goal in requested_goals: ...
python
{ "resource": "" }
q27363
GoalRunnerFactory._roots_to_targets
train
def _roots_to_targets(self, build_graph, target_roots): """Populate the BuildGraph and target list from a set of input TargetRoots.""" with self._run_tracker.new_workunit(name='parse', labels=[WorkUnitLabel.SETUP]):
python
{ "resource": "" }
q27364
Report.log
train
def log(self, workunit, level, *msg_elements): """Log a message. Each element of msg_elements is either a message string or a (message, detail) pair. """ with self._lock:
python
{ "resource": "" }
q27365
Cobertura.initialize_instrument_classpath
train
def initialize_instrument_classpath(output_dir, settings, targets, instrumentation_classpath): """Clones the existing runtime_classpath and corresponding binaries to instrumentation specific paths. :param targets: the targets for which we should create an instrumentation_classpath entry based on their ...
python
{ "resource": "" }
q27366
NailgunProtocol.send_request
train
def send_request(cls, sock, working_dir, command, *arguments, **environment): """Send the initial Nailgun request over the specified socket.""" for argument in arguments: cls.write_chunk(sock, ChunkType.ARGUMENT, argument) for item_tuple in environment.items(): cls.write_chunk(sock, ...
python
{ "resource": "" }
q27367
NailgunProtocol.write_chunk
train
def write_chunk(cls, sock, chunk_type, payload=b''): """Write a single chunk to the connected client."""
python
{ "resource": "" }
q27368
NailgunProtocol.construct_chunk
train
def construct_chunk(cls, chunk_type, payload, encoding='utf-8'): """Construct and return a single chunk.""" if isinstance(payload, str): payload = payload.encode(encoding) elif not isinstance(payload, bytes): raise TypeError('cannot
python
{ "resource": "" }
q27369
NailgunProtocol._read_until
train
def _read_until(cls, sock, desired_size): """Read a certain amount of content from a socket before returning.""" buf = b'' while len(buf) < desired_size: recv_bytes = sock.recv(desired_size - len(buf)) if not recv_bytes:
python
{ "resource": "" }
q27370
NailgunProtocol.read_chunk
train
def read_chunk(cls, sock, return_bytes=False): """Read a single chunk from the connected client. A "chunk" is a variable-length block of data beginning with a 5-byte chunk header and followed by an optional payload. The chunk header consists of: 1) The length of the chunk's payload (not includ...
python
{ "resource": "" }
q27371
NailgunProtocol.iter_chunks
train
def iter_chunks(cls, sock, return_bytes=False, timeout_object=None): """Generates chunks from a connected socket until an Exit chunk is sent or a timeout occurs. :param sock: the socket to read from. :param bool return_bytes: If False, decode the payload into a utf-8 string. :param cls.TimeoutProvider ...
python
{ "resource": "" }
q27372
NailgunProtocol.send_stdout
train
def send_stdout(cls, sock, payload): """Send the Stdout chunk over the specified socket."""
python
{ "resource": "" }
q27373
NailgunProtocol.send_stderr
train
def send_stderr(cls, sock, payload): """Send the Stderr chunk over the specified socket."""
python
{ "resource": "" }
q27374
NailgunProtocol.send_exit
train
def send_exit(cls, sock, payload=b''): """Send the Exit chunk over the specified socket."""
python
{ "resource": "" }
q27375
NailgunProtocol.send_exit_with_code
train
def send_exit_with_code(cls, sock, code): """Send an Exit chunk over the specified socket, containing the specified return code."""
python
{ "resource": "" }
q27376
NailgunProtocol.send_pid
train
def send_pid(cls, sock, pid): """Send the PID chunk over the specified socket.""" assert(isinstance(pid, IntegerForPid) and pid > 0)
python
{ "resource": "" }
q27377
NailgunProtocol.send_pgrp
train
def send_pgrp(cls, sock, pgrp): """Send the PGRP chunk over the specified socket.""" assert(isinstance(pgrp, IntegerForPid) and pgrp < 0)
python
{ "resource": "" }
q27378
NailgunProtocol.encode_int
train
def encode_int(cls, obj): """Verify the object is an int, and ASCII-encode it. :param int obj: An integer to be encoded. :raises: :class:`TypeError` if `obj` is not an integer. :return: A binary representation of the int `obj` suitable to pass as the `payload` to send_exit(). """ i...
python
{ "resource": "" }
q27379
NailgunProtocol.isatty_to_env
train
def isatty_to_env(cls, stdin, stdout, stderr): """Generate nailgun tty capability environment variables based on checking a set of fds. :param file stdin: The stream to check for stdin tty capabilities. :param file stdout: The stream to check for stdout tty capabilities. :param file stderr: The stream ...
python
{ "resource": "" }
q27380
NailgunProtocol.isatty_from_env
train
def isatty_from_env(cls, env): """Determine whether remote file descriptors are tty capable using std nailgunned env variables. :param dict env: A dictionary representing the environment. :returns: A tuple of boolean
python
{ "resource": "" }
q27381
Engine.execute
train
def execute(self, context, goals): """Executes the supplied goals and their dependencies against the given context. :param context: The pants run context. :param list goals: A list of ``Goal`` objects representing the command line goals explicitly
python
{ "resource": "" }
q27382
JarDependency.copy
train
def copy(self, **replacements): """Returns a clone of this JarDependency with the given replacements kwargs overlaid.""" cls = type(self) kwargs = self._asdict()
python
{ "resource": "" }
q27383
JarDependency.coordinate
train
def coordinate(self): """Returns the maven coordinate of this jar. :rtype: :class:`pants.java.jar.M2Coordinate` """
python
{ "resource": "" }
q27384
AnalysisExtraction._create_products_if_should_run
train
def _create_products_if_should_run(self): """If this task should run, initialize empty products that it will populate. Returns true if the task should run. """ should_run = False if self.context.products.is_required_data('classes_by_source'): should_run = True make_products = lambda:
python
{ "resource": "" }
q27385
ScmPublishMixin.check_clean_master
train
def check_clean_master(self, commit=False): """Perform a sanity check on SCM publishing constraints. Checks for uncommitted tracked files and ensures we're on an allowed branch configured to push to an allowed server if `commit` is `True`. :param bool commit: `True` if a commit is in progress. :ra...
python
{ "resource": "" }
q27386
ScmPublishMixin.commit_pushdb
train
def commit_pushdb(self, coordinates, postscript=None): """Commit changes to the pushdb with a message containing the provided coordinates.""" self.scm.commit('pants build committing publish data for push of {coordinates}'
python
{ "resource": "" }
q27387
ScmPublishMixin.publish_pushdb_changes_to_remote_scm
train
def publish_pushdb_changes_to_remote_scm(self, pushdb_file, coordinate, tag_name, tag_message, postscript=None): """Push pushdb changes to the remote scm repository, and then tag the commit if it succeeds.""" self._add_pushdb(pushdb_file)
python
{ "resource": "" }
q27388
GoTarget.package_path
train
def package_path(cls, root, path): """Returns a normalized package path constructed from the given path and its root. A remote package path is the portion of the remote Go package's import path after the remote root path. For example, the remote import path 'https://github.com/bitly/go-simplejson' has...
python
{ "resource": "" }
q27389
GoTarget.normalize_package_path
train
def normalize_package_path(cls, package_path): """Returns a normalized version of the given package path. The root package might by denoted by '' or '.' and is normalized to ''. All other packages are of the form 'path' or 'path/subpath', etc. If the given path is either absolute or relative (include...
python
{ "resource": "" }
q27390
_StoppableDaemonThread.join
train
def join(self, timeout=None): """Joins with a default timeout exposed
python
{ "resource": "" }
q27391
NailgunStreamWriter.open
train
def open(cls, sock, chunk_type, isatty, chunk_eof_type=None, buf_size=None, select_timeout=None): """Yields the write side of a pipe that will copy appropriately chunked values to a socket."""
python
{ "resource": "" }
q27392
NailgunStreamWriter.open_multi
train
def open_multi(cls, sock, chunk_types, isattys, chunk_eof_type=None, buf_size=None, select_timeout=None): """Yields the write sides of pipes that will copy appropriately chunked values to the socket.""" cls._assert_aligned(chunk_types, isattys) # N.B. This is purely to permit safe handling...
python
{ "resource": "" }
q27393
CacheKey.combine_cache_keys
train
def combine_cache_keys(cls, cache_keys): """Returns a cache key for a list of target sets that already have cache keys. This operation is 'idempotent' in the sense that if cache_keys contains a single key then that key is returned. Note that this operation is commutative but not associative. We use t...
python
{ "resource": "" }
q27394
BuildInvalidator.previous_key
train
def previous_key(self, cache_key): """If there was a previous successful build for the given key, return the previous key. :param cache_key: A CacheKey object (as returned by CacheKeyGenerator.key_for(). :returns: The previous cache_key, or None if there was not a previous build. """ if not self.ca...
python
{ "resource": "" }
q27395
BuildInvalidator.needs_update
train
def needs_update(self, cache_key): """Check if the given cached item is invalid. :param cache_key: A CacheKey object (as returned by CacheKeyGenerator.key_for().
python
{ "resource": "" }
q27396
BuildInvalidator.force_invalidate
train
def force_invalidate(self, cache_key): """Force-invalidate the cached item.""" try: if self.cacheable(cache_key):
python
{ "resource": "" }
q27397
PackageManager.run_command
train
def run_command(self, args=None, node_paths=None): """Returns a command that when executed will run an arbitury command
python
{ "resource": "" }
q27398
PackageManager.install_module
train
def install_module( self, install_optional=False, production_only=False, force=False, frozen_lockfile=True, node_paths=None): """Returns a command that when executed will install node package. :param install_optional: True to install optional dependencies. :param production_only: Tr...
python
{ "resource": "" }
q27399
PackageManager.run_script
train
def run_script(self, script_name, script_args=None, node_paths=None): """Returns a command to execute a package.json script. :param script_name: Name of the script to name. Note that script name 'test' can be used to run node tests. :param script_args: Args to be passed to package.json script. :...
python
{ "resource": "" }