repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
projectatomic/osbs-client
osbs/build/plugins_configuration.py
PluginsConfiguration.render_bump_release
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....
python
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", ")", ":", "phase", "=", "'prebuild_plugins'", "plugin", "=", "'bump_release'", "if", "not", "self", ".", "pt", ".", "has_plugin_conf", "(", "phase", ",", "plugin", ")", ":", "return", "if", "self", ".", "user_params...
If the bump_release plugin is present, configure it
[ "If", "the", "bump_release", "plugin", "is", "present", "configure", "it" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L300-L317
projectatomic/osbs-client
osbs/build/plugins_configuration.py
PluginsConfiguration.render_check_and_set_platforms
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...
python
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", ")", ":", "phase", "=", "'prebuild_plugins'", "plugin", "=", "'check_and_set_platforms'", "if", "not", "self", ".", "pt", ".", "has_plugin_conf", "(", "phase", ",", "plugin", ")", ":", "return", "if", "self",...
If the check_and_set_platforms plugin is present, configure it
[ "If", "the", "check_and_set_platforms", "plugin", "is", "present", "configure", "it" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L319-L330
projectatomic/osbs-client
osbs/build/plugins_configuration.py
PluginsConfiguration.render_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', '...
python
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", ")", ":", "# import_image is a multi-phase plugin", "if", "self", ".", "user_params", ".", "imagestream_name", ".", "value", "is", "None", ":", "self", ".", "pt", ".", "remove_plugin", "(",...
Configure the import_image plugin
[ "Configure", "the", "import_image", "plugin" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L332-L342
projectatomic/osbs-client
osbs/build/plugins_configuration.py
PluginsConfiguration.render_tag_from_config
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...
python
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", ")", ":", "phase", "=", "'postbuild_plugins'", "plugin", "=", "'tag_from_config'", "if", "not", "self", ".", "has_tag_suffixes_placeholder", "(", ")", ":", "return", "unique_tag", "=", "self", ".", "user_params", ".", ...
Configure tag_from_config plugin
[ "Configure", "tag_from_config", "plugin" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L459-L483
projectatomic/osbs-client
osbs/build/plugins_configuration.py
PluginsConfiguration.render_pull_base_image
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...
python
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", ")", ":", "phase", "=", "'prebuild_plugins'", "plugin", "=", "'pull_base_image'", "if", "self", ".", "user_params", ".", "parent_images_digests", ".", "value", ":", "self", ".", "pt", ".", "set_plugin_arg", "(", "pha...
Configure pull_base_image
[ "Configure", "pull_base_image" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/plugins_configuration.py#L485-L492
projectatomic/osbs-client
osbs/core.py
Openshift.get_user
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) ...
python
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", "=", "\"~\"", ")", ":", "url", "=", "self", ".", "_build_url", "(", "\"users/%s/\"", "%", "username", ",", "_prepend_namespace", "=", "False", ")", "response", "=", "self", ".", "_get", "(", "url", ")", ...
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
[ "get", "info", "about", "user", "(", "if", "no", "user", "specified", "use", "the", "one", "initiating", "request", ")" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L233-L243
projectatomic/osbs-client
osbs/core.py
Openshift.create_build
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"})
python
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", ")", ":", "url", "=", "self", ".", "_build_url", "(", "\"builds/\"", ")", "logger", ".", "debug", "(", "build_json", ")", "return", "self", ".", "_post", "(", "url", ",", "data", "=", "json", ".", ...
:return:
[ ":", "return", ":" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L296-L303
projectatomic/osbs-client
osbs/core.py
Openshift.get_all_build_configs_by_labels
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...
python
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", ")", ":", "labels", "=", "[", "'%s=%s'", "%", "(", "field", ",", "value", ")", "for", "field", ",", "value", "in", "label_selectors", "]", "labels", "=", "','", ".", "join", "("...
Returns all builds matching a given set of label selectors. It is up to the calling function to filter the results.
[ "Returns", "all", "builds", "matching", "a", "given", "set", "of", "label", "selectors", ".", "It", "is", "up", "to", "the", "calling", "function", "to", "filter", "the", "results", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L326-L334
projectatomic/osbs-client
osbs/core.py
Openshift.get_build_config_by_labels
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) ...
python
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", ")", ":", "items", "=", "self", ".", "get_all_build_configs_by_labels", "(", "label_selectors", ")", "if", "not", "items", ":", "raise", "OsbsException", "(", "\"Build config not found for labels:...
Returns a build config matching the given label selectors. This method will raise OsbsException if not exactly one build config is found.
[ "Returns", "a", "build", "config", "matching", "the", "given", "label", "selectors", ".", "This", "method", "will", "raise", "OsbsException", "if", "not", "exactly", "one", "build", "config", "is", "found", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L336-L353
projectatomic/osbs-client
osbs/core.py
Openshift.get_build_config_by_labels_filtered
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...
python
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", ")", ":", "items", "=", "self", ".", "get_all_build_configs_by_labels", "(", "label_selectors", ")", "if", "filter_value", "is", "not", "None", ...
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.
[ "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...
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L355-L379
projectatomic/osbs-client
osbs/core.py
Openshift.create_build_config
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"})
python
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", ")", ":", "url", "=", "self", ".", "_build_url", "(", "\"buildconfigs/\"", ")", "return", "self", ".", "_post", "(", "url", ",", "data", "=", "build_config_json", ",", "headers", "=", "{", ...
:return:
[ ":", "return", ":" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L381-L387
projectatomic/osbs-client
osbs/core.py
Openshift.stream_logs
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...
python
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", ")", ":", "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...
stream logs from build :param build_id: str :return: iterator
[ "stream", "logs", "from", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L434-L483
projectatomic/osbs-client
osbs/core.py
Openshift.logs
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...
python
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", ")", ":", "# does build exist?", "try", ":", "build_json", "=", "build_json", "or", "self", ".", "get_build", "(...
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
[ "provide", "logs", "from", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L485-L520
projectatomic/osbs-client
osbs/core.py
Openshift.list_builds
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 ...
python
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", ")", ":", "query", "=", "{", "}", "selector", "=", "'{key}={value}'", "label", "=", ...
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
[ "List", "builds", "matching", "criteria" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L522-L553
projectatomic/osbs-client
osbs/core.py
Openshift.create_resource_quota
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...
python
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", ")", ":", "url", "=", "self", ".", "_build_k8s_url", "(", "\"resourcequotas/\"", ")", "response", "=", "self", ".", "_post", "(", "url", ",", "data", "=", "json", ".", "dumps", ...
Prevent builds being scheduled and wait for running builds to finish. :return:
[ "Prevent", "builds", "being", "scheduled", "and", "wait", "for", "running", "builds", "to", "finish", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L577-L593
projectatomic/osbs-client
osbs/core.py
Openshift.wait
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"] ...
python
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", ")", ":", "logger", ".", "info", "(", "\"watching build '%s'\"", ",", "build_id", ")", "for", "changetype", ",", "obj", "in", "self", ".", "watch_resource", "(", "\"builds\"", ",", "build_id", ")"...
:param build_id: wait for build to finish :return:
[ ":", "param", "build_id", ":", "wait", "for", "build", "to", "finish" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L654-L694
projectatomic/osbs-client
osbs/core.py
Openshift.adjust_attributes_on_object
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' ...
python
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", ")", ":", "url", "=", "self", ".", "_build_url", "(", "\"%s/%s\"", "%", "(", "collection", ",", "name", ")", ")", "response", "="...
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' :...
[ "adjust", "labels", "or", "annotations", "on", "object" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L727-L749
projectatomic/osbs-client
osbs/core.py
Openshift.update_annotations_on_build
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, ...
python
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", ")", ":", "return", "self", ".", "adjust_attributes_on_object", "(", "'builds'", ",", "build_id", ",", "'annotations'", ",", "annotations", ",", "self", ".", "_update_metadata_th...
set annotations on build object :param build_id: str, id of build :param annotations: dict, annotations to set :return:
[ "set", "annotations", "on", "build", "object" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L771-L781
projectatomic/osbs-client
osbs/core.py
Openshift.import_image
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...
python
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", ")", ":", "# 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 :return: bool, whether tags were imported
[ "Import", "image", "tags", "from", "a", "Docker", "registry", "into", "an", "ImageStream" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L872-L922
projectatomic/osbs-client
osbs/core.py
Openshift.import_image_tags
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)...
python
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", ")", ":", "# Get the JSON for the ImageStream", "imagestream_json", "=", "self", ".", "get_image_stream", "(", "name", ")", ".", "json", ...
Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported
[ "Import", "image", "tags", "from", "a", "Docker", "registry", "into", "an", "ImageStream" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/core.py#L926-L986
projectatomic/osbs-client
osbs/cli/main.py
str_on_2_unicode_on_3
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...
python
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", ")", ":", "if", "not", "PY3", ":", "return", "str", "(", "s", ")", "else", ":", "# 3+", "if", "not", "isinstance", "(", "s", ",", "str", ")", ":", "return", "str", "(", "s", ",", "encoding", "=", "\"utf-8\"...
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
[ "argparse", "is", "way", "too", "awesome", "when", "doing", "repr", "()", "on", "choices", "when", "printing", "usage" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/cli/main.py#L534-L547
thombashi/pytablereader
pytablereader/jsonlines/core.py
JsonLinesTableFileLoader.load
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: ...
python
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", ")", ":", "formatter", "=", "JsonLinesTableFormatter", "(", "self", ".", "load_dict", "(", ")", ")", "formatter", ".", "accept", "(", "self", ")", "return", "formatter", ".", "to_table_data", "(", ")" ]
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...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "Line", "-", "delimited", "JSON", "file", ".", "|load_source_desc_file|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/jsonlines/core.py#L75-L94
thombashi/pytablereader
pytablereader/spreadsheet/gsloader.py
GoogleSheetsTableLoader.load
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...
python
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", ")", ":", "import", "gspread", "from", "oauth2client", ".", "service_account", "import", "ServiceAccountCredentials", "self", ".", "_validate_table_name", "(", ")", "self", ".", "_validate_title", "(", ")", "scope", "=", "[", "\"https...
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 ...
[ "Load", "table", "data", "from", "a", "Google", "Spreadsheet", "." ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/spreadsheet/gsloader.py#L62-L126
thombashi/pytablereader
pytablereader/_logger/_logger.py
set_log_level
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...
python
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", ")", ":", "if", "not", "LOGBOOK_INSTALLED", ":", "return", "# validate log level", "logbook", ".", "get_level_name", "(", "log_level", ")", "if", "log_level", "==", "logger", ".", "level", ":", "return", "if", "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``...
[ "Set", "logging", "level", "of", "this", "module", ".", "Using", "logbook", "<https", ":", "//", "logbook", ".", "readthedocs", ".", "io", "/", "en", "/", "stable", "/", ">", "__", "module", "for", "logging", "." ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/_logger/_logger.py#L51-L85
projectatomic/osbs-client
osbs/utils.py
buildconfig_update
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...
python
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", ")", ":", "if", "isinstance", "(", "orig", ",", "dict", ")", "and", "isinstance", "(", "new", ",", "dict", ")", ":", "clean_triggers", "(", "orig", ",", "...
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 `...
[ "Performs", "update", "of", "given", "orig", "BuildConfig", "with", "values", "from", "new", "BuildConfig", ".", "Both", "BuildConfigs", "have", "to", "be", "represented", "as", "dict", "s", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L168-L191
projectatomic/osbs-client
osbs/utils.py
checkout_git_repo
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...
python
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", ")", ":", "tmpdir", "=", "tempfile", ".", "mkdtemp", ...
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 :...
[ "clone", "provided", "git", "repo", "to", "target_dir", "optionally", "checkout", "provided", "commit", "yield", "the", "ClonedRepoData", "and", "delete", "the", "repo", "when", "finished" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L195-L214
projectatomic/osbs-client
osbs/utils.py
clone_git_repo
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...
python
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", ")", ":", "retry_delay", "=", "GIT_BACKOFF_FACTOR", "targe...
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...
[ "clone", "provided", "git", "repo", "to", "target_dir", "optionally", "checkout", "provided", "commit" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L217-L267
projectatomic/osbs-client
osbs/utils.py
reset_git_repo
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...
python
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", ")", ":", "deepen", "=", "retry_depth", "or", "0", "base_commit_depth", "=", "0", "for", "_", "in", "range", "(", "GIT_FETCH_RETRY", ")", ":", "try", ":", "i...
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 ...
[ "hard", "reset", "git", "clone", "in", "target_dir", "to", "given", "git_reference" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L270-L314
projectatomic/osbs-client
osbs/utils.py
get_imagestreamtag_from_image
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...
python
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", ")", ":", "ret", "=", "image", "# Remove the registry part", "ret", "=", "strip_registry_from_image", "(", "image", ")", "# ImageStream names cannot contain '/'", "ret", "=", "ret", ".", "replace", "(", "'/'", ",",...
return ImageStreamTag, give a FROM value :param image: str, the FROM value from the Dockerfile :return: str, ImageStreamTag
[ "return", "ImageStreamTag", "give", "a", "FROM", "value" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L385-L404
projectatomic/osbs-client
osbs/utils.py
get_time_from_rfc3339
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...
python
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", ")", ":", "try", ":", "# py 3", "dt", "=", "dateutil", ".", "parser", ".", "parse", "(", "rfc3339", ",", "ignoretz", "=", "False", ")", "return", "dt", ".", "timestamp", "(", ")", "except", "NameError", ":"...
return time tuple from an RFC 3339-formatted time string :param rfc3339: str, time in RFC 3339 format :return: float, seconds since the Epoch
[ "return", "time", "tuple", "from", "an", "RFC", "3339", "-", "formatted", "time", "string" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L407-L427
projectatomic/osbs-client
osbs/utils.py
sanitize_strings_for_openshift
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...
python
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", ")", ":", "filter_chars", "=", "VALID_LABEL_CHARS", "if", "label", "else", "VALID_BUILD...
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...
[ "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", "/", ...
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L444-L477
projectatomic/osbs-client
osbs/utils.py
make_name_from_git
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...
python
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", ")", ":", "branch", "=", "branch", "or", "'unknown'", "full", "=", "urlparse", "(", "repo", ")", ".", "path", ...
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' ...
[ "return", "name", "string", "representing", "the", "given", "git", "repo", "and", "branch", "to", "be", "used", "as", "a", "build", "name", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L480-L515
projectatomic/osbs-client
osbs/utils.py
wrap_name_from_git
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...
python
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", ")", ":", "# 64 is maximum length allowed by OpenShift", "# 2 is the number of dashes that will be added", "prefix", "=", "''", ".", "join", "(", "filter", "(", "VA...
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
[ "wraps", "the", "result", "of", "make_name_from_git", "in", "a", "suffix", "and", "postfix", "adding", "separators", "for", "each", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L518-L531
projectatomic/osbs-client
osbs/utils.py
sanitize_version
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: ...
python
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", ")", ":", "if", "hasattr", "(", "version", ",", "'base_version'", ")", ":", "if", "version", ".", "base_version", ":", "parts", "=", "version", ".", "base_version", ".", "split", "(", "'.'", ")", "else", ":", "p...
Take parse_version() output and standardize output from older setuptools' parse_version() to match current setuptools.
[ "Take", "parse_version", "()", "output", "and", "standardize", "output", "from", "older", "setuptools", "parse_version", "()", "to", "match", "current", "setuptools", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L539-L562
projectatomic/osbs-client
osbs/utils.py
Labels.get_name
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...
python
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", ")", ":", "if", "label_type", "in", "self", ".", "_label_values", ":", "return", "self", ".", "_label_values", "[", "label_type", "]", "[", "0", "]", "else", ":", "return", "Labels", ".", "LABEL_NAMES", ...
returns the most preferred label name if there isn't any correct name in the list it will return newest label name
[ "returns", "the", "most", "preferred", "label", "name", "if", "there", "isn", "t", "any", "correct", "name", "in", "the", "list", "it", "will", "return", "newest", "label", "name" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L627-L636
projectatomic/osbs-client
osbs/utils.py
Labels.get_new_names_by_old
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 ...
python
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", "(", ")", ":", "newdict", "=", "{", "}", "for", "label_type", ",", "label_names", "in", "Labels", ".", "LABEL_NAMES", ".", "items", "(", ")", ":", "for", "oldname", "in", "label_names", "[", "1", ":", "]", ":", "newdict", ...
Return dictionary, new label name indexed by old label name.
[ "Return", "dictionary", "new", "label", "name", "indexed", "by", "old", "label", "name", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L639-L646
projectatomic/osbs-client
osbs/utils.py
Labels.get_name_and_value
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[...
python
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", ")", ":", "if", "label_type", "in", "self", ".", "_label_values", ":", "return", "self", ".", "_label_values", "[", "label_type", "]", "else", ":", "return", "(", "label_type", ",", "self", ".", ...
Return tuple of (label name, label value) Raises KeyError if label doesn't exist
[ "Return", "tuple", "of", "(", "label", "name", "label", "value", ")", "Raises", "KeyError", "if", "label", "doesn", "t", "exist" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L648-L656
projectatomic/osbs-client
osbs/kerberos_ccache.py
kerberos_ccache_init
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...
python
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", ")", ":", "tgt_valid", "=", "False", "env", "=", "{", "\"LC_ALL\"", ":", "\"C\"", "}", "# klist uses locales to format date on RHEL7+", "if", "ccache_file", ":", ...
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.
[ "Checks", "whether", "kerberos", "credential", "cache", "has", "ticket", "-", "granting", "ticket", "that", "is", "valid", "for", "at", "least", "an", "hour", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/kerberos_ccache.py#L53-L93
thombashi/pytablereader
pytablereader/sqlite/core.py
SqliteFileLoader.load
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| =================== ============================================== ...
python
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", ")", ":", "self", ".", "_validate", "(", ")", "formatter", "=", "SqliteTableFormatter", "(", "self", ".", "source", ")", "formatter", ".", "accept", "(", "self", ")", "return", "formatter", ".", "to_table_data", "(", ")" ]
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 ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "SQLite", "database", "file", ".", "|load_source_desc_file|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/sqlite/core.py#L40-L68
projectatomic/osbs-client
osbs/build/config_map_response.py
ConfigMapResponse.get_data
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 = {} ...
python
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", ")", ":", "data", "=", "graceful_chain_get", "(", "self", ".", "json", ",", "\"data\"", ")", "if", "data", "is", "None", ":", "return", "{", "}", "data_dict", "=", "{", "}", "for", "key", "in", "data", ":", "if", "se...
Find the data stored in the config_map :return: dict, the json of the data data that was passed into the ConfigMap on creation
[ "Find", "the", "data", "stored", "in", "the", "config_map" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/config_map_response.py#L40-L57
projectatomic/osbs-client
osbs/build/config_map_response.py
ConfigMapResponse.get_data_by_key
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: ...
python
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", ")", ":", "data", "=", "graceful_chain_get", "(", "self", ".", "json", ",", "\"data\"", ")", "if", "data", "is", "None", "or", "name", "not", "in", "data", ":", "return", "{", "}", "if", "self", "."...
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
[ "Find", "the", "object", "stored", "by", "a", "JSON", "string", "at", "key", "name" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/config_map_response.py#L59-L72
thombashi/pytablereader
pytablereader/jsonlines/formatter.py
FlatJsonTableConverter.to_table_data
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: ...
python
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", ")", ":", "self", ".", "_validate_source_data", "(", ")", "header_list", "=", "[", "]", "for", "json_record", "in", "self", ".", "_buffer", ":", "for", "key", "in", "json_record", ":", "if", "key", "not", "in", "heade...
:raises ValueError: :raises pytablereader.error.ValidationError:
[ ":", "raises", "ValueError", ":", ":", "raises", "pytablereader", ".", "error", ".", "ValidationError", ":" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/jsonlines/formatter.py#L33-L55
projectatomic/osbs-client
osbs/api.py
OSBS.list_builds
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...
python
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", ")", ":", "if", "running", ":", "running_fs", "=", "\",\"", ".", "join", "(", "[", "\"stat...
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
[ "List", "builds", "with", "matching", "fields" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L135-L159
projectatomic/osbs-client
osbs/api.py
OSBS.get_pod_for_build
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["...
python
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", ")", ":", "pods", "=", "self", ".", "os", ".", "list_pods", "(", "label", "=", "'openshift.io/build.name=%s'", "%", "build_id", ")", "serialized_response", "=", "pods", ".", "json", "(", ")", "pod_lis...
:return: PodResponse object for pod relating to the build
[ ":", "return", ":", "PodResponse", "object", "for", "pod", "relating", "to", "the", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L182-L194
projectatomic/osbs-client
osbs/api.py
OSBS.get_build_request
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 ...
python
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", ")", ":", "if", "...
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...
[ "return", "instance", "of", "BuildRequest", "or", "BuildRequestV2" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L197-L239
projectatomic/osbs-client
osbs/api.py
OSBS.create_build_from_buildrequest
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_...
python
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", ")", ":", "build_request", ".", "set_openshift_required_version", "(", "self", ".", "os_conf", ".", "get_openshift_required_version", "(", ")", ")", "build", "=", "build_request", ".", "render...
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
[ "render", "provided", "build_request", "and", "submit", "build", "from", "it" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L242-L253
projectatomic/osbs-client
osbs/api.py
OSBS._get_existing_build_config
def _get_existing_build_config(self, build_config): """ Uses the given build config to find an existing matching build config. Build configs are a match if: - metadata.labels.git-repo-name AND metadata.labels.git-branch AND metadata.labels.git-full-repo are equal OR ...
python
def _get_existing_build_config(self, build_config): """ Uses the given build config to find an existing matching build config. Build configs are a match if: - metadata.labels.git-repo-name AND metadata.labels.git-branch AND metadata.labels.git-full-repo are equal OR ...
[ "def", "_get_existing_build_config", "(", "self", ",", "build_config", ")", ":", "bc_labels", "=", "build_config", "[", "'metadata'", "]", "[", "'labels'", "]", "git_labels", "=", "{", "\"label_selectors\"", ":", "[", "(", "key", ",", "bc_labels", "[", "key", ...
Uses the given build config to find an existing matching build config. Build configs are a match if: - metadata.labels.git-repo-name AND metadata.labels.git-branch AND metadata.labels.git-full-repo are equal OR - metadata.labels.git-repo-name AND metadata.labels.git-branch are ...
[ "Uses", "the", "given", "build", "config", "to", "find", "an", "existing", "matching", "build", "config", ".", "Build", "configs", "are", "a", "match", "if", ":", "-", "metadata", ".", "labels", ".", "git", "-", "repo", "-", "name", "AND", "metadata", ...
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L294-L338
projectatomic/osbs-client
osbs/api.py
OSBS._get_image_stream_info_for_build_request
def _get_image_stream_info_for_build_request(self, build_request): """Return ImageStream, and ImageStreamTag name for base_image of build_request If build_request is not auto instantiated, objects are not fetched and None, None is returned. """ image_stream = None image_...
python
def _get_image_stream_info_for_build_request(self, build_request): """Return ImageStream, and ImageStreamTag name for base_image of build_request If build_request is not auto instantiated, objects are not fetched and None, None is returned. """ image_stream = None image_...
[ "def", "_get_image_stream_info_for_build_request", "(", "self", ",", "build_request", ")", ":", "image_stream", "=", "None", "image_stream_tag_name", "=", "None", "if", "build_request", ".", "has_ist_trigger", "(", ")", ":", "image_stream_tag_id", "=", "build_request", ...
Return ImageStream, and ImageStreamTag name for base_image of build_request If build_request is not auto instantiated, objects are not fetched and None, None is returned.
[ "Return", "ImageStream", "and", "ImageStreamTag", "name", "for", "base_image", "of", "build_request" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L393-L419
projectatomic/osbs-client
osbs/api.py
OSBS.create_prod_build
def create_prod_build(self, *args, **kwargs): """ Create a production build :param git_uri: str, URI of git repository :param git_ref: str, reference to commit :param git_branch: str, branch name :param user: str, user name :param component: str, not used anymore...
python
def create_prod_build(self, *args, **kwargs): """ Create a production build :param git_uri: str, URI of git repository :param git_ref: str, reference to commit :param git_branch: str, branch name :param user: str, user name :param component: str, not used anymore...
[ "def", "create_prod_build", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "warning", "(", "\"prod (all-in-one) builds are deprecated, \"", "\"please use create_orchestrator_build \"", "\"(support will be removed in version 0.54)\"", ")", "...
Create a production build :param git_uri: str, URI of git repository :param git_ref: str, reference to commit :param git_branch: str, branch name :param user: str, user name :param component: str, not used anymore :param target: str, koji target :param architectu...
[ "Create", "a", "production", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L765-L793
projectatomic/osbs-client
osbs/api.py
OSBS.create_worker_build
def create_worker_build(self, **kwargs): """ Create a worker build Pass through method to create_prod_build with the following modifications: - platform param is required - release param is required - arrangement_version param is required, which is us...
python
def create_worker_build(self, **kwargs): """ Create a worker build Pass through method to create_prod_build with the following modifications: - platform param is required - release param is required - arrangement_version param is required, which is us...
[ "def", "create_worker_build", "(", "self", ",", "*", "*", "kwargs", ")", ":", "missing", "=", "set", "(", ")", "for", "required", "in", "(", "'platform'", ",", "'release'", ",", "'arrangement_version'", ")", ":", "if", "not", "kwargs", ".", "get", "(", ...
Create a worker build Pass through method to create_prod_build with the following modifications: - platform param is required - release param is required - arrangement_version param is required, which is used to select which worker_inner:n.json template...
[ "Create", "a", "worker", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L806-L847
projectatomic/osbs-client
osbs/api.py
OSBS.create_orchestrator_build
def create_orchestrator_build(self, **kwargs): """ Create an orchestrator build Pass through method to create_prod_build with the following modifications: - platforms param is required - arrangement_version param may be used to select which orchestr...
python
def create_orchestrator_build(self, **kwargs): """ Create an orchestrator build Pass through method to create_prod_build with the following modifications: - platforms param is required - arrangement_version param may be used to select which orchestr...
[ "def", "create_orchestrator_build", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "can_orchestrate", "(", ")", ":", "raise", "OsbsOrchestratorNotEnabled", "(", "\"can't create orchestrate build \"", "\"when can_orchestrate isn't enabled\"", "...
Create an orchestrator build Pass through method to create_prod_build with the following modifications: - platforms param is required - arrangement_version param may be used to select which orchestrator_inner:n.json template to use - inner template set ...
[ "Create", "an", "orchestrator", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L850-L891
projectatomic/osbs-client
osbs/api.py
OSBS.get_build_logs
def get_build_logs(self, build_id, follow=False, build_json=None, wait_if_missing=False, decode=False): """ provide logs from build NOTE: Since atomic-reactor 1.6.25, logs are always in UTF-8, so if asked to decode, we assume that is the encoding in use. Otherwise...
python
def get_build_logs(self, build_id, follow=False, build_json=None, wait_if_missing=False, decode=False): """ provide logs from build NOTE: Since atomic-reactor 1.6.25, logs are always in UTF-8, so if asked to decode, we assume that is the encoding in use. Otherwise...
[ "def", "get_build_logs", "(", "self", ",", "build_id", ",", "follow", "=", "False", ",", "build_json", "=", "None", ",", "wait_if_missing", "=", "False", ",", "decode", "=", "False", ")", ":", "logs", "=", "self", ".", "os", ".", "logs", "(", "build_id...
provide logs from build NOTE: Since atomic-reactor 1.6.25, logs are always in UTF-8, so if asked to decode, we assume that is the encoding in use. Otherwise, we return the bytes exactly as they came from the container. :param build_id: str :param follow: bool, fetch logs as the...
[ "provide", "logs", "from", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L899-L925
projectatomic/osbs-client
osbs/api.py
OSBS.get_orchestrator_build_logs
def get_orchestrator_build_logs(self, build_id, follow=False, wait_if_missing=False): """ provide logs from orchestrator build :param build_id: str :param follow: bool, fetch logs as they come? :param wait_if_missing: bool, if build doesn't exist, wait :return: generator...
python
def get_orchestrator_build_logs(self, build_id, follow=False, wait_if_missing=False): """ provide logs from orchestrator build :param build_id: str :param follow: bool, fetch logs as they come? :param wait_if_missing: bool, if build doesn't exist, wait :return: generator...
[ "def", "get_orchestrator_build_logs", "(", "self", ",", "build_id", ",", "follow", "=", "False", ",", "wait_if_missing", "=", "False", ")", ":", "logs", "=", "self", ".", "get_build_logs", "(", "build_id", "=", "build_id", ",", "follow", "=", "follow", ",", ...
provide logs from orchestrator build :param build_id: str :param follow: bool, fetch logs as they come? :param wait_if_missing: bool, if build doesn't exist, wait :return: generator yielding objects with attributes 'platform' and 'line'
[ "provide", "logs", "from", "orchestrator", "build" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L958-L978
projectatomic/osbs-client
osbs/api.py
OSBS.import_image
def import_image(self, name, tags=None): """ Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported """ stream_import_file = os.path.join(self.os_conf.get_build_json_store(), 'image_stream_...
python
def import_image(self, name, tags=None): """ Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported """ stream_import_file = os.path.join(self.os_conf.get_build_json_store(), 'image_stream_...
[ "def", "import_image", "(", "self", ",", "name", ",", "tags", "=", "None", ")", ":", "stream_import_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ",", "'image_stream_import.json'", ")", "wit...
Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported
[ "Import", "image", "tags", "from", "a", "Docker", "registry", "into", "an", "ImageStream" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1021-L1031
projectatomic/osbs-client
osbs/api.py
OSBS.import_image_tags
def import_image_tags(self, name, tags, repository, insecure=False): """Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image ...
python
def import_image_tags(self, name, tags, repository, insecure=False): """Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image ...
[ "def", "import_image_tags", "(", "self", ",", "name", ",", "tags", ",", "repository", ",", "insecure", "=", "False", ")", ":", "stream_import_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ...
Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image in the format <registry>/<repository> :param insecure...
[ "Import", "image", "tags", "from", "specified", "container", "repository", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1034-L1050
projectatomic/osbs-client
osbs/api.py
OSBS.ensure_image_stream_tag
def ensure_image_stream_tag(self, stream, tag_name, scheduled=False, source_registry=None, organization=None, base_image=None): """Ensures the tag is monitored in ImageStream :param stream: dict, ImageStream object :param tag_name: str, name of tag to check, with...
python
def ensure_image_stream_tag(self, stream, tag_name, scheduled=False, source_registry=None, organization=None, base_image=None): """Ensures the tag is monitored in ImageStream :param stream: dict, ImageStream object :param tag_name: str, name of tag to check, with...
[ "def", "ensure_image_stream_tag", "(", "self", ",", "stream", ",", "tag_name", ",", "scheduled", "=", "False", ",", "source_registry", "=", "None", ",", "organization", "=", "None", ",", "base_image", "=", "None", ")", ":", "img_stream_tag_file", "=", "os", ...
Ensures the tag is monitored in ImageStream :param stream: dict, ImageStream object :param tag_name: str, name of tag to check, without name of ImageStream as prefix :param scheduled: bool, if True, importPolicy.scheduled will be set...
[ "Ensures", "the", "tag", "is", "monitored", "in", "ImageStream" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1120-L1153
projectatomic/osbs-client
osbs/api.py
OSBS.create_image_stream
def create_image_stream(self, name, docker_image_repository, insecure_registry=False): """ Create an ImageStream object Raises exception on error :param name: str, name of ImageStream :param docker_image_repository: str, pull spec for docker image ...
python
def create_image_stream(self, name, docker_image_repository, insecure_registry=False): """ Create an ImageStream object Raises exception on error :param name: str, name of ImageStream :param docker_image_repository: str, pull spec for docker image ...
[ "def", "create_image_stream", "(", "self", ",", "name", ",", "docker_image_repository", ",", "insecure_registry", "=", "False", ")", ":", "img_stream_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")"...
Create an ImageStream object Raises exception on error :param name: str, name of ImageStream :param docker_image_repository: str, pull spec for docker image repository :param insecure_registry: bool, whether plain HTTP should be used :return: response
[ "Create", "an", "ImageStream", "object" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1175-L1197
projectatomic/osbs-client
osbs/api.py
OSBS.get_compression_extension
def get_compression_extension(self): """ Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot,...
python
def get_compression_extension(self): """ Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot,...
[ "def", "get_compression_extension", "(", "self", ")", ":", "build_request", "=", "BuildRequest", "(", "build_json_store", "=", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ")", "inner", "=", "build_request", ".", "inner_template", "postbuild_plugin...
Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot, or else None if no compression
[ "Find", "the", "filename", "extension", "for", "the", "docker", "save", "output", "which", "may", "or", "may", "not", "be", "compressed", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1267-L1292
projectatomic/osbs-client
osbs/api.py
OSBS.create_config_map
def create_config_map(self, name, data): """ Create an ConfigMap object on the server Raises exception on error :param name: str, name of configMap :param data: dict, dictionary of data to be stored :returns: ConfigMapResponse containing the ConfigMap with name and data...
python
def create_config_map(self, name, data): """ Create an ConfigMap object on the server Raises exception on error :param name: str, name of configMap :param data: dict, dictionary of data to be stored :returns: ConfigMapResponse containing the ConfigMap with name and data...
[ "def", "create_config_map", "(", "self", ",", "name", ",", "data", ")", ":", "config_data_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ",", "'config_map.json'", ")", "with", "open", "(", ...
Create an ConfigMap object on the server Raises exception on error :param name: str, name of configMap :param data: dict, dictionary of data to be stored :returns: ConfigMapResponse containing the ConfigMap with name and data
[ "Create", "an", "ConfigMap", "object", "on", "the", "server" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1307-L1328
projectatomic/osbs-client
osbs/api.py
OSBS.get_config_map
def get_config_map(self, name): """ Get a ConfigMap object from the server Raises exception on error :param name: str, name of configMap to get from the server :returns: ConfigMapResponse containing the ConfigMap with the requested name """ response = self.os.ge...
python
def get_config_map(self, name): """ Get a ConfigMap object from the server Raises exception on error :param name: str, name of configMap to get from the server :returns: ConfigMapResponse containing the ConfigMap with the requested name """ response = self.os.ge...
[ "def", "get_config_map", "(", "self", ",", "name", ")", ":", "response", "=", "self", ".", "os", ".", "get_config_map", "(", "name", ")", "config_map_response", "=", "ConfigMapResponse", "(", "response", ".", "json", "(", ")", ")", "return", "config_map_resp...
Get a ConfigMap object from the server Raises exception on error :param name: str, name of configMap to get from the server :returns: ConfigMapResponse containing the ConfigMap with the requested name
[ "Get", "a", "ConfigMap", "object", "from", "the", "server" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1331-L1342
projectatomic/osbs-client
osbs/api.py
OSBS.retries_disabled
def retries_disabled(self): """ Context manager to disable retries on requests :returns: OSBS object """ self.os.retries_enabled = False yield self.os.retries_enabled = True
python
def retries_disabled(self): """ Context manager to disable retries on requests :returns: OSBS object """ self.os.retries_enabled = False yield self.os.retries_enabled = True
[ "def", "retries_disabled", "(", "self", ")", ":", "self", ".", "os", ".", "retries_enabled", "=", "False", "yield", "self", ".", "os", ".", "retries_enabled", "=", "True" ]
Context manager to disable retries on requests :returns: OSBS object
[ "Context", "manager", "to", "disable", "retries", "on", "requests", ":", "returns", ":", "OSBS", "object" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1356-L1363
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.wipe
def wipe(self): """ Wipe the bolt database. Calling this after HoverPy has been instantiated is potentially dangerous. This function is mostly used internally for unit tests. """ try: if os.isfile(self._dbpath): os.remove(self._dbpath)...
python
def wipe(self): """ Wipe the bolt database. Calling this after HoverPy has been instantiated is potentially dangerous. This function is mostly used internally for unit tests. """ try: if os.isfile(self._dbpath): os.remove(self._dbpath)...
[ "def", "wipe", "(", "self", ")", ":", "try", ":", "if", "os", ".", "isfile", "(", "self", ".", "_dbpath", ")", ":", "os", ".", "remove", "(", "self", ".", "_dbpath", ")", "except", "OSError", ":", "pass" ]
Wipe the bolt database. Calling this after HoverPy has been instantiated is potentially dangerous. This function is mostly used internally for unit tests.
[ "Wipe", "the", "bolt", "database", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L95-L107
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.simulation
def simulation(self, data=None): """ Gets / Sets the simulation data. If no data is passed in, then this method acts as a getter. if data is passed in, then this method acts as a setter. Keyword arguments: data -- the simulation data you wish to set (default None) ...
python
def simulation(self, data=None): """ Gets / Sets the simulation data. If no data is passed in, then this method acts as a getter. if data is passed in, then this method acts as a setter. Keyword arguments: data -- the simulation data you wish to set (default None) ...
[ "def", "simulation", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "__v2", "(", ")", "+", "\"/simulation\"", ",", "data", "=", "data", ")", "else", ":", "return"...
Gets / Sets the simulation data. If no data is passed in, then this method acts as a getter. if data is passed in, then this method acts as a setter. Keyword arguments: data -- the simulation data you wish to set (default None)
[ "Gets", "/", "Sets", "the", "simulation", "data", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L135-L148
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.destination
def destination(self, name=""): """ Gets / Sets the destination data. """ if name: return self._session.put( self.__v2() + "/hoverfly/destination", data={"destination": name}).json() else: return self._session.get( ...
python
def destination(self, name=""): """ Gets / Sets the destination data. """ if name: return self._session.put( self.__v2() + "/hoverfly/destination", data={"destination": name}).json() else: return self._session.get( ...
[ "def", "destination", "(", "self", ",", "name", "=", "\"\"", ")", ":", "if", "name", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "__v2", "(", ")", "+", "\"/hoverfly/destination\"", ",", "data", "=", "{", "\"destination\"", ":"...
Gets / Sets the destination data.
[ "Gets", "/", "Sets", "the", "destination", "data", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L150-L160
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.mode
def mode(self, mode=None): """ Gets / Sets the mode. If no mode is provided, then this method acts as a getter. Keyword arguments: mode -- this should either be 'capture' or 'simulate' (default None) """ if mode: logging.debug("SWITCHING TO %s" % mod...
python
def mode(self, mode=None): """ Gets / Sets the mode. If no mode is provided, then this method acts as a getter. Keyword arguments: mode -- this should either be 'capture' or 'simulate' (default None) """ if mode: logging.debug("SWITCHING TO %s" % mod...
[ "def", "mode", "(", "self", ",", "mode", "=", "None", ")", ":", "if", "mode", ":", "logging", ".", "debug", "(", "\"SWITCHING TO %s\"", "%", "mode", ")", "url", "=", "self", ".", "__v2", "(", ")", "+", "\"/hoverfly/mode\"", "logging", ".", "debug", "...
Gets / Sets the mode. If no mode is provided, then this method acts as a getter. Keyword arguments: mode -- this should either be 'capture' or 'simulate' (default None)
[ "Gets", "/", "Sets", "the", "mode", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L168-L185
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.metadata
def metadata(self, delete=False): """ Gets the metadata. """ if delete: return self._session.delete(self.__v1() + "/metadata").json() else: return self._session.get(self.__v1() + "/metadata").json()
python
def metadata(self, delete=False): """ Gets the metadata. """ if delete: return self._session.delete(self.__v1() + "/metadata").json() else: return self._session.get(self.__v1() + "/metadata").json()
[ "def", "metadata", "(", "self", ",", "delete", "=", "False", ")", ":", "if", "delete", ":", "return", "self", ".", "_session", ".", "delete", "(", "self", ".", "__v1", "(", ")", "+", "\"/metadata\"", ")", ".", "json", "(", ")", "else", ":", "return...
Gets the metadata.
[ "Gets", "the", "metadata", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L193-L200
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.records
def records(self, data=None): """ Gets / Sets records. """ if data: return self._session.post( self.__v1() + "/records", data=data).json() else: return self._session.get(self.__v1() + "/records").json()
python
def records(self, data=None): """ Gets / Sets records. """ if data: return self._session.post( self.__v1() + "/records", data=data).json() else: return self._session.get(self.__v1() + "/records").json()
[ "def", "records", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", ":", "return", "self", ".", "_session", ".", "post", "(", "self", ".", "__v1", "(", ")", "+", "\"/records\"", ",", "data", "=", "data", ")", ".", "json", "(", ")", ...
Gets / Sets records.
[ "Gets", "/", "Sets", "records", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L202-L210
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.delays
def delays(self, delays=[]): """ Gets / Sets the delays. """ if delays: return self._session.put( self.__v1() + "/delays", data=json.dumps(delays)).json() else: return self._session.get(self.__v1() + "/delays").json()
python
def delays(self, delays=[]): """ Gets / Sets the delays. """ if delays: return self._session.put( self.__v1() + "/delays", data=json.dumps(delays)).json() else: return self._session.get(self.__v1() + "/delays").json()
[ "def", "delays", "(", "self", ",", "delays", "=", "[", "]", ")", ":", "if", "delays", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "__v1", "(", ")", "+", "\"/delays\"", ",", "data", "=", "json", ".", "dumps", "(", "delays...
Gets / Sets the delays.
[ "Gets", "/", "Sets", "the", "delays", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L212-L220
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.addDelay
def addDelay(self, urlPattern="", delay=0, httpMethod=None): """ Adds delays. """ print("addDelay is deprecated please use delays instead") delay = {"urlPattern": urlPattern, "delay": delay} if httpMethod: delay["httpMethod"] = httpMethod return self....
python
def addDelay(self, urlPattern="", delay=0, httpMethod=None): """ Adds delays. """ print("addDelay is deprecated please use delays instead") delay = {"urlPattern": urlPattern, "delay": delay} if httpMethod: delay["httpMethod"] = httpMethod return self....
[ "def", "addDelay", "(", "self", ",", "urlPattern", "=", "\"\"", ",", "delay", "=", "0", ",", "httpMethod", "=", "None", ")", ":", "print", "(", "\"addDelay is deprecated please use delays instead\"", ")", "delay", "=", "{", "\"urlPattern\"", ":", "urlPattern", ...
Adds delays.
[ "Adds", "delays", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L222-L230
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__enableProxy
def __enableProxy(self): """ Set the required environment variables to enable the use of hoverfly as a proxy. """ os.environ[ "HTTP_PROXY"] = self.httpProxy() os.environ[ "HTTPS_PROXY"] = self.httpsProxy() os.environ["REQUESTS_CA_BUNDLE"] = os.pat...
python
def __enableProxy(self): """ Set the required environment variables to enable the use of hoverfly as a proxy. """ os.environ[ "HTTP_PROXY"] = self.httpProxy() os.environ[ "HTTPS_PROXY"] = self.httpsProxy() os.environ["REQUESTS_CA_BUNDLE"] = os.pat...
[ "def", "__enableProxy", "(", "self", ")", ":", "os", ".", "environ", "[", "\"HTTP_PROXY\"", "]", "=", "self", ".", "httpProxy", "(", ")", "os", ".", "environ", "[", "\"HTTPS_PROXY\"", "]", "=", "self", ".", "httpsProxy", "(", ")", "os", ".", "environ",...
Set the required environment variables to enable the use of hoverfly as a proxy.
[ "Set", "the", "required", "environment", "variables", "to", "enable", "the", "use", "of", "hoverfly", "as", "a", "proxy", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L270-L282
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__writepid
def __writepid(self, pid): """ HoverFly fails to launch if it's already running on the same ports. So we have to keep track of them using temp files with the proxy port and admin port, containing the processe's PID. """ import tempfile d = tempfile.gettem...
python
def __writepid(self, pid): """ HoverFly fails to launch if it's already running on the same ports. So we have to keep track of them using temp files with the proxy port and admin port, containing the processe's PID. """ import tempfile d = tempfile.gettem...
[ "def", "__writepid", "(", "self", ",", "pid", ")", ":", "import", "tempfile", "d", "=", "tempfile", ".", "gettempdir", "(", ")", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "\"hoverpy.%i.%i\"", "%", "(", "self", ".", "_proxyPort", ","...
HoverFly fails to launch if it's already running on the same ports. So we have to keep track of them using temp files with the proxy port and admin port, containing the processe's PID.
[ "HoverFly", "fails", "to", "launch", "if", "it", "s", "already", "running", "on", "the", "same", "ports", ".", "So", "we", "have", "to", "keep", "track", "of", "them", "using", "temp", "files", "with", "the", "proxy", "port", "and", "admin", "port", "c...
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L292-L304
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__rmpid
def __rmpid(self): """ Remove the PID file on shutdown, unfortunately this may not get called if not given the time to shut down. """ import tempfile d = tempfile.gettempdir() name = os.path.join(d, "hoverpy.%i.%i"%(self._proxyPort, self._adminPort)) ...
python
def __rmpid(self): """ Remove the PID file on shutdown, unfortunately this may not get called if not given the time to shut down. """ import tempfile d = tempfile.gettempdir() name = os.path.join(d, "hoverpy.%i.%i"%(self._proxyPort, self._adminPort)) ...
[ "def", "__rmpid", "(", "self", ")", ":", "import", "tempfile", "d", "=", "tempfile", ".", "gettempdir", "(", ")", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "\"hoverpy.%i.%i\"", "%", "(", "self", ".", "_proxyPort", ",", "self", ".", ...
Remove the PID file on shutdown, unfortunately this may not get called if not given the time to shut down.
[ "Remove", "the", "PID", "file", "on", "shutdown", "unfortunately", "this", "may", "not", "get", "called", "if", "not", "given", "the", "time", "to", "shut", "down", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L306-L317
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__kill_if_not_shut_properly
def __kill_if_not_shut_properly(self): """ If the HoverFly process on these given ports did not shut down correctly, then kill the pid before launching a new instance. todo: this will kill existing HoverFly processes on those ports indiscriminately """ imp...
python
def __kill_if_not_shut_properly(self): """ If the HoverFly process on these given ports did not shut down correctly, then kill the pid before launching a new instance. todo: this will kill existing HoverFly processes on those ports indiscriminately """ imp...
[ "def", "__kill_if_not_shut_properly", "(", "self", ")", ":", "import", "tempfile", "d", "=", "tempfile", ".", "gettempdir", "(", ")", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "\"hoverpy.%i.%i\"", "%", "(", "self", ".", "_proxyPort", ",...
If the HoverFly process on these given ports did not shut down correctly, then kill the pid before launching a new instance. todo: this will kill existing HoverFly processes on those ports indiscriminately
[ "If", "the", "HoverFly", "process", "on", "these", "given", "ports", "did", "not", "shut", "down", "correctly", "then", "kill", "the", "pid", "before", "launching", "a", "new", "instance", ".", "todo", ":", "this", "will", "kill", "existing", "HoverFly", "...
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L319-L342
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__start
def __start(self): """ Start the hoverfly process. This function waits until it can make contact with the hoverfly API before returning. """ logging.debug("starting %i" % id(self)) self.__kill_if_not_shut_properly() self.FNULL = open(os.devnull, 'w') ...
python
def __start(self): """ Start the hoverfly process. This function waits until it can make contact with the hoverfly API before returning. """ logging.debug("starting %i" % id(self)) self.__kill_if_not_shut_properly() self.FNULL = open(os.devnull, 'w') ...
[ "def", "__start", "(", "self", ")", ":", "logging", ".", "debug", "(", "\"starting %i\"", "%", "id", "(", "self", ")", ")", "self", ".", "__kill_if_not_shut_properly", "(", ")", "self", ".", "FNULL", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ...
Start the hoverfly process. This function waits until it can make contact with the hoverfly API before returning.
[ "Start", "the", "hoverfly", "process", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L344-L385
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__stop
def __stop(self): """ Stop the hoverfly process. """ if logging: logging.debug("stopping") self._process.terminate() # communicate means we wait until the process # was actually terminated, this removes some # warnings in python3 self._...
python
def __stop(self): """ Stop the hoverfly process. """ if logging: logging.debug("stopping") self._process.terminate() # communicate means we wait until the process # was actually terminated, this removes some # warnings in python3 self._...
[ "def", "__stop", "(", "self", ")", ":", "if", "logging", ":", "logging", ".", "debug", "(", "\"stopping\"", ")", "self", ".", "_process", ".", "terminate", "(", ")", "# communicate means we wait until the process", "# was actually terminated, this removes some", "# wa...
Stop the hoverfly process.
[ "Stop", "the", "hoverfly", "process", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L387-L404
SpectoLabs/hoverpy
hoverpy/hp.py
HoverPy.__flags
def __flags(self): """ Internal method. Turns arguments into flags. """ flags = [] if self._capture: flags.append("-capture") if self._spy: flags.append("-spy") if self._dbpath: flags += ["-db-path", self._dbpath] fl...
python
def __flags(self): """ Internal method. Turns arguments into flags. """ flags = [] if self._capture: flags.append("-capture") if self._spy: flags.append("-spy") if self._dbpath: flags += ["-db-path", self._dbpath] fl...
[ "def", "__flags", "(", "self", ")", ":", "flags", "=", "[", "]", "if", "self", ".", "_capture", ":", "flags", ".", "append", "(", "\"-capture\"", ")", "if", "self", ".", "_spy", ":", "flags", ".", "append", "(", "\"-spy\"", ")", "if", "self", ".", ...
Internal method. Turns arguments into flags.
[ "Internal", "method", ".", "Turns", "arguments", "into", "flags", "." ]
train
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L406-L460
thombashi/pytablereader
pytablereader/json/core.py
JsonTableFileLoader.load
def load(self): """ Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Sc...
python
def load(self): """ Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Sc...
[ "def", "load", "(", "self", ")", ":", "formatter", "=", "JsonTableFormatter", "(", "self", ".", "load_dict", "(", ")", ")", "formatter", ".", "accept", "(", "self", ")", "return", "formatter", ".", "to_table_data", "(", ")" ]
Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Schema (1): single table ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "JSON", "file", ".", "|load_source_desc_file|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/core.py#L67-L439
thombashi/pytablereader
pytablereader/mediawiki/core.py
MediaWikiTableFileLoader.load
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki file. |load_source_desc_file| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== ...
python
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki file. |load_source_desc_file| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== ...
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "self", ".", "encoding", "=", "get_file_encoding", "(", "self", ".", "source", ",", "self", ".", "encoding", ")", "with", ...
Extract tabular data as |TableData| instances from a MediaWiki file. |load_source_desc_file| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== Format specifier Value after ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "MediaWiki", "file", ".", "|load_source_desc_file|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/mediawiki/core.py#L51-L86
thombashi/pytablereader
pytablereader/mediawiki/core.py
MediaWikiTableTextLoader.load
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki text object. |load_source_desc_text| :return: Loaded table data iterator. |load_table_name_desc| =================== =========================================...
python
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki text object. |load_source_desc_text| :return: Loaded table data iterator. |load_table_name_desc| =================== =========================================...
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "formatter", "=", "MediaWikiTableFormatter", "(", "self", ".", "source", ")", "formatter", ".", "accept", "(", "self", ")", ...
Extract tabular data as |TableData| instances from a MediaWiki text object. |load_source_desc_text| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== Format specifier ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "MediaWiki", "text", "object", ".", "|load_source_desc_text|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/mediawiki/core.py#L113-L147
projectatomic/osbs-client
osbs/build/manipulate.py
DockJsonManipulator.get_dock_json
def get_dock_json(self): """ return dock json from existing build json """ env_json = self.build_json['spec']['strategy']['customStrategy']['env'] try: p = [env for env in env_json if env["name"] == "ATOMIC_REACTOR_PLUGINS"] except TypeError: raise RuntimeError("\...
python
def get_dock_json(self): """ return dock json from existing build json """ env_json = self.build_json['spec']['strategy']['customStrategy']['env'] try: p = [env for env in env_json if env["name"] == "ATOMIC_REACTOR_PLUGINS"] except TypeError: raise RuntimeError("\...
[ "def", "get_dock_json", "(", "self", ")", ":", "env_json", "=", "self", ".", "build_json", "[", "'spec'", "]", "[", "'strategy'", "]", "[", "'customStrategy'", "]", "[", "'env'", "]", "try", ":", "p", "=", "[", "env", "for", "env", "in", "env_json", ...
return dock json from existing build json
[ "return", "dock", "json", "from", "existing", "build", "json" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L21-L32
projectatomic/osbs-client
osbs/build/manipulate.py
DockJsonManipulator.dock_json_get_plugin_conf
def dock_json_get_plugin_conf(self, plugin_type, plugin_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.dock_json[plugin_type] if x.g...
python
def dock_json_get_plugin_conf(self, plugin_type, plugin_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.dock_json[plugin_type] if x.g...
[ "def", "dock_json_get_plugin_conf", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "match", "=", "[", "x", "for", "x", "in", "self", ".", "dock_json", "[", "plugin_type", "]", "if", "x", ".", "get", "(", "'name'", ")", "==", "plugin_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.
[ "Return", "the", "configuration", "for", "a", "plugin", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L34-L42
projectatomic/osbs-client
osbs/build/manipulate.py
DockJsonManipulator.remove_plugin
def remove_plugin(self, plugin_type, plugin_name): """ if config contains plugin, remove it """ for p in self.dock_json[plugin_type]: if p.get('name') == plugin_name: self.dock_json[plugin_type].remove(p) break
python
def remove_plugin(self, plugin_type, plugin_name): """ if config contains plugin, remove it """ for p in self.dock_json[plugin_type]: if p.get('name') == plugin_name: self.dock_json[plugin_type].remove(p) break
[ "def", "remove_plugin", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "for", "p", "in", "self", ".", "dock_json", "[", "plugin_type", "]", ":", "if", "p", ".", "get", "(", "'name'", ")", "==", "plugin_name", ":", "self", ".", "dock_jso...
if config contains plugin, remove it
[ "if", "config", "contains", "plugin", "remove", "it" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L44-L51
projectatomic/osbs-client
osbs/build/manipulate.py
DockJsonManipulator.add_plugin
def add_plugin(self, plugin_type, plugin_name, args_dict): """ if config has plugin, override it, else add it """ plugin_modified = False for plugin in self.dock_json[plugin_type]: if plugin['name'] == plugin_name: plugin['args'] = args_dict ...
python
def add_plugin(self, plugin_type, plugin_name, args_dict): """ if config has plugin, override it, else add it """ plugin_modified = False for plugin in self.dock_json[plugin_type]: if plugin['name'] == plugin_name: plugin['args'] = args_dict ...
[ "def", "add_plugin", "(", "self", ",", "plugin_type", ",", "plugin_name", ",", "args_dict", ")", ":", "plugin_modified", "=", "False", "for", "plugin", "in", "self", ".", "dock_json", "[", "plugin_type", "]", ":", "if", "plugin", "[", "'name'", "]", "==", ...
if config has plugin, override it, else add it
[ "if", "config", "has", "plugin", "override", "it", "else", "add", "it" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L53-L66
projectatomic/osbs-client
osbs/build/manipulate.py
DockJsonManipulator.dock_json_has_plugin_conf
def dock_json_has_plugin_conf(self, plugin_type, plugin_name): """ Check whether a plugin is configured. """ try: self.dock_json_get_plugin_conf(plugin_type, plugin_name) return True except (KeyError, IndexError): return False
python
def dock_json_has_plugin_conf(self, plugin_type, plugin_name): """ Check whether a plugin is configured. """ try: self.dock_json_get_plugin_conf(plugin_type, plugin_name) return True except (KeyError, IndexError): return False
[ "def", "dock_json_has_plugin_conf", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "try", ":", "self", ".", "dock_json_get_plugin_conf", "(", "plugin_type", ",", "plugin_name", ")", "return", "True", "except", "(", "KeyError", ",", "IndexError", ...
Check whether a plugin is configured.
[ "Check", "whether", "a", "plugin", "is", "configured", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L68-L77
thombashi/pytablereader
pytablereader/factory/_url.py
TableUrlLoaderFactory.create_from_path
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================================= ===================================== Extension Loader ...
python
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================================= ===================================== Extension Loader ...
[ "def", "create_from_path", "(", "self", ")", ":", "import", "requests", "url_path", "=", "urlparse", "(", "self", ".", "__url", ")", ".", "path", "try", ":", "url_extension", "=", "get_extension", "(", "url_path", ".", "rstrip", "(", "\"/\"", ")", ")", "...
Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================================= ===================================== Extension Loader ========================================...
[ "Create", "a", "file", "loader", "from", "the", "file", "extension", "to", "loading", "file", ".", "Supported", "file", "extensions", "are", "as", "follows", ":" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L53-L100
thombashi/pytablereader
pytablereader/factory/_url.py
TableUrlLoaderFactory.create_from_format_name
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ========================== ====================================== Format name Loader =========================...
python
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ========================== ====================================== Format name Loader =========================...
[ "def", "create_from_format_name", "(", "self", ",", "format_name", ")", ":", "import", "requests", "logger", ".", "debug", "(", "\"TableUrlLoaderFactory: name={}\"", ".", "format", "(", "format_name", ")", ")", "loader_class", "=", "self", ".", "_get_loader_class", ...
Create a file loader from a format name. Supported file formats are as follows: ========================== ====================================== Format name Loader ========================== ====================================== ``"csv"`` ...
[ "Create", "a", "file", "loader", "from", "a", "format", "name", ".", "Supported", "file", "formats", "are", "as", "follows", ":" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L102-L148
thombashi/pytablereader
pytablereader/factory/_url.py
TableUrlLoaderFactory._get_extension_loader_mapping
def _get_extension_loader_mapping(self): """ :return: Mappings of format-extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "asp": HtmlTableTextLoader, "aspx": H...
python
def _get_extension_loader_mapping(self): """ :return: Mappings of format-extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "asp": HtmlTableTextLoader, "aspx": H...
[ "def", "_get_extension_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"asp\"", ":", "HtmlTableTextLoader", ",", "\"aspx\"", ":", "HtmlTableTextLoader", ",",...
:return: Mappings of format-extension and loader class. :rtype: dict
[ ":", "return", ":", "Mappings", "of", "format", "-", "extension", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L204-L223
thombashi/pytablereader
pytablereader/factory/_url.py
TableUrlLoaderFactory._get_format_name_loader_mapping
def _get_format_name_loader_mapping(self): """ :return: Mappings of format-name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
python
def _get_format_name_loader_mapping(self): """ :return: Mappings of format-name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
[ "def", "_get_format_name_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"excel\"", ":", "ExcelTableFileLoader", ",", "\"json_lines\"", ":", "JsonLinesTableTex...
:return: Mappings of format-name and loader class. :rtype: dict
[ ":", "return", ":", "Mappings", "of", "format", "-", "name", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L225-L242
projectatomic/osbs-client
osbs/build/pod_response.py
PodResponse.get_container_image_ids
def get_container_image_ids(self): """ Find the image IDs the containers use. :return: dict, image tag to docker ID """ statuses = graceful_chain_get(self.json, "status", "containerStatuses") if statuses is None: return {} def remove_prefix(image_id...
python
def get_container_image_ids(self): """ Find the image IDs the containers use. :return: dict, image tag to docker ID """ statuses = graceful_chain_get(self.json, "status", "containerStatuses") if statuses is None: return {} def remove_prefix(image_id...
[ "def", "get_container_image_ids", "(", "self", ")", ":", "statuses", "=", "graceful_chain_get", "(", "self", ".", "json", ",", "\"status\"", ",", "\"containerStatuses\"", ")", "if", "statuses", "is", "None", ":", "return", "{", "}", "def", "remove_prefix", "("...
Find the image IDs the containers use. :return: dict, image tag to docker ID
[ "Find", "the", "image", "IDs", "the", "containers", "use", "." ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/pod_response.py#L33-L51
projectatomic/osbs-client
osbs/build/pod_response.py
PodResponse.get_failure_reason
def get_failure_reason(self): """ Find the reason a pod failed :return: dict, which will always have key 'reason': reason: brief reason for state containerID (if known): ID of container exitCode (if known): numeric exit code """ ...
python
def get_failure_reason(self): """ Find the reason a pod failed :return: dict, which will always have key 'reason': reason: brief reason for state containerID (if known): ID of container exitCode (if known): numeric exit code """ ...
[ "def", "get_failure_reason", "(", "self", ")", ":", "reason_key", "=", "'reason'", "cid_key", "=", "'containerID'", "exit_key", "=", "'exitCode'", "pod_status", "=", "self", ".", "json", ".", "get", "(", "'status'", ",", "{", "}", ")", "statuses", "=", "po...
Find the reason a pod failed :return: dict, which will always have key 'reason': reason: brief reason for state containerID (if known): ID of container exitCode (if known): numeric exit code
[ "Find", "the", "reason", "a", "pod", "failed" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/pod_response.py#L53-L108
projectatomic/osbs-client
osbs/build/build_response.py
BuildResponse.get_error_message
def get_error_message(self): """ Return an error message based on atomic-reactor's metadata """ error_reason = self.get_error_reason() if error_reason: error_message = error_reason.get('pod') or None if error_message: return "Error in pod: ...
python
def get_error_message(self): """ Return an error message based on atomic-reactor's metadata """ error_reason = self.get_error_reason() if error_reason: error_message = error_reason.get('pod') or None if error_message: return "Error in pod: ...
[ "def", "get_error_message", "(", "self", ")", ":", "error_reason", "=", "self", ".", "get_error_reason", "(", ")", "if", "error_reason", ":", "error_message", "=", "error_reason", ".", "get", "(", "'pod'", ")", "or", "None", "if", "error_message", ":", "retu...
Return an error message based on atomic-reactor's metadata
[ "Return", "an", "error", "message", "based", "on", "atomic", "-", "reactor", "s", "metadata" ]
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_response.py#L108-L123
thombashi/pytablereader
pytablereader/factory/_file.py
TableFileLoaderFactory.create_from_path
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================== ======================================= Extension Loader ====================...
python
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================== ======================================= Extension Loader ====================...
[ "def", "create_from_path", "(", "self", ")", ":", "loader", "=", "self", ".", "_create_from_extension", "(", "self", ".", "file_extension", ")", "logger", ".", "debug", "(", "\"TableFileLoaderFactory.create_from_path: extension={}, loader={}\"", ".", "format", "(", "s...
Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================== ======================================= Extension Loader ========================== ======================================= ...
[ "Create", "a", "file", "loader", "from", "the", "file", "extension", "to", "loading", "file", ".", "Supported", "file", "extensions", "are", "as", "follows", ":" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L49-L85
thombashi/pytablereader
pytablereader/factory/_file.py
TableFileLoaderFactory.create_from_format_name
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ================ ====================================== Format name Loader ================ ===================...
python
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ================ ====================================== Format name Loader ================ ===================...
[ "def", "create_from_format_name", "(", "self", ",", "format_name", ")", ":", "loader", "=", "self", ".", "_create_from_format_name", "(", "format_name", ")", "logger", ".", "debug", "(", "\"TableFileLoaderFactory.create_from_format_name: name={}, loader={}\"", ".", "forma...
Create a file loader from a format name. Supported file formats are as follows: ================ ====================================== Format name Loader ================ ====================================== ``"csv"`` :py:class:`~.CsvTa...
[ "Create", "a", "file", "loader", "from", "a", "format", "name", ".", "Supported", "file", "formats", "are", "as", "follows", ":" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L87-L125
thombashi/pytablereader
pytablereader/factory/_file.py
TableFileLoaderFactory._get_extension_loader_mapping
def _get_extension_loader_mapping(self): """ :return: Mappings of format extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "htm": HtmlTableFileLoader, "md": Mar...
python
def _get_extension_loader_mapping(self): """ :return: Mappings of format extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "htm": HtmlTableFileLoader, "md": Mar...
[ "def", "_get_extension_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"htm\"", ":", "HtmlTableFileLoader", ",", "\"md\"", ":", "MarkdownTableFileLoader", ",...
:return: Mappings of format extension and loader class. :rtype: dict
[ ":", "return", ":", "Mappings", "of", "format", "extension", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L141-L158
thombashi/pytablereader
pytablereader/factory/_file.py
TableFileLoaderFactory._get_format_name_loader_mapping
def _get_format_name_loader_mapping(self): """ :return: Mappings of format name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
python
def _get_format_name_loader_mapping(self): """ :return: Mappings of format name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
[ "def", "_get_format_name_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"excel\"", ":", "ExcelTableFileLoader", ",", "\"json_lines\"", ":", "JsonLinesTableFil...
:return: Mappings of format name and loader class. :rtype: dict
[ ":", "return", ":", "Mappings", "of", "format", "name", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L160-L177
thombashi/pytablereader
pytablereader/spreadsheet/excelloader.py
ExcelTableFileLoader.load
def load(self): """ Extract tabular data as |TableData| instances from an Excel file. |spreadsheet_load_desc| :return: Loaded |TableData| iterator. |TableData| created for each sheet in the workbook. |load_table_name_desc| ===============...
python
def load(self): """ Extract tabular data as |TableData| instances from an Excel file. |spreadsheet_load_desc| :return: Loaded |TableData| iterator. |TableData| created for each sheet in the workbook. |load_table_name_desc| ===============...
[ "def", "load", "(", "self", ")", ":", "import", "xlrd", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "try", ":", "workbook", "=", "xlrd", ".", "open_workbook", "(", "self", ".", "source", ")", "except", "...
Extract tabular data as |TableData| instances from an Excel file. |spreadsheet_load_desc| :return: Loaded |TableData| iterator. |TableData| created for each sheet in the workbook. |load_table_name_desc| =================== ==============================...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "an", "Excel", "file", ".", "|spreadsheet_load_desc|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/spreadsheet/excelloader.py#L59-L122
thombashi/pytablereader
pytablereader/ltsv/core.py
LtsvTableFileLoader.load
def load(self): """ Extract tabular data as |TableData| instances from a LTSV file. |load_source_desc_file| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier ...
python
def load(self): """ Extract tabular data as |TableData| instances from a LTSV file. |load_source_desc_file| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier ...
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "self", ".", "encoding", "=", "get_file_encoding", "(", "self", ".", "source", ",", "self", ".", "encoding", ")", "self", ...
Extract tabular data as |TableData| instances from a LTSV file. |load_source_desc_file| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier Value after the replacement ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "LTSV", "file", ".", "|load_source_desc_file|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/ltsv/core.py#L106-L140
thombashi/pytablereader
pytablereader/ltsv/core.py
LtsvTableTextLoader.load
def load(self): """ Extract tabular data as |TableData| instances from a LTSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format spe...
python
def load(self): """ Extract tabular data as |TableData| instances from a LTSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format spe...
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "self", ".", "_ltsv_input_stream", "=", "self", ".", "source", ".", "splitlines", "(", ")", "for", "data_matrix", "in", "se...
Extract tabular data as |TableData| instances from a LTSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier Value after the replaceme...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "LTSV", "text", "object", ".", "|load_source_desc_text|" ]
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/ltsv/core.py#L164-L197
robhowley/nhlscrapi
nhlscrapi/games/eventsummary.py
EventSummary.totals
def totals(self): """ Computes and returns dictionary containing home/away by player, shots and face-off totals :returns: dict of the form ``{ 'home/away': { 'all_keys': w_numeric_data } }`` """ def agg(d): keys = ['g','a','p','pm','pn','pim','s','ab','ms','h...
python
def totals(self): """ Computes and returns dictionary containing home/away by player, shots and face-off totals :returns: dict of the form ``{ 'home/away': { 'all_keys': w_numeric_data } }`` """ def agg(d): keys = ['g','a','p','pm','pn','pim','s','ab','ms','h...
[ "def", "totals", "(", "self", ")", ":", "def", "agg", "(", "d", ")", ":", "keys", "=", "[", "'g'", ",", "'a'", ",", "'p'", ",", "'pm'", ",", "'pn'", ",", "'pim'", ",", "'s'", ",", "'ab'", ",", "'ms'", ",", "'ht'", ",", "'gv'", ",", "'tk'", ...
Computes and returns dictionary containing home/away by player, shots and face-off totals :returns: dict of the form ``{ 'home/away': { 'all_keys': w_numeric_data } }``
[ "Computes", "and", "returns", "dictionary", "containing", "home", "/", "away", "by", "player", "shots", "and", "face", "-", "off", "totals", ":", "returns", ":", "dict", "of", "the", "form", "{", "home", "/", "away", ":", "{", "all_keys", ":", "w_numeric...
train
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L137-L154
robhowley/nhlscrapi
nhlscrapi/games/eventsummary.py
EventSummary.filter_players
def filter_players(self, pl_filter): """ Return the subset home and away players that satisfy the provided filter function. :param pl_filter: function that takes a by player dictionary and returns bool :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:f...
python
def filter_players(self, pl_filter): """ Return the subset home and away players that satisfy the provided filter function. :param pl_filter: function that takes a by player dictionary and returns bool :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:f...
[ "def", "filter_players", "(", "self", ",", "pl_filter", ")", ":", "def", "each", "(", "d", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", "if", "pl_filter", "(", "k", ",", "v", ")", "}", "retu...
Return the subset home and away players that satisfy the provided filter function. :param pl_filter: function that takes a by player dictionary and returns bool :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`home_players` and :py:func:`away_players`
[ "Return", "the", "subset", "home", "and", "away", "players", "that", "satisfy", "the", "provided", "filter", "function", ".", ":", "param", "pl_filter", ":", "function", "that", "takes", "a", "by", "player", "dictionary", "and", "returns", "bool", ":", "retu...
train
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L156-L170