repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
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", "." ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/spreadsheet/gsloader.py#L62-L126
train
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", "." ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/_logger/_logger.py#L51-L85
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L168-L191
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L195-L214
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L217-L267
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L270-L314
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L385-L404
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L407-L427
train
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", "/", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L444-L477
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L480-L515
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L518-L531
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L539-L562
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L627-L636
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L639-L646
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/utils.py#L648-L656
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/kerberos_ccache.py#L53-L93
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/sqlite/core.py#L40-L68
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/config_map_response.py#L40-L57
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/config_map_response.py#L59-L72
train
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", ":" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/jsonlines/formatter.py#L33-L55
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L135-L159
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L182-L194
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L197-L239
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L242-L253
train
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", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L294-L338
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L393-L419
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L765-L793
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L806-L847
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L850-L891
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L899-L925
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L958-L978
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1021-L1031
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1034-L1050
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1120-L1153
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1175-L1197
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1267-L1292
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1307-L1328
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1331-L1342
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1356-L1363
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L95-L107
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L135-L148
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L150-L160
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L168-L185
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L193-L200
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L202-L210
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L212-L220
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L222-L230
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L270-L282
train
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...
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L292-L304
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L306-L317
train
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", "...
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L319-L342
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L344-L385
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L387-L404
train
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", "." ]
e153ec57f80634019d827d378f184c01fedc5a0e
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L406-L460
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/core.py#L67-L439
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/mediawiki/core.py#L51-L86
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/mediawiki/core.py#L113-L147
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L21-L32
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L34-L42
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L44-L51
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L53-L66
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L68-L77
train
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", ":" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L53-L100
train
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", ":" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L102-L148
train
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" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L204-L223
train
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" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L225-L242
train
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", "." ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/pod_response.py#L33-L51
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/pod_response.py#L53-L108
train
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" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_response.py#L108-L123
train
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", ":" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L49-L85
train
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", ":" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L87-L125
train
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" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L141-L158
train
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" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L160-L177
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/spreadsheet/excelloader.py#L59-L122
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/ltsv/core.py#L106-L140
train
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|" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/ltsv/core.py#L164-L197
train
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...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L137-L154
train
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...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L156-L170
train
robhowley/nhlscrapi
nhlscrapi/games/eventsummary.py
EventSummary.sort_players
def sort_players(self, sort_key=None, sort_func=None, reverse=False): """ Return all home and away by player info sorted by either the provided key or function. Must provide at least one of the two parameters. Can sort either ascending or descending. :param sort_key: (def None) ...
python
def sort_players(self, sort_key=None, sort_func=None, reverse=False): """ Return all home and away by player info sorted by either the provided key or function. Must provide at least one of the two parameters. Can sort either ascending or descending. :param sort_key: (def None) ...
[ "def", "sort_players", "(", "self", ",", "sort_key", "=", "None", ",", "sort_func", "=", "None", ",", "reverse", "=", "False", ")", ":", "def", "each", "(", "d", ")", ":", "t", "=", "[", "]", "for", "num", ",", "v", "in", "d", ".", "items", "("...
Return all home and away by player info sorted by either the provided key or function. Must provide at least one of the two parameters. Can sort either ascending or descending. :param sort_key: (def None) dict key to sort on :param sort_func: (def None) sorting function :param r...
[ "Return", "all", "home", "and", "away", "by", "player", "info", "sorted", "by", "either", "the", "provided", "key", "or", "function", ".", "Must", "provide", "at", "least", "one", "of", "the", "two", "parameters", ".", "Can", "sort", "either", "ascending",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L172-L194
train
robhowley/nhlscrapi
nhlscrapi/games/eventsummary.py
EventSummary.top_by_key
def top_by_key(self, sort_key): """ Return home/away by player info for the players on each team that are first in the provided category. :param sort_key: str, the dictionary key to be sorted on :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`ho...
python
def top_by_key(self, sort_key): """ Return home/away by player info for the players on each team that are first in the provided category. :param sort_key: str, the dictionary key to be sorted on :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`ho...
[ "def", "top_by_key", "(", "self", ",", "sort_key", ")", ":", "res", "=", "self", ".", "sort_players", "(", "sort_key", "=", "sort_key", ",", "reverse", "=", "True", ")", "return", "{", "'home'", ":", "res", "[", "'home'", "]", "[", "0", "]", ",", "...
Return home/away by player info for the players on each team that are first in the provided category. :param sort_key: str, the dictionary key to be sorted on :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`home_players` and :py:func:`away_players`
[ "Return", "home", "/", "away", "by", "player", "info", "for", "the", "players", "on", "each", "team", "that", "are", "first", "in", "the", "provided", "category", ".", ":", "param", "sort_key", ":", "str", "the", "dictionary", "key", "to", "be", "sorted"...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L226-L237
train
robhowley/nhlscrapi
nhlscrapi/games/eventsummary.py
EventSummary.top_by_func
def top_by_func(self, sort_func): """ Return home/away by player info for the players on each team who come in first according to the provided sorting function. Will perform ascending sort. :param sort_func: function that yields the sorting quantity :returns: dict of the...
python
def top_by_func(self, sort_func): """ Return home/away by player info for the players on each team who come in first according to the provided sorting function. Will perform ascending sort. :param sort_func: function that yields the sorting quantity :returns: dict of the...
[ "def", "top_by_func", "(", "self", ",", "sort_func", ")", ":", "res", "=", "self", ".", "sort_players", "(", "sort_func", "=", "sort_func", ",", "reverse", "=", "True", ")", "return", "{", "'home'", ":", "res", "[", "'home'", "]", "[", "0", "]", ",",...
Return home/away by player info for the players on each team who come in first according to the provided sorting function. Will perform ascending sort. :param sort_func: function that yields the sorting quantity :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py...
[ "Return", "home", "/", "away", "by", "player", "info", "for", "the", "players", "on", "each", "team", "who", "come", "in", "first", "according", "to", "the", "provided", "sorting", "function", ".", "Will", "perform", "ascending", "sort", ".", ":", "param",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L239-L251
train
ryanpetrello/python-zombie
zombie/proxy/client.py
encode
def encode(obj): """ Encode one argument/object to json """ if hasattr(obj, 'json'): return obj.json if hasattr(obj, '__json__'): return obj.__json__() return dumps(obj)
python
def encode(obj): """ Encode one argument/object to json """ if hasattr(obj, 'json'): return obj.json if hasattr(obj, '__json__'): return obj.__json__() return dumps(obj)
[ "def", "encode", "(", "obj", ")", ":", "if", "hasattr", "(", "obj", ",", "'json'", ")", ":", "return", "obj", ".", "json", "if", "hasattr", "(", "obj", ",", "'__json__'", ")", ":", "return", "obj", ".", "__json__", "(", ")", "return", "dumps", "(",...
Encode one argument/object to json
[ "Encode", "one", "argument", "/", "object", "to", "json" ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L14-L22
train
ryanpetrello/python-zombie
zombie/proxy/client.py
encode_args
def encode_args(args, extra=False): """ Encode a list of arguments """ if not args: return '' methodargs = ', '.join([encode(a) for a in args]) if extra: methodargs += ', ' return methodargs
python
def encode_args(args, extra=False): """ Encode a list of arguments """ if not args: return '' methodargs = ', '.join([encode(a) for a in args]) if extra: methodargs += ', ' return methodargs
[ "def", "encode_args", "(", "args", ",", "extra", "=", "False", ")", ":", "if", "not", "args", ":", "return", "''", "methodargs", "=", "', '", ".", "join", "(", "[", "encode", "(", "a", ")", "for", "a", "in", "args", "]", ")", "if", "extra", ":", ...
Encode a list of arguments
[ "Encode", "a", "list", "of", "arguments" ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L25-L36
train
ryanpetrello/python-zombie
zombie/proxy/client.py
ZombieProxyClient._send
def _send(self, javascript): """ Establishes a socket connection to the zombie.js server and sends Javascript instructions. :param js: the Javascript string to execute """ # Prepend JS to switch to the proper client context. message = """ var _ctx = ...
python
def _send(self, javascript): """ Establishes a socket connection to the zombie.js server and sends Javascript instructions. :param js: the Javascript string to execute """ # Prepend JS to switch to the proper client context. message = """ var _ctx = ...
[ "def", "_send", "(", "self", ",", "javascript", ")", ":", "# Prepend JS to switch to the proper client context.", "message", "=", "\"\"\"\n var _ctx = ctx_switch('%s'),\n browser = _ctx[0],\n ELEMENTS = _ctx[1];\n %s\n \"\"\"", "%", ...
Establishes a socket connection to the zombie.js server and sends Javascript instructions. :param js: the Javascript string to execute
[ "Establishes", "a", "socket", "connection", "to", "the", "zombie", ".", "js", "server", "and", "sends", "Javascript", "instructions", "." ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L123-L141
train
ryanpetrello/python-zombie
zombie/proxy/client.py
ZombieProxyClient.wait
def wait(self, method, *args): """ Call a method on the zombie.js Browser instance and wait on a callback. :param method: the method to call, e.g., html() :param args: one of more arguments for the method """ methodargs = encode_args(args, extra=True) js = """ ...
python
def wait(self, method, *args): """ Call a method on the zombie.js Browser instance and wait on a callback. :param method: the method to call, e.g., html() :param args: one of more arguments for the method """ methodargs = encode_args(args, extra=True) js = """ ...
[ "def", "wait", "(", "self", ",", "method", ",", "*", "args", ")", ":", "methodargs", "=", "encode_args", "(", "args", ",", "extra", "=", "True", ")", "js", "=", "\"\"\"\n %s(%s wait_callback);\n \"\"\"", "%", "(", "method", ",", "methodargs", "...
Call a method on the zombie.js Browser instance and wait on a callback. :param method: the method to call, e.g., html() :param args: one of more arguments for the method
[ "Call", "a", "method", "on", "the", "zombie", ".", "js", "Browser", "instance", "and", "wait", "on", "a", "callback", "." ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L168-L179
train
ryanpetrello/python-zombie
zombie/proxy/client.py
ZombieProxyClient.create_element
def create_element(self, method, args=None): """ Evaluate a browser method and CSS selector against the document (or an optional context DOMNode) and return a single :class:`zombie.dom.DOMNode` object, e.g., browser._node('query', 'body > div') ...roughly translates to ...
python
def create_element(self, method, args=None): """ Evaluate a browser method and CSS selector against the document (or an optional context DOMNode) and return a single :class:`zombie.dom.DOMNode` object, e.g., browser._node('query', 'body > div') ...roughly translates to ...
[ "def", "create_element", "(", "self", ",", "method", ",", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "arguments", "=", "''", "else", ":", "arguments", "=", "\"(%s)\"", "%", "encode_args", "(", "args", ")", "js", "=", "\"\"\"\n ...
Evaluate a browser method and CSS selector against the document (or an optional context DOMNode) and return a single :class:`zombie.dom.DOMNode` object, e.g., browser._node('query', 'body > div') ...roughly translates to the following Javascript... browser.query('body > div') ...
[ "Evaluate", "a", "browser", "method", "and", "CSS", "selector", "against", "the", "document", "(", "or", "an", "optional", "context", "DOMNode", ")", "and", "return", "a", "single", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", "object", "e", ...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L213-L245
train
ryanpetrello/python-zombie
zombie/proxy/client.py
ZombieProxyClient.create_elements
def create_elements(self, method, args=[]): """ Execute a browser method that will return a list of elements. Returns a list of the element indexes """ args = encode_args(args) js = """ create_elements(ELEMENTS, %(method)s(%(args)s)) """ % { ...
python
def create_elements(self, method, args=[]): """ Execute a browser method that will return a list of elements. Returns a list of the element indexes """ args = encode_args(args) js = """ create_elements(ELEMENTS, %(method)s(%(args)s)) """ % { ...
[ "def", "create_elements", "(", "self", ",", "method", ",", "args", "=", "[", "]", ")", ":", "args", "=", "encode_args", "(", "args", ")", "js", "=", "\"\"\"\n create_elements(ELEMENTS, %(method)s(%(args)s))\n \"\"\"", "%", "{", "'method'", ":", "...
Execute a browser method that will return a list of elements. Returns a list of the element indexes
[ "Execute", "a", "browser", "method", "that", "will", "return", "a", "list", "of", "elements", "." ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L247-L263
train
ryanpetrello/python-zombie
zombie/browser.py
Browser.fill
def fill(self, field, value): """ Fill a specified form field in the current document. :param field: an instance of :class:`zombie.dom.DOMNode` :param value: any string value :return: self to allow function chaining. """ self.client.nowait('browser.fill', (field,...
python
def fill(self, field, value): """ Fill a specified form field in the current document. :param field: an instance of :class:`zombie.dom.DOMNode` :param value: any string value :return: self to allow function chaining. """ self.client.nowait('browser.fill', (field,...
[ "def", "fill", "(", "self", ",", "field", ",", "value", ")", ":", "self", ".", "client", ".", "nowait", "(", "'browser.fill'", ",", "(", "field", ",", "value", ")", ")", "return", "self" ]
Fill a specified form field in the current document. :param field: an instance of :class:`zombie.dom.DOMNode` :param value: any string value :return: self to allow function chaining.
[ "Fill", "a", "specified", "form", "field", "in", "the", "current", "document", "." ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L39-L48
train
ryanpetrello/python-zombie
zombie/browser.py
Browser.query
def query(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a single :class:`zombie.dom.DOMNode` object. :param selector: a string CSS selector (http://zombie.la...
python
def query(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a single :class:`zombie.dom.DOMNode` object. :param selector: a string CSS selector (http://zombie.la...
[ "def", "query", "(", "self", ",", "selector", ",", "context", "=", "None", ")", ":", "element", "=", "self", ".", "client", ".", "create_element", "(", "'browser.query'", ",", "(", "selector", ",", "context", ")", ")", "return", "DOMNode", ".", "factory"...
Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a single :class:`zombie.dom.DOMNode` object. :param selector: a string CSS selector (http://zombie.labnotes.org/selectors) :param context: an (optional) i...
[ "Evaluate", "a", "CSS", "selector", "against", "the", "document", "(", "or", "an", "optional", "context", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", ")", "and", "return", "a", "single", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNo...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L124-L136
train
ryanpetrello/python-zombie
zombie/browser.py
Browser.queryAll
def queryAll(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a list of :class:`zombie.dom.DOMNode` objects. :param selector: a string CSS selector (http://zomb...
python
def queryAll(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a list of :class:`zombie.dom.DOMNode` objects. :param selector: a string CSS selector (http://zomb...
[ "def", "queryAll", "(", "self", ",", "selector", ",", "context", "=", "None", ")", ":", "elements", "=", "self", ".", "client", ".", "create_elements", "(", "'browser.queryAll'", ",", "(", "selector", ",", "context", ")", ")", "return", "[", "DOMNode", "...
Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a list of :class:`zombie.dom.DOMNode` objects. :param selector: a string CSS selector (http://zombie.labnotes.org/selectors) :param context: an (optional)...
[ "Evaluate", "a", "CSS", "selector", "against", "the", "document", "(", "or", "an", "optional", "context", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", ")", "and", "return", "a", "list", "of", ":", "class", ":", "zombie", ".", "dom", ".", ...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L138-L150
train
ryanpetrello/python-zombie
zombie/browser.py
Browser.link
def link(self, selector): """ Finds and returns a link ``<a>`` element (:class:`zombie.dom.DOMNode`). You can use a CSS selector or find a link by its text contents (case sensitive, but ignores leading/trailing spaces). :param selector: an optional string CSS selector ...
python
def link(self, selector): """ Finds and returns a link ``<a>`` element (:class:`zombie.dom.DOMNode`). You can use a CSS selector or find a link by its text contents (case sensitive, but ignores leading/trailing spaces). :param selector: an optional string CSS selector ...
[ "def", "link", "(", "self", ",", "selector", ")", ":", "element", "=", "self", ".", "client", ".", "create_element", "(", "'browser.link'", ",", "(", "selector", ",", ")", ")", "return", "DOMNode", "(", "element", ",", "self", ")" ]
Finds and returns a link ``<a>`` element (:class:`zombie.dom.DOMNode`). You can use a CSS selector or find a link by its text contents (case sensitive, but ignores leading/trailing spaces). :param selector: an optional string CSS selector (http://zombie.labnotes.org/sele...
[ "Finds", "and", "returns", "a", "link", "<a", ">", "element", "(", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", ")", ".", "You", "can", "use", "a", "CSS", "selector", "or", "find", "a", "link", "by", "its", "text", "contents", "(", "cas...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L234-L244
train
ryanpetrello/python-zombie
zombie/browser.py
DOMNode.value
def value(self, value): """ Used to set the ``value`` of form elements. """ self.client.nowait( 'set_field', (Literal('browser'), self.element, value))
python
def value(self, value): """ Used to set the ``value`` of form elements. """ self.client.nowait( 'set_field', (Literal('browser'), self.element, value))
[ "def", "value", "(", "self", ",", "value", ")", ":", "self", ".", "client", ".", "nowait", "(", "'set_field'", ",", "(", "Literal", "(", "'browser'", ")", ",", "self", ".", "element", ",", "value", ")", ")" ]
Used to set the ``value`` of form elements.
[ "Used", "to", "set", "the", "value", "of", "form", "elements", "." ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L527-L532
train
ryanpetrello/python-zombie
zombie/browser.py
DOMNode.fire
def fire(self, event): """ Fires a specified DOM event on the current node. :param event: the name of the event to fire (e.g., 'click'). Returns the :class:`zombie.dom.DOMNode` to allow function chaining. """ self.browser.fire(self.element, event) return self
python
def fire(self, event): """ Fires a specified DOM event on the current node. :param event: the name of the event to fire (e.g., 'click'). Returns the :class:`zombie.dom.DOMNode` to allow function chaining. """ self.browser.fire(self.element, event) return self
[ "def", "fire", "(", "self", ",", "event", ")", ":", "self", ".", "browser", ".", "fire", "(", "self", ".", "element", ",", "event", ")", "return", "self" ]
Fires a specified DOM event on the current node. :param event: the name of the event to fire (e.g., 'click'). Returns the :class:`zombie.dom.DOMNode` to allow function chaining.
[ "Fires", "a", "specified", "DOM", "event", "on", "the", "current", "node", "." ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L562-L571
train
robhowley/nhlscrapi
nhlscrapi/games/game.py
Game.load_all
def load_all(self): """ Force all reports to be loaded and parsed instead of lazy loading on demand. :returns: ``self`` or ``None`` if load fails """ try: self.toi.load_all() self.rosters.load_all() #self.summary.load_all() ...
python
def load_all(self): """ Force all reports to be loaded and parsed instead of lazy loading on demand. :returns: ``self`` or ``None`` if load fails """ try: self.toi.load_all() self.rosters.load_all() #self.summary.load_all() ...
[ "def", "load_all", "(", "self", ")", ":", "try", ":", "self", ".", "toi", ".", "load_all", "(", ")", "self", ".", "rosters", ".", "load_all", "(", ")", "#self.summary.load_all()", "self", ".", "play_by_play", ".", "load_all", "(", ")", "self", ".", "fa...
Force all reports to be loaded and parsed instead of lazy loading on demand. :returns: ``self`` or ``None`` if load fails
[ "Force", "all", "reports", "to", "be", "loaded", "and", "parsed", "instead", "of", "lazy", "loading", "on", "demand", ".", ":", "returns", ":", "self", "or", "None", "if", "load", "fails" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/game.py#L135-L150
train
robhowley/nhlscrapi
nhlscrapi/games/game.py
Game.matchup
def matchup(self): """ Return the game meta information displayed in report banners including team names, final score, game date, location, and attendance. Data format is .. code:: python { 'home': home, 'away': away, ...
python
def matchup(self): """ Return the game meta information displayed in report banners including team names, final score, game date, location, and attendance. Data format is .. code:: python { 'home': home, 'away': away, ...
[ "def", "matchup", "(", "self", ")", ":", "if", "self", ".", "play_by_play", ".", "matchup", ":", "return", "self", ".", "play_by_play", ".", "matchup", "elif", "self", ".", "rosters", ".", "matchup", ":", "return", "self", ".", "rosters", ".", "matchup",...
Return the game meta information displayed in report banners including team names, final score, game date, location, and attendance. Data format is .. code:: python { 'home': home, 'away': away, 'final': final, ...
[ "Return", "the", "game", "meta", "information", "displayed", "in", "report", "banners", "including", "team", "names", "final", "score", "game", "date", "location", "and", "attendance", ".", "Data", "format", "is", "..", "code", "::", "python", "{", "home", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/game.py#L159-L185
train
evansherlock/nytimesarticle
nytimesarticle.py
articleAPI._utf8_encode
def _utf8_encode(self, d): """ Ensures all values are encoded in UTF-8 and converts them to lowercase """ for k, v in d.items(): if isinstance(v, str): d[k] = v.encode('utf8').lower() if isinstance(v, list): for index,item ...
python
def _utf8_encode(self, d): """ Ensures all values are encoded in UTF-8 and converts them to lowercase """ for k, v in d.items(): if isinstance(v, str): d[k] = v.encode('utf8').lower() if isinstance(v, list): for index,item ...
[ "def", "_utf8_encode", "(", "self", ",", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "str", ")", ":", "d", "[", "k", "]", "=", "v", ".", "encode", "(", "'utf8'", ")", ".", ...
Ensures all values are encoded in UTF-8 and converts them to lowercase
[ "Ensures", "all", "values", "are", "encoded", "in", "UTF", "-", "8", "and", "converts", "them", "to", "lowercase" ]
89f551699ffb11f71b47271246d350a1043e9326
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L29-L44
train
evansherlock/nytimesarticle
nytimesarticle.py
articleAPI._bool_encode
def _bool_encode(self, d): """ Converts bool values to lowercase strings """ for k, v in d.items(): if isinstance(v, bool): d[k] = str(v).lower() return d
python
def _bool_encode(self, d): """ Converts bool values to lowercase strings """ for k, v in d.items(): if isinstance(v, bool): d[k] = str(v).lower() return d
[ "def", "_bool_encode", "(", "self", ",", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "bool", ")", ":", "d", "[", "k", "]", "=", "str", "(", "v", ")", ".", "lower", "(", "...
Converts bool values to lowercase strings
[ "Converts", "bool", "values", "to", "lowercase", "strings" ]
89f551699ffb11f71b47271246d350a1043e9326
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L46-L55
train
evansherlock/nytimesarticle
nytimesarticle.py
articleAPI._options
def _options(self, **kwargs): """ Formats search parameters/values for use with API :param \*\*kwargs: search parameters/values """ def _format_fq(d): for k,v in d.items(): if isinstance(v, list): d[k] = ' '.join(m...
python
def _options(self, **kwargs): """ Formats search parameters/values for use with API :param \*\*kwargs: search parameters/values """ def _format_fq(d): for k,v in d.items(): if isinstance(v, list): d[k] = ' '.join(m...
[ "def", "_options", "(", "self", ",", "*", "*", "kwargs", ")", ":", "def", "_format_fq", "(", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "list", ")", ":", "d", "[", "k", "]...
Formats search parameters/values for use with API :param \*\*kwargs: search parameters/values
[ "Formats", "search", "parameters", "/", "values", "for", "use", "with", "API", ":", "param", "\\", "*", "\\", "*", "kwargs", ":", "search", "parameters", "/", "values" ]
89f551699ffb11f71b47271246d350a1043e9326
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L57-L89
train
evansherlock/nytimesarticle
nytimesarticle.py
articleAPI.search
def search(self, response_format = None, key = None, **kwargs): """ Calls the API and returns a dictionary of the search results :param response_format: the format that the API uses for its response, inc...
python
def search(self, response_format = None, key = None, **kwargs): """ Calls the API and returns a dictionary of the search results :param response_format: the format that the API uses for its response, inc...
[ "def", "search", "(", "self", ",", "response_format", "=", "None", ",", "key", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "response_format", "is", "None", ":", "response_format", "=", "self", ".", "response_format", "if", "key", "is", "None", ...
Calls the API and returns a dictionary of the search results :param response_format: the format that the API uses for its response, includes JSON (.json) and JSONP (.jsonp). Defaults to '.json'. :...
[ "Calls", "the", "API", "and", "returns", "a", "dictionary", "of", "the", "search", "results", ":", "param", "response_format", ":", "the", "format", "that", "the", "API", "uses", "for", "its", "response", "includes", "JSON", "(", ".", "json", ")", "and", ...
89f551699ffb11f71b47271246d350a1043e9326
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L91-L115
train
robhowley/nhlscrapi
nhlscrapi/scrapr/gamesummrep.py
parse
def parse(self): """Fully parses game summary report. :returns: boolean success indicator :rtype: bool """ r = super(GameSummRep, self).parse() try: self.parse_scoring_summary() return r and False except: return False
python
def parse(self): """Fully parses game summary report. :returns: boolean success indicator :rtype: bool """ r = super(GameSummRep, self).parse() try: self.parse_scoring_summary() return r and False except: return False
[ "def", "parse", "(", "self", ")", ":", "r", "=", "super", "(", "GameSummRep", ",", "self", ")", ".", "parse", "(", ")", "try", ":", "self", ".", "parse_scoring_summary", "(", ")", "return", "r", "and", "False", "except", ":", "return", "False" ]
Fully parses game summary report. :returns: boolean success indicator :rtype: bool
[ "Fully", "parses", "game", "summary", "report", ".", ":", "returns", ":", "boolean", "success", "indicator", ":", "rtype", ":", "bool" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/gamesummrep.py#L18-L28
train