partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Actor.get_target_temperature | Returns the actual target temperature.
Attention: Returns None if the value can't be queried or is unknown. | fritzhome/actor.py | def get_target_temperature(self):
"""
Returns the actual target temperature.
Attention: Returns None if the value can't be queried or is unknown.
"""
value = self.box.homeautoswitch("gethkrtsoll", self.actor_id)
self.target_temperature = self.__get_temp(value)
ret... | def get_target_temperature(self):
"""
Returns the actual target temperature.
Attention: Returns None if the value can't be queried or is unknown.
"""
value = self.box.homeautoswitch("gethkrtsoll", self.actor_id)
self.target_temperature = self.__get_temp(value)
ret... | [
"Returns",
"the",
"actual",
"target",
"temperature",
".",
"Attention",
":",
"Returns",
"None",
"if",
"the",
"value",
"can",
"t",
"be",
"queried",
"or",
"is",
"unknown",
"."
] | DerMitch/fritzbox-smarthome | python | https://github.com/DerMitch/fritzbox-smarthome/blob/84cbd7c1b33e6256add041b0395ff5fccc01f103/fritzhome/actor.py#L125-L132 | [
"def",
"get_target_temperature",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"box",
".",
"homeautoswitch",
"(",
"\"gethkrtsoll\"",
",",
"self",
".",
"actor_id",
")",
"self",
".",
"target_temperature",
"=",
"self",
".",
"__get_temp",
"(",
"value",
")",
... | 84cbd7c1b33e6256add041b0395ff5fccc01f103 |
train | Actor.set_temperature | Sets the temperature in celcius | fritzhome/actor.py | def set_temperature(self, temp):
"""
Sets the temperature in celcius
"""
# Temperature is send to fritz.box a little weird
param = 16 + ( ( temp - 8 ) * 2 )
if param < 16:
param = 253
logger.info("Actor " + self.name + ": Temperature control set t... | def set_temperature(self, temp):
"""
Sets the temperature in celcius
"""
# Temperature is send to fritz.box a little weird
param = 16 + ( ( temp - 8 ) * 2 )
if param < 16:
param = 253
logger.info("Actor " + self.name + ": Temperature control set t... | [
"Sets",
"the",
"temperature",
"in",
"celcius"
] | DerMitch/fritzbox-smarthome | python | https://github.com/DerMitch/fritzbox-smarthome/blob/84cbd7c1b33e6256add041b0395ff5fccc01f103/fritzhome/actor.py#L134-L150 | [
"def",
"set_temperature",
"(",
"self",
",",
"temp",
")",
":",
"# Temperature is send to fritz.box a little weird",
"param",
"=",
"16",
"+",
"(",
"(",
"temp",
"-",
"8",
")",
"*",
"2",
")",
"if",
"param",
"<",
"16",
":",
"param",
"=",
"253",
"logger",
".",... | 84cbd7c1b33e6256add041b0395ff5fccc01f103 |
train | Configuration.get_openshift_base_uri | https://<host>[:<port>]/
:return: str | osbs/conf.py | def get_openshift_base_uri(self):
"""
https://<host>[:<port>]/
:return: str
"""
deprecated_key = "openshift_uri"
key = "openshift_url"
val = self._get_value(deprecated_key, self.conf_section, deprecated_key)
if val is not None:
warnings.warn("... | def get_openshift_base_uri(self):
"""
https://<host>[:<port>]/
:return: str
"""
deprecated_key = "openshift_uri"
key = "openshift_url"
val = self._get_value(deprecated_key, self.conf_section, deprecated_key)
if val is not None:
warnings.warn("... | [
"https",
":",
"//",
"<host",
">",
"[",
":",
"<port",
">",
"]",
"/"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/conf.py#L130-L142 | [
"def",
"get_openshift_base_uri",
"(",
"self",
")",
":",
"deprecated_key",
"=",
"\"openshift_uri\"",
"key",
"=",
"\"openshift_url\"",
"val",
"=",
"self",
".",
"_get_value",
"(",
"deprecated_key",
",",
"self",
".",
"conf_section",
",",
"deprecated_key",
")",
"if",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Configuration.get_builder_openshift_url | url of OpenShift where builder will connect | osbs/conf.py | def get_builder_openshift_url(self):
""" url of OpenShift where builder will connect """
key = "builder_openshift_url"
url = self._get_deprecated(key, self.conf_section, key)
if url is None:
logger.warning("%r not found, falling back to get_openshift_base_uri()", key)
... | def get_builder_openshift_url(self):
""" url of OpenShift where builder will connect """
key = "builder_openshift_url"
url = self._get_deprecated(key, self.conf_section, key)
if url is None:
logger.warning("%r not found, falling back to get_openshift_base_uri()", key)
... | [
"url",
"of",
"OpenShift",
"where",
"builder",
"will",
"connect"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/conf.py#L363-L370 | [
"def",
"get_builder_openshift_url",
"(",
"self",
")",
":",
"key",
"=",
"\"builder_openshift_url\"",
"url",
"=",
"self",
".",
"_get_deprecated",
"(",
"key",
",",
"self",
".",
"conf_section",
",",
"key",
")",
"if",
"url",
"is",
"None",
":",
"logger",
".",
"w... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Configuration.generate_nodeselector_dict | helper method for generating nodeselector dict
:param nodeselector_str:
:return: dict | osbs/conf.py | def generate_nodeselector_dict(self, nodeselector_str):
"""
helper method for generating nodeselector dict
:param nodeselector_str:
:return: dict
"""
nodeselector = {}
if nodeselector_str and nodeselector_str != 'none':
constraints = [x.strip() for x i... | def generate_nodeselector_dict(self, nodeselector_str):
"""
helper method for generating nodeselector dict
:param nodeselector_str:
:return: dict
"""
nodeselector = {}
if nodeselector_str and nodeselector_str != 'none':
constraints = [x.strip() for x i... | [
"helper",
"method",
"for",
"generating",
"nodeselector",
"dict",
":",
"param",
"nodeselector_str",
":",
":",
"return",
":",
"dict"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/conf.py#L565-L577 | [
"def",
"generate_nodeselector_dict",
"(",
"self",
",",
"nodeselector_str",
")",
":",
"nodeselector",
"=",
"{",
"}",
"if",
"nodeselector_str",
"and",
"nodeselector_str",
"!=",
"'none'",
":",
"constraints",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
"i... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Configuration.get_platform_node_selector | search the configuration for entries of the form node_selector.platform
:param platform: str, platform to search for, can be null
:return dict | osbs/conf.py | def get_platform_node_selector(self, platform):
"""
search the configuration for entries of the form node_selector.platform
:param platform: str, platform to search for, can be null
:return dict
"""
nodeselector = {}
if platform:
nodeselector_str = sel... | def get_platform_node_selector(self, platform):
"""
search the configuration for entries of the form node_selector.platform
:param platform: str, platform to search for, can be null
:return dict
"""
nodeselector = {}
if platform:
nodeselector_str = sel... | [
"search",
"the",
"configuration",
"for",
"entries",
"of",
"the",
"form",
"node_selector",
".",
"platform",
":",
"param",
"platform",
":",
"str",
"platform",
"to",
"search",
"for",
"can",
"be",
"null",
":",
"return",
"dict"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/conf.py#L579-L591 | [
"def",
"get_platform_node_selector",
"(",
"self",
",",
"platform",
")",
":",
"nodeselector",
"=",
"{",
"}",
"if",
"platform",
":",
"nodeselector_str",
"=",
"self",
".",
"_get_value",
"(",
"\"node_selector.\"",
"+",
"platform",
",",
"self",
".",
"conf_section",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | CsvTableFileLoader.load | Extract tabular data as |TableData| instances from a CSV file.
|load_source_desc_file|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format specifier Value after the replacement
... | pytablereader/csv/core.py | def load(self):
"""
Extract tabular data as |TableData| instances from a CSV file.
|load_source_desc_file|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format specifier ... | def load(self):
"""
Extract tabular data as |TableData| instances from a CSV file.
|load_source_desc_file|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format specifier ... | [
"Extract",
"tabular",
"data",
"as",
"|TableData|",
"instances",
"from",
"a",
"CSV",
"file",
".",
"|load_source_desc_file|"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/csv/core.py#L145-L194 | [
"def",
"load",
"(",
"self",
")",
":",
"self",
".",
"_validate",
"(",
")",
"self",
".",
"_logger",
".",
"logging_load",
"(",
")",
"self",
".",
"encoding",
"=",
"get_file_encoding",
"(",
"self",
".",
"source",
",",
"self",
".",
"encoding",
")",
"if",
"... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | CsvTableTextLoader.load | Extract tabular data as |TableData| instances from a CSV text object.
|load_source_desc_text|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format specifier Value after the replacemen... | pytablereader/csv/core.py | def load(self):
"""
Extract tabular data as |TableData| instances from a CSV text object.
|load_source_desc_text|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format spec... | def load(self):
"""
Extract tabular data as |TableData| instances from a CSV text object.
|load_source_desc_text|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format spec... | [
"Extract",
"tabular",
"data",
"as",
"|TableData|",
"instances",
"from",
"a",
"CSV",
"text",
"object",
".",
"|load_source_desc_text|"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/csv/core.py#L220-L258 | [
"def",
"load",
"(",
"self",
")",
":",
"self",
".",
"_validate",
"(",
")",
"self",
".",
"_logger",
".",
"logging_load",
"(",
")",
"self",
".",
"_csv_reader",
"=",
"csv",
".",
"reader",
"(",
"six",
".",
"StringIO",
"(",
"self",
".",
"source",
".",
"s... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | BuildRequest.set_params | set parameters according to specification
these parameters are accepted:
:param pulp_secret: str, resource name of pulp secret
:param koji_target: str, koji tag with packages used to build the image
:param kojiroot: str, URL from which koji packages are fetched
:param kojihub: ... | osbs/build/build_request.py | def set_params(self, **kwargs):
"""
set parameters according to specification
these parameters are accepted:
:param pulp_secret: str, resource name of pulp secret
:param koji_target: str, koji tag with packages used to build the image
:param kojiroot: str, URL from whic... | def set_params(self, **kwargs):
"""
set parameters according to specification
these parameters are accepted:
:param pulp_secret: str, resource name of pulp secret
:param koji_target: str, koji tag with packages used to build the image
:param kojiroot: str, URL from whic... | [
"set",
"parameters",
"according",
"to",
"specification"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L72-L131 | [
"def",
"set_params",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Here we cater to the koji \"scratch\" build type, this will disable",
"# all plugins that might cause importing of data to koji",
"self",
".",
"scratch",
"=",
"kwargs",
".",
"pop",
"(",
"'scratch'",
","... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.has_ist_trigger | Return True if this BuildConfig has ImageStreamTag trigger. | osbs/build/build_request.py | def has_ist_trigger(self):
"""Return True if this BuildConfig has ImageStreamTag trigger."""
triggers = self.template['spec'].get('triggers', [])
if not triggers:
return False
for trigger in triggers:
if trigger['type'] == 'ImageChange' and \
t... | def has_ist_trigger(self):
"""Return True if this BuildConfig has ImageStreamTag trigger."""
triggers = self.template['spec'].get('triggers', [])
if not triggers:
return False
for trigger in triggers:
if trigger['type'] == 'ImageChange' and \
t... | [
"Return",
"True",
"if",
"this",
"BuildConfig",
"has",
"ImageStreamTag",
"trigger",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L210-L219 | [
"def",
"has_ist_trigger",
"(",
"self",
")",
":",
"triggers",
"=",
"self",
".",
"template",
"[",
"'spec'",
"]",
".",
"get",
"(",
"'triggers'",
",",
"[",
"]",
")",
"if",
"not",
"triggers",
":",
"return",
"False",
"for",
"trigger",
"in",
"triggers",
":",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.set_secret_for_plugin | Sets secret for plugin, if no plugin specified
it will also set general secret
:param secret: str, secret name
:param plugin: tuple, (plugin type, plugin name, argument name)
:param mount_path: str, mount path of secret | osbs/build/build_request.py | def set_secret_for_plugin(self, secret, plugin=None, mount_path=None):
"""
Sets secret for plugin, if no plugin specified
it will also set general secret
:param secret: str, secret name
:param plugin: tuple, (plugin type, plugin name, argument name)
:param mount_path: st... | def set_secret_for_plugin(self, secret, plugin=None, mount_path=None):
"""
Sets secret for plugin, if no plugin specified
it will also set general secret
:param secret: str, secret name
:param plugin: tuple, (plugin type, plugin name, argument name)
:param mount_path: st... | [
"Sets",
"secret",
"for",
"plugin",
"if",
"no",
"plugin",
"specified",
"it",
"will",
"also",
"set",
"general",
"secret"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L403-L445 | [
"def",
"set_secret_for_plugin",
"(",
"self",
",",
"secret",
",",
"plugin",
"=",
"None",
",",
"mount_path",
"=",
"None",
")",
":",
"has_plugin_conf",
"=",
"False",
"if",
"plugin",
"is",
"not",
"None",
":",
"has_plugin_conf",
"=",
"self",
".",
"dj",
".",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.set_secrets | :param secrets: dict, {(plugin type, plugin name, argument name): secret name}
for example {('exit_plugins', 'koji_promote', 'koji_ssl_certs'): 'koji_ssl_certs', ...} | osbs/build/build_request.py | def set_secrets(self, secrets):
"""
:param secrets: dict, {(plugin type, plugin name, argument name): secret name}
for example {('exit_plugins', 'koji_promote', 'koji_ssl_certs'): 'koji_ssl_certs', ...}
"""
secret_set = False
for (plugin, secret) in secrets.items():
... | def set_secrets(self, secrets):
"""
:param secrets: dict, {(plugin type, plugin name, argument name): secret name}
for example {('exit_plugins', 'koji_promote', 'koji_ssl_certs'): 'koji_ssl_certs', ...}
"""
secret_set = False
for (plugin, secret) in secrets.items():
... | [
":",
"param",
"secrets",
":",
"dict",
"{",
"(",
"plugin",
"type",
"plugin",
"name",
"argument",
"name",
")",
":",
"secret",
"name",
"}",
"for",
"example",
"{",
"(",
"exit_plugins",
"koji_promote",
"koji_ssl_certs",
")",
":",
"koji_ssl_certs",
"...",
"}"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L447-L467 | [
"def",
"set_secrets",
"(",
"self",
",",
"secrets",
")",
":",
"secret_set",
"=",
"False",
"for",
"(",
"plugin",
",",
"secret",
")",
"in",
"secrets",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"plugin",
",",
"tuple",
")",
"or",
"len",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.remove_tag_and_push_registries | Remove matching entries from tag_and_push_registries (in-place)
:param tag_and_push_registries: dict, uri -> dict
:param version: str, 'version' to match against | osbs/build/build_request.py | def remove_tag_and_push_registries(tag_and_push_registries, version):
"""
Remove matching entries from tag_and_push_registries (in-place)
:param tag_and_push_registries: dict, uri -> dict
:param version: str, 'version' to match against
"""
registries = [uri
... | def remove_tag_and_push_registries(tag_and_push_registries, version):
"""
Remove matching entries from tag_and_push_registries (in-place)
:param tag_and_push_registries: dict, uri -> dict
:param version: str, 'version' to match against
"""
registries = [uri
... | [
"Remove",
"matching",
"entries",
"from",
"tag_and_push_registries",
"(",
"in",
"-",
"place",
")"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L488-L500 | [
"def",
"remove_tag_and_push_registries",
"(",
"tag_and_push_registries",
",",
"version",
")",
":",
"registries",
"=",
"[",
"uri",
"for",
"uri",
",",
"regdict",
"in",
"tag_and_push_registries",
".",
"items",
"(",
")",
"if",
"regdict",
"[",
"'version'",
"]",
"==",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.adjust_for_registry_api_versions | Enable/disable plugins depending on supported registry API versions | osbs/build/build_request.py | def adjust_for_registry_api_versions(self):
"""
Enable/disable plugins depending on supported registry API versions
"""
versions = self.spec.registry_api_versions.value
if 'v2' not in versions:
raise OsbsValidationException('v1-only docker registry API is not support... | def adjust_for_registry_api_versions(self):
"""
Enable/disable plugins depending on supported registry API versions
"""
versions = self.spec.registry_api_versions.value
if 'v2' not in versions:
raise OsbsValidationException('v1-only docker registry API is not support... | [
"Enable",
"/",
"disable",
"plugins",
"depending",
"on",
"supported",
"registry",
"API",
"versions"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L515-L544 | [
"def",
"adjust_for_registry_api_versions",
"(",
"self",
")",
":",
"versions",
"=",
"self",
".",
"spec",
".",
"registry_api_versions",
".",
"value",
"if",
"'v2'",
"not",
"in",
"versions",
":",
"raise",
"OsbsValidationException",
"(",
"'v1-only docker registry API is no... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.adjust_for_triggers | Remove trigger-related plugins when needed
If there are no triggers defined, it's assumed the
feature is disabled and all trigger-related plugins
are removed.
If there are triggers defined, and this is a custom
base image, some trigger-related plugins do not apply.
Add... | osbs/build/build_request.py | def adjust_for_triggers(self):
"""Remove trigger-related plugins when needed
If there are no triggers defined, it's assumed the
feature is disabled and all trigger-related plugins
are removed.
If there are triggers defined, and this is a custom
base image, some trigger-... | def adjust_for_triggers(self):
"""Remove trigger-related plugins when needed
If there are no triggers defined, it's assumed the
feature is disabled and all trigger-related plugins
are removed.
If there are triggers defined, and this is a custom
base image, some trigger-... | [
"Remove",
"trigger",
"-",
"related",
"plugins",
"when",
"needed"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L546-L583 | [
"def",
"adjust_for_triggers",
"(",
"self",
")",
":",
"triggers",
"=",
"self",
".",
"template",
"[",
"'spec'",
"]",
".",
"get",
"(",
"'triggers'",
",",
"[",
"]",
")",
"remove_plugins",
"=",
"[",
"(",
"\"prebuild_plugins\"",
",",
"\"check_and_set_rebuild\"",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.adjust_for_scratch | Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji. | osbs/build/build_request.py | def adjust_for_scratch(self):
"""
Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji.
"""
if self.scratch:
self.template['spec'].pop('triggers', None)
... | def adjust_for_scratch(self):
"""
Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji.
"""
if self.scratch:
self.template['spec'].pop('triggers', None)
... | [
"Remove",
"certain",
"plugins",
"in",
"order",
"to",
"handle",
"the",
"scratch",
"build",
"scenario",
".",
"Scratch",
"builds",
"must",
"not",
"affect",
"subsequent",
"builds",
"and",
"should",
"not",
"be",
"imported",
"into",
"Koji",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L585-L622 | [
"def",
"adjust_for_scratch",
"(",
"self",
")",
":",
"if",
"self",
".",
"scratch",
":",
"self",
".",
"template",
"[",
"'spec'",
"]",
".",
"pop",
"(",
"'triggers'",
",",
"None",
")",
"remove_plugins",
"=",
"[",
"(",
"\"prebuild_plugins\"",
",",
"\"koji_paren... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.adjust_for_custom_base_image | Disable plugins to handle builds depending on whether
or not this is a build from a custom base image. | osbs/build/build_request.py | def adjust_for_custom_base_image(self):
"""
Disable plugins to handle builds depending on whether
or not this is a build from a custom base image.
"""
plugins = []
if self.is_custom_base_image():
# Plugins irrelevant to building base images.
plugin... | def adjust_for_custom_base_image(self):
"""
Disable plugins to handle builds depending on whether
or not this is a build from a custom base image.
"""
plugins = []
if self.is_custom_base_image():
# Plugins irrelevant to building base images.
plugin... | [
"Disable",
"plugins",
"to",
"handle",
"builds",
"depending",
"on",
"whether",
"or",
"not",
"this",
"is",
"a",
"build",
"from",
"a",
"custom",
"base",
"image",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L641-L660 | [
"def",
"adjust_for_custom_base_image",
"(",
"self",
")",
":",
"plugins",
"=",
"[",
"]",
"if",
"self",
".",
"is_custom_base_image",
"(",
")",
":",
"# Plugins irrelevant to building base images.",
"plugins",
".",
"append",
"(",
"(",
"\"prebuild_plugins\"",
",",
"\"pul... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_koji | if there is yum repo specified, don't pick stuff from koji | osbs/build/build_request.py | def render_koji(self):
"""
if there is yum repo specified, don't pick stuff from koji
"""
phase = 'prebuild_plugins'
plugin = 'koji'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.yum_repourls.value:
logger.in... | def render_koji(self):
"""
if there is yum repo specified, don't pick stuff from koji
"""
phase = 'prebuild_plugins'
plugin = 'koji'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.yum_repourls.value:
logger.in... | [
"if",
"there",
"is",
"yum",
"repo",
"specified",
"don",
"t",
"pick",
"stuff",
"from",
"koji"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L814-L841 | [
"def",
"render_koji",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'koji'",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"if",
"self",
".",
"spec",
".",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_bump_release | If the bump_release plugin is present, configure it | osbs/build/build_request.py | def render_bump_release(self):
"""
If the bump_release plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'bump_release'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.release.value:
logge... | def render_bump_release(self):
"""
If the bump_release plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'bump_release'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.release.value:
logge... | [
"If",
"the",
"bump_release",
"plugin",
"is",
"present",
"configure",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L843-L871 | [
"def",
"render_bump_release",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'bump_release'",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"if",
"self",
".",
"s... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_sendmail | if we have smtp_host and smtp_from, configure sendmail plugin,
else remove it | osbs/build/build_request.py | def render_sendmail(self):
"""
if we have smtp_host and smtp_from, configure sendmail plugin,
else remove it
"""
phase = 'exit_plugins'
plugin = 'sendmail'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.smtp_host.... | def render_sendmail(self):
"""
if we have smtp_host and smtp_from, configure sendmail plugin,
else remove it
"""
phase = 'exit_plugins'
plugin = 'sendmail'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.smtp_host.... | [
"if",
"we",
"have",
"smtp_host",
"and",
"smtp_from",
"configure",
"sendmail",
"plugin",
"else",
"remove",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L986-L1032 | [
"def",
"render_sendmail",
"(",
"self",
")",
":",
"phase",
"=",
"'exit_plugins'",
"plugin",
"=",
"'sendmail'",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"if",
"self",
".",
"spec",
".",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_fetch_maven_artifacts | Configure fetch_maven_artifacts plugin | osbs/build/build_request.py | def render_fetch_maven_artifacts(self):
"""Configure fetch_maven_artifacts plugin"""
phase = 'prebuild_plugins'
plugin = 'fetch_maven_artifacts'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
koji_hub = self.spec.kojihub.value
koji_root = sel... | def render_fetch_maven_artifacts(self):
"""Configure fetch_maven_artifacts plugin"""
phase = 'prebuild_plugins'
plugin = 'fetch_maven_artifacts'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
koji_hub = self.spec.kojihub.value
koji_root = sel... | [
"Configure",
"fetch_maven_artifacts",
"plugin"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1034-L1054 | [
"def",
"render_fetch_maven_artifacts",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'fetch_maven_artifacts'",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"koji_hub... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_tag_from_config | Configure tag_from_config plugin | osbs/build/build_request.py | def render_tag_from_config(self):
"""Configure tag_from_config plugin"""
phase = 'postbuild_plugins'
plugin = 'tag_from_config'
if not self.has_tag_suffixes_placeholder():
return
unique_tag = self.spec.image_tag.value.split(':')[-1]
tag_suffixes = {'unique': ... | def render_tag_from_config(self):
"""Configure tag_from_config plugin"""
phase = 'postbuild_plugins'
plugin = 'tag_from_config'
if not self.has_tag_suffixes_placeholder():
return
unique_tag = self.spec.image_tag.value.split(':')[-1]
tag_suffixes = {'unique': ... | [
"Configure",
"tag_from_config",
"plugin"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1056-L1078 | [
"def",
"render_tag_from_config",
"(",
"self",
")",
":",
"phase",
"=",
"'postbuild_plugins'",
"plugin",
"=",
"'tag_from_config'",
"if",
"not",
"self",
".",
"has_tag_suffixes_placeholder",
"(",
")",
":",
"return",
"unique_tag",
"=",
"self",
".",
"spec",
".",
"imag... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_pulp_pull | If a pulp registry is specified, use pulp_pull plugin | osbs/build/build_request.py | def render_pulp_pull(self):
"""
If a pulp registry is specified, use pulp_pull plugin
"""
# pulp_pull is a multi-phase plugin
phases = ('postbuild_plugins', 'exit_plugins')
plugin = 'pulp_pull'
for phase in phases:
if not self.dj.dock_json_has_plugin_c... | def render_pulp_pull(self):
"""
If a pulp registry is specified, use pulp_pull plugin
"""
# pulp_pull is a multi-phase plugin
phases = ('postbuild_plugins', 'exit_plugins')
plugin = 'pulp_pull'
for phase in phases:
if not self.dj.dock_json_has_plugin_c... | [
"If",
"a",
"pulp",
"registry",
"is",
"specified",
"use",
"pulp_pull",
"plugin"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1080-L1105 | [
"def",
"render_pulp_pull",
"(",
"self",
")",
":",
"# pulp_pull is a multi-phase plugin",
"phases",
"=",
"(",
"'postbuild_plugins'",
",",
"'exit_plugins'",
")",
"plugin",
"=",
"'pulp_pull'",
"for",
"phase",
"in",
"phases",
":",
"if",
"not",
"self",
".",
"dj",
"."... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_pulp_sync | If a pulp registry is specified, use the pulp plugin as well as the
delete_from_registry to delete the image after sync | osbs/build/build_request.py | def render_pulp_sync(self):
"""
If a pulp registry is specified, use the pulp plugin as well as the
delete_from_registry to delete the image after sync
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins',
'pulp_sync'):... | def render_pulp_sync(self):
"""
If a pulp registry is specified, use the pulp plugin as well as the
delete_from_registry to delete the image after sync
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins',
'pulp_sync'):... | [
"If",
"a",
"pulp",
"registry",
"is",
"specified",
"use",
"the",
"pulp",
"plugin",
"as",
"well",
"as",
"the",
"delete_from_registry",
"to",
"delete",
"the",
"image",
"after",
"sync"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1134-L1213 | [
"def",
"render_pulp_sync",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"'postbuild_plugins'",
",",
"'pulp_sync'",
")",
":",
"return",
"pulp_registry",
"=",
"self",
".",
"spec",
".",
"pulp_registry",
".",
"value... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_pulp_tag | Configure the pulp_tag plugin. | osbs/build/build_request.py | def render_pulp_tag(self):
"""
Configure the pulp_tag plugin.
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins',
'pulp_tag'):
return
pulp_registry = self.spec.pulp_registry.value
if pulp_registry... | def render_pulp_tag(self):
"""
Configure the pulp_tag plugin.
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins',
'pulp_tag'):
return
pulp_registry = self.spec.pulp_registry.value
if pulp_registry... | [
"Configure",
"the",
"pulp_tag",
"plugin",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1215-L1240 | [
"def",
"render_pulp_tag",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"'postbuild_plugins'",
",",
"'pulp_tag'",
")",
":",
"return",
"pulp_registry",
"=",
"self",
".",
"spec",
".",
"pulp_registry",
".",
"value",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_group_manifests | Configure the group_manifests plugin. Group is always set to false for now. | osbs/build/build_request.py | def render_group_manifests(self):
"""
Configure the group_manifests plugin. Group is always set to false for now.
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins', 'group_manifests'):
return
push_conf = self.dj.dock_json_get_plugin_conf('postbuild_plu... | def render_group_manifests(self):
"""
Configure the group_manifests plugin. Group is always set to false for now.
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins', 'group_manifests'):
return
push_conf = self.dj.dock_json_get_plugin_conf('postbuild_plu... | [
"Configure",
"the",
"group_manifests",
"plugin",
".",
"Group",
"is",
"always",
"set",
"to",
"false",
"for",
"now",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1269-L1301 | [
"def",
"render_group_manifests",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"dj",
".",
"dock_json_has_plugin_conf",
"(",
"'postbuild_plugins'",
",",
"'group_manifests'",
")",
":",
"return",
"push_conf",
"=",
"self",
".",
"dj",
".",
"dock_json_get_plugin_conf... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_import_image | Configure the import_image plugin | osbs/build/build_request.py | def render_import_image(self, use_auth=None):
"""
Configure the import_image plugin
"""
# import_image is a multi-phase plugin
phases = ('postbuild_plugins', 'exit_plugins')
plugin = 'import_image'
for phase in phases:
if self.spec.imagestream_name.va... | def render_import_image(self, use_auth=None):
"""
Configure the import_image plugin
"""
# import_image is a multi-phase plugin
phases = ('postbuild_plugins', 'exit_plugins')
plugin = 'import_image'
for phase in phases:
if self.spec.imagestream_name.va... | [
"Configure",
"the",
"import_image",
"plugin"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1303-L1333 | [
"def",
"render_import_image",
"(",
"self",
",",
"use_auth",
"=",
"None",
")",
":",
"# import_image is a multi-phase plugin",
"phases",
"=",
"(",
"'postbuild_plugins'",
",",
"'exit_plugins'",
")",
"plugin",
"=",
"'import_image'",
"for",
"phase",
"in",
"phases",
":",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_customizations | Customize prod_inner for site specific customizations | osbs/build/build_request.py | def render_customizations(self):
"""
Customize prod_inner for site specific customizations
"""
disable_plugins = self.customize_conf.get('disable_plugins', [])
if not disable_plugins:
logger.debug("No site-specific plugins to disable")
else:
for p... | def render_customizations(self):
"""
Customize prod_inner for site specific customizations
"""
disable_plugins = self.customize_conf.get('disable_plugins', [])
if not disable_plugins:
logger.debug("No site-specific plugins to disable")
else:
for p... | [
"Customize",
"prod_inner",
"for",
"site",
"specific",
"customizations"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1375-L1420 | [
"def",
"render_customizations",
"(",
"self",
")",
":",
"disable_plugins",
"=",
"self",
".",
"customize_conf",
".",
"get",
"(",
"'disable_plugins'",
",",
"[",
"]",
")",
"if",
"not",
"disable_plugins",
":",
"logger",
".",
"debug",
"(",
"\"No site-specific plugins ... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequest.render_name | Sets the Build/BuildConfig object name | osbs/build/build_request.py | def render_name(self, name, image_tag, platform):
"""Sets the Build/BuildConfig object name"""
if self.scratch or self.isolated:
name = image_tag
# Platform name may contain characters not allowed by OpenShift.
if platform:
platform_suffix = '-{}'.for... | def render_name(self, name, image_tag, platform):
"""Sets the Build/BuildConfig object name"""
if self.scratch or self.isolated:
name = image_tag
# Platform name may contain characters not allowed by OpenShift.
if platform:
platform_suffix = '-{}'.for... | [
"Sets",
"the",
"Build",
"/",
"BuildConfig",
"object",
"name"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L1425-L1444 | [
"def",
"render_name",
"(",
"self",
",",
"name",
",",
"image_tag",
",",
"platform",
")",
":",
"if",
"self",
".",
"scratch",
"or",
"self",
".",
"isolated",
":",
"name",
"=",
"image_tag",
"# Platform name may contain characters not allowed by OpenShift.",
"if",
"plat... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | setup_json_capture | Only used for setting up the testing framework. | osbs/cli/capture.py | def setup_json_capture(osbs, os_conf, capture_dir):
"""
Only used for setting up the testing framework.
"""
try:
os.mkdir(capture_dir)
except OSError:
pass
finally:
osbs.os._con.request = ResponseSaver(capture_dir,
os_conf.get... | def setup_json_capture(osbs, os_conf, capture_dir):
"""
Only used for setting up the testing framework.
"""
try:
os.mkdir(capture_dir)
except OSError:
pass
finally:
osbs.os._con.request = ResponseSaver(capture_dir,
os_conf.get... | [
"Only",
"used",
"for",
"setting",
"up",
"the",
"testing",
"framework",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/capture.py#L96-L109 | [
"def",
"setup_json_capture",
"(",
"osbs",
",",
"os_conf",
",",
"capture_dir",
")",
":",
"try",
":",
"os",
".",
"mkdir",
"(",
"capture_dir",
")",
"except",
"OSError",
":",
"pass",
"finally",
":",
"osbs",
".",
"os",
".",
"_con",
".",
"request",
"=",
"Res... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | get_terminal_size | get size of console: rows x columns
:return: tuple, (int, int) | osbs/cli/render.py | def get_terminal_size():
"""
get size of console: rows x columns
:return: tuple, (int, int)
"""
try:
rows, columns = subprocess.check_output(['stty', 'size']).split()
except subprocess.CalledProcessError:
# not attached to terminal
logger.info("not attached to terminal")... | def get_terminal_size():
"""
get size of console: rows x columns
:return: tuple, (int, int)
"""
try:
rows, columns = subprocess.check_output(['stty', 'size']).split()
except subprocess.CalledProcessError:
# not attached to terminal
logger.info("not attached to terminal")... | [
"get",
"size",
"of",
"console",
":",
"rows",
"x",
"columns"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L18-L31 | [
"def",
"get_terminal_size",
"(",
")",
":",
"try",
":",
"rows",
",",
"columns",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'stty'",
",",
"'size'",
"]",
")",
".",
"split",
"(",
")",
"except",
"subprocess",
".",
"CalledProcessError",
":",
"# not attac... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | TableFormatter._longest_val_in_column | get size of longest value in specific column
:param col: str, column name
:return int | osbs/cli/render.py | def _longest_val_in_column(self, col):
"""
get size of longest value in specific column
:param col: str, column name
:return int
"""
try:
# +2 is for implicit separator
return max([len(x[col]) for x in self.table if x[col]]) + 2
except Key... | def _longest_val_in_column(self, col):
"""
get size of longest value in specific column
:param col: str, column name
:return int
"""
try:
# +2 is for implicit separator
return max([len(x[col]) for x in self.table if x[col]]) + 2
except Key... | [
"get",
"size",
"of",
"longest",
"value",
"in",
"specific",
"column"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L59-L71 | [
"def",
"_longest_val_in_column",
"(",
"self",
",",
"col",
")",
":",
"try",
":",
"# +2 is for implicit separator",
"return",
"max",
"(",
"[",
"len",
"(",
"x",
"[",
"col",
"]",
")",
"for",
"x",
"in",
"self",
".",
"table",
"if",
"x",
"[",
"col",
"]",
"]... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | TablePrinter._init | initialize all values based on provided input
:return: None | osbs/cli/render.py | def _init(self):
"""
initialize all values based on provided input
:return: None
"""
self.col_count = len(self.col_list)
# list of lengths of longest entries in columns
self.col_longest = self.get_all_longest_col_lengths()
self.data_length = sum(self.col_... | def _init(self):
"""
initialize all values based on provided input
:return: None
"""
self.col_count = len(self.col_list)
# list of lengths of longest entries in columns
self.col_longest = self.get_all_longest_col_lengths()
self.data_length = sum(self.col_... | [
"initialize",
"all",
"values",
"based",
"on",
"provided",
"input"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L95-L122 | [
"def",
"_init",
"(",
"self",
")",
":",
"self",
".",
"col_count",
"=",
"len",
"(",
"self",
".",
"col_list",
")",
"# list of lengths of longest entries in columns",
"self",
".",
"col_longest",
"=",
"self",
".",
"get_all_longest_col_lengths",
"(",
")",
"self",
".",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | TablePrinter._count_sizes | count all values needed to display whole table
<><---terminal-width-----------><>
<> HEADER | HEADER2 | HEADER3 <>
<>---------+----------+---------<>
kudos to PostgreSQL developers
:return: None | osbs/cli/render.py | def _count_sizes(self):
"""
count all values needed to display whole table
<><---terminal-width-----------><>
<> HEADER | HEADER2 | HEADER3 <>
<>---------+----------+---------<>
kudos to PostgreSQL developers
:return: None
"""
format_list = [... | def _count_sizes(self):
"""
count all values needed to display whole table
<><---terminal-width-----------><>
<> HEADER | HEADER2 | HEADER3 <>
<>---------+----------+---------<>
kudos to PostgreSQL developers
:return: None
"""
format_list = [... | [
"count",
"all",
"values",
"needed",
"to",
"display",
"whole",
"table"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L124-L157 | [
"def",
"_count_sizes",
"(",
"self",
")",
":",
"format_list",
"=",
"[",
"]",
"header_sepa_format_list",
"=",
"[",
"]",
"# actual widths of columns",
"self",
".",
"col_widths",
"=",
"{",
"}",
"for",
"col",
"in",
"self",
".",
"col_list",
":",
"col_length",
"=",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | TablePrinter.get_all_longest_col_lengths | iterate over all columns and get their longest values
:return: dict, {"column_name": 132} | osbs/cli/render.py | def get_all_longest_col_lengths(self):
"""
iterate over all columns and get their longest values
:return: dict, {"column_name": 132}
"""
response = {}
for col in self.col_list:
response[col] = self._longest_val_in_column(col)
return response | def get_all_longest_col_lengths(self):
"""
iterate over all columns and get their longest values
:return: dict, {"column_name": 132}
"""
response = {}
for col in self.col_list:
response[col] = self._longest_val_in_column(col)
return response | [
"iterate",
"over",
"all",
"columns",
"and",
"get",
"their",
"longest",
"values"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L159-L168 | [
"def",
"get_all_longest_col_lengths",
"(",
"self",
")",
":",
"response",
"=",
"{",
"}",
"for",
"col",
"in",
"self",
".",
"col_list",
":",
"response",
"[",
"col",
"]",
"=",
"self",
".",
"_longest_val_in_column",
"(",
"col",
")",
"return",
"response"
] | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | TablePrinter._separate | get a width of separator for current column
:return: int | osbs/cli/render.py | def _separate(self):
"""
get a width of separator for current column
:return: int
"""
if self.total_free_space is None:
return 0
else:
sepa = self.default_column_space
# we need to distribute remainders
if self.default_colu... | def _separate(self):
"""
get a width of separator for current column
:return: int
"""
if self.total_free_space is None:
return 0
else:
sepa = self.default_column_space
# we need to distribute remainders
if self.default_colu... | [
"get",
"a",
"width",
"of",
"separator",
"for",
"current",
"column"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L170-L186 | [
"def",
"_separate",
"(",
"self",
")",
":",
"if",
"self",
".",
"total_free_space",
"is",
"None",
":",
"return",
"0",
"else",
":",
"sepa",
"=",
"self",
".",
"default_column_space",
"# we need to distribute remainders",
"if",
"self",
".",
"default_column_space_remain... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | TablePrinter.render | print provided table
:return: None | osbs/cli/render.py | def render(self):
"""
print provided table
:return: None
"""
print(self.format_str.format(**self.header), file=sys.stderr)
print(self.header_format_str.format(**self.header_data), file=sys.stderr)
for row in self.data:
print(self.format_str.format(**r... | def render(self):
"""
print provided table
:return: None
"""
print(self.format_str.format(**self.header), file=sys.stderr)
print(self.header_format_str.format(**self.header_data), file=sys.stderr)
for row in self.data:
print(self.format_str.format(**r... | [
"print",
"provided",
"table"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/render.py#L188-L197 | [
"def",
"render",
"(",
"self",
")",
":",
"print",
"(",
"self",
".",
"format_str",
".",
"format",
"(",
"*",
"*",
"self",
".",
"header",
")",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"print",
"(",
"self",
".",
"header_format_str",
".",
"format",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | JsonConverter._validate_source_data | :raises ValidationError: | pytablereader/json/formatter.py | def _validate_source_data(self):
"""
:raises ValidationError:
"""
try:
jsonschema.validate(self._buffer, self._schema)
except jsonschema.ValidationError as e:
raise ValidationError(e) | def _validate_source_data(self):
"""
:raises ValidationError:
"""
try:
jsonschema.validate(self._buffer, self._schema)
except jsonschema.ValidationError as e:
raise ValidationError(e) | [
":",
"raises",
"ValidationError",
":"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/formatter.py#L38-L46 | [
"def",
"_validate_source_data",
"(",
"self",
")",
":",
"try",
":",
"jsonschema",
".",
"validate",
"(",
"self",
".",
"_buffer",
",",
"self",
".",
"_schema",
")",
"except",
"jsonschema",
".",
"ValidationError",
"as",
"e",
":",
"raise",
"ValidationError",
"(",
... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | SingleJsonTableConverterC.to_table_data | :raises ValueError:
:raises pytablereader.error.ValidationError: | pytablereader/json/formatter.py | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
self._loader.inc_table_count()
yield TableData(
self._make_table_name(),
["key", "value"],
[record ... | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
self._loader.inc_table_count()
yield TableData(
self._make_table_name(),
["key", "value"],
[record ... | [
":",
"raises",
"ValueError",
":",
":",
"raises",
"pytablereader",
".",
"error",
".",
"ValidationError",
":"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/formatter.py#L139-L154 | [
"def",
"to_table_data",
"(",
"self",
")",
":",
"self",
".",
"_validate_source_data",
"(",
")",
"self",
".",
"_loader",
".",
"inc_table_count",
"(",
")",
"yield",
"TableData",
"(",
"self",
".",
"_make_table_name",
"(",
")",
",",
"[",
"\"key\"",
",",
"\"valu... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | MultipleJsonTableConverterA.to_table_data | :raises ValueError:
:raises pytablereader.error.ValidationError: | pytablereader/json/formatter.py | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
attr_name_set = set()
for json_record in json_records:
... | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
attr_name_set = set()
for json_record in json_records:
... | [
":",
"raises",
"ValueError",
":",
":",
"raises",
"pytablereader",
".",
"error",
".",
"ValidationError",
":"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/formatter.py#L186-L209 | [
"def",
"to_table_data",
"(",
"self",
")",
":",
"self",
".",
"_validate_source_data",
"(",
")",
"for",
"table_key",
",",
"json_records",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_buffer",
")",
":",
"attr_name_set",
"=",
"set",
"(",
")",
"for",
"j... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | MultipleJsonTableConverterB.to_table_data | :raises ValueError:
:raises pytablereader.error.ValidationError: | pytablereader/json/formatter.py | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
headers = sorted(six.viewkeys(json_records))
self._loader.... | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
headers = sorted(six.viewkeys(json_records))
self._loader.... | [
":",
"raises",
"ValueError",
":",
":",
"raises",
"pytablereader",
".",
"error",
".",
"ValidationError",
":"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/formatter.py#L227-L247 | [
"def",
"to_table_data",
"(",
"self",
")",
":",
"self",
".",
"_validate_source_data",
"(",
")",
"for",
"table_key",
",",
"json_records",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_buffer",
")",
":",
"headers",
"=",
"sorted",
"(",
"six",
".",
"view... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | MultipleJsonTableConverterC.to_table_data | :raises ValueError:
:raises pytablereader.error.ValidationError: | pytablereader/json/formatter.py | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
self._loader.inc_table_count()
self._table_key = table_key
... | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
self._loader.inc_table_count()
self._table_key = table_key
... | [
":",
"raises",
"ValueError",
":",
":",
"raises",
"pytablereader",
".",
"error",
".",
"ValidationError",
":"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/formatter.py#L265-L283 | [
"def",
"to_table_data",
"(",
"self",
")",
":",
"self",
".",
"_validate_source_data",
"(",
")",
"for",
"table_key",
",",
"json_records",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_buffer",
")",
":",
"self",
".",
"_loader",
".",
"inc_table_count",
"(... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | BuildRequestV2.set_params | set parameters in the user parameters
these parameters are accepted:
:param git_uri: str, uri of the git repository for the source
:param git_ref: str, commit ID of the branch to be pulled
:param git_branch: str, branch name of the branch to be pulled
:param base_image: str, nam... | osbs/build/build_requestv2.py | def set_params(self, **kwargs):
"""
set parameters in the user parameters
these parameters are accepted:
:param git_uri: str, uri of the git repository for the source
:param git_ref: str, commit ID of the branch to be pulled
:param git_branch: str, branch name of the bra... | def set_params(self, **kwargs):
"""
set parameters in the user parameters
these parameters are accepted:
:param git_uri: str, uri of the git repository for the source
:param git_ref: str, commit ID of the branch to be pulled
:param git_branch: str, branch name of the bra... | [
"set",
"parameters",
"in",
"the",
"user",
"parameters"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_requestv2.py#L42-L109 | [
"def",
"set_params",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Here we cater to the koji \"scratch\" build type, this will disable",
"# all plugins that might cause importing of data to koji",
"self",
".",
"scratch",
"=",
"kwargs",
".",
"get",
"(",
"'scratch'",
")"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequestV2.set_data_from_reactor_config | Sets data from reactor config | osbs/build/build_requestv2.py | def set_data_from_reactor_config(self):
"""
Sets data from reactor config
"""
reactor_config_override = self.user_params.reactor_config_override.value
reactor_config_map = self.user_params.reactor_config_map.value
data = None
if reactor_config_override:
... | def set_data_from_reactor_config(self):
"""
Sets data from reactor config
"""
reactor_config_override = self.user_params.reactor_config_override.value
reactor_config_map = self.user_params.reactor_config_map.value
data = None
if reactor_config_override:
... | [
"Sets",
"data",
"from",
"reactor",
"config"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_requestv2.py#L166-L208 | [
"def",
"set_data_from_reactor_config",
"(",
"self",
")",
":",
"reactor_config_override",
"=",
"self",
".",
"user_params",
".",
"reactor_config_override",
".",
"value",
"reactor_config_map",
"=",
"self",
".",
"user_params",
".",
"reactor_config_map",
".",
"value",
"dat... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | BuildRequestV2._set_required_secrets | Sets required secrets | osbs/build/build_requestv2.py | def _set_required_secrets(self, required_secrets, token_secrets):
"""
Sets required secrets
"""
if self.user_params.build_type.value == BUILD_TYPE_ORCHESTRATOR:
required_secrets += token_secrets
if not required_secrets:
return
secrets = self.temp... | def _set_required_secrets(self, required_secrets, token_secrets):
"""
Sets required secrets
"""
if self.user_params.build_type.value == BUILD_TYPE_ORCHESTRATOR:
required_secrets += token_secrets
if not required_secrets:
return
secrets = self.temp... | [
"Sets",
"required",
"secrets"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_requestv2.py#L210-L237 | [
"def",
"_set_required_secrets",
"(",
"self",
",",
"required_secrets",
",",
"token_secrets",
")",
":",
"if",
"self",
".",
"user_params",
".",
"build_type",
".",
"value",
"==",
"BUILD_TYPE_ORCHESTRATOR",
":",
"required_secrets",
"+=",
"token_secrets",
"if",
"not",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsTemplate.remove_plugin | if config contains plugin, remove it | osbs/build/plugins_configuration.py | def remove_plugin(self, phase, name, reason=None):
"""
if config contains plugin, remove it
"""
for p in self.template[phase]:
if p.get('name') == name:
self.template[phase].remove(p)
if reason:
logger.info('Removing {}:{}, ... | def remove_plugin(self, phase, name, reason=None):
"""
if config contains plugin, remove it
"""
for p in self.template[phase]:
if p.get('name') == name:
self.template[phase].remove(p)
if reason:
logger.info('Removing {}:{}, ... | [
"if",
"config",
"contains",
"plugin",
"remove",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L55-L64 | [
"def",
"remove_plugin",
"(",
"self",
",",
"phase",
",",
"name",
",",
"reason",
"=",
"None",
")",
":",
"for",
"p",
"in",
"self",
".",
"template",
"[",
"phase",
"]",
":",
"if",
"p",
".",
"get",
"(",
"'name'",
")",
"==",
"name",
":",
"self",
".",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsTemplate.add_plugin | if config has plugin, override it, else add it | osbs/build/plugins_configuration.py | def add_plugin(self, phase, name, args, reason=None):
"""
if config has plugin, override it, else add it
"""
plugin_modified = False
for plugin in self.template[phase]:
if plugin['name'] == name:
plugin['args'] = args
plugin_modified =... | def add_plugin(self, phase, name, args, reason=None):
"""
if config has plugin, override it, else add it
"""
plugin_modified = False
for plugin in self.template[phase]:
if plugin['name'] == name:
plugin['args'] = args
plugin_modified =... | [
"if",
"config",
"has",
"plugin",
"override",
"it",
"else",
"add",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L66-L80 | [
"def",
"add_plugin",
"(",
"self",
",",
"phase",
",",
"name",
",",
"args",
",",
"reason",
"=",
"None",
")",
":",
"plugin_modified",
"=",
"False",
"for",
"plugin",
"in",
"self",
".",
"template",
"[",
"phase",
"]",
":",
"if",
"plugin",
"[",
"'name'",
"]... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsTemplate.get_plugin_conf | Return the configuration for a plugin.
Raises KeyError if there are no plugins of that type.
Raises IndexError if the named plugin is not listed. | osbs/build/plugins_configuration.py | def get_plugin_conf(self, phase, name):
"""
Return the configuration for a plugin.
Raises KeyError if there are no plugins of that type.
Raises IndexError if the named plugin is not listed.
"""
match = [x for x in self.template[phase] if x.get('name') == name]
re... | def get_plugin_conf(self, phase, name):
"""
Return the configuration for a plugin.
Raises KeyError if there are no plugins of that type.
Raises IndexError if the named plugin is not listed.
"""
match = [x for x in self.template[phase] if x.get('name') == name]
re... | [
"Return",
"the",
"configuration",
"for",
"a",
"plugin",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L82-L90 | [
"def",
"get_plugin_conf",
"(",
"self",
",",
"phase",
",",
"name",
")",
":",
"match",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"template",
"[",
"phase",
"]",
"if",
"x",
".",
"get",
"(",
"'name'",
")",
"==",
"name",
"]",
"return",
"match",
"["... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsTemplate.has_plugin_conf | Check whether a plugin is configured. | osbs/build/plugins_configuration.py | def has_plugin_conf(self, phase, name):
"""
Check whether a plugin is configured.
"""
try:
self.get_plugin_conf(phase, name)
return True
except (KeyError, IndexError):
return False | def has_plugin_conf(self, phase, name):
"""
Check whether a plugin is configured.
"""
try:
self.get_plugin_conf(phase, name)
return True
except (KeyError, IndexError):
return False | [
"Check",
"whether",
"a",
"plugin",
"is",
"configured",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L92-L100 | [
"def",
"has_plugin_conf",
"(",
"self",
",",
"phase",
",",
"name",
")",
":",
"try",
":",
"self",
".",
"get_plugin_conf",
"(",
"phase",
",",
"name",
")",
"return",
"True",
"except",
"(",
"KeyError",
",",
"IndexError",
")",
":",
"return",
"False"
] | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.adjust_for_scratch | Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji. | osbs/build/plugins_configuration.py | def adjust_for_scratch(self):
"""
Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji.
"""
if self.user_params.scratch.value:
remove_plugins = [
... | def adjust_for_scratch(self):
"""
Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji.
"""
if self.user_params.scratch.value:
remove_plugins = [
... | [
"Remove",
"certain",
"plugins",
"in",
"order",
"to",
"handle",
"the",
"scratch",
"build",
"scenario",
".",
"Scratch",
"builds",
"must",
"not",
"affect",
"subsequent",
"builds",
"and",
"should",
"not",
"be",
"imported",
"into",
"Koji",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L149-L173 | [
"def",
"adjust_for_scratch",
"(",
"self",
")",
":",
"if",
"self",
".",
"user_params",
".",
"scratch",
".",
"value",
":",
"remove_plugins",
"=",
"[",
"(",
"\"prebuild_plugins\"",
",",
"\"koji_parent\"",
")",
",",
"(",
"\"postbuild_plugins\"",
",",
"\"compress\"",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.adjust_for_isolated | Remove certain plugins in order to handle the "isolated build"
scenario. | osbs/build/plugins_configuration.py | def adjust_for_isolated(self):
"""
Remove certain plugins in order to handle the "isolated build"
scenario.
"""
if self.user_params.isolated.value:
remove_plugins = [
("prebuild_plugins", "check_and_set_rebuild"),
("prebuild_plugins", "... | def adjust_for_isolated(self):
"""
Remove certain plugins in order to handle the "isolated build"
scenario.
"""
if self.user_params.isolated.value:
remove_plugins = [
("prebuild_plugins", "check_and_set_rebuild"),
("prebuild_plugins", "... | [
"Remove",
"certain",
"plugins",
"in",
"order",
"to",
"handle",
"the",
"isolated",
"build",
"scenario",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L175-L187 | [
"def",
"adjust_for_isolated",
"(",
"self",
")",
":",
"if",
"self",
".",
"user_params",
".",
"isolated",
".",
"value",
":",
"remove_plugins",
"=",
"[",
"(",
"\"prebuild_plugins\"",
",",
"\"check_and_set_rebuild\"",
")",
",",
"(",
"\"prebuild_plugins\"",
",",
"\"s... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.adjust_for_flatpak | Remove plugins that don't work when building Flatpaks | osbs/build/plugins_configuration.py | def adjust_for_flatpak(self):
"""
Remove plugins that don't work when building Flatpaks
"""
if self.user_params.flatpak.value:
remove_plugins = [
("prebuild_plugins", "resolve_composes"),
# We'll extract the filesystem anyways for a Flatpak ins... | def adjust_for_flatpak(self):
"""
Remove plugins that don't work when building Flatpaks
"""
if self.user_params.flatpak.value:
remove_plugins = [
("prebuild_plugins", "resolve_composes"),
# We'll extract the filesystem anyways for a Flatpak ins... | [
"Remove",
"plugins",
"that",
"don",
"t",
"work",
"when",
"building",
"Flatpaks"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L189-L210 | [
"def",
"adjust_for_flatpak",
"(",
"self",
")",
":",
"if",
"self",
".",
"user_params",
".",
"flatpak",
".",
"value",
":",
"remove_plugins",
"=",
"[",
"(",
"\"prebuild_plugins\"",
",",
"\"resolve_composes\"",
")",
",",
"# We'll extract the filesystem anyways for a Flatp... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_customizations | Customize template for site user specified customizations | osbs/build/plugins_configuration.py | def render_customizations(self):
"""
Customize template for site user specified customizations
"""
disable_plugins = self.pt.customize_conf.get('disable_plugins', [])
if not disable_plugins:
logger.debug('No site-user specified plugins to disable')
else:
... | def render_customizations(self):
"""
Customize template for site user specified customizations
"""
disable_plugins = self.pt.customize_conf.get('disable_plugins', [])
if not disable_plugins:
logger.debug('No site-user specified plugins to disable')
else:
... | [
"Customize",
"template",
"for",
"site",
"user",
"specified",
"customizations"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L239-L266 | [
"def",
"render_customizations",
"(",
"self",
")",
":",
"disable_plugins",
"=",
"self",
".",
"pt",
".",
"customize_conf",
".",
"get",
"(",
"'disable_plugins'",
",",
"[",
"]",
")",
"if",
"not",
"disable_plugins",
":",
"logger",
".",
"debug",
"(",
"'No site-use... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_koji | if there is yum repo in user params, don't pick stuff from koji | osbs/build/plugins_configuration.py | def render_koji(self):
"""
if there is yum repo in user params, don't pick stuff from koji
"""
phase = 'prebuild_plugins'
plugin = 'koji'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.yum_repourls.value:
self.pt... | def render_koji(self):
"""
if there is yum repo in user params, don't pick stuff from koji
"""
phase = 'prebuild_plugins'
plugin = 'koji'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.yum_repourls.value:
self.pt... | [
"if",
"there",
"is",
"yum",
"repo",
"in",
"user",
"params",
"don",
"t",
"pick",
"stuff",
"from",
"koji"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L285-L298 | [
"def",
"render_koji",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'koji'",
"if",
"not",
"self",
".",
"pt",
".",
"has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"if",
"self",
".",
"user_params",
".",
"yum... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_bump_release | If the bump_release plugin is present, configure it | osbs/build/plugins_configuration.py | def render_bump_release(self):
"""
If the bump_release plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'bump_release'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.release.value:
self.pt.... | def render_bump_release(self):
"""
If the bump_release plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'bump_release'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.release.value:
self.pt.... | [
"If",
"the",
"bump_release",
"plugin",
"is",
"present",
"configure",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L300-L317 | [
"def",
"render_bump_release",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'bump_release'",
"if",
"not",
"self",
".",
"pt",
".",
"has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"if",
"self",
".",
"user_params... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_check_and_set_platforms | If the check_and_set_platforms plugin is present, configure it | osbs/build/plugins_configuration.py | def render_check_and_set_platforms(self):
"""
If the check_and_set_platforms plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'check_and_set_platforms'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.ko... | def render_check_and_set_platforms(self):
"""
If the check_and_set_platforms plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'check_and_set_platforms'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.ko... | [
"If",
"the",
"check_and_set_platforms",
"plugin",
"is",
"present",
"configure",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L319-L330 | [
"def",
"render_check_and_set_platforms",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'check_and_set_platforms'",
"if",
"not",
"self",
".",
"pt",
".",
"has_plugin_conf",
"(",
"phase",
",",
"plugin",
")",
":",
"return",
"if",
"self",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_import_image | Configure the import_image plugin | osbs/build/plugins_configuration.py | def render_import_image(self, use_auth=None):
"""
Configure the import_image plugin
"""
# import_image is a multi-phase plugin
if self.user_params.imagestream_name.value is None:
self.pt.remove_plugin('exit_plugins', 'import_image',
'... | def render_import_image(self, use_auth=None):
"""
Configure the import_image plugin
"""
# import_image is a multi-phase plugin
if self.user_params.imagestream_name.value is None:
self.pt.remove_plugin('exit_plugins', 'import_image',
'... | [
"Configure",
"the",
"import_image",
"plugin"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L332-L342 | [
"def",
"render_import_image",
"(",
"self",
",",
"use_auth",
"=",
"None",
")",
":",
"# import_image is a multi-phase plugin",
"if",
"self",
".",
"user_params",
".",
"imagestream_name",
".",
"value",
"is",
"None",
":",
"self",
".",
"pt",
".",
"remove_plugin",
"(",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_tag_from_config | Configure tag_from_config plugin | osbs/build/plugins_configuration.py | def render_tag_from_config(self):
"""Configure tag_from_config plugin"""
phase = 'postbuild_plugins'
plugin = 'tag_from_config'
if not self.has_tag_suffixes_placeholder():
return
unique_tag = self.user_params.image_tag.value.split(':')[-1]
tag_suffixes = {'un... | def render_tag_from_config(self):
"""Configure tag_from_config plugin"""
phase = 'postbuild_plugins'
plugin = 'tag_from_config'
if not self.has_tag_suffixes_placeholder():
return
unique_tag = self.user_params.image_tag.value.split(':')[-1]
tag_suffixes = {'un... | [
"Configure",
"tag_from_config",
"plugin"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L459-L483 | [
"def",
"render_tag_from_config",
"(",
"self",
")",
":",
"phase",
"=",
"'postbuild_plugins'",
"plugin",
"=",
"'tag_from_config'",
"if",
"not",
"self",
".",
"has_tag_suffixes_placeholder",
"(",
")",
":",
"return",
"unique_tag",
"=",
"self",
".",
"user_params",
".",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | PluginsConfiguration.render_pull_base_image | Configure pull_base_image | osbs/build/plugins_configuration.py | def render_pull_base_image(self):
"""Configure pull_base_image"""
phase = 'prebuild_plugins'
plugin = 'pull_base_image'
if self.user_params.parent_images_digests.value:
self.pt.set_plugin_arg(phase, plugin, 'parent_images_digests',
self.use... | def render_pull_base_image(self):
"""Configure pull_base_image"""
phase = 'prebuild_plugins'
plugin = 'pull_base_image'
if self.user_params.parent_images_digests.value:
self.pt.set_plugin_arg(phase, plugin, 'parent_images_digests',
self.use... | [
"Configure",
"pull_base_image"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L485-L492 | [
"def",
"render_pull_base_image",
"(",
"self",
")",
":",
"phase",
"=",
"'prebuild_plugins'",
"plugin",
"=",
"'pull_base_image'",
"if",
"self",
".",
"user_params",
".",
"parent_images_digests",
".",
"value",
":",
"self",
".",
"pt",
".",
"set_plugin_arg",
"(",
"pha... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.get_user | get info about user (if no user specified, use the one initiating request)
:param username: str, name of user to get info about, default="~"
:return: dict | osbs/core.py | def get_user(self, username="~"):
"""
get info about user (if no user specified, use the one initiating request)
:param username: str, name of user to get info about, default="~"
:return: dict
"""
url = self._build_url("users/%s/" % username, _prepend_namespace=False)
... | def get_user(self, username="~"):
"""
get info about user (if no user specified, use the one initiating request)
:param username: str, name of user to get info about, default="~"
:return: dict
"""
url = self._build_url("users/%s/" % username, _prepend_namespace=False)
... | [
"get",
"info",
"about",
"user",
"(",
"if",
"no",
"user",
"specified",
"use",
"the",
"one",
"initiating",
"request",
")"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L233-L243 | [
"def",
"get_user",
"(",
"self",
",",
"username",
"=",
"\"~\"",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"\"users/%s/\"",
"%",
"username",
",",
"_prepend_namespace",
"=",
"False",
")",
"response",
"=",
"self",
".",
"_get",
"(",
"url",
")",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.create_build | :return: | osbs/core.py | def create_build(self, build_json):
"""
:return:
"""
url = self._build_url("builds/")
logger.debug(build_json)
return self._post(url, data=json.dumps(build_json),
headers={"Content-Type": "application/json"}) | def create_build(self, build_json):
"""
:return:
"""
url = self._build_url("builds/")
logger.debug(build_json)
return self._post(url, data=json.dumps(build_json),
headers={"Content-Type": "application/json"}) | [
":",
"return",
":"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L296-L303 | [
"def",
"create_build",
"(",
"self",
",",
"build_json",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"\"builds/\"",
")",
"logger",
".",
"debug",
"(",
"build_json",
")",
"return",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"json",
".",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.get_all_build_configs_by_labels | Returns all builds matching a given set of label selectors. It is up to the
calling function to filter the results. | osbs/core.py | def get_all_build_configs_by_labels(self, label_selectors):
"""
Returns all builds matching a given set of label selectors. It is up to the
calling function to filter the results.
"""
labels = ['%s=%s' % (field, value) for field, value in label_selectors]
labels = ','.joi... | def get_all_build_configs_by_labels(self, label_selectors):
"""
Returns all builds matching a given set of label selectors. It is up to the
calling function to filter the results.
"""
labels = ['%s=%s' % (field, value) for field, value in label_selectors]
labels = ','.joi... | [
"Returns",
"all",
"builds",
"matching",
"a",
"given",
"set",
"of",
"label",
"selectors",
".",
"It",
"is",
"up",
"to",
"the",
"calling",
"function",
"to",
"filter",
"the",
"results",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L326-L334 | [
"def",
"get_all_build_configs_by_labels",
"(",
"self",
",",
"label_selectors",
")",
":",
"labels",
"=",
"[",
"'%s=%s'",
"%",
"(",
"field",
",",
"value",
")",
"for",
"field",
",",
"value",
"in",
"label_selectors",
"]",
"labels",
"=",
"','",
".",
"join",
"("... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.get_build_config_by_labels | Returns a build config matching the given label
selectors. This method will raise OsbsException
if not exactly one build config is found. | osbs/core.py | def get_build_config_by_labels(self, label_selectors):
"""
Returns a build config matching the given label
selectors. This method will raise OsbsException
if not exactly one build config is found.
"""
items = self.get_all_build_configs_by_labels(label_selectors)
... | def get_build_config_by_labels(self, label_selectors):
"""
Returns a build config matching the given label
selectors. This method will raise OsbsException
if not exactly one build config is found.
"""
items = self.get_all_build_configs_by_labels(label_selectors)
... | [
"Returns",
"a",
"build",
"config",
"matching",
"the",
"given",
"label",
"selectors",
".",
"This",
"method",
"will",
"raise",
"OsbsException",
"if",
"not",
"exactly",
"one",
"build",
"config",
"is",
"found",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L336-L353 | [
"def",
"get_build_config_by_labels",
"(",
"self",
",",
"label_selectors",
")",
":",
"items",
"=",
"self",
".",
"get_all_build_configs_by_labels",
"(",
"label_selectors",
")",
"if",
"not",
"items",
":",
"raise",
"OsbsException",
"(",
"\"Build config not found for labels:... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.get_build_config_by_labels_filtered | Returns a build config matching the given label selectors, filtering against
another predetermined value. This method will raise OsbsException
if not exactly one build config is found after filtering. | osbs/core.py | def get_build_config_by_labels_filtered(self, label_selectors, filter_key, filter_value):
"""
Returns a build config matching the given label selectors, filtering against
another predetermined value. This method will raise OsbsException
if not exactly one build config is found after filt... | def get_build_config_by_labels_filtered(self, label_selectors, filter_key, filter_value):
"""
Returns a build config matching the given label selectors, filtering against
another predetermined value. This method will raise OsbsException
if not exactly one build config is found after filt... | [
"Returns",
"a",
"build",
"config",
"matching",
"the",
"given",
"label",
"selectors",
"filtering",
"against",
"another",
"predetermined",
"value",
".",
"This",
"method",
"will",
"raise",
"OsbsException",
"if",
"not",
"exactly",
"one",
"build",
"config",
"is",
"fo... | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L355-L379 | [
"def",
"get_build_config_by_labels_filtered",
"(",
"self",
",",
"label_selectors",
",",
"filter_key",
",",
"filter_value",
")",
":",
"items",
"=",
"self",
".",
"get_all_build_configs_by_labels",
"(",
"label_selectors",
")",
"if",
"filter_value",
"is",
"not",
"None",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.create_build_config | :return: | osbs/core.py | def create_build_config(self, build_config_json):
"""
:return:
"""
url = self._build_url("buildconfigs/")
return self._post(url, data=build_config_json,
headers={"Content-Type": "application/json"}) | def create_build_config(self, build_config_json):
"""
:return:
"""
url = self._build_url("buildconfigs/")
return self._post(url, data=build_config_json,
headers={"Content-Type": "application/json"}) | [
":",
"return",
":"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L381-L387 | [
"def",
"create_build_config",
"(",
"self",
",",
"build_config_json",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"\"buildconfigs/\"",
")",
"return",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"build_config_json",
",",
"headers",
"=",
"{",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.stream_logs | stream logs from build
:param build_id: str
:return: iterator | osbs/core.py | def stream_logs(self, build_id):
"""
stream logs from build
:param build_id: str
:return: iterator
"""
kwargs = {'follow': 1}
# If connection is closed within this many seconds, give up:
min_idle_timeout = 60
# Stream logs, but be careful of the... | def stream_logs(self, build_id):
"""
stream logs from build
:param build_id: str
:return: iterator
"""
kwargs = {'follow': 1}
# If connection is closed within this many seconds, give up:
min_idle_timeout = 60
# Stream logs, but be careful of the... | [
"stream",
"logs",
"from",
"build"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L434-L483 | [
"def",
"stream_logs",
"(",
"self",
",",
"build_id",
")",
":",
"kwargs",
"=",
"{",
"'follow'",
":",
"1",
"}",
"# If connection is closed within this many seconds, give up:",
"min_idle_timeout",
"=",
"60",
"# Stream logs, but be careful of the connection closing",
"# due to idl... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.logs | provide logs from build
:param build_id: str
:param follow: bool, fetch logs as they come?
:param build_json: dict, to save one get-build query
:param wait_if_missing: bool, if build doesn't exist, wait
:return: None, str or iterator | osbs/core.py | def logs(self, build_id, follow=False, build_json=None, wait_if_missing=False):
"""
provide logs from build
:param build_id: str
:param follow: bool, fetch logs as they come?
:param build_json: dict, to save one get-build query
:param wait_if_missing: bool, if build does... | def logs(self, build_id, follow=False, build_json=None, wait_if_missing=False):
"""
provide logs from build
:param build_id: str
:param follow: bool, fetch logs as they come?
:param build_json: dict, to save one get-build query
:param wait_if_missing: bool, if build does... | [
"provide",
"logs",
"from",
"build"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L485-L520 | [
"def",
"logs",
"(",
"self",
",",
"build_id",
",",
"follow",
"=",
"False",
",",
"build_json",
"=",
"None",
",",
"wait_if_missing",
"=",
"False",
")",
":",
"# does build exist?",
"try",
":",
"build_json",
"=",
"build_json",
"or",
"self",
".",
"get_build",
"(... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.list_builds | List builds matching criteria
:param build_config_id: str, only list builds created from BuildConfig
:param koji_task_id: str, only list builds for Koji Task ID
:param field_selector: str, field selector for query
:return: HttpResponse | osbs/core.py | def list_builds(self, build_config_id=None, koji_task_id=None,
field_selector=None, labels=None):
"""
List builds matching criteria
:param build_config_id: str, only list builds created from BuildConfig
:param koji_task_id: str, only list builds for Koji Task ID
... | def list_builds(self, build_config_id=None, koji_task_id=None,
field_selector=None, labels=None):
"""
List builds matching criteria
:param build_config_id: str, only list builds created from BuildConfig
:param koji_task_id: str, only list builds for Koji Task ID
... | [
"List",
"builds",
"matching",
"criteria"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L522-L553 | [
"def",
"list_builds",
"(",
"self",
",",
"build_config_id",
"=",
"None",
",",
"koji_task_id",
"=",
"None",
",",
"field_selector",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"query",
"=",
"{",
"}",
"selector",
"=",
"'{key}={value}'",
"label",
"=",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.create_resource_quota | Prevent builds being scheduled and wait for running builds to finish.
:return: | osbs/core.py | def create_resource_quota(self, name, quota_json):
"""
Prevent builds being scheduled and wait for running builds to finish.
:return:
"""
url = self._build_k8s_url("resourcequotas/")
response = self._post(url, data=json.dumps(quota_json),
h... | def create_resource_quota(self, name, quota_json):
"""
Prevent builds being scheduled and wait for running builds to finish.
:return:
"""
url = self._build_k8s_url("resourcequotas/")
response = self._post(url, data=json.dumps(quota_json),
h... | [
"Prevent",
"builds",
"being",
"scheduled",
"and",
"wait",
"for",
"running",
"builds",
"to",
"finish",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L577-L593 | [
"def",
"create_resource_quota",
"(",
"self",
",",
"name",
",",
"quota_json",
")",
":",
"url",
"=",
"self",
".",
"_build_k8s_url",
"(",
"\"resourcequotas/\"",
")",
"response",
"=",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"json",
".",
"dumps",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.wait | :param build_id: wait for build to finish
:return: | osbs/core.py | def wait(self, build_id, states):
"""
:param build_id: wait for build to finish
:return:
"""
logger.info("watching build '%s'", build_id)
for changetype, obj in self.watch_resource("builds", build_id):
try:
obj_name = obj["metadata"]["name"]
... | def wait(self, build_id, states):
"""
:param build_id: wait for build to finish
:return:
"""
logger.info("watching build '%s'", build_id)
for changetype, obj in self.watch_resource("builds", build_id):
try:
obj_name = obj["metadata"]["name"]
... | [
":",
"param",
"build_id",
":",
"wait",
"for",
"build",
"to",
"finish"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L654-L694 | [
"def",
"wait",
"(",
"self",
",",
"build_id",
",",
"states",
")",
":",
"logger",
".",
"info",
"(",
"\"watching build '%s'\"",
",",
"build_id",
")",
"for",
"changetype",
",",
"obj",
"in",
"self",
".",
"watch_resource",
"(",
"\"builds\"",
",",
"build_id",
")"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.adjust_attributes_on_object | adjust labels or annotations on object
labels have to match RE: (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? and
have at most 63 chars
:param collection: str, object collection e.g. 'builds'
:param name: str, name of object
:param things: str, 'labels' or 'annotations'
:... | osbs/core.py | def adjust_attributes_on_object(self, collection, name, things, values, how):
"""
adjust labels or annotations on object
labels have to match RE: (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? and
have at most 63 chars
:param collection: str, object collection e.g. 'builds'
... | def adjust_attributes_on_object(self, collection, name, things, values, how):
"""
adjust labels or annotations on object
labels have to match RE: (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? and
have at most 63 chars
:param collection: str, object collection e.g. 'builds'
... | [
"adjust",
"labels",
"or",
"annotations",
"on",
"object"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L727-L749 | [
"def",
"adjust_attributes_on_object",
"(",
"self",
",",
"collection",
",",
"name",
",",
"things",
",",
"values",
",",
"how",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"\"%s/%s\"",
"%",
"(",
"collection",
",",
"name",
")",
")",
"response",
"="... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.update_annotations_on_build | set annotations on build object
:param build_id: str, id of build
:param annotations: dict, annotations to set
:return: | osbs/core.py | def update_annotations_on_build(self, build_id, annotations):
"""
set annotations on build object
:param build_id: str, id of build
:param annotations: dict, annotations to set
:return:
"""
return self.adjust_attributes_on_object('builds', build_id,
... | def update_annotations_on_build(self, build_id, annotations):
"""
set annotations on build object
:param build_id: str, id of build
:param annotations: dict, annotations to set
:return:
"""
return self.adjust_attributes_on_object('builds', build_id,
... | [
"set",
"annotations",
"on",
"build",
"object"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L771-L781 | [
"def",
"update_annotations_on_build",
"(",
"self",
",",
"build_id",
",",
"annotations",
")",
":",
"return",
"self",
".",
"adjust_attributes_on_object",
"(",
"'builds'",
",",
"build_id",
",",
"'annotations'",
",",
"annotations",
",",
"self",
".",
"_update_metadata_th... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.import_image | Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported | osbs/core.py | def import_image(self, name, stream_import, tags=None):
"""
Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported
"""
# Get the JSON for the ImageStream
imagestream_json = self.get_image_stream(name).json()
logger... | def import_image(self, name, stream_import, tags=None):
"""
Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported
"""
# Get the JSON for the ImageStream
imagestream_json = self.get_image_stream(name).json()
logger... | [
"Import",
"image",
"tags",
"from",
"a",
"Docker",
"registry",
"into",
"an",
"ImageStream"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L872-L922 | [
"def",
"import_image",
"(",
"self",
",",
"name",
",",
"stream_import",
",",
"tags",
"=",
"None",
")",
":",
"# Get the JSON for the ImageStream",
"imagestream_json",
"=",
"self",
".",
"get_image_stream",
"(",
"name",
")",
".",
"json",
"(",
")",
"logger",
".",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Openshift.import_image_tags | Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported | osbs/core.py | def import_image_tags(self, name, stream_import, tags, repository, insecure):
"""
Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported
"""
# Get the JSON for the ImageStream
imagestream_json = self.get_image_stream(name)... | def import_image_tags(self, name, stream_import, tags, repository, insecure):
"""
Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported
"""
# Get the JSON for the ImageStream
imagestream_json = self.get_image_stream(name)... | [
"Import",
"image",
"tags",
"from",
"a",
"Docker",
"registry",
"into",
"an",
"ImageStream"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L926-L986 | [
"def",
"import_image_tags",
"(",
"self",
",",
"name",
",",
"stream_import",
",",
"tags",
",",
"repository",
",",
"insecure",
")",
":",
"# Get the JSON for the ImageStream",
"imagestream_json",
"=",
"self",
".",
"get_image_stream",
"(",
"name",
")",
".",
"json",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | str_on_2_unicode_on_3 | argparse is way too awesome when doing repr() on choices when printing usage
:param s: str or unicode
:return: str on 2, unicode on 3 | osbs/cli/main.py | def str_on_2_unicode_on_3(s):
"""
argparse is way too awesome when doing repr() on choices when printing usage
:param s: str or unicode
:return: str on 2, unicode on 3
"""
if not PY3:
return str(s)
else: # 3+
if not isinstance(s, str):
return str(s, encoding="u... | def str_on_2_unicode_on_3(s):
"""
argparse is way too awesome when doing repr() on choices when printing usage
:param s: str or unicode
:return: str on 2, unicode on 3
"""
if not PY3:
return str(s)
else: # 3+
if not isinstance(s, str):
return str(s, encoding="u... | [
"argparse",
"is",
"way",
"too",
"awesome",
"when",
"doing",
"repr",
"()",
"on",
"choices",
"when",
"printing",
"usage"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/main.py#L534-L547 | [
"def",
"str_on_2_unicode_on_3",
"(",
"s",
")",
":",
"if",
"not",
"PY3",
":",
"return",
"str",
"(",
"s",
")",
"else",
":",
"# 3+",
"if",
"not",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"return",
"str",
"(",
"s",
",",
"encoding",
"=",
"\"utf-8\"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | JsonLinesTableFileLoader.load | Extract tabular data as |TableData| instances from a Line-delimited JSON file.
|load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
:rtype: |TableData| iterator
:raises pytablereader.DataError:
If the data is invalid Li... | pytablereader/jsonlines/core.py | def load(self):
"""
Extract tabular data as |TableData| instances from a Line-delimited JSON file.
|load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
:rtype: |TableData| iterator
:raises pytablereader.DataError:
... | def load(self):
"""
Extract tabular data as |TableData| instances from a Line-delimited JSON file.
|load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
:rtype: |TableData| iterator
:raises pytablereader.DataError:
... | [
"Extract",
"tabular",
"data",
"as",
"|TableData|",
"instances",
"from",
"a",
"Line",
"-",
"delimited",
"JSON",
"file",
".",
"|load_source_desc_file|"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/jsonlines/core.py#L75-L94 | [
"def",
"load",
"(",
"self",
")",
":",
"formatter",
"=",
"JsonLinesTableFormatter",
"(",
"self",
".",
"load_dict",
"(",
")",
")",
"formatter",
".",
"accept",
"(",
"self",
")",
"return",
"formatter",
".",
"to_table_data",
"(",
")"
] | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | GoogleSheetsTableLoader.load | Load table data from a Google Spreadsheet.
This method consider :py:attr:`.source` as a path to the
credential JSON file to access Google Sheets API.
The method automatically search the header row start from
:py:attr:`.start_row`. The condition of the header row is that
all of ... | pytablereader/spreadsheet/gsloader.py | def load(self):
"""
Load table data from a Google Spreadsheet.
This method consider :py:attr:`.source` as a path to the
credential JSON file to access Google Sheets API.
The method automatically search the header row start from
:py:attr:`.start_row`. The condition of th... | def load(self):
"""
Load table data from a Google Spreadsheet.
This method consider :py:attr:`.source` as a path to the
credential JSON file to access Google Sheets API.
The method automatically search the header row start from
:py:attr:`.start_row`. The condition of th... | [
"Load",
"table",
"data",
"from",
"a",
"Google",
"Spreadsheet",
"."
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/spreadsheet/gsloader.py#L62-L126 | [
"def",
"load",
"(",
"self",
")",
":",
"import",
"gspread",
"from",
"oauth2client",
".",
"service_account",
"import",
"ServiceAccountCredentials",
"self",
".",
"_validate_table_name",
"(",
")",
"self",
".",
"_validate_title",
"(",
")",
"scope",
"=",
"[",
"\"https... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | set_log_level | Set logging level of this module. Using
`logbook <https://logbook.readthedocs.io/en/stable/>`__ module for logging.
:param int log_level:
One of the log level of
`logbook <https://logbook.readthedocs.io/en/stable/api/base.html>`__.
Disabled logging if ``log_level`` is ``logbook.NOTSET``... | pytablereader/_logger/_logger.py | def set_log_level(log_level):
"""
Set logging level of this module. Using
`logbook <https://logbook.readthedocs.io/en/stable/>`__ module for logging.
:param int log_level:
One of the log level of
`logbook <https://logbook.readthedocs.io/en/stable/api/base.html>`__.
Disabled logg... | def set_log_level(log_level):
"""
Set logging level of this module. Using
`logbook <https://logbook.readthedocs.io/en/stable/>`__ module for logging.
:param int log_level:
One of the log level of
`logbook <https://logbook.readthedocs.io/en/stable/api/base.html>`__.
Disabled logg... | [
"Set",
"logging",
"level",
"of",
"this",
"module",
".",
"Using",
"logbook",
"<https",
":",
"//",
"logbook",
".",
"readthedocs",
".",
"io",
"/",
"en",
"/",
"stable",
"/",
">",
"__",
"module",
"for",
"logging",
"."
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/_logger/_logger.py#L51-L85 | [
"def",
"set_log_level",
"(",
"log_level",
")",
":",
"if",
"not",
"LOGBOOK_INSTALLED",
":",
"return",
"# validate log level",
"logbook",
".",
"get_level_name",
"(",
"log_level",
")",
"if",
"log_level",
"==",
"logger",
".",
"level",
":",
"return",
"if",
"log_level... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | buildconfig_update | Performs update of given `orig` BuildConfig with values from `new` BuildConfig.
Both BuildConfigs have to be represented as `dict`s.
This function:
- adds all key/value pairs to `orig` from `new` that are missing
- replaces values in `orig` for keys that are in both
- removes key/value pairs from `... | osbs/utils.py | def buildconfig_update(orig, new, remove_nonexistent_keys=False):
"""Performs update of given `orig` BuildConfig with values from `new` BuildConfig.
Both BuildConfigs have to be represented as `dict`s.
This function:
- adds all key/value pairs to `orig` from `new` that are missing
- replaces values... | def buildconfig_update(orig, new, remove_nonexistent_keys=False):
"""Performs update of given `orig` BuildConfig with values from `new` BuildConfig.
Both BuildConfigs have to be represented as `dict`s.
This function:
- adds all key/value pairs to `orig` from `new` that are missing
- replaces values... | [
"Performs",
"update",
"of",
"given",
"orig",
"BuildConfig",
"with",
"values",
"from",
"new",
"BuildConfig",
".",
"Both",
"BuildConfigs",
"have",
"to",
"be",
"represented",
"as",
"dict",
"s",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L168-L191 | [
"def",
"buildconfig_update",
"(",
"orig",
",",
"new",
",",
"remove_nonexistent_keys",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"orig",
",",
"dict",
")",
"and",
"isinstance",
"(",
"new",
",",
"dict",
")",
":",
"clean_triggers",
"(",
"orig",
",",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | checkout_git_repo | clone provided git repo to target_dir, optionally checkout provided commit
yield the ClonedRepoData and delete the repo when finished
:param git_url: str, git repo to clone
:param target_dir: str, filesystem path where the repo should be cloned
:param commit: str, commit to checkout, SHA-1 or ref
:... | osbs/utils.py | def checkout_git_repo(git_url, target_dir=None, commit=None, retry_times=GIT_MAX_RETRIES,
branch=None, depth=None):
"""
clone provided git repo to target_dir, optionally checkout provided commit
yield the ClonedRepoData and delete the repo when finished
:param git_url: str, git re... | def checkout_git_repo(git_url, target_dir=None, commit=None, retry_times=GIT_MAX_RETRIES,
branch=None, depth=None):
"""
clone provided git repo to target_dir, optionally checkout provided commit
yield the ClonedRepoData and delete the repo when finished
:param git_url: str, git re... | [
"clone",
"provided",
"git",
"repo",
"to",
"target_dir",
"optionally",
"checkout",
"provided",
"commit",
"yield",
"the",
"ClonedRepoData",
"and",
"delete",
"the",
"repo",
"when",
"finished"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L195-L214 | [
"def",
"checkout_git_repo",
"(",
"git_url",
",",
"target_dir",
"=",
"None",
",",
"commit",
"=",
"None",
",",
"retry_times",
"=",
"GIT_MAX_RETRIES",
",",
"branch",
"=",
"None",
",",
"depth",
"=",
"None",
")",
":",
"tmpdir",
"=",
"tempfile",
".",
"mkdtemp",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | clone_git_repo | clone provided git repo to target_dir, optionally checkout provided commit
:param git_url: str, git repo to clone
:param target_dir: str, filesystem path where the repo should be cloned
:param commit: str, commit to checkout, SHA-1 or ref
:param retry_times: int, number of retries for git clone
:pa... | osbs/utils.py | def clone_git_repo(git_url, target_dir=None, commit=None, retry_times=GIT_MAX_RETRIES, branch=None,
depth=None):
"""
clone provided git repo to target_dir, optionally checkout provided commit
:param git_url: str, git repo to clone
:param target_dir: str, filesystem path where the rep... | def clone_git_repo(git_url, target_dir=None, commit=None, retry_times=GIT_MAX_RETRIES, branch=None,
depth=None):
"""
clone provided git repo to target_dir, optionally checkout provided commit
:param git_url: str, git repo to clone
:param target_dir: str, filesystem path where the rep... | [
"clone",
"provided",
"git",
"repo",
"to",
"target_dir",
"optionally",
"checkout",
"provided",
"commit"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L217-L267 | [
"def",
"clone_git_repo",
"(",
"git_url",
",",
"target_dir",
"=",
"None",
",",
"commit",
"=",
"None",
",",
"retry_times",
"=",
"GIT_MAX_RETRIES",
",",
"branch",
"=",
"None",
",",
"depth",
"=",
"None",
")",
":",
"retry_delay",
"=",
"GIT_BACKOFF_FACTOR",
"targe... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | reset_git_repo | hard reset git clone in target_dir to given git_reference
:param target_dir: str, filesystem path where the repo is cloned
:param git_reference: str, any valid git reference
:param retry_depth: int, if the repo was cloned with --shallow, this is the expected
depth of the commit
... | osbs/utils.py | def reset_git_repo(target_dir, git_reference, retry_depth=None):
"""
hard reset git clone in target_dir to given git_reference
:param target_dir: str, filesystem path where the repo is cloned
:param git_reference: str, any valid git reference
:param retry_depth: int, if the repo was cloned with --s... | def reset_git_repo(target_dir, git_reference, retry_depth=None):
"""
hard reset git clone in target_dir to given git_reference
:param target_dir: str, filesystem path where the repo is cloned
:param git_reference: str, any valid git reference
:param retry_depth: int, if the repo was cloned with --s... | [
"hard",
"reset",
"git",
"clone",
"in",
"target_dir",
"to",
"given",
"git_reference"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L270-L314 | [
"def",
"reset_git_repo",
"(",
"target_dir",
",",
"git_reference",
",",
"retry_depth",
"=",
"None",
")",
":",
"deepen",
"=",
"retry_depth",
"or",
"0",
"base_commit_depth",
"=",
"0",
"for",
"_",
"in",
"range",
"(",
"GIT_FETCH_RETRY",
")",
":",
"try",
":",
"i... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | get_imagestreamtag_from_image | return ImageStreamTag, give a FROM value
:param image: str, the FROM value from the Dockerfile
:return: str, ImageStreamTag | osbs/utils.py | def get_imagestreamtag_from_image(image):
"""
return ImageStreamTag, give a FROM value
:param image: str, the FROM value from the Dockerfile
:return: str, ImageStreamTag
"""
ret = image
# Remove the registry part
ret = strip_registry_from_image(image)
# ImageStream names cannot co... | def get_imagestreamtag_from_image(image):
"""
return ImageStreamTag, give a FROM value
:param image: str, the FROM value from the Dockerfile
:return: str, ImageStreamTag
"""
ret = image
# Remove the registry part
ret = strip_registry_from_image(image)
# ImageStream names cannot co... | [
"return",
"ImageStreamTag",
"give",
"a",
"FROM",
"value"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L385-L404 | [
"def",
"get_imagestreamtag_from_image",
"(",
"image",
")",
":",
"ret",
"=",
"image",
"# Remove the registry part",
"ret",
"=",
"strip_registry_from_image",
"(",
"image",
")",
"# ImageStream names cannot contain '/'",
"ret",
"=",
"ret",
".",
"replace",
"(",
"'/'",
",",... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | get_time_from_rfc3339 | return time tuple from an RFC 3339-formatted time string
:param rfc3339: str, time in RFC 3339 format
:return: float, seconds since the Epoch | osbs/utils.py | def get_time_from_rfc3339(rfc3339):
"""
return time tuple from an RFC 3339-formatted time string
:param rfc3339: str, time in RFC 3339 format
:return: float, seconds since the Epoch
"""
try:
# py 3
dt = dateutil.parser.parse(rfc3339, ignoretz=False)
return dt.timestamp... | def get_time_from_rfc3339(rfc3339):
"""
return time tuple from an RFC 3339-formatted time string
:param rfc3339: str, time in RFC 3339 format
:return: float, seconds since the Epoch
"""
try:
# py 3
dt = dateutil.parser.parse(rfc3339, ignoretz=False)
return dt.timestamp... | [
"return",
"time",
"tuple",
"from",
"an",
"RFC",
"3339",
"-",
"formatted",
"time",
"string"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L407-L427 | [
"def",
"get_time_from_rfc3339",
"(",
"rfc3339",
")",
":",
"try",
":",
"# py 3",
"dt",
"=",
"dateutil",
".",
"parser",
".",
"parse",
"(",
"rfc3339",
",",
"ignoretz",
"=",
"False",
")",
"return",
"dt",
".",
"timestamp",
"(",
")",
"except",
"NameError",
":"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | sanitize_strings_for_openshift | OpenShift requires labels to be no more than 64 characters and forbids any characters other
than alphanumerics, ., and -. BuildConfig names are similar, but cannot contain /.
Sanitize and concatanate one or two strings to meet OpenShift's requirements. include an
equal number of characters from both string... | osbs/utils.py | def sanitize_strings_for_openshift(str1, str2='', limit=LABEL_MAX_CHARS, separator='-',
label=True):
"""
OpenShift requires labels to be no more than 64 characters and forbids any characters other
than alphanumerics, ., and -. BuildConfig names are similar, but cannot cont... | def sanitize_strings_for_openshift(str1, str2='', limit=LABEL_MAX_CHARS, separator='-',
label=True):
"""
OpenShift requires labels to be no more than 64 characters and forbids any characters other
than alphanumerics, ., and -. BuildConfig names are similar, but cannot cont... | [
"OpenShift",
"requires",
"labels",
"to",
"be",
"no",
"more",
"than",
"64",
"characters",
"and",
"forbids",
"any",
"characters",
"other",
"than",
"alphanumerics",
".",
"and",
"-",
".",
"BuildConfig",
"names",
"are",
"similar",
"but",
"cannot",
"contain",
"/",
... | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L444-L477 | [
"def",
"sanitize_strings_for_openshift",
"(",
"str1",
",",
"str2",
"=",
"''",
",",
"limit",
"=",
"LABEL_MAX_CHARS",
",",
"separator",
"=",
"'-'",
",",
"label",
"=",
"True",
")",
":",
"filter_chars",
"=",
"VALID_LABEL_CHARS",
"if",
"label",
"else",
"VALID_BUILD... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | make_name_from_git | return name string representing the given git repo and branch
to be used as a build name.
NOTE: Build name will be used to generate pods which have a
limit of 64 characters and is composed as:
<buildname>-<buildnumber>-<podsuffix>
rhel7-1-build
Assuming '-XXXX' (5 chars) and '-build' ... | osbs/utils.py | def make_name_from_git(repo, branch, limit=53, separator='-', hash_size=5):
"""
return name string representing the given git repo and branch
to be used as a build name.
NOTE: Build name will be used to generate pods which have a
limit of 64 characters and is composed as:
<buildname>-<buil... | def make_name_from_git(repo, branch, limit=53, separator='-', hash_size=5):
"""
return name string representing the given git repo and branch
to be used as a build name.
NOTE: Build name will be used to generate pods which have a
limit of 64 characters and is composed as:
<buildname>-<buil... | [
"return",
"name",
"string",
"representing",
"the",
"given",
"git",
"repo",
"and",
"branch",
"to",
"be",
"used",
"as",
"a",
"build",
"name",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L480-L515 | [
"def",
"make_name_from_git",
"(",
"repo",
",",
"branch",
",",
"limit",
"=",
"53",
",",
"separator",
"=",
"'-'",
",",
"hash_size",
"=",
"5",
")",
":",
"branch",
"=",
"branch",
"or",
"'unknown'",
"full",
"=",
"urlparse",
"(",
"repo",
")",
".",
"path",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | wrap_name_from_git | wraps the result of make_name_from_git in a suffix and postfix
adding separators for each.
see docstring for make_name_from_git for a full list of parameters | osbs/utils.py | def wrap_name_from_git(prefix, suffix, *args, **kwargs):
"""
wraps the result of make_name_from_git in a suffix and postfix
adding separators for each.
see docstring for make_name_from_git for a full list of parameters
"""
# 64 is maximum length allowed by OpenShift
# 2 is the number of das... | def wrap_name_from_git(prefix, suffix, *args, **kwargs):
"""
wraps the result of make_name_from_git in a suffix and postfix
adding separators for each.
see docstring for make_name_from_git for a full list of parameters
"""
# 64 is maximum length allowed by OpenShift
# 2 is the number of das... | [
"wraps",
"the",
"result",
"of",
"make_name_from_git",
"in",
"a",
"suffix",
"and",
"postfix",
"adding",
"separators",
"for",
"each",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L518-L531 | [
"def",
"wrap_name_from_git",
"(",
"prefix",
",",
"suffix",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# 64 is maximum length allowed by OpenShift",
"# 2 is the number of dashes that will be added",
"prefix",
"=",
"''",
".",
"join",
"(",
"filter",
"(",
"VA... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | sanitize_version | Take parse_version() output and standardize output from older
setuptools' parse_version() to match current setuptools. | osbs/utils.py | def sanitize_version(version):
"""
Take parse_version() output and standardize output from older
setuptools' parse_version() to match current setuptools.
"""
if hasattr(version, 'base_version'):
if version.base_version:
parts = version.base_version.split('.')
else:
... | def sanitize_version(version):
"""
Take parse_version() output and standardize output from older
setuptools' parse_version() to match current setuptools.
"""
if hasattr(version, 'base_version'):
if version.base_version:
parts = version.base_version.split('.')
else:
... | [
"Take",
"parse_version",
"()",
"output",
"and",
"standardize",
"output",
"from",
"older",
"setuptools",
"parse_version",
"()",
"to",
"match",
"current",
"setuptools",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L539-L562 | [
"def",
"sanitize_version",
"(",
"version",
")",
":",
"if",
"hasattr",
"(",
"version",
",",
"'base_version'",
")",
":",
"if",
"version",
".",
"base_version",
":",
"parts",
"=",
"version",
".",
"base_version",
".",
"split",
"(",
"'.'",
")",
"else",
":",
"p... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Labels.get_name | returns the most preferred label name
if there isn't any correct name in the list
it will return newest label name | osbs/utils.py | def get_name(self, label_type):
"""
returns the most preferred label name
if there isn't any correct name in the list
it will return newest label name
"""
if label_type in self._label_values:
return self._label_values[label_type][0]
else:
r... | def get_name(self, label_type):
"""
returns the most preferred label name
if there isn't any correct name in the list
it will return newest label name
"""
if label_type in self._label_values:
return self._label_values[label_type][0]
else:
r... | [
"returns",
"the",
"most",
"preferred",
"label",
"name",
"if",
"there",
"isn",
"t",
"any",
"correct",
"name",
"in",
"the",
"list",
"it",
"will",
"return",
"newest",
"label",
"name"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L627-L636 | [
"def",
"get_name",
"(",
"self",
",",
"label_type",
")",
":",
"if",
"label_type",
"in",
"self",
".",
"_label_values",
":",
"return",
"self",
".",
"_label_values",
"[",
"label_type",
"]",
"[",
"0",
"]",
"else",
":",
"return",
"Labels",
".",
"LABEL_NAMES",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Labels.get_new_names_by_old | Return dictionary, new label name indexed by old label name. | osbs/utils.py | def get_new_names_by_old():
"""Return dictionary, new label name indexed by old label name."""
newdict = {}
for label_type, label_names in Labels.LABEL_NAMES.items():
for oldname in label_names[1:]:
newdict[oldname] = Labels.LABEL_NAMES[label_type][0]
return ... | def get_new_names_by_old():
"""Return dictionary, new label name indexed by old label name."""
newdict = {}
for label_type, label_names in Labels.LABEL_NAMES.items():
for oldname in label_names[1:]:
newdict[oldname] = Labels.LABEL_NAMES[label_type][0]
return ... | [
"Return",
"dictionary",
"new",
"label",
"name",
"indexed",
"by",
"old",
"label",
"name",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L639-L646 | [
"def",
"get_new_names_by_old",
"(",
")",
":",
"newdict",
"=",
"{",
"}",
"for",
"label_type",
",",
"label_names",
"in",
"Labels",
".",
"LABEL_NAMES",
".",
"items",
"(",
")",
":",
"for",
"oldname",
"in",
"label_names",
"[",
"1",
":",
"]",
":",
"newdict",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | Labels.get_name_and_value | Return tuple of (label name, label value)
Raises KeyError if label doesn't exist | osbs/utils.py | def get_name_and_value(self, label_type):
"""
Return tuple of (label name, label value)
Raises KeyError if label doesn't exist
"""
if label_type in self._label_values:
return self._label_values[label_type]
else:
return (label_type, self._df_labels[... | def get_name_and_value(self, label_type):
"""
Return tuple of (label name, label value)
Raises KeyError if label doesn't exist
"""
if label_type in self._label_values:
return self._label_values[label_type]
else:
return (label_type, self._df_labels[... | [
"Return",
"tuple",
"of",
"(",
"label",
"name",
"label",
"value",
")",
"Raises",
"KeyError",
"if",
"label",
"doesn",
"t",
"exist"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L648-L656 | [
"def",
"get_name_and_value",
"(",
"self",
",",
"label_type",
")",
":",
"if",
"label_type",
"in",
"self",
".",
"_label_values",
":",
"return",
"self",
".",
"_label_values",
"[",
"label_type",
"]",
"else",
":",
"return",
"(",
"label_type",
",",
"self",
".",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | kerberos_ccache_init | Checks whether kerberos credential cache has ticket-granting ticket that is valid for at least
an hour.
Default ccache is used unless ccache_file is provided. In that case, KRB5CCNAME environment
variable is set to the value of ccache_file if we successfully obtain the ticket. | osbs/kerberos_ccache.py | def kerberos_ccache_init(principal, keytab_file, ccache_file=None):
"""
Checks whether kerberos credential cache has ticket-granting ticket that is valid for at least
an hour.
Default ccache is used unless ccache_file is provided. In that case, KRB5CCNAME environment
variable is set to the value of... | def kerberos_ccache_init(principal, keytab_file, ccache_file=None):
"""
Checks whether kerberos credential cache has ticket-granting ticket that is valid for at least
an hour.
Default ccache is used unless ccache_file is provided. In that case, KRB5CCNAME environment
variable is set to the value of... | [
"Checks",
"whether",
"kerberos",
"credential",
"cache",
"has",
"ticket",
"-",
"granting",
"ticket",
"that",
"is",
"valid",
"for",
"at",
"least",
"an",
"hour",
"."
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/kerberos_ccache.py#L53-L93 | [
"def",
"kerberos_ccache_init",
"(",
"principal",
",",
"keytab_file",
",",
"ccache_file",
"=",
"None",
")",
":",
"tgt_valid",
"=",
"False",
"env",
"=",
"{",
"\"LC_ALL\"",
":",
"\"C\"",
"}",
"# klist uses locales to format date on RHEL7+",
"if",
"ccache_file",
":",
... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | SqliteFileLoader.load | Extract tabular data as |TableData| instances from a SQLite database
file. |load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
=================== ==============================================
Format specifier Value ... | pytablereader/sqlite/core.py | def load(self):
"""
Extract tabular data as |TableData| instances from a SQLite database
file. |load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
=================== ==============================================
... | def load(self):
"""
Extract tabular data as |TableData| instances from a SQLite database
file. |load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
=================== ==============================================
... | [
"Extract",
"tabular",
"data",
"as",
"|TableData|",
"instances",
"from",
"a",
"SQLite",
"database",
"file",
".",
"|load_source_desc_file|"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/sqlite/core.py#L40-L68 | [
"def",
"load",
"(",
"self",
")",
":",
"self",
".",
"_validate",
"(",
")",
"formatter",
"=",
"SqliteTableFormatter",
"(",
"self",
".",
"source",
")",
"formatter",
".",
"accept",
"(",
"self",
")",
"return",
"formatter",
".",
"to_table_data",
"(",
")"
] | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | ConfigMapResponse.get_data | Find the data stored in the config_map
:return: dict, the json of the data data that was passed into the ConfigMap on creation | osbs/build/config_map_response.py | def get_data(self):
"""
Find the data stored in the config_map
:return: dict, the json of the data data that was passed into the ConfigMap on creation
"""
data = graceful_chain_get(self.json, "data")
if data is None:
return {}
data_dict = {}
... | def get_data(self):
"""
Find the data stored in the config_map
:return: dict, the json of the data data that was passed into the ConfigMap on creation
"""
data = graceful_chain_get(self.json, "data")
if data is None:
return {}
data_dict = {}
... | [
"Find",
"the",
"data",
"stored",
"in",
"the",
"config_map"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/config_map_response.py#L40-L57 | [
"def",
"get_data",
"(",
"self",
")",
":",
"data",
"=",
"graceful_chain_get",
"(",
"self",
".",
"json",
",",
"\"data\"",
")",
"if",
"data",
"is",
"None",
":",
"return",
"{",
"}",
"data_dict",
"=",
"{",
"}",
"for",
"key",
"in",
"data",
":",
"if",
"se... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | ConfigMapResponse.get_data_by_key | Find the object stored by a JSON string at key 'name'
:return: str or dict, the json of the str or dict stored in the ConfigMap at that location | osbs/build/config_map_response.py | def get_data_by_key(self, name):
"""
Find the object stored by a JSON string at key 'name'
:return: str or dict, the json of the str or dict stored in the ConfigMap at that location
"""
data = graceful_chain_get(self.json, "data")
if data is None or name not in data:
... | def get_data_by_key(self, name):
"""
Find the object stored by a JSON string at key 'name'
:return: str or dict, the json of the str or dict stored in the ConfigMap at that location
"""
data = graceful_chain_get(self.json, "data")
if data is None or name not in data:
... | [
"Find",
"the",
"object",
"stored",
"by",
"a",
"JSON",
"string",
"at",
"key",
"name"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/config_map_response.py#L59-L72 | [
"def",
"get_data_by_key",
"(",
"self",
",",
"name",
")",
":",
"data",
"=",
"graceful_chain_get",
"(",
"self",
".",
"json",
",",
"\"data\"",
")",
"if",
"data",
"is",
"None",
"or",
"name",
"not",
"in",
"data",
":",
"return",
"{",
"}",
"if",
"self",
"."... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | FlatJsonTableConverter.to_table_data | :raises ValueError:
:raises pytablereader.error.ValidationError: | pytablereader/jsonlines/formatter.py | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
header_list = []
for json_record in self._buffer:
for key in json_record:
if key not in header_list:
... | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
header_list = []
for json_record in self._buffer:
for key in json_record:
if key not in header_list:
... | [
":",
"raises",
"ValueError",
":",
":",
"raises",
"pytablereader",
".",
"error",
".",
"ValidationError",
":"
] | thombashi/pytablereader | python | https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/jsonlines/formatter.py#L33-L55 | [
"def",
"to_table_data",
"(",
"self",
")",
":",
"self",
".",
"_validate_source_data",
"(",
")",
"header_list",
"=",
"[",
"]",
"for",
"json_record",
"in",
"self",
".",
"_buffer",
":",
"for",
"key",
"in",
"json_record",
":",
"if",
"key",
"not",
"in",
"heade... | bc3c057a2cc775bcce690e0e9019c2907b638101 |
train | OSBS.list_builds | List builds with matching fields
:param field_selector: str, field selector for Builds
:param koji_task_id: str, only list builds for Koji Task ID
:return: BuildResponse list | osbs/api.py | def list_builds(self, field_selector=None, koji_task_id=None, running=None,
labels=None):
"""
List builds with matching fields
:param field_selector: str, field selector for Builds
:param koji_task_id: str, only list builds for Koji Task ID
:return: BuildResp... | def list_builds(self, field_selector=None, koji_task_id=None, running=None,
labels=None):
"""
List builds with matching fields
:param field_selector: str, field selector for Builds
:param koji_task_id: str, only list builds for Koji Task ID
:return: BuildResp... | [
"List",
"builds",
"with",
"matching",
"fields"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L135-L159 | [
"def",
"list_builds",
"(",
"self",
",",
"field_selector",
"=",
"None",
",",
"koji_task_id",
"=",
"None",
",",
"running",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"if",
"running",
":",
"running_fs",
"=",
"\",\"",
".",
"join",
"(",
"[",
"\"stat... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | OSBS.get_pod_for_build | :return: PodResponse object for pod relating to the build | osbs/api.py | def get_pod_for_build(self, build_id):
"""
:return: PodResponse object for pod relating to the build
"""
pods = self.os.list_pods(label='openshift.io/build.name=%s' % build_id)
serialized_response = pods.json()
pod_list = [PodResponse(pod) for pod in serialized_response["... | def get_pod_for_build(self, build_id):
"""
:return: PodResponse object for pod relating to the build
"""
pods = self.os.list_pods(label='openshift.io/build.name=%s' % build_id)
serialized_response = pods.json()
pod_list = [PodResponse(pod) for pod in serialized_response["... | [
":",
"return",
":",
"PodResponse",
"object",
"for",
"pod",
"relating",
"to",
"the",
"build"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L182-L194 | [
"def",
"get_pod_for_build",
"(",
"self",
",",
"build_id",
")",
":",
"pods",
"=",
"self",
".",
"os",
".",
"list_pods",
"(",
"label",
"=",
"'openshift.io/build.name=%s'",
"%",
"build_id",
")",
"serialized_response",
"=",
"pods",
".",
"json",
"(",
")",
"pod_lis... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | OSBS.get_build_request | return instance of BuildRequest or BuildRequestV2
:param build_type: str, unused
:param inner_template: str, name of inner template for BuildRequest
:param outer_template: str, name of outer template for BuildRequest
:param customize_conf: str, name of customization config for BuildRequ... | osbs/api.py | def get_build_request(self, build_type=None, inner_template=None,
outer_template=None, customize_conf=None,
arrangement_version=DEFAULT_ARRANGEMENT_VERSION):
"""
return instance of BuildRequest or BuildRequestV2
:param build_type: str, unused
... | def get_build_request(self, build_type=None, inner_template=None,
outer_template=None, customize_conf=None,
arrangement_version=DEFAULT_ARRANGEMENT_VERSION):
"""
return instance of BuildRequest or BuildRequestV2
:param build_type: str, unused
... | [
"return",
"instance",
"of",
"BuildRequest",
"or",
"BuildRequestV2"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L197-L239 | [
"def",
"get_build_request",
"(",
"self",
",",
"build_type",
"=",
"None",
",",
"inner_template",
"=",
"None",
",",
"outer_template",
"=",
"None",
",",
"customize_conf",
"=",
"None",
",",
"arrangement_version",
"=",
"DEFAULT_ARRANGEMENT_VERSION",
")",
":",
"if",
"... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
train | OSBS.create_build_from_buildrequest | render provided build_request and submit build from it
:param build_request: instance of build.build_request.BuildRequest
:return: instance of build.build_response.BuildResponse | osbs/api.py | def create_build_from_buildrequest(self, build_request):
"""
render provided build_request and submit build from it
:param build_request: instance of build.build_request.BuildRequest
:return: instance of build.build_response.BuildResponse
"""
build_request.set_openshift_... | def create_build_from_buildrequest(self, build_request):
"""
render provided build_request and submit build from it
:param build_request: instance of build.build_request.BuildRequest
:return: instance of build.build_response.BuildResponse
"""
build_request.set_openshift_... | [
"render",
"provided",
"build_request",
"and",
"submit",
"build",
"from",
"it"
] | projectatomic/osbs-client | python | https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L242-L253 | [
"def",
"create_build_from_buildrequest",
"(",
"self",
",",
"build_request",
")",
":",
"build_request",
".",
"set_openshift_required_version",
"(",
"self",
".",
"os_conf",
".",
"get_openshift_required_version",
"(",
")",
")",
"build",
"=",
"build_request",
".",
"render... | 571fe035dab3a7c02e1dccd5d65ffd75be750458 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.