_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q27900
Depmap._dep_id
train
def _dep_id(self, dependency): """Returns a tuple of dependency_id, is_internal_dep.""" params = dict(sep=self.separator) if isinstance(dependency, JarDependency): # TODO(kwilson): handle 'classifier' and 'type'. params.update(org=dependency.org, name=dependency.name, rev=dependency.rev) ...
python
{ "resource": "" }
q27901
Depmap._output_dependency_tree
train
def _output_dependency_tree(self, target): """Plain-text depmap output handler.""" def make_line(dep, indent, is_dupe=False): indent_join, indent_chars = ('--', ' |') if self.should_tree else ('', ' ') dupe_char = '*' if is_dupe else '' return ''.join((indent * indent_chars, indent_join, du...
python
{ "resource": "" }
q27902
Depmap._output_digraph
train
def _output_digraph(self, target): """Graphviz format depmap output handler.""" color_by_type = {} def maybe_add_type(dep, dep_id): """Add a class type to a dependency id if --show-types is passed.""" return dep_id if not self.show_types else '\\n'.join((dep_id, dep.__class__.__name__)) de...
python
{ "resource": "" }
q27903
_algebraic_data
train
def _algebraic_data(metaclass): """A class decorator to pull out `_list_fields` from a mixin class for use with a `datatype`.""" def wrapper(cls):
python
{ "resource": "" }
q27904
_ExtensibleAlgebraic.prepend_field
train
def prepend_field(self, field_name, list_value): """Return a copy of this object with `list_value` prepended to the field named `field_name`."""
python
{ "resource": "" }
q27905
_ExtensibleAlgebraic.append_field
train
def append_field(self, field_name, list_value): """Return a copy of this object with `list_value` appended to the field named `field_name`."""
python
{ "resource": "" }
q27906
_ExtensibleAlgebraic.sequence
train
def sequence(self, other, exclude_list_fields=None): """Return a copy of this object which combines all the fields common to both `self` and `other`. List fields will be concatenated. The return type of this method is the type of `self` (or whatever `.copy()` returns), but the `other` argument can be ...
python
{ "resource": "" }
q27907
_Executable.invocation_environment_dict
train
def invocation_environment_dict(self): """A dict to use as this _Executable's execution environment. This isn't made into an "algebraic" field because its contents (the keys of the dict) are generally known to the specific class which is overriding this property. Implementations of this property can th...
python
{ "resource": "" }
q27908
LibcDev._get_host_libc_from_host_compiler
train
def _get_host_libc_from_host_compiler(self): """Locate the host's libc-dev installation using a specified host compiler's search dirs.""" compiler_exe = self.get_options().host_compiler # Implicitly, we are passing in the environment of the executing pants process to # `get_compiler_library_dirs()`. ...
python
{ "resource": "" }
q27909
RewriteBase.execute
train
def execute(self): """Runs the tool on all source files that are located.""" relevant_targets = self._get_non_synthetic_targets(self.get_targets()) if self.sideeffecting: # Always execute sideeffecting tasks
python
{ "resource": "" }
q27910
NodeDistribution._install_node
train
def _install_node(self): """Install the Node distribution from pants support binaries. :returns: The Node distribution bin path. :rtype: string """ node_package_path = self.select() # Todo: https://github.com/pantsbuild/pants/issues/4431 # This line depends on repacked node distribution. ...
python
{ "resource": "" }
q27911
NodeDistribution._install_yarnpkg
train
def _install_yarnpkg(self): """Install the Yarnpkg distribution from pants support binaries. :returns: The Yarnpkg distribution bin path. :rtype: string """ yarnpkg_package_path =
python
{ "resource": "" }
q27912
NodeDistribution.node_command
train
def node_command(self, args=None, node_paths=None): """Creates a command that can run `node`, passing the given args to it. :param list args: An optional list of arguments to pass to `node`. :param list node_paths: An optional list of paths to node_modules. :returns: A `node` command that can be run la...
python
{ "resource": "" }
q27913
NodeDistribution.eslint_supportdir
train
def eslint_supportdir(self, task_workdir): """ Returns the path where the ESLint is bootstrapped. :param string task_workdir: The task's working directory :returns: The path where ESLint is bootstrapped and whether or not it is configured :rtype: (string, bool) """ bootstrapped_support_path = o...
python
{ "resource": "" }
q27914
GoRemoteLibrary.remote_root
train
def remote_root(self): """The remote package root prefix portion of the the full `import_path`"""
python
{ "resource": "" }
q27915
GoRemoteLibrary.import_path
train
def import_path(self): """The full remote import path as used in import statements in `.go` source files.""" return
python
{ "resource": "" }
q27916
JvmDependencyUsage.create_dep_usage_graph
train
def create_dep_usage_graph(self, targets): """Creates a graph of concrete targets, with their sum of products and dependencies. Synthetic targets contribute products and dependencies to their concrete target. """ with self.invalidated(targets, invalidate_dependents=True) as in...
python
{ "resource": "" }
q27917
JvmDependencyUsage.calculating_node_creator
train
def calculating_node_creator(self, classes_by_source, runtime_classpath, product_deps_by_src, target_to_vts): """Strategy directly computes dependency graph node based on `classes_by_source`, `runtime_classpath`, `product_deps_by_src` parameters and stores the result to the bu...
python
{ "resource": "" }
q27918
JvmDependencyUsage.cached_node_creator
train
def cached_node_creator(self, target_to_vts): """Strategy restores dependency graph node from the build cache. """ def creator(target): vt = target_to_vts[target] if vt.valid and os.path.exists(self.nodes_json(vt.results_dir)): try: with open(self.nodes_json(vt.results_dir), 'r...
python
{ "resource": "" }
q27919
DependencyUsageGraph.to_summary
train
def to_summary(self): """Outputs summarized dependencies ordered by a combination of max usage and cost.""" # Aggregate inbound edges by their maximum product usage ratio. max_target_usage = defaultdict(lambda: 0.0) for target, node in self._nodes.items(): for dep_target, edge in node.dep_edges.i...
python
{ "resource": "" }
q27920
DependencyUsageGraph.to_json
train
def to_json(self): """Outputs the entire graph.""" res_dict = {} def gen_dep_edge(node, edge, dep_tgt, aliases): return { 'target': dep_tgt.address.spec, 'dependency_type': self._edge_type(node.concrete_target, edge, dep_tgt), 'products_used': len(edge.products_used), ...
python
{ "resource": "" }
q27921
rst_to_html
train
def rst_to_html(in_rst, stderr): """Renders HTML from an RST fragment. :param string in_rst: An rst formatted string. :param stderr: An open stream to use for docutils stderr output. :returns: A tuple of (html rendered rst, return code) """ if not in_rst: return '', 0 # Unfortunately, docutils is re...
python
{ "resource": "" }
q27922
SubsystemDependency.options_scope
train
def options_scope(self): """The subscope for options of `subsystem_cls` scoped to `scope`. This is the scope that option values are read from when initializing the instance indicated by this dependency. """
python
{ "resource": "" }
q27923
SubsystemClientMixin.subsystem_dependencies_iter
train
def subsystem_dependencies_iter(cls): """Iterate over the direct subsystem dependencies of this Optionable.""" for dep in cls.subsystem_dependencies(): if isinstance(dep, SubsystemDependency): yield
python
{ "resource": "" }
q27924
SubsystemClientMixin.subsystem_closure_iter
train
def subsystem_closure_iter(cls): """Iterate over the transitive closure of subsystem dependencies of this Optionable. :rtype: :class:`collections.Iterator` of :class:`SubsystemDependency` :raises: :class:`pants.subsystem.subsystem_client_mixin.SubsystemClientMixin.CycleException` if a dependen...
python
{ "resource": "" }
q27925
SubsystemClientMixin.known_scope_infos
train
def known_scope_infos(cls): """Yield ScopeInfo for all known scopes for this optionable, in no particular order. :rtype: set of :class:`pants.option.scope.ScopeInfo` :raises: :class:`pants.subsystem.subsystem_client_mixin.SubsystemClientMixin.CycleException` if a dependency cycle is detected. ...
python
{ "resource": "" }
q27926
PexBuilderWrapper.extract_single_dist_for_current_platform
train
def extract_single_dist_for_current_platform(self, reqs, dist_key): """Resolve a specific distribution from a set of requirements matching the current platform. :param list reqs: A list of :class:`PythonRequirement` to resolve. :param str dist_key: The value of `distribution.key` to match for a `distributi...
python
{ "resource": "" }
q27927
NodeModule.bin_executables
train
def bin_executables(self): """A normalized map of bin executable names and local path to an executable :rtype: dict """ if isinstance(self.payload.bin_executables, string_types):
python
{ "resource": "" }
q27928
Fetcher.fetch
train
def fetch(self, url, listener, chunk_size_bytes=None, timeout_secs=None): """Fetches data from the given URL notifying listener of all lifecycle events. :param string url: the url to GET data from :param listener: the listener to notify of all download lifecycle events :param chunk_size_bytes: the chun...
python
{ "resource": "" }
q27929
Fetcher.download
train
def download(self, url, listener=None, path_or_fd=None, chunk_size_bytes=None, timeout_secs=None): """Downloads data from the given URL. By default data is downloaded to a temporary file. :param string url: the url to GET data from :param listener: an optional listener to notify of all download lifecy...
python
{ "resource": "" }
q27930
NailgunProcessGroup.killall
train
def killall(self, everywhere=False): """Kills all nailgun servers started by pants. :param bool everywhere: If ``True``, kills all pants-started nailguns on this machine; otherwise restricts the nailguns killed to those started for the
python
{ "resource": "" }
q27931
NailgunExecutor._fingerprint
train
def _fingerprint(jvm_options, classpath, java_version): """Compute a fingerprint for this invocation of a Java task. :param list jvm_options: JVM options passed to the java invocation :param list classpath: The -cp arguments passed to the java invocation :param Revision java_version: return va...
python
{ "resource": "" }
q27932
NailgunExecutor._await_socket
train
def _await_socket(self, timeout): """Blocks for the nailgun subprocess to bind and emit a listening port in the nailgun stdout.""" with safe_open(self._ng_stdout, 'r') as ng_stdout: start_time = time.time() accumulated_stdout = '' while 1: # TODO: share the decreasing timeout logic her...
python
{ "resource": "" }
q27933
NailgunExecutor.ensure_connectable
train
def ensure_connectable(self, nailgun): """Ensures that a nailgun client is connectable or raises NailgunError.""" attempt_count = 1 while 1: try: with closing(nailgun.try_connect()) as sock: logger.debug('Verified new ng server is connectable at {}'.format(sock.getpeername())) ...
python
{ "resource": "" }
q27934
NailgunExecutor._spawn_nailgun_server
train
def _spawn_nailgun_server(self, fingerprint, jvm_options, classpath, stdout, stderr, stdin): """Synchronously spawn a new nailgun server.""" # Truncate the nailguns stdout & stderr. safe_file_dump(self._ng_stdout, b'', mode='wb') safe_file_dump(self._ng_stderr, b'', mode='wb') jvm_options = jvm_opt...
python
{ "resource": "" }
q27935
XmlParser._parse
train
def _parse(cls, xml_path): """Parse .xml file and return parsed text as a DOM Document. :param string xml_path: File path of xml file to be parsed. :returns xml.dom.minidom.Document parsed_xml: Document instance containing parsed xml. """ try: parsed_xml = parse(xml_path) # Minidom is a f...
python
{ "resource": "" }
q27936
XmlParser.from_file
train
def from_file(cls, xml_path): """Parse .xml file and create a XmlParser object.""" try: parsed_xml = cls._parse(xml_path)
python
{ "resource": "" }
q27937
XmlParser.get_attribute
train
def get_attribute(self, element, attribute): """Retrieve the value of an attribute that is contained by the tag element. :param string element: Name of an xml element. :param string attribute: Name of the attribute that is to be returned. :return: Desired attribute value. :rtype: string """ ...
python
{ "resource": "" }
q27938
XmlParser.get_optional_attribute
train
def get_optional_attribute(self, element, attribute): """Attempt to retrieve an optional attribute from the xml and return None on failure.""" try:
python
{ "resource": "" }
q27939
RankedValue.get_rank_value
train
def get_rank_value(cls, name): """Returns the integer constant value for the given rank name. :param string rank: the string rank name (E.g., 'HARDCODED'). :returns: the integer constant value of the rank.
python
{ "resource": "" }
q27940
RankedValue.prioritized_iter
train
def prioritized_iter(cls, flag_val, env_val, config_val, config_default_val, hardcoded_val, default): """Yield the non-None values from highest-ranked to lowest, wrapped in RankedValue instances.""" if flag_val is not None: yield RankedValue(cls.FLAG, flag_val) if env_val is not...
python
{ "resource": "" }
q27941
call_use_cached_files
train
def call_use_cached_files(tup): """Importable helper for multi-proc calling of ArtifactCache.use_cached_files on a cache instance. Multiprocessing map/apply/etc require functions which can be imported, not bound methods. To call a bound method, instead call a helper like this and pass tuple of the instance and a...
python
{ "resource": "" }
q27942
call_insert
train
def call_insert(tup): """Importable helper for multi-proc calling of ArtifactCache.insert on an ArtifactCache instance. See docstring on call_use_cached_files explaining why this is useful. :param tup: A 4-tuple of an ArtifactCache and the 3 args passed to ArtifactCache.insert: eg (some_cache_inst...
python
{ "resource": "" }
q27943
ArtifactCache.insert
train
def insert(self, cache_key, paths, overwrite=False): """Cache the output of a build. By default, checks cache.has(key) first, only proceeding to create and insert an artifact if it is not already in the cache (though `overwrite` can be used to skip the check and unconditionally insert). :param Cac...
python
{ "resource": "" }
q27944
LineOriented.line_oriented
train
def line_oriented(cls, line_oriented_options, console): """Given Goal.Options and a Console, yields functions for writing to stdout and stderr, respectively. The passed options instance will generally be the `Goal.Options` of a `LineOriented` `Goal`. """ if type(line_oriented_options) != cls.Options: ...
python
{ "resource": "" }
q27945
Goal.register
train
def register(cls, name, description, options_registrar_cls=None): """Register a goal description. Otherwise the description must be set when registering some task on the goal, which is clunky, and dependent on things like registration order of tasks in the goal. A goal that isn't explicitly registered...
python
{ "resource": "" }
q27946
Goal.by_name
train
def by_name(cls, name): """Returns the unique object representing the goal of the specified name. :API: public """ if name
python
{ "resource": "" }
q27947
Goal.all
train
def all(): """Returns all active registered goals, sorted alphabetically by name. :API: public """ return
python
{ "resource": "" }
q27948
Goal.subsystems
train
def subsystems(cls): """Returns all subsystem types used by all tasks, in no particular order. :API: public """ ret
python
{ "resource": "" }
q27949
_Goal.install
train
def install(self, task_registrar, first=False, replace=False, before=None, after=None): """Installs the given task in this goal. The placement of the task in this goal's execution list defaults to the end but its position can be influenced by specifying exactly one of the following arguments: first: P...
python
{ "resource": "" }
q27950
_Goal.uninstall_task
train
def uninstall_task(self, name): """Removes the named task from this goal. Allows external plugins to modify the execution plan. Use with caution. Note: Does not relax a serialization requirement that originated from the uninstalled task's install() call. :API: public """ if name in self._...
python
{ "resource": "" }
q27951
_Goal.subsystems
train
def subsystems(self): """Returns all subsystem types used by tasks in this goal, in no particular order.""" ret = set() for task_type in self.task_types():
python
{ "resource": "" }
q27952
Options.complete_scopes
train
def complete_scopes(cls, scope_infos): """Expand a set of scopes to include all enclosing scopes. E.g., if the set contains `foo.bar.baz`, ensure that it also contains `foo.bar` and `foo`. Also adds any deprecated scopes. """ ret = {GlobalOptionsRegistrar.get_scope_info()} original_scopes = di...
python
{ "resource": "" }
q27953
Options.create
train
def create(cls, env, config, known_scope_infos, args=None, bootstrap_option_values=None): """Create an Options instance. :param env: a dict of environment variables. :param :class:`pants.option.config.Config` config: data from a config file. :param known_scope_infos: ScopeInfos for all scopes that may ...
python
{ "resource": "" }
q27954
Options.drop_flag_values
train
def drop_flag_values(self): """Returns a copy of these options that ignores values specified via flags. Any pre-cached option values are cleared and only option values that come from option defaults, the config or the environment are used. """ # An empty scope_to_flags to force all values to come v...
python
{ "resource": "" }
q27955
Options.register
train
def register(self, scope, *args, **kwargs): """Register an option in the given scope.""" self._assert_not_frozen() self.get_parser(scope).register(*args,
python
{ "resource": "" }
q27956
Options.registration_function_for_optionable
train
def registration_function_for_optionable(self, optionable_class): """Returns a function for registering options on the given scope.""" self._assert_not_frozen() # TODO(benjy): Make this an instance of a class that implements __call__, so we can # docstring it, and so it's less weird than attatching prop...
python
{ "resource": "" }
q27957
Options._check_and_apply_deprecations
train
def _check_and_apply_deprecations(self, scope, values): """Checks whether a ScopeInfo has options specified in a deprecated scope. There are two related cases here. Either: 1) The ScopeInfo has an associated deprecated_scope that was replaced with a non-deprecated scope, meaning that the options...
python
{ "resource": "" }
q27958
Options.for_scope
train
def for_scope(self, scope, inherit_from_enclosing_scope=True): """Return the option values for the given scope. Values are attributes of the returned object, e.g., options.foo. Computed lazily per scope. :API: public """ # First get enclosing scope's option values, if any. if scope == GLO...
python
{ "resource": "" }
q27959
OptionTracker.record_option
train
def record_option(self, scope, option, value, rank, deprecation_version=None, details=None): """Records that the given option was set to the given value. :param string scope: scope of the option. :param string option: name of the option. :param string value: value the option was set to. :param int ...
python
{ "resource": "" }
q27960
FingerprintStrategy.fingerprint_target
train
def fingerprint_target(self, target): """Consumers of subclass instances call this to get a fingerprint labeled with the name""" fingerprint = self.compute_fingerprint(target) if fingerprint:
python
{ "resource": "" }
q27961
UnpackWheelsFingerprintStrategy.compute_fingerprint
train
def compute_fingerprint(self, target): """UnpackedWheels targets need to be re-unpacked if any of its configuration changes or any of the jars they import have changed. """ if isinstance(target, UnpackedWheels):
python
{ "resource": "" }
q27962
UnpackWheels._get_matching_wheel
train
def _get_matching_wheel(self, pex_path, interpreter, requirements, module_name): """Use PexBuilderWrapper to resolve a single wheel from the requirement specs using pex.""" with self.context.new_workunit('extract-native-wheels'):
python
{ "resource": "" }
q27963
Exiter.exit
train
def exit(self, result=PANTS_SUCCEEDED_EXIT_CODE, msg=None, out=None): """Exits the runtime. :param result: The exit status. Typically either PANTS_SUCCEEDED_EXIT_CODE or PANTS_FAILED_EXIT_CODE, but can be a string as well. (Optional) :param msg: A string message to print to stderr or ano...
python
{ "resource": "" }
q27964
Exiter.exit_and_fail
train
def exit_and_fail(self, msg=None, out=None): """Exits the runtime with a nonzero exit code, indicating failure. :param msg: A string message to print to
python
{ "resource": "" }
q27965
ResponseParser.parse
train
def parse(self, content): """Parse raw response content for a list of remote artifact cache URLs. :API: public """ if self.format == 'json_map': try: return assert_list(json.loads(content.decode(self.encoding))[self.index]) except (KeyError, UnicodeDecodeError, ValueError) as e: ...
python
{ "resource": "" }
q27966
ExecutionGraph._compute_job_priorities
train
def _compute_job_priorities(self, job_list): """Walks the dependency graph breadth-first, starting from the most dependent tasks, and computes the job priority as the sum of the jobs sizes along the critical path.""" job_size = {job.key: job.size for job in job_list} job_priority = defaultdict(int) ...
python
{ "resource": "" }
q27967
JvmPlatform.preferred_jvm_distribution
train
def preferred_jvm_distribution(cls, platforms, strict=False): """Returns a jvm Distribution with a version that should work for all the platforms. Any one of those distributions whose version is >= all requested platforms' versions can be returned unless strict flag is set. :param iterable platforms: ...
python
{ "resource": "" }
q27968
JvmPlatform.get_platform_by_name
train
def get_platform_by_name(self, name, for_target=None): """Finds the platform with the given name. If the name is empty or None, returns the default platform. If not platform with the given name is defined, raises an error. :param str name: name of the platform. :param JvmTarget for_target: optional...
python
{ "resource": "" }
q27969
JvmPlatform.get_platform_for_target
train
def get_platform_for_target(self, target): """Find the platform associated with this target. :param JvmTarget target: target to query. :return: The jvm platform object. :rtype: JvmPlatformSettings
python
{ "resource": "" }
q27970
Serializable.is_serializable
train
def is_serializable(obj): """Return `True` if the given object conforms to the Serializable protocol. :rtype: bool """ if inspect.isclass(obj):
python
{ "resource": "" }
q27971
Serializable.is_serializable_type
train
def is_serializable_type(type_): """Return `True` if the given type's instances conform to the Serializable protocol. :rtype: bool """ if not
python
{ "resource": "" }
q27972
HelpFormatter.format_options
train
def format_options(self, scope, description, option_registrations_iter): """Return a help message for the specified options. :param option_registrations_iter: An iterator over (args, kwargs) pairs, as passed in to options registration. """ oshi = HelpInfoExtracter(...
python
{ "resource": "" }
q27973
HelpFormatter.format_option
train
def format_option(self, ohi): """Format the help output for a single option. :param OptionHelpInfo ohi: Extracted information for option to print :return: Formatted help text for this option :rtype: list of string """ lines = [] choices = 'one of: [{}] '.format(ohi.choices) if ohi.choices e...
python
{ "resource": "" }
q27974
pants_setup_py
train
def pants_setup_py(name, description, additional_classifiers=None, **kwargs): """Creates the setup_py for a pants artifact. :param str name: The name of the package. :param str description: A brief description of what the package provides. :param list additional_classifiers: Any additional trove classifiers th...
python
{ "resource": "" }
q27975
contrib_setup_py
train
def contrib_setup_py(name, description, additional_classifiers=None, **kwargs): """Creates the setup_py for a pants contrib plugin artifact. :param str name: The name of the package; must start with 'pantsbuild.pants.contrib.'. :param str description: A brief description of what the plugin provides. :param lis...
python
{ "resource": "" }
q27976
PantsReleases._branch_name
train
def _branch_name(cls, version): """Defines a mapping between versions and branches. In particular, `-dev` suffixed releases always live on master. Any other (modern) release lives in a branch. """ suffix = version.public[len(version.base_version):] components = version.base_version.split('.') +...
python
{ "resource": "" }
q27977
PantsReleases.notes_for_version
train
def notes_for_version(self, version): """Given the parsed Version of pants, return its release notes. TODO: This method should parse out the specific version from the resulting file: see https://github.com/pantsbuild/pants/issues/1708
python
{ "resource": "" }
q27978
JarLibrary.managed_dependencies
train
def managed_dependencies(self): """The managed_jar_dependencies target this jar_library specifies, or None. :API: public """ if self.payload.managed_dependencies: address = Address.parse(self.payload.managed_dependencies,
python
{ "resource": "" }
q27979
BuildConfigInitializer.setup
train
def setup(self): """Load backends and plugins. :returns: A `BuildConfiguration` object constructed during backend/plugin loading. """ return self._load_plugins( self._working_set,
python
{ "resource": "" }
q27980
OptionsInitializer._construct_options
train
def _construct_options(options_bootstrapper, build_configuration): """Parse and register options. :returns: An Options object representing the full set of runtime options. """ # Now that plugins and backends are loaded, we can gather the known scopes. # Gather the optionables that are not scoped t...
python
{ "resource": "" }
q27981
create_filters
train
def create_filters(predicate_params, predicate_factory): """Create filter functions from a list of string parameters. :param predicate_params: A list of predicate_param arguments as in `create_filter`. :param predicate_factory: As in `create_filter`. """ filters =
python
{ "resource": "" }
q27982
create_filter
train
def create_filter(predicate_param, predicate_factory): """Create a filter function from a string parameter. :param predicate_param: Create a filter for this param string. Each string is a comma-separated list of arguments to the predicate_factory. If the entire c...
python
{ "resource": "" }
q27983
wrap_filters
train
def wrap_filters(filters): """Returns a single filter that short-circuit ANDs the specified filters. :API: public """ def combined_filter(x): for filt in
python
{ "resource": "" }
q27984
AppBase.binary
train
def binary(self): """Returns the binary this target references.""" dependencies = self.dependencies if len(dependencies) != 1: raise TargetDefinitionException(self, 'An app must define exactly one binary ' 'dependency, have: {}'.format(dependencies)) bin...
python
{ "resource": "" }
q27985
UnionProducts.copy
train
def copy(self): """Returns a copy of this UnionProducts. Edits to the copy's mappings will not affect the product mappings in the original. The copy is shallow though, so edits to the copy's product values will mutate the original's product values. :API: public :rtype: :class:`UnionProducts` ...
python
{ "resource": "" }
q27986
UnionProducts.add_for_targets
train
def add_for_targets(self, targets, products): """Updates the products for the given targets, adding to existing entries. :API: public """ # TODO:
python
{ "resource": "" }
q27987
UnionProducts.remove_for_target
train
def remove_for_target(self, target, products): """Updates the products for a particular target, removing the given existing entries. :API: public :param target: The target to remove the products for.
python
{ "resource": "" }
q27988
UnionProducts.get_for_targets
train
def get_for_targets(self, targets): """Gets the union of the products for the given targets, preserving the input order. :API: public """ products
python
{ "resource": "" }
q27989
UnionProducts.get_product_target_mappings_for_targets
train
def get_product_target_mappings_for_targets(self, targets): """Gets the product-target associations for the given targets, preserving the input order. :API: public :param targets: The targets to lookup
python
{ "resource": "" }
q27990
UnionProducts.target_for_product
train
def target_for_product(self, product): """Looks up the target key for a product. :API: public :param product: The product to search for :return: None if there is no target for the product
python
{ "resource": "" }
q27991
Products.register_data
train
def register_data(self, typename, value): """Registers a data product, raising if a product was already registered. :API: public :param typename: The type of product to register a value for. :param value: The data product to register under `typename`. :returns: The registered `value`. :raises:...
python
{ "resource": "" }
q27992
Products.get_data
train
def get_data(self, typename, init_func=None): """Returns a data product. :API: public If the product isn't found, returns None, unless init_func is set, in which case the product's
python
{ "resource": "" }
q27993
Products.get_only
train
def get_only(self, product_type, target): """If there is exactly one product for the given product type and target, returns the full filepath of said product. Otherwise, raises a ProductError. Useful for retrieving the filepath for the executable of a binary target. :API: public """ produ...
python
{ "resource": "" }
q27994
PythonAWSLambda.binary
train
def binary(self): """Returns the binary that builds the pex for this lambda.""" dependencies = self.dependencies if len(dependencies) != 1: raise TargetDefinitionException(self, 'An app must define exactly one binary '
python
{ "resource": "" }
q27995
load_backends_and_plugins
train
def load_backends_and_plugins(plugins, working_set, backends, build_configuration=None): """Load named plugins and source backends :param list<str> plugins: Plugins to load (see `load_plugins`). Plugins are loaded after backends. :param WorkingSet working_set: A pkg_resources.WorkingSet to load plugins from...
python
{ "resource": "" }
q27996
load_plugins
train
def load_plugins(build_configuration, plugins, working_set): """Load named plugins from the current working_set into the supplied build_configuration "Loading" a plugin here refers to calling registration methods -- it is assumed each plugin is already on the path and an error will be thrown if it is not. Plugin...
python
{ "resource": "" }
q27997
load_build_configuration_from_source
train
def load_build_configuration_from_source(build_configuration, backends=None): """Installs pants backend packages to provide BUILD file symbols and cli goals. :param BuildConfiguration build_configuration: The BuildConfiguration (for adding aliases). :param backends: An optional list of additional packages to loa...
python
{ "resource": "" }
q27998
load_backend
train
def load_backend(build_configuration, backend_package): """Installs the given backend package into the build configuration. :param build_configuration the :class:``pants.build_graph.build_configuration.BuildConfiguration`` to install the backend plugin into. :param string backend_package: the package name co...
python
{ "resource": "" }
q27999
TargetAdaptor.get_sources
train
def get_sources(self): """Returns target's non-deferred sources if exists or the default sources if defined. :rtype: :class:`GlobsWithConjunction` NB: once ivy is implemented in the engine, we can fetch sources natively here, and/or refactor how deferred sources are implemented. see: https://git...
python
{ "resource": "" }