_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q245000 | MOFWBEMConnection.GetClass | train | def GetClass(self, *args, **kwargs):
"""Retrieve a CIM class from the local repository of this class.
For a description of the parameters, see
:meth:`pywbem.WBEMConnection.GetClass`.
"""
cname = args[0] if args else kwargs['ClassName']
try:
cc = self.classes... | python | {
"resource": ""
} |
q245001 | MOFWBEMConnection.EnumerateQualifiers | train | def EnumerateQualifiers(self, *args, **kwargs):
"""Enumerate the qualifier types in the local repository of this class.
For a description of the parameters, see
:meth:`pywbem.WBEMConnection.EnumerateQualifiers`.
"""
if self.conn is not None:
rv | python | {
"resource": ""
} |
q245002 | MOFWBEMConnection.GetQualifier | train | def GetQualifier(self, *args, **kwargs):
"""Retrieve a qualifier type from the local repository of this class.
For a description of the parameters, see
:meth:`pywbem.WBEMConnection.GetQualifier`.
"""
qualname = args[0] if args else kwargs['QualifierName']
try:
... | python | {
"resource": ""
} |
q245003 | MOFWBEMConnection.SetQualifier | train | def SetQualifier(self, *args, **kwargs):
"""Create or modify a qualifier type in the local repository of this
class.
For a description of the parameters, see
:meth:`pywbem.WBEMConnection.SetQualifier`.
"""
qual = args[0] if args else kwargs['QualifierDeclaration']
... | python | {
"resource": ""
} |
q245004 | MOFWBEMConnection.rollback | train | def rollback(self, verbose=False):
"""
Remove classes and instances from the underlying repository, that have
been created in the local repository of this class.
Limitation: At this point, only classes and instances will be removed,
but not qualifiers.
"""
for ns... | python | {
"resource": ""
} |
q245005 | MOFCompiler.compile_string | train | def compile_string(self, mof, ns, filename=None):
"""
Compile a string of MOF statements into a namespace of the associated
CIM repository.
Parameters:
mof (:term:`string`):
The string of MOF statements to be compiled.
ns (:term:`string`):
T... | python | {
"resource": ""
} |
q245006 | MOFCompiler.compile_file | train | def compile_file(self, filename, ns):
"""
Compile a MOF file into a namespace of the associated CIM repository.
Parameters:
filename (:term:`string`):
The path name of the MOF file containing the MOF statements to be
compiled.
ns (:term:`string`):
... | python | {
"resource": ""
} |
q245007 | MOFCompiler.find_mof | train | def find_mof(self, classname):
"""
Find the MOF file that defines a particular CIM class, in the search
path of the MOF compiler.
The MOF file is found based on its file name: It is assumed that the
base part of the file name is the CIM class name.
Example: The class "C... | python | {
"resource": ""
} |
q245008 | configure_loggers_from_string | train | def configure_loggers_from_string(log_configuration_str,
log_filename=DEFAULT_LOG_FILENAME,
connection=None, propagate=False):
# pylint: disable=line-too-long
"""
Configure the pywbem loggers and optionally activate WBEM connections for
... | python | {
"resource": ""
} |
q245009 | display_paths | train | def display_paths(instances, type_str):
"""Display the count and paths for the list of instances in instances."""
print('%ss: count=%s' | python | {
"resource": ""
} |
q245010 | get_default_ca_certs | train | def get_default_ca_certs():
"""
Try to find out system path with ca certificates. This path is cached and
returned. If no path is found out, None is returned.
"""
# pylint: disable=protected-access
if not hasattr(get_default_ca_certs, '_path'):
for path in get_default_ca_cert_paths():
... | python | {
"resource": ""
} |
q245011 | get_cimobject_header | train | def get_cimobject_header(obj):
"""
Return the value for the CIM-XML extension header field 'CIMObject', using
the given object.
This function implements the rules defined in DSP0200 section 6.3.7
"CIMObject". The format of the CIMObject value is similar but not identical
to a local WBEM URI (on... | python | {
"resource": ""
} |
q245012 | print_profile_info | train | def print_profile_info(org_vm, inst):
"""Print the registered org, name, version for the profile defined by
inst
| python | {
"resource": ""
} |
q245013 | explore_server | train | def explore_server(server_url, username, password):
""" Demo of exploring a cim server for characteristics defined by
the server class
"""
print("WBEM server URL:\n %s" % server_url)
conn = WBEMConnection(server_url, (username, password),
no_verification=True)
se... | python | {
"resource": ""
} |
q245014 | WBEMServer.create_namespace | train | def create_namespace(self, namespace):
"""
Create the specified CIM namespace in the WBEM server and
update this WBEMServer object to reflect the new namespace
there.
This method attempts the following approaches for creating the
namespace, in order, until an approach su... | python | {
"resource": ""
} |
q245015 | WBEMServer.delete_namespace | train | def delete_namespace(self, namespace):
"""
Delete the specified CIM namespace in the WBEM server and
update this WBEMServer object to reflect the removed namespace
there.
The specified namespace must be empty (i.e. must not contain any
classes, instances, or qualifier ty... | python | {
"resource": ""
} |
q245016 | WBEMServer._traverse | train | def _traverse(self, start_paths, traversal_path):
"""
Traverse a multi-hop traversal path from a list of start instance
paths, and return the resulting list of instance paths.
Parameters:
start_paths (list of CIMInstanceName): Instance paths to start
traversal from... | python | {
"resource": ""
} |
q245017 | WBEMServer._validate_interop_ns | train | def _validate_interop_ns(self, interop_ns):
"""
Validate whether the specified Interop namespace exists in the WBEM
server, by communicating with it.
If the specified Interop namespace exists, this method sets the
:attr:`interop_ns` property of this object to that namespace and
... | python | {
"resource": ""
} |
q245018 | WBEMServer._determine_profiles | train | def _determine_profiles(self):
"""
Determine the WBEM management profiles advertised by the WBEM server,
by communicating with it and enumerating the instances of
`CIM_RegisteredProfile`.
If the profiles could be determined, this method sets the
:attr:`profiles` property... | python | {
"resource": ""
} |
q245019 | _represent_undefined | train | def _represent_undefined(self, data):
"""Raises flag for objects that cannot be represented"""
raise RepresenterError(
_format("Cannot represent an object: {0!A} of type: {1}; "
"yaml_representers: {2!A}, "
| python | {
"resource": ""
} |
q245020 | BaseOperationRecorder.open_file | train | def open_file(filename, file_mode='w'):
"""
A static convenience function that performs the open of the recorder
file correctly for different versions of Python.
*New in pywbem 0.10.*
This covers the issue where the file should be opened in text mode but
that is done di... | python | {
"resource": ""
} |
q245021 | BaseOperationRecorder.reset | train | def reset(self, pull_op=None):
"""Reset all the attributes in the class. This also allows setting
the pull_op attribute that defines whether the operation is to be
a traditional or pull operation.
This does NOT reset _conn.id as that exists through the life of
the connection.
... | python | {
"resource": ""
} |
q245022 | BaseOperationRecorder.stage_pywbem_args | train | def stage_pywbem_args(self, method, **kwargs):
"""
Set requst method and all args.
Normally called before the cmd is | python | {
"resource": ""
} |
q245023 | BaseOperationRecorder.stage_pywbem_result | train | def stage_pywbem_result(self, ret, exc):
""" Set Result return info or exception info"""
# pylint: disable=attribute-defined-outside-init
| python | {
"resource": ""
} |
q245024 | BaseOperationRecorder.stage_http_request | train | def stage_http_request(self, conn_id, version, url, target, method, headers,
payload):
"""Set request HTTP information including url, headers, etc."""
# pylint: disable=attribute-defined-outside-init
self._http_request_version = version
self._http_request_conn_... | python | {
"resource": ""
} |
q245025 | BaseOperationRecorder.stage_http_response1 | train | def stage_http_response1(self, conn_id, version, status, reason, headers):
"""Set response http info including headers, status, etc.
conn_id unused here. Used in | python | {
"resource": ""
} |
q245026 | BaseOperationRecorder.record_staged | train | def record_staged(self):
"""Encode staged information on request and result to output"""
if self.enabled:
pwargs = OpArgs(
self._pywbem_method,
self._pywbem_args)
pwresult = OpResult(
self._pywbem_result_ret,
self._p... | python | {
"resource": ""
} |
q245027 | LogOperationRecorder.set_detail_level | train | def set_detail_level(self, detail_levels):
"""
Sets the detail levels from the input dictionary in detail_levels.
"""
if detail_levels is None:
return
self.detail_levels = detail_levels
if 'api' in detail_levels:
self.api_detail_level = detail_lev... | python | {
"resource": ""
} |
q245028 | LogOperationRecorder.stage_pywbem_args | train | def stage_pywbem_args(self, method, **kwargs):
"""
Log request method and all args.
Normally called before the cmd is executed to record request
parameters.
This method does not support the summary detail_level because
that seems to add little info to the log that is not ... | python | {
"resource": ""
} |
q245029 | LogOperationRecorder.stage_pywbem_result | train | def stage_pywbem_result(self, ret, exc):
"""
Log result return or exception parameter. This method provides varied
type of formatting based on the detail_level parameter and the
data in ret.
"""
def format_result(ret, max_len):
""" format ret as repr while cli... | python | {
"resource": ""
} |
q245030 | LogOperationRecorder.stage_http_request | train | def stage_http_request(self, conn_id, version, url, target, method, headers,
payload):
"""Log request HTTP information including url, headers, etc."""
if self.enabled and self.http_detail_level is not None and \
self.httplogger.isEnabledFor(logging.DEBUG):
... | python | {
"resource": ""
} |
q245031 | LogOperationRecorder.stage_http_response2 | train | def stage_http_response2(self, payload):
"""Log complete http response, including response1 and payload"""
# required because http code uses sending all None to reset
# parameters. We ignore that
if not self._http_response_version and not payload:
return
if self.enab... | python | {
"resource": ""
} |
q245032 | ValueMapping._to_int | train | def _to_int(self, val_str):
"""Conver val_str to an integer or raise ValueError"""
val = _integerValue_to_int(val_str)
if val is None:
raise ValueError(
_format("The value-mapped {0} has an invalid integer " | python | {
"resource": ""
} |
q245033 | ValueMapping._element_str | train | def _element_str(self):
"""
Return a string that identifies the value-mapped element.
"""
# pylint: disable=no-else-return
if isinstance(self.element, CIMProperty):
return _format("property {0!A} in class {1!A} (in {2!A})",
self.propname, se... | python | {
"resource": ""
} |
q245034 | ValueMapping.tovalues | train | def tovalues(self, element_value):
"""
Return the `Values` string for an element value, based upon this value
mapping.
Parameters:
element_value (:term:`integer` or :class:`~pywbem.CIMInt`):
The value of the CIM element (property, method, parameter).
Retu... | python | {
"resource": ""
} |
q245035 | ValueMapping.tobinary | train | def tobinary(self, values_str):
"""
Return the integer value or values for a `Values` string, based upon
this value mapping.
Any returned integer value is represented as the CIM type of the
element (e.g. :class:`~pywbem.Uint16`).
If the `Values` string corresponds to a ... | python | {
"resource": ""
} |
q245036 | WBEMSubscriptionManager._get_server | train | def _get_server(self, server_id):
"""
Internal method to get the server object, given a server_id.
Parameters:
server_id (:term:`string`):
The server ID of the WBEM server, returned by
:meth:`~pywbem.WBEMSubscriptionManager.add_server`.
Returns:
... | python | {
"resource": ""
} |
q245037 | WBEMSubscriptionManager.add_server | train | def add_server(self, server):
"""
Register a WBEM server with the subscription manager. This is a
prerequisite for adding listener destinations, indication filters and
indication subscriptions to the server.
This method discovers listener destination, indication filter, and
... | python | {
"resource": ""
} |
q245038 | WBEMSubscriptionManager.remove_server | train | def remove_server(self, server_id):
"""
Remove a registered WBEM server from the subscription manager. This
also unregisters listeners from that server and removes all owned
indication subscriptions, owned indication filters and owned listener
destinations.
Parameters:
... | python | {
"resource": ""
} |
q245039 | WBEMSubscriptionManager.remove_all_servers | train | def remove_all_servers(self):
"""
Remove all registered WBEM servers from the subscription manager. This
also unregisters listeners from these servers and removes all owned
indication subscriptions, owned indication filters, and owned listener
destinations.
Raises:
| python | {
"resource": ""
} |
q245040 | WBEMSubscriptionManager.add_listener_destinations | train | def add_listener_destinations(self, server_id, listener_urls, owned=True):
"""
Register WBEM listeners to be the target of indications sent by a
WBEM server.
This function automatically creates a listener destination instance
(of CIM class "CIM_ListenerDestinationCIMXML") for ea... | python | {
"resource": ""
} |
q245041 | WBEMSubscriptionManager.get_owned_destinations | train | def get_owned_destinations(self, server_id):
"""
Return the listener destinations in a WBEM server owned by this
subscription manager.
This function accesses only the local list of owned destinations; it
does not contact the WBEM server. The local list of owned destinations
... | python | {
"resource": ""
} |
q245042 | WBEMSubscriptionManager.get_all_destinations | train | def get_all_destinations(self, server_id):
"""
Return all listener destinations in a WBEM server.
This function contacts the WBEM server and retrieves the listener
destinations by enumerating the instances of CIM class
"CIM_ListenerDestinationCIMXML" in the Interop namespace of ... | python | {
"resource": ""
} |
q245043 | WBEMSubscriptionManager.remove_destinations | train | def remove_destinations(self, server_id, destination_paths):
# pylint: disable=line-too-long
"""
Remove listener destinations from a WBEM server, by deleting the
listener destination instances in the server.
The listener destinations must be owned or permanent (i.e. not static).... | python | {
"resource": ""
} |
q245044 | WBEMSubscriptionManager.get_owned_filters | train | def get_owned_filters(self, server_id):
"""
Return the indication filters in a WBEM server owned by this
subscription manager.
This function accesses only the local list of owned filters; it does
not contact the WBEM server. The local list of owned filters is
discovered ... | python | {
"resource": ""
} |
q245045 | WBEMSubscriptionManager.get_all_filters | train | def get_all_filters(self, server_id):
"""
Return all indication filters in a WBEM server.
This function contacts the WBEM server and retrieves the indication
filters by enumerating the instances of CIM class
"CIM_IndicationFilter" in the Interop namespace of the WBEM server.
... | python | {
"resource": ""
} |
q245046 | WBEMSubscriptionManager.remove_filter | train | def remove_filter(self, server_id, filter_path):
"""
Remove an indication filter from a WBEM server, by deleting the
indication filter instance in the WBEM server.
The indication filter must be owned or permanent (i.e. not static).
This method verifies that there are not curren... | python | {
"resource": ""
} |
q245047 | WBEMSubscriptionManager.get_owned_subscriptions | train | def get_owned_subscriptions(self, server_id):
"""
Return the indication subscriptions in a WBEM server owned by this
subscription manager.
This function accesses only the local list of owned subscriptions; it
does not contact the WBEM server. The local list of owned subscription... | python | {
"resource": ""
} |
q245048 | WBEMSubscriptionManager.get_all_subscriptions | train | def get_all_subscriptions(self, server_id):
"""
Return all indication subscriptions in a WBEM server.
This function contacts the WBEM server and retrieves the indication
subscriptions by enumerating the instances of CIM class
"CIM_IndicationSubscription" in the Interop namespace... | python | {
"resource": ""
} |
q245049 | WBEMSubscriptionManager._create_destination | train | def _create_destination(self, server_id, dest_url, owned):
"""
Create a listener destination instance in the Interop namespace of a
WBEM server and return that instance.
In order to catch any changes the server applies, the instance is
retrieved again using the instance path ret... | python | {
"resource": ""
} |
q245050 | WBEMSubscriptionManager._create_subscription | train | def _create_subscription(self, server_id, dest_path, filter_path, owned):
"""
Create an indication subscription instance in the Interop namespace of
a WBEM server and return that instance.
In order to catch any changes the server applies, the instance is
retrieved again using th... | python | {
"resource": ""
} |
q245051 | _MockMOFWBEMConnection.CreateClass | train | def CreateClass(self, *args, **kwargs):
"""
Override the CreateClass method in MOFWBEMConnection
For a description of the parameters, see
:meth:`pywbem.WBEMConnection.CreateClass`.
"""
cc = args[0] if args else kwargs['NewClass']
namespace = self.getns()
... | python | {
"resource": ""
} |
q245052 | _MockMOFWBEMConnection._get_class | train | def _get_class(self, superclass, namespace=None,
local_only=False, include_qualifiers=True,
include_classorigin=True):
"""
This method is just rename of GetClass to support same method
with both MOFWBEMConnection and FakedWBEMConnection
"""
r... | python | {
"resource": ""
} |
q245053 | xml_to_tupletree_sax | train | def xml_to_tupletree_sax(xml_string, meaning, conn_id=None):
"""
Parse an XML string into tupletree with SAX parser.
Parses the string using the class CIMContentHandler and
returns the root element. As a SAX parser it uses minimal
memory.
This is a replacement for the previous parser (xml_to_t... | python | {
"resource": ""
} |
q245054 | check_invalid_xml_chars | train | def check_invalid_xml_chars(xml_string, meaning, conn_id=None):
"""
Examine an XML string and raise a `pywbem.XMLParseError` exception if the
string contains characters that cannot legally be represented as XML
characters.
This function is used to improve the error information raised from Python's
... | python | {
"resource": ""
} |
q245055 | wrapped_spawn | train | def wrapped_spawn(self, cmdElements, tag):
'''
wrap spawn with unique-ish travis fold prints
'''
import uuid
a = uuid.uuid1()
print("travis_fold:start:%s-%s" % (tag, a))
| python | {
"resource": ""
} |
q245056 | BuildManager._build | train | def _build(self, build_method):
"""
build image from provided build_args
:return: BuildResults
"""
logger.info("building image '%s'", self.image)
self.ensure_not_built()
self.temp_dir = tempfile.mkdtemp()
temp_path = os.path.join(self.temp_dir, BUILD_JSON... | python | {
"resource": ""
} |
q245057 | BuildManager._load_results | train | def _load_results(self, container_id):
"""
load results from recent build
:return: BuildResults
"""
if self.temp_dir:
dt = DockerTasker()
# FIXME: load results only when requested
# results_path = os.path.join(self.temp_dir, RESULTS_JSON)
... | python | {
"resource": ""
} |
q245058 | BuildManager.commit_buildroot | train | def commit_buildroot(self):
"""
create image from buildroot
:return:
"""
logger.info("committing buildroot")
self.ensure_is_built()
commit_message = "docker build of '%s' (%s)" % (self.image, self.uri)
self.buildroot_image_name = ImageName(
r... | python | {
"resource": ""
} |
q245059 | ManPageFormatter.create_main_synopsis | train | def create_main_synopsis(self, parser):
""" create synopsis from main parser """
self.add_usage(parser.usage, parser._actions,
parser._mutually_exclusive_groups, prefix='')
usage = self._format_usage(None, parser._actions,
| python | {
"resource": ""
} |
q245060 | ManPageFormatter.create_subcommand_synopsis | train | def create_subcommand_synopsis(self, parser):
""" show usage with description for commands """
self.add_usage(parser.usage, parser._get_positional_actions(),
| python | {
"resource": ""
} |
q245061 | get_worker_build_info | train | def get_worker_build_info(workflow, platform):
"""
Obtain worker build information for a given platform
"""
| python | {
"resource": ""
} |
q245062 | override_build_kwarg | train | def override_build_kwarg(workflow, k, v, platform=None):
"""
Override a build-kwarg for all worker builds
"""
key = OrchestrateBuildPlugin.key
# Use None to indicate an override for all platforms
workspace = workflow.plugin_workspace.setdefault(key, {})
| python | {
"resource": ""
} |
q245063 | wait_for_any_cluster | train | def wait_for_any_cluster(contexts):
"""
Wait until any of the clusters are out of retry-wait
:param contexts: List[ClusterRetryContext]
:raises: AllClustersFailedException if no more retry attempts allowed
"""
try:
earliest_retry_at = min(ctx.retry_at for ctx in contexts.values() | python | {
"resource": ""
} |
q245064 | OrchestrateBuildPlugin.validate_arrangement_version | train | def validate_arrangement_version(self):
"""Validate if the arrangement_version is supported
This is for autorebuilds to fail early otherwise they may failed
on workers because of osbs-client validation checks.
Method should be called after self.adjust_build_kwargs
Shows a warn... | python | {
"resource": ""
} |
q245065 | OrchestrateBuildPlugin.get_clusters | train | def get_clusters(self, platform, retry_contexts, all_clusters):
''' return clusters sorted by load. '''
possible_cluster_info = {}
candidates = set(copy.copy(all_clusters))
while candidates and not possible_cluster_info:
wait_for_any_cluster(retry_contexts)
for ... | python | {
"resource": ""
} |
q245066 | OrchestrateBuildPlugin.get_koji_upload_dir | train | def get_koji_upload_dir():
"""
Create a path name for uploading files to
:return: str, path name expected to be unique
"""
dir_prefix = 'koji-upload'
random_chars = ''.join([random.choice(ascii_letters)
| python | {
"resource": ""
} |
q245067 | OrchestrateBuildPlugin.select_and_start_cluster | train | def select_and_start_cluster(self, platform):
''' Choose a cluster and start a build on it '''
clusters = self.reactor_config.get_enabled_clusters_for_platform(platform)
if not clusters:
raise UnknownPlatformException('No clusters found for platform {}!'
... | python | {
"resource": ""
} |
q245068 | OrchestrateBuildPlugin.set_build_image | train | def set_build_image(self):
"""
Overrides build_image for worker, to be same as in orchestrator build
"""
current_platform = platform.processor()
orchestrator_platform = current_platform or 'x86_64'
current_buildimage = self.get_current_buildimage()
for plat, buil... | python | {
"resource": ""
} |
q245069 | GroupManifestsPlugin.get_manifest | train | def get_manifest(self, session, repository, ref):
"""
Downloads a manifest from a registry. ref can be a digest, or a tag.
"""
self.log.debug("%s: Retrieving manifest for %s:%s", session.registry, repository, ref)
headers = {
'Accept': ', '.join(self.manifest_media_t... | python | {
"resource": ""
} |
q245070 | GroupManifestsPlugin.link_manifest_references_into_repository | train | def link_manifest_references_into_repository(self, session, manifest, media_type,
source_repo, target_repo):
"""
Links all the blobs referenced by the manifest from source_repo into target_repo.
"""
if source_repo == target_repo:
... | python | {
"resource": ""
} |
q245071 | GroupManifestsPlugin.store_manifest_in_repository | train | def store_manifest_in_repository(self, session, manifest, media_type,
source_repo, target_repo, digest=None, tag=None):
"""
Stores the manifest into target_repo, possibly tagging it. This may involve
copying referenced blobs from source_repo.
"""
... | python | {
"resource": ""
} |
q245072 | GroupManifestsPlugin.build_list | train | def build_list(self, manifests):
"""
Builds a manifest list or OCI image out of the given manifests
"""
media_type = manifests[0]['media_type']
if (not all(m['media_type'] == media_type for m in manifests)):
raise PluginFailedException('worker manifests have inconsis... | python | {
"resource": ""
} |
q245073 | GroupManifestsPlugin.group_manifests_and_tag | train | def group_manifests_and_tag(self, session, worker_digests):
"""
Creates a manifest list or OCI image index that groups the different manifests
in worker_digests, then tags the result with with all the configured tags found
in workflow.tag_conf.
"""
self.log.info("%s: Crea... | python | {
"resource": ""
} |
q245074 | GroupManifestsPlugin.tag_manifest_into_registry | train | def tag_manifest_into_registry(self, session, worker_digest):
"""
Tags the manifest identified by worker_digest into session.registry with all the
configured tags found in workflow.tag_conf.
"""
self.log.info("%s: Tagging manifest", session.registry)
digest = worker_dige... | python | {
"resource": ""
} |
q245075 | KojiParentPlugin.detect_parent_image_nvr | train | def detect_parent_image_nvr(self, image_name, inspect_data=None):
"""
Look for the NVR labels, if any, in the image.
:return NVR string if labels found, otherwise None
"""
if inspect_data is None:
inspect_data = self.workflow.builder.parent_image_inspect(image_name)... | python | {
"resource": ""
} |
q245076 | KojiParentPlugin.wait_for_parent_image_build | train | def wait_for_parent_image_build(self, nvr):
"""
Given image NVR, wait for the build that produced it to show up in koji.
If it doesn't within the timeout, raise an error.
:return build info dict with 'nvr' and 'id' keys
"""
self.log.info('Waiting for Koji build for pare... | python | {
"resource": ""
} |
q245077 | KojiParentPlugin.make_result | train | def make_result(self):
"""Construct the result dict to be preserved in the build metadata."""
result = {}
if self._base_image_build:
result[BASE_IMAGE_KOJI_BUILD] = self._base_image_build
| python | {
"resource": ""
} |
q245078 | wait_for_command | train | def wait_for_command(logs_generator):
"""
Create a CommandResult from given iterator
:return: CommandResult
"""
logger.info("wait_for_command")
cr = CommandResult()
| python | {
"resource": ""
} |
q245079 | print_version_of_tools | train | def print_version_of_tools():
"""
print versions of used tools to logger
"""
logger.info("Using these | python | {
"resource": ""
} |
q245080 | guess_manifest_media_type | train | def guess_manifest_media_type(content):
"""
Guess the media type for the given manifest content
:param content: JSON content of manifest (bytes)
:return: media type (str), or None if unable to guess
"""
encoding = guess_json_utf(content)
try:
manifest = json.loads(content.decode(enc... | python | {
"resource": ""
} |
q245081 | manifest_is_media_type | train | def manifest_is_media_type(response, media_type):
"""
Attempt to confirm the returned manifest is of a given media type
:param response: a requests.Response
:param media_type: media_type (str), or None to confirm
the media type cannot be guessed
"""
try:
received_media_type = re... | python | {
"resource": ""
} |
q245082 | get_manifest_list | train | def get_manifest_list(image, registry, insecure=False, dockercfg_path=None):
"""Return manifest list for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bo... | python | {
"resource": ""
} |
q245083 | get_all_manifests | train | def get_all_manifests(image, registry, insecure=False, dockercfg_path=None,
versions=('v1', 'v2', 'v2_list')):
"""Return manifest digests for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
... | python | {
"resource": ""
} |
q245084 | get_inspect_for_image | train | def get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None):
"""Return inspect for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bool... | python | {
"resource": ""
} |
q245085 | df_parser | train | def df_parser(df_path, workflow=None, cache_content=False, env_replace=True, parent_env=None):
"""
Wrapper for dockerfile_parse's DockerfileParser that takes into account
parent_env inheritance.
:param df_path: string, path to Dockerfile (normally in DockerBuildWorkflow instance)
:param workflow: D... | python | {
"resource": ""
} |
q245086 | are_plugins_in_order | train | def are_plugins_in_order(plugins_conf, *plugins_names):
"""Check if plugins are configured in given order."""
all_plugins_names = [plugin['name'] for plugin in plugins_conf or []]
start_index = 0
for plugin_name in plugins_names:
try:
| python | {
"resource": ""
} |
q245087 | get_parent_image_koji_data | train | def get_parent_image_koji_data(workflow):
"""Transform koji_parent plugin results into metadata dict."""
koji_parent = workflow.prebuild_results.get(PLUGIN_KOJI_PARENT_KEY) or {}
image_metadata = {}
parents = {}
for img, build in (koji_parent.get(PARENT_IMAGES_KOJI_BUILDS) or {}).items():
i... | python | {
"resource": ""
} |
q245088 | Dockercfg.unpack_auth_b64 | train | def unpack_auth_b64(self, docker_registry):
"""Decode and unpack base64 'auth' credentials from config file.
:param docker_registry: str, registry reference in config file
:return: namedtuple, UnpackedAuth (or None if no 'auth' is available)
"""
UnpackedAuth = namedtuple('Unpac... | python | {
"resource": ""
} |
q245089 | ManifestDigest.default | train | def default(self):
"""Return the default manifest schema version.
Depending on the docker version, <= 1.9, used to push
the image to the registry, v2 schema may not be available.
In such case, the v1 schema should be used when interacting
with the registry. An OCI digest will on... | python | {
"resource": ""
} |
q245090 | OSBSLogs.get_log_files | train | def get_log_files(self, osbs, build_id):
"""
Build list of log files
:return: list, of log files
"""
logs = None
output = []
# Collect logs from server
try:
logs = osbs.get_orchestrator_build_logs(build_id)
except OsbsException as ex... | python | {
"resource": ""
} |
q245091 | DigestCollector.update_image_digest | train | def update_image_digest(self, image, platform, digest):
"""Update parent image digest for specific platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:param str digest: digest of the specified image (sha256:...)
"""
... | python | {
"resource": ""
} |
q245092 | DigestCollector.get_image_digests | train | def get_image_digests(self, image):
"""Get platform digests of specified image
:param ImageName image: image
:raises KeyError: when image is not found
:rtype: dict
:return: mapping platform:digest of the specified image
"""
image_name_tag = self._key(image)
... | python | {
"resource": ""
} |
q245093 | DigestCollector.get_image_platform_digest | train | def get_image_platform_digest(self, image, platform):
"""Get digest of specified image and platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:raises KeyError: when digest is not found
:rtype: str
:return: digest ... | python | {
"resource": ""
} |
q245094 | rpm_qf_args | train | def rpm_qf_args(tags=None, separator=';'):
"""
Return the arguments to pass to rpm to list RPMs in the format expected
by | python | {
"resource": ""
} |
q245095 | parse_rpm_output | train | def parse_rpm_output(output, tags=None, separator=';'):
"""
Parse output of the rpm query.
:param output: list, decoded output (str) from the rpm subprocess
:param tags: list, str fields used for query output
:return: list, dicts describing each rpm package
"""
if tags is None:
tag... | python | {
"resource": ""
} |
q245096 | koji_login | train | def koji_login(session,
proxyuser=None,
ssl_certs_dir=None,
krb_principal=None,
krb_keytab=None):
"""
Choose the correct login method based on the available credentials,
and call that method on the provided session object.
:param session: koji... | python | {
"resource": ""
} |
q245097 | create_koji_session | train | def create_koji_session(hub_url, auth_info=None):
"""
Creates and returns a Koji session. If auth_info
is provided, the session will be authenticated.
:param hub_url: str, Koji hub URL
:param auth_info: dict, authentication parameters used for koji_login
:return: koji.ClientSession | python | {
"resource": ""
} |
q245098 | stream_task_output | train | def stream_task_output(session, task_id, file_name,
blocksize=DEFAULT_DOWNLOAD_BLOCK_SIZE):
"""
Generator to download file from task without loading the whole
file into memory.
"""
logger.debug('Streaming {} from task {}'.format(file_name, task_id))
offset = 0
contents... | python | {
"resource": ""
} |
q245099 | YumRepo.filename | train | def filename(self):
'''Returns the filename to be used for saving the repo file.
The filename is derived from the repo url by injecting a suffix
after the name and before the file extension. This suffix is a
partial md5 checksum of the full repourl. This avoids multiple
repos fr... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.