id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
222,000 | PyThaiNLP/pythainlp | pythainlp/spell/pn.py | NorvigSpellChecker.known | def known(self, words: List[str]) -> List[str]:
"""
Return a list of given words that found in the spelling dictionary
:param str words: A list of words to check if they are in the spelling dictionary
"""
return list(w for w in words if w in self.__WORDS) | python | def known(self, words: List[str]) -> List[str]:
"""
Return a list of given words that found in the spelling dictionary
:param str words: A list of words to check if they are in the spelling dictionary
"""
return list(w for w in words if w in self.__WORDS) | [
"def",
"known",
"(",
"self",
",",
"words",
":",
"List",
"[",
"str",
"]",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"w",
"for",
"w",
"in",
"words",
"if",
"w",
"in",
"self",
".",
"__WORDS",
")"
] | Return a list of given words that found in the spelling dictionary
:param str words: A list of words to check if they are in the spelling dictionary | [
"Return",
"a",
"list",
"of",
"given",
"words",
"that",
"found",
"in",
"the",
"spelling",
"dictionary"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/spell/pn.py#L114-L120 |
222,001 | PyThaiNLP/pythainlp | pythainlp/spell/pn.py | NorvigSpellChecker.prob | def prob(self, word: str) -> float:
"""
Return probability of an input word, according to the spelling dictionary
:param str word: A word to check its probability of occurrence
"""
return self.__WORDS[word] / self.__WORDS_TOTAL | python | def prob(self, word: str) -> float:
"""
Return probability of an input word, according to the spelling dictionary
:param str word: A word to check its probability of occurrence
"""
return self.__WORDS[word] / self.__WORDS_TOTAL | [
"def",
"prob",
"(",
"self",
",",
"word",
":",
"str",
")",
"->",
"float",
":",
"return",
"self",
".",
"__WORDS",
"[",
"word",
"]",
"/",
"self",
".",
"__WORDS_TOTAL"
] | Return probability of an input word, according to the spelling dictionary
:param str word: A word to check its probability of occurrence | [
"Return",
"probability",
"of",
"an",
"input",
"word",
"according",
"to",
"the",
"spelling",
"dictionary"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/spell/pn.py#L122-L128 |
222,002 | PyThaiNLP/pythainlp | pythainlp/spell/pn.py | NorvigSpellChecker.spell | def spell(self, word: str) -> List[str]:
"""
Return a list of possible words, according to edit distance of 1 and 2,
sorted by frequency of word occurrance in the spelling dictionary
:param str word: A word to check its spelling
"""
if not word:
return ""
... | python | def spell(self, word: str) -> List[str]:
"""
Return a list of possible words, according to edit distance of 1 and 2,
sorted by frequency of word occurrance in the spelling dictionary
:param str word: A word to check its spelling
"""
if not word:
return ""
... | [
"def",
"spell",
"(",
"self",
",",
"word",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"not",
"word",
":",
"return",
"\"\"",
"candidates",
"=",
"(",
"self",
".",
"known",
"(",
"[",
"word",
"]",
")",
"or",
"self",
".",
"known",
"("... | Return a list of possible words, according to edit distance of 1 and 2,
sorted by frequency of word occurrance in the spelling dictionary
:param str word: A word to check its spelling | [
"Return",
"a",
"list",
"of",
"possible",
"words",
"according",
"to",
"edit",
"distance",
"of",
"1",
"and",
"2",
"sorted",
"by",
"frequency",
"of",
"word",
"occurrance",
"in",
"the",
"spelling",
"dictionary"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/spell/pn.py#L138-L156 |
222,003 | PyThaiNLP/pythainlp | pythainlp/tokenize/__init__.py | sent_tokenize | def sent_tokenize(text: str, engine: str = "whitespace+newline") -> List[str]:
"""
This function does not yet automatically recognize when a sentence actually ends. Rather it helps split text where white space and a new line is found.
:param str text: the text to be tokenized
:param str engine: choose ... | python | def sent_tokenize(text: str, engine: str = "whitespace+newline") -> List[str]:
"""
This function does not yet automatically recognize when a sentence actually ends. Rather it helps split text where white space and a new line is found.
:param str text: the text to be tokenized
:param str engine: choose ... | [
"def",
"sent_tokenize",
"(",
"text",
":",
"str",
",",
"engine",
":",
"str",
"=",
"\"whitespace+newline\"",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"not",
"text",
"or",
"not",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"return",
"[",
"]",... | This function does not yet automatically recognize when a sentence actually ends. Rather it helps split text where white space and a new line is found.
:param str text: the text to be tokenized
:param str engine: choose between 'whitespace' or 'whitespace+newline'
:return: list of sentences | [
"This",
"function",
"does",
"not",
"yet",
"automatically",
"recognize",
"when",
"a",
"sentence",
"actually",
"ends",
".",
"Rather",
"it",
"helps",
"split",
"text",
"where",
"white",
"space",
"and",
"a",
"new",
"line",
"is",
"found",
"."
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/tokenize/__init__.py#L115-L135 |
222,004 | PyThaiNLP/pythainlp | pythainlp/tag/locations.py | tag_provinces | def tag_provinces(tokens: List[str]) -> List[Tuple[str, str]]:
"""
Recognize Thailand provinces in text
Input is a list of words
Return a list of tuples
Example::
>>> text = ['หนองคาย', 'น่าอยู่']
>>> tag_provinces(text)
[('หนองคาย', 'B-LOCATION'), ('น่าอยู่', 'O')]
"""
prov... | python | def tag_provinces(tokens: List[str]) -> List[Tuple[str, str]]:
"""
Recognize Thailand provinces in text
Input is a list of words
Return a list of tuples
Example::
>>> text = ['หนองคาย', 'น่าอยู่']
>>> tag_provinces(text)
[('หนองคาย', 'B-LOCATION'), ('น่าอยู่', 'O')]
"""
prov... | [
"def",
"tag_provinces",
"(",
"tokens",
":",
"List",
"[",
"str",
"]",
")",
"->",
"List",
"[",
"Tuple",
"[",
"str",
",",
"str",
"]",
"]",
":",
"province_list",
"=",
"provinces",
"(",
")",
"output",
"=",
"[",
"]",
"for",
"token",
"in",
"tokens",
":",
... | Recognize Thailand provinces in text
Input is a list of words
Return a list of tuples
Example::
>>> text = ['หนองคาย', 'น่าอยู่']
>>> tag_provinces(text)
[('หนองคาย', 'B-LOCATION'), ('น่าอยู่', 'O')] | [
"Recognize",
"Thailand",
"provinces",
"in",
"text"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/tag/locations.py#L11-L32 |
222,005 | PyThaiNLP/pythainlp | pythainlp/tag/named_entity.py | ThaiNameTagger.get_ner | def get_ner(
self, text: str, pos: bool = True
) -> Union[List[Tuple[str, str]], List[Tuple[str, str, str]]]:
"""
Get named-entities in text
:param string text: Thai text
:param boolean pos: get Part-Of-Speech tag (True) or get not (False)
:return: list of strings w... | python | def get_ner(
self, text: str, pos: bool = True
) -> Union[List[Tuple[str, str]], List[Tuple[str, str, str]]]:
"""
Get named-entities in text
:param string text: Thai text
:param boolean pos: get Part-Of-Speech tag (True) or get not (False)
:return: list of strings w... | [
"def",
"get_ner",
"(",
"self",
",",
"text",
":",
"str",
",",
"pos",
":",
"bool",
"=",
"True",
")",
"->",
"Union",
"[",
"List",
"[",
"Tuple",
"[",
"str",
",",
"str",
"]",
"]",
",",
"List",
"[",
"Tuple",
"[",
"str",
",",
"str",
",",
"str",
"]",... | Get named-entities in text
:param string text: Thai text
:param boolean pos: get Part-Of-Speech tag (True) or get not (False)
:return: list of strings with name labels (and part-of-speech tags)
**Example**::
>>> from pythainlp.tag.named_entity import ThaiNameTagger
... | [
"Get",
"named",
"-",
"entities",
"in",
"text"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/tag/named_entity.py#L92-L133 |
222,006 | PyThaiNLP/pythainlp | pythainlp/tokenize/multi_cut.py | find_all_segment | def find_all_segment(text: str, custom_dict: Trie = None) -> List[str]:
"""
Get all possible segment variations
:param str text: input string to be tokenized
:return: returns list of segment variations
"""
if not text or not isinstance(text, str):
return []
ww = list(_multicut(text... | python | def find_all_segment(text: str, custom_dict: Trie = None) -> List[str]:
"""
Get all possible segment variations
:param str text: input string to be tokenized
:return: returns list of segment variations
"""
if not text or not isinstance(text, str):
return []
ww = list(_multicut(text... | [
"def",
"find_all_segment",
"(",
"text",
":",
"str",
",",
"custom_dict",
":",
"Trie",
"=",
"None",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"not",
"text",
"or",
"not",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"return",
"[",
"]",
"ww",
... | Get all possible segment variations
:param str text: input string to be tokenized
:return: returns list of segment variations | [
"Get",
"all",
"possible",
"segment",
"variations"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/tokenize/multi_cut.py#L131-L143 |
222,007 | PyThaiNLP/pythainlp | pythainlp/util/date.py | reign_year_to_ad | def reign_year_to_ad(reign_year: int, reign: int) -> int:
"""
Reign year of Chakri dynasty, Thailand
"""
if int(reign) == 10:
ad = int(reign_year) + 2015
elif int(reign) == 9:
ad = int(reign_year) + 1945
elif int(reign) == 8:
ad = int(reign_year) + 1928
elif int(reign... | python | def reign_year_to_ad(reign_year: int, reign: int) -> int:
"""
Reign year of Chakri dynasty, Thailand
"""
if int(reign) == 10:
ad = int(reign_year) + 2015
elif int(reign) == 9:
ad = int(reign_year) + 1945
elif int(reign) == 8:
ad = int(reign_year) + 1928
elif int(reign... | [
"def",
"reign_year_to_ad",
"(",
"reign_year",
":",
"int",
",",
"reign",
":",
"int",
")",
"->",
"int",
":",
"if",
"int",
"(",
"reign",
")",
"==",
"10",
":",
"ad",
"=",
"int",
"(",
"reign_year",
")",
"+",
"2015",
"elif",
"int",
"(",
"reign",
")",
"... | Reign year of Chakri dynasty, Thailand | [
"Reign",
"year",
"of",
"Chakri",
"dynasty",
"Thailand"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/util/date.py#L281-L293 |
222,008 | PyThaiNLP/pythainlp | pythainlp/word_vector/__init__.py | most_similar_cosmul | def most_similar_cosmul(positive: List[str], negative: List[str]):
"""
Word arithmetic operations
If a word is not in the vocabulary, KeyError will be raised.
:param list positive: a list of words to add
:param list negative: a list of words to substract
:return: the cosine similarity between ... | python | def most_similar_cosmul(positive: List[str], negative: List[str]):
"""
Word arithmetic operations
If a word is not in the vocabulary, KeyError will be raised.
:param list positive: a list of words to add
:param list negative: a list of words to substract
:return: the cosine similarity between ... | [
"def",
"most_similar_cosmul",
"(",
"positive",
":",
"List",
"[",
"str",
"]",
",",
"negative",
":",
"List",
"[",
"str",
"]",
")",
":",
"return",
"_MODEL",
".",
"most_similar_cosmul",
"(",
"positive",
"=",
"positive",
",",
"negative",
"=",
"negative",
")"
] | Word arithmetic operations
If a word is not in the vocabulary, KeyError will be raised.
:param list positive: a list of words to add
:param list negative: a list of words to substract
:return: the cosine similarity between the two word vectors | [
"Word",
"arithmetic",
"operations",
"If",
"a",
"word",
"is",
"not",
"in",
"the",
"vocabulary",
"KeyError",
"will",
"be",
"raised",
"."
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/word_vector/__init__.py#L38-L49 |
222,009 | PyThaiNLP/pythainlp | pythainlp/word_vector/__init__.py | similarity | def similarity(word1: str, word2: str) -> float:
"""
Get cosine similarity between two words.
If a word is not in the vocabulary, KeyError will be raised.
:param string word1: first word
:param string word2: second word
:return: the cosine similarity between the two word vectors
"""
ret... | python | def similarity(word1: str, word2: str) -> float:
"""
Get cosine similarity between two words.
If a word is not in the vocabulary, KeyError will be raised.
:param string word1: first word
:param string word2: second word
:return: the cosine similarity between the two word vectors
"""
ret... | [
"def",
"similarity",
"(",
"word1",
":",
"str",
",",
"word2",
":",
"str",
")",
"->",
"float",
":",
"return",
"_MODEL",
".",
"similarity",
"(",
"word1",
",",
"word2",
")"
] | Get cosine similarity between two words.
If a word is not in the vocabulary, KeyError will be raised.
:param string word1: first word
:param string word2: second word
:return: the cosine similarity between the two word vectors | [
"Get",
"cosine",
"similarity",
"between",
"two",
"words",
".",
"If",
"a",
"word",
"is",
"not",
"in",
"the",
"vocabulary",
"KeyError",
"will",
"be",
"raised",
"."
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/word_vector/__init__.py#L63-L72 |
222,010 | PyThaiNLP/pythainlp | pythainlp/word_vector/__init__.py | sentence_vectorizer | def sentence_vectorizer(text: str, use_mean: bool = True):
"""
Get sentence vector from text
If a word is not in the vocabulary, KeyError will be raised.
:param string text: text input
:param boolean use_mean: if `True` use mean of all word vectors else use summation
:return: sentence vector o... | python | def sentence_vectorizer(text: str, use_mean: bool = True):
"""
Get sentence vector from text
If a word is not in the vocabulary, KeyError will be raised.
:param string text: text input
:param boolean use_mean: if `True` use mean of all word vectors else use summation
:return: sentence vector o... | [
"def",
"sentence_vectorizer",
"(",
"text",
":",
"str",
",",
"use_mean",
":",
"bool",
"=",
"True",
")",
":",
"words",
"=",
"word_tokenize",
"(",
"text",
",",
"engine",
"=",
"\"ulmfit\"",
")",
"vec",
"=",
"np",
".",
"zeros",
"(",
"(",
"1",
",",
"WV_DIM... | Get sentence vector from text
If a word is not in the vocabulary, KeyError will be raised.
:param string text: text input
:param boolean use_mean: if `True` use mean of all word vectors else use summation
:return: sentence vector of given input text | [
"Get",
"sentence",
"vector",
"from",
"text",
"If",
"a",
"word",
"is",
"not",
"in",
"the",
"vocabulary",
"KeyError",
"will",
"be",
"raised",
"."
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/word_vector/__init__.py#L75-L102 |
222,011 | PyThaiNLP/pythainlp | pythainlp/util/keywords.py | rank | def rank(words: List[str], exclude_stopwords: bool = False) -> Counter:
"""
Sort words by frequency
:param list words: a list of words
:param bool exclude_stopwords: exclude stopwords
:return: Counter
"""
if not words:
return None
if exclude_stopwords:
words = [word for... | python | def rank(words: List[str], exclude_stopwords: bool = False) -> Counter:
"""
Sort words by frequency
:param list words: a list of words
:param bool exclude_stopwords: exclude stopwords
:return: Counter
"""
if not words:
return None
if exclude_stopwords:
words = [word for... | [
"def",
"rank",
"(",
"words",
":",
"List",
"[",
"str",
"]",
",",
"exclude_stopwords",
":",
"bool",
"=",
"False",
")",
"->",
"Counter",
":",
"if",
"not",
"words",
":",
"return",
"None",
"if",
"exclude_stopwords",
":",
"words",
"=",
"[",
"word",
"for",
... | Sort words by frequency
:param list words: a list of words
:param bool exclude_stopwords: exclude stopwords
:return: Counter | [
"Sort",
"words",
"by",
"frequency"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/util/keywords.py#L10-L24 |
222,012 | PyThaiNLP/pythainlp | pythainlp/ulmfit/__init__.py | replace_rep_after | def replace_rep_after(text: str) -> str:
"Replace repetitions at the character level in `text` after the repetition"
def _replace_rep(m):
c, cc = m.groups()
return f"{c}{TK_REP}{len(cc)+1}"
re_rep = re.compile(r"(\S)(\1{2,})")
return re_rep.sub(_replace_rep, text) | python | def replace_rep_after(text: str) -> str:
"Replace repetitions at the character level in `text` after the repetition"
def _replace_rep(m):
c, cc = m.groups()
return f"{c}{TK_REP}{len(cc)+1}"
re_rep = re.compile(r"(\S)(\1{2,})")
return re_rep.sub(_replace_rep, text) | [
"def",
"replace_rep_after",
"(",
"text",
":",
"str",
")",
"->",
"str",
":",
"def",
"_replace_rep",
"(",
"m",
")",
":",
"c",
",",
"cc",
"=",
"m",
".",
"groups",
"(",
")",
"return",
"f\"{c}{TK_REP}{len(cc)+1}\"",
"re_rep",
"=",
"re",
".",
"compile",
"(",... | Replace repetitions at the character level in `text` after the repetition | [
"Replace",
"repetitions",
"at",
"the",
"character",
"level",
"in",
"text",
"after",
"the",
"repetition"
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/ulmfit/__init__.py#L78-L87 |
222,013 | PyThaiNLP/pythainlp | pythainlp/ulmfit/__init__.py | rm_brackets | def rm_brackets(text: str) -> str:
"Remove all empty brackets from `t`."
new_line = re.sub(r"\(\)", "", text)
new_line = re.sub(r"\{\}", "", new_line)
new_line = re.sub(r"\[\]", "", new_line)
return new_line | python | def rm_brackets(text: str) -> str:
"Remove all empty brackets from `t`."
new_line = re.sub(r"\(\)", "", text)
new_line = re.sub(r"\{\}", "", new_line)
new_line = re.sub(r"\[\]", "", new_line)
return new_line | [
"def",
"rm_brackets",
"(",
"text",
":",
"str",
")",
"->",
"str",
":",
"new_line",
"=",
"re",
".",
"sub",
"(",
"r\"\\(\\)\"",
",",
"\"\"",
",",
"text",
")",
"new_line",
"=",
"re",
".",
"sub",
"(",
"r\"\\{\\}\"",
",",
"\"\"",
",",
"new_line",
")",
"n... | Remove all empty brackets from `t`. | [
"Remove",
"all",
"empty",
"brackets",
"from",
"t",
"."
] | e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca | https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/ulmfit/__init__.py#L96-L102 |
222,014 | great-expectations/great_expectations | great_expectations/data_asset/base.py | _calc_validation_statistics | def _calc_validation_statistics(validation_results):
"""
Calculate summary statistics for the validation results and
return ``ExpectationStatistics``.
"""
# calc stats
successful_expectations = sum(exp["success"] for exp in validation_results)
evaluated_expectations = len(validation_results)... | python | def _calc_validation_statistics(validation_results):
"""
Calculate summary statistics for the validation results and
return ``ExpectationStatistics``.
"""
# calc stats
successful_expectations = sum(exp["success"] for exp in validation_results)
evaluated_expectations = len(validation_results)... | [
"def",
"_calc_validation_statistics",
"(",
"validation_results",
")",
":",
"# calc stats",
"successful_expectations",
"=",
"sum",
"(",
"exp",
"[",
"\"success\"",
"]",
"for",
"exp",
"in",
"validation_results",
")",
"evaluated_expectations",
"=",
"len",
"(",
"validation... | Calculate summary statistics for the validation results and
return ``ExpectationStatistics``. | [
"Calculate",
"summary",
"statistics",
"for",
"the",
"validation",
"results",
"and",
"return",
"ExpectationStatistics",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L1127-L1148 |
222,015 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset.expectation | def expectation(cls, method_arg_names):
"""Manages configuration and running of expectation objects.
Expectation builds and saves a new expectation configuration to the DataAsset object. It is the core decorator \
used by great expectations to manage expectation configurations.
Args:
... | python | def expectation(cls, method_arg_names):
"""Manages configuration and running of expectation objects.
Expectation builds and saves a new expectation configuration to the DataAsset object. It is the core decorator \
used by great expectations to manage expectation configurations.
Args:
... | [
"def",
"expectation",
"(",
"cls",
",",
"method_arg_names",
")",
":",
"def",
"outer_wrapper",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get the name of t... | Manages configuration and running of expectation objects.
Expectation builds and saves a new expectation configuration to the DataAsset object. It is the core decorator \
used by great expectations to manage expectation configurations.
Args:
method_arg_names (List) : An ordered lis... | [
"Manages",
"configuration",
"and",
"running",
"of",
"expectation",
"objects",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L52-L203 |
222,016 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset._append_expectation | def _append_expectation(self, expectation_config):
"""Appends an expectation to `DataAsset._expectations_config` and drops existing expectations of the same type.
If `expectation_config` is a column expectation, this drops existing expectations that are specific to \
that column and only ... | python | def _append_expectation(self, expectation_config):
"""Appends an expectation to `DataAsset._expectations_config` and drops existing expectations of the same type.
If `expectation_config` is a column expectation, this drops existing expectations that are specific to \
that column and only ... | [
"def",
"_append_expectation",
"(",
"self",
",",
"expectation_config",
")",
":",
"expectation_type",
"=",
"expectation_config",
"[",
"'expectation_type'",
"]",
"# Test to ensure the new expectation is serializable.",
"# FIXME: If it's not, are we sure we want to raise an error?",
"# F... | Appends an expectation to `DataAsset._expectations_config` and drops existing expectations of the same type.
If `expectation_config` is a column expectation, this drops existing expectations that are specific to \
that column and only if it is the same expectation type as `expectation_config`. Ot... | [
"Appends",
"an",
"expectation",
"to",
"DataAsset",
".",
"_expectations_config",
"and",
"drops",
"existing",
"expectations",
"of",
"the",
"same",
"type",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L262-L307 |
222,017 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset._copy_and_clean_up_expectation | def _copy_and_clean_up_expectation(self,
expectation,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
... | python | def _copy_and_clean_up_expectation(self,
expectation,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
... | [
"def",
"_copy_and_clean_up_expectation",
"(",
"self",
",",
"expectation",
",",
"discard_result_format_kwargs",
"=",
"True",
",",
"discard_include_configs_kwargs",
"=",
"True",
",",
"discard_catch_exceptions_kwargs",
"=",
"True",
",",
")",
":",
"new_expectation",
"=",
"c... | Returns copy of `expectation` without `success_on_last_run` and other specified key-value pairs removed
Returns a copy of specified expectation will not have `success_on_last_run` key-value. The other key-value \
pairs will be removed by default but will remain in the copy if specified.
... | [
"Returns",
"copy",
"of",
"expectation",
"without",
"success_on_last_run",
"and",
"other",
"specified",
"key",
"-",
"value",
"pairs",
"removed"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L309-L353 |
222,018 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset._copy_and_clean_up_expectations_from_indexes | def _copy_and_clean_up_expectations_from_indexes(
self,
match_indexes,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
):
"""Copies and cleans all expectations provided by their index in DataAsset._expectat... | python | def _copy_and_clean_up_expectations_from_indexes(
self,
match_indexes,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
):
"""Copies and cleans all expectations provided by their index in DataAsset._expectat... | [
"def",
"_copy_and_clean_up_expectations_from_indexes",
"(",
"self",
",",
"match_indexes",
",",
"discard_result_format_kwargs",
"=",
"True",
",",
"discard_include_configs_kwargs",
"=",
"True",
",",
"discard_catch_exceptions_kwargs",
"=",
"True",
",",
")",
":",
"rval",
"=",... | Copies and cleans all expectations provided by their index in DataAsset._expectations_config.expectations.
Applies the _copy_and_clean_up_expectation method to multiple expectations, provided by their index in \
`DataAsset,_expectations_config.expectations`. Returns a list of the copied and clean... | [
"Copies",
"and",
"cleans",
"all",
"expectations",
"provided",
"by",
"their",
"index",
"in",
"DataAsset",
".",
"_expectations_config",
".",
"expectations",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L355-L395 |
222,019 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset.get_expectations_config | def get_expectations_config(self,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
... | python | def get_expectations_config(self,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
... | [
"def",
"get_expectations_config",
"(",
"self",
",",
"discard_failed_expectations",
"=",
"True",
",",
"discard_result_format_kwargs",
"=",
"True",
",",
"discard_include_configs_kwargs",
"=",
"True",
",",
"discard_catch_exceptions_kwargs",
"=",
"True",
",",
"suppress_warnings... | Returns _expectation_config as a JSON object, and perform some cleaning along the way.
Args:
discard_failed_expectations (boolean): \
Only include expectations with success_on_last_run=True in the exported config. Defaults to `True`.
discard_result_format_kwargs (boolea... | [
"Returns",
"_expectation_config",
"as",
"a",
"JSON",
"object",
"and",
"perform",
"some",
"cleaning",
"along",
"the",
"way",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L581-L673 |
222,020 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset.save_expectations_config | def save_expectations_config(
self,
filepath=None,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
suppress_warnings=False
):
"""Writes ``_expectation_confi... | python | def save_expectations_config(
self,
filepath=None,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_configs_kwargs=True,
discard_catch_exceptions_kwargs=True,
suppress_warnings=False
):
"""Writes ``_expectation_confi... | [
"def",
"save_expectations_config",
"(",
"self",
",",
"filepath",
"=",
"None",
",",
"discard_failed_expectations",
"=",
"True",
",",
"discard_result_format_kwargs",
"=",
"True",
",",
"discard_include_configs_kwargs",
"=",
"True",
",",
"discard_catch_exceptions_kwargs",
"="... | Writes ``_expectation_config`` to a JSON file.
Writes the DataAsset's expectation config to the specified JSON ``filepath``. Failing expectations \
can be excluded from the JSON expectations config with ``discard_failed_expectations``. The kwarg key-value \
pairs :ref:`result_format`, ... | [
"Writes",
"_expectation_config",
"to",
"a",
"JSON",
"file",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L675-L721 |
222,021 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset.validate | def validate(self, expectations_config=None, evaluation_parameters=None, catch_exceptions=True, result_format=None, only_return_failures=False):
"""Generates a JSON-formatted report describing the outcome of all expectations.
Use the default expectations_config=None to validate the expectations con... | python | def validate(self, expectations_config=None, evaluation_parameters=None, catch_exceptions=True, result_format=None, only_return_failures=False):
"""Generates a JSON-formatted report describing the outcome of all expectations.
Use the default expectations_config=None to validate the expectations con... | [
"def",
"validate",
"(",
"self",
",",
"expectations_config",
"=",
"None",
",",
"evaluation_parameters",
"=",
"None",
",",
"catch_exceptions",
"=",
"True",
",",
"result_format",
"=",
"None",
",",
"only_return_failures",
"=",
"False",
")",
":",
"results",
"=",
"[... | Generates a JSON-formatted report describing the outcome of all expectations.
Use the default expectations_config=None to validate the expectations config associated with the DataAsset.
Args:
expectations_config (json or None): \
If None, uses the expectatio... | [
"Generates",
"a",
"JSON",
"-",
"formatted",
"report",
"describing",
"the",
"outcome",
"of",
"all",
"expectations",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L723-L893 |
222,022 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset.get_evaluation_parameter | def get_evaluation_parameter(self, parameter_name, default_value=None):
"""Get an evaluation parameter value that has been stored in meta.
Args:
parameter_name (string): The name of the parameter to store.
default_value (any): The default value to be returned if the parameter is... | python | def get_evaluation_parameter(self, parameter_name, default_value=None):
"""Get an evaluation parameter value that has been stored in meta.
Args:
parameter_name (string): The name of the parameter to store.
default_value (any): The default value to be returned if the parameter is... | [
"def",
"get_evaluation_parameter",
"(",
"self",
",",
"parameter_name",
",",
"default_value",
"=",
"None",
")",
":",
"if",
"\"evaluation_parameters\"",
"in",
"self",
".",
"_expectations_config",
"and",
"parameter_name",
"in",
"self",
".",
"_expectations_config",
"[",
... | Get an evaluation parameter value that has been stored in meta.
Args:
parameter_name (string): The name of the parameter to store.
default_value (any): The default value to be returned if the parameter is not found.
Returns:
The current value of the evaluation param... | [
"Get",
"an",
"evaluation",
"parameter",
"value",
"that",
"has",
"been",
"stored",
"in",
"meta",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L895-L909 |
222,023 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset.set_evaluation_parameter | def set_evaluation_parameter(self, parameter_name, parameter_value):
"""Provide a value to be stored in the data_asset evaluation_parameters object and used to evaluate
parameterized expectations.
Args:
parameter_name (string): The name of the kwarg to be replaced at evaluation time... | python | def set_evaluation_parameter(self, parameter_name, parameter_value):
"""Provide a value to be stored in the data_asset evaluation_parameters object and used to evaluate
parameterized expectations.
Args:
parameter_name (string): The name of the kwarg to be replaced at evaluation time... | [
"def",
"set_evaluation_parameter",
"(",
"self",
",",
"parameter_name",
",",
"parameter_value",
")",
":",
"if",
"'evaluation_parameters'",
"not",
"in",
"self",
".",
"_expectations_config",
":",
"self",
".",
"_expectations_config",
"[",
"'evaluation_parameters'",
"]",
"... | Provide a value to be stored in the data_asset evaluation_parameters object and used to evaluate
parameterized expectations.
Args:
parameter_name (string): The name of the kwarg to be replaced at evaluation time
parameter_value (any): The value to be used | [
"Provide",
"a",
"value",
"to",
"be",
"stored",
"in",
"the",
"data_asset",
"evaluation_parameters",
"object",
"and",
"used",
"to",
"evaluate",
"parameterized",
"expectations",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L911-L924 |
222,024 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset._build_evaluation_parameters | def _build_evaluation_parameters(self, expectation_args, evaluation_parameters):
"""Build a dictionary of parameters to evaluate, using the provided evaluation_paramters,
AND mutate expectation_args by removing any parameter values passed in as temporary values during
exploratory work.
"... | python | def _build_evaluation_parameters(self, expectation_args, evaluation_parameters):
"""Build a dictionary of parameters to evaluate, using the provided evaluation_paramters,
AND mutate expectation_args by removing any parameter values passed in as temporary values during
exploratory work.
"... | [
"def",
"_build_evaluation_parameters",
"(",
"self",
",",
"expectation_args",
",",
"evaluation_parameters",
")",
":",
"evaluation_args",
"=",
"copy",
".",
"deepcopy",
"(",
"expectation_args",
")",
"# Iterate over arguments, and replace $PARAMETER-defined args with their",
"# spe... | Build a dictionary of parameters to evaluate, using the provided evaluation_paramters,
AND mutate expectation_args by removing any parameter values passed in as temporary values during
exploratory work. | [
"Build",
"a",
"dictionary",
"of",
"parameters",
"to",
"evaluate",
"using",
"the",
"provided",
"evaluation_paramters",
"AND",
"mutate",
"expectation_args",
"by",
"removing",
"any",
"parameter",
"values",
"passed",
"in",
"as",
"temporary",
"values",
"during",
"explora... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L934-L959 |
222,025 | great-expectations/great_expectations | great_expectations/data_asset/base.py | DataAsset._calc_map_expectation_success | def _calc_map_expectation_success(self, success_count, nonnull_count, mostly):
"""Calculate success and percent_success for column_map_expectations
Args:
success_count (int): \
The number of successful values in the column
nonnull_count (int): \
T... | python | def _calc_map_expectation_success(self, success_count, nonnull_count, mostly):
"""Calculate success and percent_success for column_map_expectations
Args:
success_count (int): \
The number of successful values in the column
nonnull_count (int): \
T... | [
"def",
"_calc_map_expectation_success",
"(",
"self",
",",
"success_count",
",",
"nonnull_count",
",",
"mostly",
")",
":",
"if",
"nonnull_count",
">",
"0",
":",
"# percent_success = float(success_count)/nonnull_count",
"percent_success",
"=",
"success_count",
"/",
"nonnull... | Calculate success and percent_success for column_map_expectations
Args:
success_count (int): \
The number of successful values in the column
nonnull_count (int): \
The number of nonnull values in the column
mostly (float or None): \
... | [
"Calculate",
"success",
"and",
"percent_success",
"for",
"column_map_expectations"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/base.py#L1058-L1088 |
222,026 | great-expectations/great_expectations | great_expectations/cli.py | validate | def validate(parsed_args):
"""
Read a dataset file and validate it using a config saved in another file. Uses parameters defined in the dispatch
method.
:param parsed_args: A Namespace object containing parsed arguments from the dispatch method.
:return: The number of unsucessful expectations
"... | python | def validate(parsed_args):
"""
Read a dataset file and validate it using a config saved in another file. Uses parameters defined in the dispatch
method.
:param parsed_args: A Namespace object containing parsed arguments from the dispatch method.
:return: The number of unsucessful expectations
"... | [
"def",
"validate",
"(",
"parsed_args",
")",
":",
"parsed_args",
"=",
"vars",
"(",
"parsed_args",
")",
"data_set",
"=",
"parsed_args",
"[",
"'dataset'",
"]",
"expectations_config_file",
"=",
"parsed_args",
"[",
"'expectations_config_file'",
"]",
"expectations_config",
... | Read a dataset file and validate it using a config saved in another file. Uses parameters defined in the dispatch
method.
:param parsed_args: A Namespace object containing parsed arguments from the dispatch method.
:return: The number of unsucessful expectations | [
"Read",
"a",
"dataset",
"file",
"and",
"validate",
"it",
"using",
"a",
"config",
"saved",
"in",
"another",
"file",
".",
"Uses",
"parameters",
"defined",
"in",
"the",
"dispatch",
"method",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/cli.py#L55-L112 |
222,027 | great-expectations/great_expectations | great_expectations/dataset/util.py | categorical_partition_data | def categorical_partition_data(data):
"""Convenience method for creating weights from categorical data.
Args:
data (list-like): The data from which to construct the estimate.
Returns:
A new partition object::
{
"partition": (list) The categorical values present... | python | def categorical_partition_data(data):
"""Convenience method for creating weights from categorical data.
Args:
data (list-like): The data from which to construct the estimate.
Returns:
A new partition object::
{
"partition": (list) The categorical values present... | [
"def",
"categorical_partition_data",
"(",
"data",
")",
":",
"# Make dropna explicit (even though it defaults to true)",
"series",
"=",
"pd",
".",
"Series",
"(",
"data",
")",
"value_counts",
"=",
"series",
".",
"value_counts",
"(",
"dropna",
"=",
"True",
")",
"# Comp... | Convenience method for creating weights from categorical data.
Args:
data (list-like): The data from which to construct the estimate.
Returns:
A new partition object::
{
"partition": (list) The categorical values present in the data
"weights": (list... | [
"Convenience",
"method",
"for",
"creating",
"weights",
"from",
"categorical",
"data",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/util.py#L56-L83 |
222,028 | great-expectations/great_expectations | great_expectations/dataset/util.py | kde_partition_data | def kde_partition_data(data, estimate_tails=True):
"""Convenience method for building a partition and weights using a gaussian Kernel Density Estimate and default bandwidth.
Args:
data (list-like): The data from which to construct the estimate
estimate_tails (bool): Whether to estimate the tail... | python | def kde_partition_data(data, estimate_tails=True):
"""Convenience method for building a partition and weights using a gaussian Kernel Density Estimate and default bandwidth.
Args:
data (list-like): The data from which to construct the estimate
estimate_tails (bool): Whether to estimate the tail... | [
"def",
"kde_partition_data",
"(",
"data",
",",
"estimate_tails",
"=",
"True",
")",
":",
"kde",
"=",
"stats",
".",
"kde",
".",
"gaussian_kde",
"(",
"data",
")",
"evaluation_bins",
"=",
"np",
".",
"linspace",
"(",
"start",
"=",
"np",
".",
"min",
"(",
"da... | Convenience method for building a partition and weights using a gaussian Kernel Density Estimate and default bandwidth.
Args:
data (list-like): The data from which to construct the estimate
estimate_tails (bool): Whether to estimate the tails of the distribution to keep the partition object finite
... | [
"Convenience",
"method",
"for",
"building",
"a",
"partition",
"and",
"weights",
"using",
"a",
"gaussian",
"Kernel",
"Density",
"Estimate",
"and",
"default",
"bandwidth",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/util.py#L86-L122 |
222,029 | great-expectations/great_expectations | great_expectations/dataset/util.py | continuous_partition_data | def continuous_partition_data(data, bins='auto', n_bins=10):
"""Convenience method for building a partition object on continuous data
Args:
data (list-like): The data from which to construct the estimate.
bins (string): One of 'uniform' (for uniformly spaced bins), 'ntile' (for percentile-space... | python | def continuous_partition_data(data, bins='auto', n_bins=10):
"""Convenience method for building a partition object on continuous data
Args:
data (list-like): The data from which to construct the estimate.
bins (string): One of 'uniform' (for uniformly spaced bins), 'ntile' (for percentile-space... | [
"def",
"continuous_partition_data",
"(",
"data",
",",
"bins",
"=",
"'auto'",
",",
"n_bins",
"=",
"10",
")",
":",
"if",
"bins",
"==",
"'uniform'",
":",
"bins",
"=",
"np",
".",
"linspace",
"(",
"start",
"=",
"np",
".",
"min",
"(",
"data",
")",
",",
"... | Convenience method for building a partition object on continuous data
Args:
data (list-like): The data from which to construct the estimate.
bins (string): One of 'uniform' (for uniformly spaced bins), 'ntile' (for percentile-spaced bins), or 'auto' (for automatically spaced bins)
n_bins (i... | [
"Convenience",
"method",
"for",
"building",
"a",
"partition",
"object",
"on",
"continuous",
"data"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/util.py#L131-L160 |
222,030 | great-expectations/great_expectations | great_expectations/dataset/util.py | infer_distribution_parameters | def infer_distribution_parameters(data, distribution, params=None):
"""Convenience method for determining the shape parameters of a given distribution
Args:
data (list-like): The data to build shape parameters from.
distribution (string): Scipy distribution, determines which parameters to build... | python | def infer_distribution_parameters(data, distribution, params=None):
"""Convenience method for determining the shape parameters of a given distribution
Args:
data (list-like): The data to build shape parameters from.
distribution (string): Scipy distribution, determines which parameters to build... | [
"def",
"infer_distribution_parameters",
"(",
"data",
",",
"distribution",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"dict",
"(",
")",
"elif",
"not",
"isinstance",
"(",
"params",
",",
"dict",
")",
":",
"raise"... | Convenience method for determining the shape parameters of a given distribution
Args:
data (list-like): The data to build shape parameters from.
distribution (string): Scipy distribution, determines which parameters to build.
params (dict or None): The known parameters. Parameters given her... | [
"Convenience",
"method",
"for",
"determining",
"the",
"shape",
"parameters",
"of",
"a",
"given",
"distribution"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/util.py#L163-L253 |
222,031 | great-expectations/great_expectations | great_expectations/dataset/util.py | _scipy_distribution_positional_args_from_dict | def _scipy_distribution_positional_args_from_dict(distribution, params):
"""Helper function that returns positional arguments for a scipy distribution using a dict of parameters.
See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\
to see a... | python | def _scipy_distribution_positional_args_from_dict(distribution, params):
"""Helper function that returns positional arguments for a scipy distribution using a dict of parameters.
See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\
to see a... | [
"def",
"_scipy_distribution_positional_args_from_dict",
"(",
"distribution",
",",
"params",
")",
":",
"params",
"[",
"'loc'",
"]",
"=",
"params",
".",
"get",
"(",
"'loc'",
",",
"0",
")",
"if",
"'scale'",
"not",
"in",
"params",
":",
"params",
"[",
"'scale'",
... | Helper function that returns positional arguments for a scipy distribution using a dict of parameters.
See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\
to see an example of scipy's positional arguments. This function returns the arguments s... | [
"Helper",
"function",
"that",
"returns",
"positional",
"arguments",
"for",
"a",
"scipy",
"distribution",
"using",
"a",
"dict",
"of",
"parameters",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/util.py#L256-L291 |
222,032 | great-expectations/great_expectations | great_expectations/dataset/util.py | create_multiple_expectations | def create_multiple_expectations(df, columns, expectation_type, *args, **kwargs):
"""Creates an identical expectation for each of the given columns with the specified arguments, if any.
Args:
df (great_expectations.dataset): A great expectations dataset object.
columns (list): A list of column ... | python | def create_multiple_expectations(df, columns, expectation_type, *args, **kwargs):
"""Creates an identical expectation for each of the given columns with the specified arguments, if any.
Args:
df (great_expectations.dataset): A great expectations dataset object.
columns (list): A list of column ... | [
"def",
"create_multiple_expectations",
"(",
"df",
",",
"columns",
",",
"expectation_type",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"expectation",
"=",
"getattr",
"(",
"df",
",",
"expectation_type",
")",
"results",
"=",
"list",
"(",
")",
"for",... | Creates an identical expectation for each of the given columns with the specified arguments, if any.
Args:
df (great_expectations.dataset): A great expectations dataset object.
columns (list): A list of column names represented as strings.
expectation_type (string): The expectation type.
... | [
"Creates",
"an",
"identical",
"expectation",
"for",
"each",
"of",
"the",
"given",
"columns",
"with",
"the",
"specified",
"arguments",
"if",
"any",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/util.py#L422-L445 |
222,033 | great-expectations/great_expectations | great_expectations/dataset/autoinspect.py | columns_exist | def columns_exist(inspect_dataset):
"""
This function will take a dataset and add expectations that each column present exists.
Args:
inspect_dataset (great_expectations.dataset): The dataset to inspect and to which to add expectations.
"""
# Attempt to get column names. For pandas, column... | python | def columns_exist(inspect_dataset):
"""
This function will take a dataset and add expectations that each column present exists.
Args:
inspect_dataset (great_expectations.dataset): The dataset to inspect and to which to add expectations.
"""
# Attempt to get column names. For pandas, column... | [
"def",
"columns_exist",
"(",
"inspect_dataset",
")",
":",
"# Attempt to get column names. For pandas, columns is just a list of strings",
"if",
"not",
"hasattr",
"(",
"inspect_dataset",
",",
"\"columns\"",
")",
":",
"warnings",
".",
"warn",
"(",
"\"No columns list found in da... | This function will take a dataset and add expectations that each column present exists.
Args:
inspect_dataset (great_expectations.dataset): The dataset to inspect and to which to add expectations. | [
"This",
"function",
"will",
"take",
"a",
"dataset",
"and",
"add",
"expectations",
"that",
"each",
"column",
"present",
"exists",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/autoinspect.py#L23-L45 |
222,034 | great-expectations/great_expectations | great_expectations/dataset/sqlalchemy_dataset.py | SqlAlchemyDataset.column_reflection_fallback | def column_reflection_fallback(self):
"""If we can't reflect the table, use a query to at least get column names."""
sql = sa.select([sa.text("*")]).select_from(self._table)
col_names = self.engine.execute(sql).keys()
col_dict = [{'name': col_name} for col_name in col_names]
retu... | python | def column_reflection_fallback(self):
"""If we can't reflect the table, use a query to at least get column names."""
sql = sa.select([sa.text("*")]).select_from(self._table)
col_names = self.engine.execute(sql).keys()
col_dict = [{'name': col_name} for col_name in col_names]
retu... | [
"def",
"column_reflection_fallback",
"(",
"self",
")",
":",
"sql",
"=",
"sa",
".",
"select",
"(",
"[",
"sa",
".",
"text",
"(",
"\"*\"",
")",
"]",
")",
".",
"select_from",
"(",
"self",
".",
"_table",
")",
"col_names",
"=",
"self",
".",
"engine",
".",
... | If we can't reflect the table, use a query to at least get column names. | [
"If",
"we",
"can",
"t",
"reflect",
"the",
"table",
"use",
"a",
"query",
"to",
"at",
"least",
"get",
"column",
"names",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/sqlalchemy_dataset.py#L303-L308 |
222,035 | great-expectations/great_expectations | great_expectations/data_asset/util.py | parse_result_format | def parse_result_format(result_format):
"""This is a simple helper utility that can be used to parse a string result_format into the dict format used
internally by great_expectations. It is not necessary but allows shorthand for result_format in cases where
there is no need to specify a custom partial_unexp... | python | def parse_result_format(result_format):
"""This is a simple helper utility that can be used to parse a string result_format into the dict format used
internally by great_expectations. It is not necessary but allows shorthand for result_format in cases where
there is no need to specify a custom partial_unexp... | [
"def",
"parse_result_format",
"(",
"result_format",
")",
":",
"if",
"isinstance",
"(",
"result_format",
",",
"string_types",
")",
":",
"result_format",
"=",
"{",
"'result_format'",
":",
"result_format",
",",
"'partial_unexpected_count'",
":",
"20",
"}",
"else",
":... | This is a simple helper utility that can be used to parse a string result_format into the dict format used
internally by great_expectations. It is not necessary but allows shorthand for result_format in cases where
there is no need to specify a custom partial_unexpected_count. | [
"This",
"is",
"a",
"simple",
"helper",
"utility",
"that",
"can",
"be",
"used",
"to",
"parse",
"a",
"string",
"result_format",
"into",
"the",
"dict",
"format",
"used",
"internally",
"by",
"great_expectations",
".",
"It",
"is",
"not",
"necessary",
"but",
"allo... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/util.py#L18-L31 |
222,036 | great-expectations/great_expectations | great_expectations/data_asset/util.py | recursively_convert_to_json_serializable | def recursively_convert_to_json_serializable(test_obj):
"""
Helper function to convert a dict object to one that is serializable
Args:
test_obj: an object to attempt to convert a corresponding json-serializable object
Returns:
(dict) A converted test_object
Warning:
test_o... | python | def recursively_convert_to_json_serializable(test_obj):
"""
Helper function to convert a dict object to one that is serializable
Args:
test_obj: an object to attempt to convert a corresponding json-serializable object
Returns:
(dict) A converted test_object
Warning:
test_o... | [
"def",
"recursively_convert_to_json_serializable",
"(",
"test_obj",
")",
":",
"# Validate that all aruguments are of approved types, coerce if it's easy, else exception",
"# print(type(test_obj), test_obj)",
"# Note: Not 100% sure I've resolved this correctly...",
"try",
":",
"if",
"not",
... | Helper function to convert a dict object to one that is serializable
Args:
test_obj: an object to attempt to convert a corresponding json-serializable object
Returns:
(dict) A converted test_object
Warning:
test_obj may also be converted in place. | [
"Helper",
"function",
"to",
"convert",
"a",
"dict",
"object",
"to",
"one",
"that",
"is",
"serializable"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/util.py#L106-L195 |
222,037 | great-expectations/great_expectations | great_expectations/util.py | read_excel | def read_excel(
filename,
dataset_class=dataset.pandas_dataset.PandasDataset,
expectations_config=None,
autoinspect_func=None,
*args, **kwargs
):
"""Read a file using Pandas read_excel and return a great_expectations dataset.
Args:
filename (string): path to file to read
dat... | python | def read_excel(
filename,
dataset_class=dataset.pandas_dataset.PandasDataset,
expectations_config=None,
autoinspect_func=None,
*args, **kwargs
):
"""Read a file using Pandas read_excel and return a great_expectations dataset.
Args:
filename (string): path to file to read
dat... | [
"def",
"read_excel",
"(",
"filename",
",",
"dataset_class",
"=",
"dataset",
".",
"pandas_dataset",
".",
"PandasDataset",
",",
"expectations_config",
"=",
"None",
",",
"autoinspect_func",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"df",... | Read a file using Pandas read_excel and return a great_expectations dataset.
Args:
filename (string): path to file to read
dataset_class (Dataset class): class to which to convert resulting Pandas df
expectations_config (string): path to great_expectations config file
Returns:
... | [
"Read",
"a",
"file",
"using",
"Pandas",
"read_excel",
"and",
"return",
"a",
"great_expectations",
"dataset",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/util.py#L60-L86 |
222,038 | great-expectations/great_expectations | great_expectations/util.py | from_pandas | def from_pandas(pandas_df,
dataset_class=dataset.pandas_dataset.PandasDataset,
expectations_config=None,
autoinspect_func=None
):
"""Read a Pandas data frame and return a great_expectations dataset.
Args:
pandas_df (Pandas df): Pandas data frame
... | python | def from_pandas(pandas_df,
dataset_class=dataset.pandas_dataset.PandasDataset,
expectations_config=None,
autoinspect_func=None
):
"""Read a Pandas data frame and return a great_expectations dataset.
Args:
pandas_df (Pandas df): Pandas data frame
... | [
"def",
"from_pandas",
"(",
"pandas_df",
",",
"dataset_class",
"=",
"dataset",
".",
"pandas_dataset",
".",
"PandasDataset",
",",
"expectations_config",
"=",
"None",
",",
"autoinspect_func",
"=",
"None",
")",
":",
"return",
"_convert_to_dataset_class",
"(",
"pandas_df... | Read a Pandas data frame and return a great_expectations dataset.
Args:
pandas_df (Pandas df): Pandas data frame
dataset_class (Dataset class) = dataset.pandas_dataset.PandasDataset:
class to which to convert resulting Pandas df
expectations_config (string) = None: path to great... | [
"Read",
"a",
"Pandas",
"data",
"frame",
"and",
"return",
"a",
"great_expectations",
"dataset",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/util.py#L135-L158 |
222,039 | great-expectations/great_expectations | great_expectations/data_asset/file_data_asset.py | MetaFileDataAsset.file_lines_map_expectation | def file_lines_map_expectation(cls, func):
"""Constructs an expectation using file lines map semantics.
The file_lines_map_expectations decorator handles boilerplate issues
surrounding the common pattern of evaluating truthiness of some
condition on an line by line basis in a file.
... | python | def file_lines_map_expectation(cls, func):
"""Constructs an expectation using file lines map semantics.
The file_lines_map_expectations decorator handles boilerplate issues
surrounding the common pattern of evaluating truthiness of some
condition on an line by line basis in a file.
... | [
"def",
"file_lines_map_expectation",
"(",
"cls",
",",
"func",
")",
":",
"if",
"PY3",
":",
"argspec",
"=",
"inspect",
".",
"getfullargspec",
"(",
"func",
")",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"else",
":",
"argspec",
"=",
"inspect",
".",
"getargspec",
... | Constructs an expectation using file lines map semantics.
The file_lines_map_expectations decorator handles boilerplate issues
surrounding the common pattern of evaluating truthiness of some
condition on an line by line basis in a file.
Args:
func (function): \
... | [
"Constructs",
"an",
"expectation",
"using",
"file",
"lines",
"map",
"semantics",
".",
"The",
"file_lines_map_expectations",
"decorator",
"handles",
"boilerplate",
"issues",
"surrounding",
"the",
"common",
"pattern",
"of",
"evaluating",
"truthiness",
"of",
"some",
"con... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/file_data_asset.py#L28-L132 |
222,040 | great-expectations/great_expectations | great_expectations/data_asset/file_data_asset.py | FileDataAsset.expect_file_hash_to_equal | def expect_file_hash_to_equal(self, value, hash_alg='md5', result_format=None,
include_config=False, catch_exceptions=None,
meta=None):
"""
Expect computed file hash to equal some given value.
Args:
value: A string... | python | def expect_file_hash_to_equal(self, value, hash_alg='md5', result_format=None,
include_config=False, catch_exceptions=None,
meta=None):
"""
Expect computed file hash to equal some given value.
Args:
value: A string... | [
"def",
"expect_file_hash_to_equal",
"(",
"self",
",",
"value",
",",
"hash_alg",
"=",
"'md5'",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":",
"success",
"=",
... | Expect computed file hash to equal some given value.
Args:
value: A string to compare with the computed hash value
Keyword Args:
hash_alg (string): Indicates the hash algorithm to use
result_format (str or None): \
Which output mode to use: `BOOLEA... | [
"Expect",
"computed",
"file",
"hash",
"to",
"equal",
"some",
"given",
"value",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/file_data_asset.py#L336-L387 |
222,041 | great-expectations/great_expectations | great_expectations/data_asset/file_data_asset.py | FileDataAsset.expect_file_size_to_be_between | def expect_file_size_to_be_between(self, minsize=0, maxsize=None, result_format=None,
include_config=False, catch_exceptions=None,
meta=None):
"""
Expect file size to be between a user specified maxsize and minsize.
... | python | def expect_file_size_to_be_between(self, minsize=0, maxsize=None, result_format=None,
include_config=False, catch_exceptions=None,
meta=None):
"""
Expect file size to be between a user specified maxsize and minsize.
... | [
"def",
"expect_file_size_to_be_between",
"(",
"self",
",",
"minsize",
"=",
"0",
",",
"maxsize",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":",
"... | Expect file size to be between a user specified maxsize and minsize.
Args:
minsize(integer): minimum expected file size
maxsize(integer): maximum expected file size
Keyword Args:
result_format (str or None): \
Which output mode to use: `BOOLEAN_ONLY... | [
"Expect",
"file",
"size",
"to",
"be",
"between",
"a",
"user",
"specified",
"maxsize",
"and",
"minsize",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/file_data_asset.py#L390-L464 |
222,042 | great-expectations/great_expectations | great_expectations/data_asset/file_data_asset.py | FileDataAsset.expect_file_to_exist | def expect_file_to_exist(self, filepath=None, result_format=None, include_config=False,
catch_exceptions=None, meta=None):
"""
Checks to see if a file specified by the user actually exists
Args:
filepath (str or None): \
The filepath to ... | python | def expect_file_to_exist(self, filepath=None, result_format=None, include_config=False,
catch_exceptions=None, meta=None):
"""
Checks to see if a file specified by the user actually exists
Args:
filepath (str or None): \
The filepath to ... | [
"def",
"expect_file_to_exist",
"(",
"self",
",",
"filepath",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":",
"if",
"filepath",
"is",
"not",
"None... | Checks to see if a file specified by the user actually exists
Args:
filepath (str or None): \
The filepath to evalutate. If none, will check the currently-configured path object
of this FileDataAsset.
Keyword Args:
result_format (str or None): \... | [
"Checks",
"to",
"see",
"if",
"a",
"file",
"specified",
"by",
"the",
"user",
"actually",
"exists"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/file_data_asset.py#L467-L511 |
222,043 | great-expectations/great_expectations | great_expectations/data_asset/file_data_asset.py | FileDataAsset.expect_file_to_have_valid_table_header | def expect_file_to_have_valid_table_header(self, regex, skip=None,
result_format=None,
include_config=False,
catch_exceptions=None, meta=None):
"""
Checks to see i... | python | def expect_file_to_have_valid_table_header(self, regex, skip=None,
result_format=None,
include_config=False,
catch_exceptions=None, meta=None):
"""
Checks to see i... | [
"def",
"expect_file_to_have_valid_table_header",
"(",
"self",
",",
"regex",
",",
"skip",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":",
"try",
":"... | Checks to see if a file has a line with unique delimited values,
such a line may be used as a table header.
Keyword Args:
skip (nonnegative integer): \
Integer specifying the first lines in the file the method
should skip before assessing expectations
... | [
"Checks",
"to",
"see",
"if",
"a",
"file",
"has",
"a",
"line",
"with",
"unique",
"delimited",
"values",
"such",
"a",
"line",
"may",
"be",
"used",
"as",
"a",
"table",
"header",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_asset/file_data_asset.py#L514-L584 |
222,044 | great-expectations/great_expectations | great_expectations/data_context/__init__.py | get_data_context | def get_data_context(context_type, options, *args, **kwargs):
"""Return a data_context object which exposes options to list datasets and get a dataset from
that context. This is a new API in Great Expectations 0.4, and is subject to rapid change.
:param context_type: (string) one of "SqlAlchemy" or "Pandas... | python | def get_data_context(context_type, options, *args, **kwargs):
"""Return a data_context object which exposes options to list datasets and get a dataset from
that context. This is a new API in Great Expectations 0.4, and is subject to rapid change.
:param context_type: (string) one of "SqlAlchemy" or "Pandas... | [
"def",
"get_data_context",
"(",
"context_type",
",",
"options",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"context_type",
"==",
"\"SqlAlchemy\"",
":",
"return",
"SqlAlchemyDataContext",
"(",
"options",
",",
"*",
"args",
",",
"*",
"*",
"kwa... | Return a data_context object which exposes options to list datasets and get a dataset from
that context. This is a new API in Great Expectations 0.4, and is subject to rapid change.
:param context_type: (string) one of "SqlAlchemy" or "PandasCSV"
:param options: options to be passed to the data context's c... | [
"Return",
"a",
"data_context",
"object",
"which",
"exposes",
"options",
"to",
"list",
"datasets",
"and",
"get",
"a",
"dataset",
"from",
"that",
"context",
".",
"This",
"is",
"a",
"new",
"API",
"in",
"Great",
"Expectations",
"0",
".",
"4",
"and",
"is",
"s... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/data_context/__init__.py#L5-L18 |
222,045 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset._initialize_expectations | def _initialize_expectations(self, config=None, data_asset_name=None):
"""Override data_asset_type with "Dataset"
"""
super(Dataset, self)._initialize_expectations(config=config, data_asset_name=data_asset_name)
self._expectations_config["data_asset_type"] = "Dataset" | python | def _initialize_expectations(self, config=None, data_asset_name=None):
"""Override data_asset_type with "Dataset"
"""
super(Dataset, self)._initialize_expectations(config=config, data_asset_name=data_asset_name)
self._expectations_config["data_asset_type"] = "Dataset" | [
"def",
"_initialize_expectations",
"(",
"self",
",",
"config",
"=",
"None",
",",
"data_asset_name",
"=",
"None",
")",
":",
"super",
"(",
"Dataset",
",",
"self",
")",
".",
"_initialize_expectations",
"(",
"config",
"=",
"config",
",",
"data_asset_name",
"=",
... | Override data_asset_type with "Dataset" | [
"Override",
"data_asset_type",
"with",
"Dataset"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L9-L13 |
222,046 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_to_exist | def expect_column_to_exist(
self, column, column_index=None, result_format=None, include_config=False,
catch_exceptions=None, meta=None
):
"""Expect the specified column to exist.
expect_column_to_exist is a :func:`expectation <great_expectations.data_asset.dataset.Dataset.expectati... | python | def expect_column_to_exist(
self, column, column_index=None, result_format=None, include_config=False,
catch_exceptions=None, meta=None
):
"""Expect the specified column to exist.
expect_column_to_exist is a :func:`expectation <great_expectations.data_asset.dataset.Dataset.expectati... | [
"def",
"expect_column_to_exist",
"(",
"self",
",",
"column",
",",
"column_index",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":",
"raise",
"NotImpl... | Expect the specified column to exist.
expect_column_to_exist is a :func:`expectation <great_expectations.data_asset.dataset.Dataset.expectation>`, not a \
`column_map_expectation` or `column_aggregate_expectation`.
Args:
column (str): \
The column name.
Oth... | [
"Expect",
"the",
"specified",
"column",
"to",
"exist",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L111-L149 |
222,047 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_table_row_count_to_be_between | def expect_table_row_count_to_be_between(self,
min_value=0,
max_value=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
... | python | def expect_table_row_count_to_be_between(self,
min_value=0,
max_value=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
... | [
"def",
"expect_table_row_count_to_be_between",
"(",
"self",
",",
"min_value",
"=",
"0",
",",
"max_value",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
... | Expect the number of rows to be between two values.
expect_table_row_count_to_be_between is a :func:`expectation <great_expectations.data_asset.dataset.Dataset.expectation>`, \
not a `column_map_expectation` or `column_aggregate_expectation`.
Keyword Args:
min_value (int or None): ... | [
"Expect",
"the",
"number",
"of",
"rows",
"to",
"be",
"between",
"two",
"values",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L188-L232 |
222,048 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_be_of_type | def expect_column_values_to_be_of_type(
self,
column,
type_,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
):
"""Expect each column entry to be a specified data type.
expect_column_values_to_be_of_type is a :func:`col... | python | def expect_column_values_to_be_of_type(
self,
column,
type_,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
):
"""Expect each column entry to be a specified data type.
expect_column_values_to_be_of_type is a :func:`col... | [
"def",
"expect_column_values_to_be_of_type",
"(",
"self",
",",
"column",
",",
"type_",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":... | Expect each column entry to be a specified data type.
expect_column_values_to_be_of_type is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`.
Args:
column (str): \
The column name.
type\_ (str): \
... | [
"Expect",
"each",
"column",
"entry",
"to",
"be",
"a",
"specified",
"data",
"type",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L409-L462 |
222,049 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_be_in_type_list | def expect_column_values_to_be_in_type_list(
self,
column,
type_list,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
):
"""Expect each column entry to match a list of specified data types.
expect_column_values_to_be_in... | python | def expect_column_values_to_be_in_type_list(
self,
column,
type_list,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
):
"""Expect each column entry to match a list of specified data types.
expect_column_values_to_be_in... | [
"def",
"expect_column_values_to_be_in_type_list",
"(",
"self",
",",
"column",
",",
"type_list",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
... | Expect each column entry to match a list of specified data types.
expect_column_values_to_be_in_type_list is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`.
Args:
column (str): \
The column name.
type_list... | [
"Expect",
"each",
"column",
"entry",
"to",
"match",
"a",
"list",
"of",
"specified",
"data",
"types",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L464-L517 |
222,050 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_be_in_set | def expect_column_values_to_be_in_set(self,
column,
value_set,
mostly=None,
parse_strings_as_datetimes=None,
r... | python | def expect_column_values_to_be_in_set(self,
column,
value_set,
mostly=None,
parse_strings_as_datetimes=None,
r... | [
"def",
"expect_column_values_to_be_in_set",
"(",
"self",
",",
"column",
",",
"value_set",
",",
"mostly",
"=",
"None",
",",
"parse_strings_as_datetimes",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"... | Expect each column value to be in a given set.
For example:
::
# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_be_in_set(
"my_col",
[2,3]
)
{
"success": false
"result": {
... | [
"Expect",
"each",
"column",
"value",
"to",
"be",
"in",
"a",
"given",
"set",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L521-L589 |
222,051 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_be_decreasing | def expect_column_values_to_be_decreasing(self,
column,
strictly=None,
parse_strings_as_datetimes=None,
mostly=None,
... | python | def expect_column_values_to_be_decreasing(self,
column,
strictly=None,
parse_strings_as_datetimes=None,
mostly=None,
... | [
"def",
"expect_column_values_to_be_decreasing",
"(",
"self",
",",
"column",
",",
"strictly",
"=",
"None",
",",
"parse_strings_as_datetimes",
"=",
"None",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"ca... | Expect column values to be decreasing.
By default, this expectation only works for numeric or datetime data.
When `parse_strings_as_datetimes=True`, it can also parse strings to datetimes.
If `strictly=True`, then this expectation is only satisfied if each consecutive value
is strictly... | [
"Expect",
"column",
"values",
"to",
"be",
"decreasing",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L776-L830 |
222,052 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_match_regex_list | def expect_column_values_to_match_regex_list(self,
column,
regex_list,
match_on="any",
mostly=None,
... | python | def expect_column_values_to_match_regex_list(self,
column,
regex_list,
match_on="any",
mostly=None,
... | [
"def",
"expect_column_values_to_match_regex_list",
"(",
"self",
",",
"column",
",",
"regex_list",
",",
"match_on",
"=",
"\"any\"",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"... | Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions.
Matches can be anywhere in the string.
expect_column_values_to_match_regex_list is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>... | [
"Expect",
"the",
"column",
"entries",
"to",
"be",
"strings",
"that",
"can",
"be",
"matched",
"to",
"either",
"any",
"of",
"or",
"all",
"of",
"a",
"list",
"of",
"regular",
"expressions",
".",
"Matches",
"can",
"be",
"anywhere",
"in",
"the",
"string",
"."
... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1035-L1086 |
222,053 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_not_match_regex_list | def expect_column_values_to_not_match_regex_list(self, column, regex_list,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None):
"""Expect the column entries to be string... | python | def expect_column_values_to_not_match_regex_list(self, column, regex_list,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None):
"""Expect the column entries to be string... | [
"def",
"expect_column_values_to_not_match_regex_list",
"(",
"self",
",",
"column",
",",
"regex_list",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"Non... | Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can \
be anywhere in the string.
expect_column_values_to_not_match_regex_list is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`.
Arg... | [
"Expect",
"the",
"column",
"entries",
"to",
"be",
"strings",
"that",
"do",
"not",
"match",
"any",
"of",
"a",
"list",
"of",
"regular",
"expressions",
".",
"Matches",
"can",
"\\",
"be",
"anywhere",
"in",
"the",
"string",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1088-L1131 |
222,054 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_match_strftime_format | def expect_column_values_to_match_strftime_format(self,
column,
strftime_format,
mostly=None,
result_for... | python | def expect_column_values_to_match_strftime_format(self,
column,
strftime_format,
mostly=None,
result_for... | [
"def",
"expect_column_values_to_match_strftime_format",
"(",
"self",
",",
"column",
",",
"strftime_format",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
... | Expect column entries to be strings representing a date or time with a given format.
expect_column_values_to_match_strftime_format is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`.
Args:
column (str): \
The column na... | [
"Expect",
"column",
"entries",
"to",
"be",
"strings",
"representing",
"a",
"date",
"or",
"time",
"with",
"a",
"given",
"format",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1135-L1177 |
222,055 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_be_dateutil_parseable | def expect_column_values_to_be_dateutil_parseable(self,
column,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
... | python | def expect_column_values_to_be_dateutil_parseable(self,
column,
mostly=None,
result_format=None, include_config=False, catch_exceptions=None, meta=None
... | [
"def",
"expect_column_values_to_be_dateutil_parseable",
"(",
"self",
",",
"column",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None",
")",
":",
"r... | Expect column entries to be parseable using dateutil.
expect_column_values_to_be_dateutil_parseable is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`.
Args:
column (str): \
The column name.
Keyword Args:
... | [
"Expect",
"column",
"entries",
"to",
"be",
"parseable",
"using",
"dateutil",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1179-L1217 |
222,056 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_values_to_match_json_schema | def expect_column_values_to_match_json_schema(self,
column,
json_schema,
mostly=None,
result_format=None, include_config... | python | def expect_column_values_to_match_json_schema(self,
column,
json_schema,
mostly=None,
result_format=None, include_config... | [
"def",
"expect_column_values_to_match_json_schema",
"(",
"self",
",",
"column",
",",
"json_schema",
",",
"mostly",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"None"... | Expect column entries to be JSON objects matching a given JSON schema.
expect_column_values_to_match_json_schema is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`.
Args:
column (str): \
The column name.
Keywo... | [
"Expect",
"column",
"entries",
"to",
"be",
"JSON",
"objects",
"matching",
"a",
"given",
"JSON",
"schema",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1262-L1306 |
222,057 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_most_common_value_to_be_in_set | def expect_column_most_common_value_to_be_in_set(self,
column,
value_set,
ties_okay=None,
result_format=None... | python | def expect_column_most_common_value_to_be_in_set(self,
column,
value_set,
ties_okay=None,
result_format=None... | [
"def",
"expect_column_most_common_value_to_be_in_set",
"(",
"self",
",",
"column",
",",
"value_set",
",",
"ties_okay",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
"N... | Expect the most common value to be within the designated value set
expect_column_most_common_value_to_be_in_set is a :func:`column_aggregate_expectation <great_expectations.data_asset.dataset.Dataset.column_aggregate_expectation>`.
Args:
column (str): \
The column name
... | [
"Expect",
"the",
"most",
"common",
"value",
"to",
"be",
"within",
"the",
"designated",
"value",
"set"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1666-L1719 |
222,058 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_min_to_be_between | def expect_column_min_to_be_between(self,
column,
min_value=None,
max_value=None,
parse_strings_as_datetimes=None,
outpu... | python | def expect_column_min_to_be_between(self,
column,
min_value=None,
max_value=None,
parse_strings_as_datetimes=None,
outpu... | [
"def",
"expect_column_min_to_be_between",
"(",
"self",
",",
"column",
",",
"min_value",
"=",
"None",
",",
"max_value",
"=",
"None",
",",
"parse_strings_as_datetimes",
"=",
"None",
",",
"output_strftime_format",
"=",
"None",
",",
"result_format",
"=",
"None",
",",
... | Expect the column to sum to be between an min and max value
expect_column_min_to_be_between is a :func:`column_aggregate_expectation <great_expectations.data_asset.dataset.Dataset.column_aggregate_expectation>`.
Args:
column (str): \
The column name
min_value (c... | [
"Expect",
"the",
"column",
"to",
"sum",
"to",
"be",
"between",
"an",
"min",
"and",
"max",
"value"
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1775-L1835 |
222,059 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_pair_values_to_be_equal | def expect_column_pair_values_to_be_equal(self,
column_A,
column_B,
ignore_row_if="both_values_are_missing",
result_format=None, include... | python | def expect_column_pair_values_to_be_equal(self,
column_A,
column_B,
ignore_row_if="both_values_are_missing",
result_format=None, include... | [
"def",
"expect_column_pair_values_to_be_equal",
"(",
"self",
",",
"column_A",
",",
"column_B",
",",
"ignore_row_if",
"=",
"\"both_values_are_missing\"",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
... | Expect the values in column A to be the same as column B.
Args:
column_A (str): The first column name
column_B (str): The second column name
Keyword Args:
ignore_row_if (str): "both_values_are_missing", "either_value_is_missing", "neither"
Other Parameters:... | [
"Expect",
"the",
"values",
"in",
"column",
"A",
"to",
"be",
"the",
"same",
"as",
"column",
"B",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L2165-L2202 |
222,060 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_pair_values_A_to_be_greater_than_B | def expect_column_pair_values_A_to_be_greater_than_B(self,
column_A,
column_B,
or_equal=None,
... | python | def expect_column_pair_values_A_to_be_greater_than_B(self,
column_A,
column_B,
or_equal=None,
... | [
"def",
"expect_column_pair_values_A_to_be_greater_than_B",
"(",
"self",
",",
"column_A",
",",
"column_B",
",",
"or_equal",
"=",
"None",
",",
"parse_strings_as_datetimes",
"=",
"None",
",",
"allow_cross_type_comparisons",
"=",
"None",
",",
"ignore_row_if",
"=",
"\"both_v... | Expect values in column A to be greater than column B.
Args:
column_A (str): The first column name
column_B (str): The second column name
or_equal (boolean or None): If True, then values can be equal, not strictly greater
Keyword Args:
allow_cross_type_c... | [
"Expect",
"values",
"in",
"column",
"A",
"to",
"be",
"greater",
"than",
"column",
"B",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L2204-L2249 |
222,061 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_column_pair_values_to_be_in_set | def expect_column_pair_values_to_be_in_set(self,
column_A,
column_B,
value_pairs_set,
ignore_row_if="both_values_are_missing",
... | python | def expect_column_pair_values_to_be_in_set(self,
column_A,
column_B,
value_pairs_set,
ignore_row_if="both_values_are_missing",
... | [
"def",
"expect_column_pair_values_to_be_in_set",
"(",
"self",
",",
"column_A",
",",
"column_B",
",",
"value_pairs_set",
",",
"ignore_row_if",
"=",
"\"both_values_are_missing\"",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptio... | Expect paired values from columns A and B to belong to a set of valid pairs.
Args:
column_A (str): The first column name
column_B (str): The second column name
value_pairs_set (list of tuples): All the valid pairs to be matched
Keyword Args:
ignore_row_i... | [
"Expect",
"paired",
"values",
"from",
"columns",
"A",
"and",
"B",
"to",
"belong",
"to",
"a",
"set",
"of",
"valid",
"pairs",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L2251-L2290 |
222,062 | great-expectations/great_expectations | great_expectations/dataset/dataset.py | Dataset.expect_multicolumn_values_to_be_unique | def expect_multicolumn_values_to_be_unique(self,
column_list,
ignore_row_if="all_values_are_missing",
result_format=None, include_config=False, catch_exceptions=None, meta=None
... | python | def expect_multicolumn_values_to_be_unique(self,
column_list,
ignore_row_if="all_values_are_missing",
result_format=None, include_config=False, catch_exceptions=None, meta=None
... | [
"def",
"expect_multicolumn_values_to_be_unique",
"(",
"self",
",",
"column_list",
",",
"ignore_row_if",
"=",
"\"all_values_are_missing\"",
",",
"result_format",
"=",
"None",
",",
"include_config",
"=",
"False",
",",
"catch_exceptions",
"=",
"None",
",",
"meta",
"=",
... | Expect the values for each row to be unique across the columns listed.
Args:
column_list (tuple or list): The first column name
Keyword Args:
ignore_row_if (str): "all_values_are_missing", "any_value_is_missing", "never"
Other Parameters:
result_format (str... | [
"Expect",
"the",
"values",
"for",
"each",
"row",
"to",
"be",
"unique",
"across",
"the",
"columns",
"listed",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L2294-L2329 |
222,063 | great-expectations/great_expectations | great_expectations/dataset/pandas_dataset.py | MetaPandasDataset.column_map_expectation | def column_map_expectation(cls, func):
"""Constructs an expectation using column-map semantics.
The MetaPandasDataset implementation replaces the "column" parameter supplied by the user with a pandas Series
object containing the actual column from the relevant pandas dataframe. This simplifies... | python | def column_map_expectation(cls, func):
"""Constructs an expectation using column-map semantics.
The MetaPandasDataset implementation replaces the "column" parameter supplied by the user with a pandas Series
object containing the actual column from the relevant pandas dataframe. This simplifies... | [
"def",
"column_map_expectation",
"(",
"cls",
",",
"func",
")",
":",
"if",
"PY3",
":",
"argspec",
"=",
"inspect",
".",
"getfullargspec",
"(",
"func",
")",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"else",
":",
"argspec",
"=",
"inspect",
".",
"getargspec",
"(... | Constructs an expectation using column-map semantics.
The MetaPandasDataset implementation replaces the "column" parameter supplied by the user with a pandas Series
object containing the actual column from the relevant pandas dataframe. This simplifies the implementing expectation
logic while ... | [
"Constructs",
"an",
"expectation",
"using",
"column",
"-",
"map",
"semantics",
"."
] | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/pandas_dataset.py#L43-L122 |
222,064 | great-expectations/great_expectations | great_expectations/dataset/pandas_dataset.py | MetaPandasDataset.column_pair_map_expectation | def column_pair_map_expectation(cls, func):
"""
The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating
truthiness of some condition on a per row basis across a pair of columns.
"""
if PY3:
argspec = inspect.ge... | python | def column_pair_map_expectation(cls, func):
"""
The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating
truthiness of some condition on a per row basis across a pair of columns.
"""
if PY3:
argspec = inspect.ge... | [
"def",
"column_pair_map_expectation",
"(",
"cls",
",",
"func",
")",
":",
"if",
"PY3",
":",
"argspec",
"=",
"inspect",
".",
"getfullargspec",
"(",
"func",
")",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"else",
":",
"argspec",
"=",
"inspect",
".",
"getargspec",... | The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating
truthiness of some condition on a per row basis across a pair of columns. | [
"The",
"column_pair_map_expectation",
"decorator",
"handles",
"boilerplate",
"issues",
"surrounding",
"the",
"common",
"pattern",
"of",
"evaluating",
"truthiness",
"of",
"some",
"condition",
"on",
"a",
"per",
"row",
"basis",
"across",
"a",
"pair",
"of",
"columns",
... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/pandas_dataset.py#L125-L196 |
222,065 | great-expectations/great_expectations | great_expectations/dataset/pandas_dataset.py | MetaPandasDataset.multicolumn_map_expectation | def multicolumn_map_expectation(cls, func):
"""
The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of
evaluating truthiness of some condition on a per row basis across a set of columns.
"""
if PY3:
argspec = inspect.get... | python | def multicolumn_map_expectation(cls, func):
"""
The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of
evaluating truthiness of some condition on a per row basis across a set of columns.
"""
if PY3:
argspec = inspect.get... | [
"def",
"multicolumn_map_expectation",
"(",
"cls",
",",
"func",
")",
":",
"if",
"PY3",
":",
"argspec",
"=",
"inspect",
".",
"getfullargspec",
"(",
"func",
")",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"else",
":",
"argspec",
"=",
"inspect",
".",
"getargspec",... | The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of
evaluating truthiness of some condition on a per row basis across a set of columns. | [
"The",
"multicolumn_map_expectation",
"decorator",
"handles",
"boilerplate",
"issues",
"surrounding",
"the",
"common",
"pattern",
"of",
"evaluating",
"truthiness",
"of",
"some",
"condition",
"on",
"a",
"per",
"row",
"basis",
"across",
"a",
"set",
"of",
"columns",
... | 08385c40529d4f14a1c46916788aecc47f33ee9d | https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/pandas_dataset.py#L199-L252 |
222,066 | splunk/splunk-sdk-python | splunklib/searchcommands/search_command.py | dispatch | def dispatch(command_class, argv=sys.argv, input_file=sys.stdin, output_file=sys.stdout, module_name=None):
""" Instantiates and executes a search command class
This function implements a `conditional script stanza <https://docs.python.org/2/library/__main__.html>`_ based on the value of
:code:`module_name... | python | def dispatch(command_class, argv=sys.argv, input_file=sys.stdin, output_file=sys.stdout, module_name=None):
""" Instantiates and executes a search command class
This function implements a `conditional script stanza <https://docs.python.org/2/library/__main__.html>`_ based on the value of
:code:`module_name... | [
"def",
"dispatch",
"(",
"command_class",
",",
"argv",
"=",
"sys",
".",
"argv",
",",
"input_file",
"=",
"sys",
".",
"stdin",
",",
"output_file",
"=",
"sys",
".",
"stdout",
",",
"module_name",
"=",
"None",
")",
":",
"assert",
"issubclass",
"(",
"command_cl... | Instantiates and executes a search command class
This function implements a `conditional script stanza <https://docs.python.org/2/library/__main__.html>`_ based on the value of
:code:`module_name`::
if module_name is None or module_name == '__main__':
# execute command
Call this funct... | [
"Instantiates",
"and",
"executes",
"a",
"search",
"command",
"class"
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/searchcommands/search_command.py#L1056-L1116 |
222,067 | splunk/splunk-sdk-python | splunklib/searchcommands/search_command.py | SearchCommand.search_results_info | def search_results_info(self):
""" Returns the search results info for this command invocation.
The search results info object is created from the search results info file associated with the command
invocation.
:return: Search results info:const:`None`, if the search results info file... | python | def search_results_info(self):
""" Returns the search results info for this command invocation.
The search results info object is created from the search results info file associated with the command
invocation.
:return: Search results info:const:`None`, if the search results info file... | [
"def",
"search_results_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"_search_results_info",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_search_results_info",
"if",
"self",
".",
"_protocol_version",
"==",
"1",
":",
"try",
":",
"path",
"=",
"self",
... | Returns the search results info for this command invocation.
The search results info object is created from the search results info file associated with the command
invocation.
:return: Search results info:const:`None`, if the search results info file associated with the command
invoca... | [
"Returns",
"the",
"search",
"results",
"info",
"for",
"this",
"command",
"invocation",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/searchcommands/search_command.py#L252-L330 |
222,068 | splunk/splunk-sdk-python | splunklib/searchcommands/search_command.py | SearchCommand.process | def process(self, argv=sys.argv, ifile=sys.stdin, ofile=sys.stdout):
""" Process data.
:param argv: Command line arguments.
:type argv: list or tuple
:param ifile: Input data file.
:type ifile: file
:param ofile: Output data file.
:type ofile: file
:re... | python | def process(self, argv=sys.argv, ifile=sys.stdin, ofile=sys.stdout):
""" Process data.
:param argv: Command line arguments.
:type argv: list or tuple
:param ifile: Input data file.
:type ifile: file
:param ofile: Output data file.
:type ofile: file
:re... | [
"def",
"process",
"(",
"self",
",",
"argv",
"=",
"sys",
".",
"argv",
",",
"ifile",
"=",
"sys",
".",
"stdin",
",",
"ofile",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"len",
"(",
"argv",
")",
">",
"1",
":",
"self",
".",
"_process_protocol_v1",
"("... | Process data.
:param argv: Command line arguments.
:type argv: list or tuple
:param ifile: Input data file.
:type ifile: file
:param ofile: Output data file.
:type ofile: file
:return: :const:`None`
:rtype: NoneType | [
"Process",
"data",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/searchcommands/search_command.py#L415-L434 |
222,069 | splunk/splunk-sdk-python | splunklib/searchcommands/search_command.py | SearchCommand._execute | def _execute(self, ifile, process):
""" Default processing loop
:param ifile: Input file object.
:type ifile: file
:param process: Bound method to call in processing loop.
:type process: instancemethod
:return: :const:`None`.
:rtype: NoneType
"""
... | python | def _execute(self, ifile, process):
""" Default processing loop
:param ifile: Input file object.
:type ifile: file
:param process: Bound method to call in processing loop.
:type process: instancemethod
:return: :const:`None`.
:rtype: NoneType
"""
... | [
"def",
"_execute",
"(",
"self",
",",
"ifile",
",",
"process",
")",
":",
"self",
".",
"_record_writer",
".",
"write_records",
"(",
"process",
"(",
"self",
".",
"_records",
"(",
"ifile",
")",
")",
")",
"self",
".",
"finish",
"(",
")"
] | Default processing loop
:param ifile: Input file object.
:type ifile: file
:param process: Bound method to call in processing loop.
:type process: instancemethod
:return: :const:`None`.
:rtype: NoneType | [
"Default",
"processing",
"loop"
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/searchcommands/search_command.py#L835-L849 |
222,070 | splunk/splunk-sdk-python | utils/__init__.py | parse | def parse(argv, rules=None, config=None, **kwargs):
"""Parse the given arg vector with the default Splunk command rules."""
parser_ = parser(rules, **kwargs)
if config is not None: parser_.loadrc(config)
return parser_.parse(argv).result | python | def parse(argv, rules=None, config=None, **kwargs):
"""Parse the given arg vector with the default Splunk command rules."""
parser_ = parser(rules, **kwargs)
if config is not None: parser_.loadrc(config)
return parser_.parse(argv).result | [
"def",
"parse",
"(",
"argv",
",",
"rules",
"=",
"None",
",",
"config",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"parser_",
"=",
"parser",
"(",
"rules",
",",
"*",
"*",
"kwargs",
")",
"if",
"config",
"is",
"not",
"None",
":",
"parser_",
".",... | Parse the given arg vector with the default Splunk command rules. | [
"Parse",
"the",
"given",
"arg",
"vector",
"with",
"the",
"default",
"Splunk",
"command",
"rules",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/utils/__init__.py#L99-L103 |
222,071 | splunk/splunk-sdk-python | utils/__init__.py | parser | def parser(rules=None, **kwargs):
"""Instantiate a parser with the default Splunk command rules."""
rules = RULES_SPLUNK if rules is None else dict(RULES_SPLUNK, **rules)
return Parser(rules, **kwargs) | python | def parser(rules=None, **kwargs):
"""Instantiate a parser with the default Splunk command rules."""
rules = RULES_SPLUNK if rules is None else dict(RULES_SPLUNK, **rules)
return Parser(rules, **kwargs) | [
"def",
"parser",
"(",
"rules",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"rules",
"=",
"RULES_SPLUNK",
"if",
"rules",
"is",
"None",
"else",
"dict",
"(",
"RULES_SPLUNK",
",",
"*",
"*",
"rules",
")",
"return",
"Parser",
"(",
"rules",
",",
"*",
... | Instantiate a parser with the default Splunk command rules. | [
"Instantiate",
"a",
"parser",
"with",
"the",
"default",
"Splunk",
"command",
"rules",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/utils/__init__.py#L105-L108 |
222,072 | splunk/splunk-sdk-python | utils/cmdopts.py | cmdline | def cmdline(argv, rules=None, config=None, **kwargs):
"""Simplified cmdopts interface that does not default any parsing rules
and that does not allow compounding calls to the parser."""
parser = Parser(rules, **kwargs)
if config is not None: parser.loadrc(config)
return parser.parse(argv).result | python | def cmdline(argv, rules=None, config=None, **kwargs):
"""Simplified cmdopts interface that does not default any parsing rules
and that does not allow compounding calls to the parser."""
parser = Parser(rules, **kwargs)
if config is not None: parser.loadrc(config)
return parser.parse(argv).result | [
"def",
"cmdline",
"(",
"argv",
",",
"rules",
"=",
"None",
",",
"config",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"parser",
"=",
"Parser",
"(",
"rules",
",",
"*",
"*",
"kwargs",
")",
"if",
"config",
"is",
"not",
"None",
":",
"parser",
".",... | Simplified cmdopts interface that does not default any parsing rules
and that does not allow compounding calls to the parser. | [
"Simplified",
"cmdopts",
"interface",
"that",
"does",
"not",
"default",
"any",
"parsing",
"rules",
"and",
"that",
"does",
"not",
"allow",
"compounding",
"calls",
"to",
"the",
"parser",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/utils/cmdopts.py#L113-L118 |
222,073 | splunk/splunk-sdk-python | utils/cmdopts.py | Parser.init | def init(self, rules):
"""Initialize the parser with the given command rules."""
# Initialize the option parser
for dest in rules.keys():
rule = rules[dest]
# Assign defaults ourselves here, instead of in the option parser
# itself in order to allow for multi... | python | def init(self, rules):
"""Initialize the parser with the given command rules."""
# Initialize the option parser
for dest in rules.keys():
rule = rules[dest]
# Assign defaults ourselves here, instead of in the option parser
# itself in order to allow for multi... | [
"def",
"init",
"(",
"self",
",",
"rules",
")",
":",
"# Initialize the option parser",
"for",
"dest",
"in",
"rules",
".",
"keys",
"(",
")",
":",
"rule",
"=",
"rules",
"[",
"dest",
"]",
"# Assign defaults ourselves here, instead of in the option parser",
"# itself in ... | Initialize the parser with the given command rules. | [
"Initialize",
"the",
"parser",
"with",
"the",
"given",
"command",
"rules",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/utils/cmdopts.py#L49-L69 |
222,074 | splunk/splunk-sdk-python | utils/cmdopts.py | Parser.loadif | def loadif(self, filepath):
"""Load the given filepath if it exists, otherwise ignore."""
if path.isfile(filepath): self.load(filepath)
return self | python | def loadif(self, filepath):
"""Load the given filepath if it exists, otherwise ignore."""
if path.isfile(filepath): self.load(filepath)
return self | [
"def",
"loadif",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"path",
".",
"isfile",
"(",
"filepath",
")",
":",
"self",
".",
"load",
"(",
"filepath",
")",
"return",
"self"
] | Load the given filepath if it exists, otherwise ignore. | [
"Load",
"the",
"given",
"filepath",
"if",
"it",
"exists",
"otherwise",
"ignore",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/utils/cmdopts.py#L88-L91 |
222,075 | splunk/splunk-sdk-python | utils/cmdopts.py | Parser.parse | def parse(self, argv):
"""Parse the given argument vector."""
kwargs, args = self.parse_args(argv)
self.result['args'] += args
# Annoying that parse_args doesn't just return a dict
for dest in self.dests:
value = getattr(kwargs, dest)
if value is not None:... | python | def parse(self, argv):
"""Parse the given argument vector."""
kwargs, args = self.parse_args(argv)
self.result['args'] += args
# Annoying that parse_args doesn't just return a dict
for dest in self.dests:
value = getattr(kwargs, dest)
if value is not None:... | [
"def",
"parse",
"(",
"self",
",",
"argv",
")",
":",
"kwargs",
",",
"args",
"=",
"self",
".",
"parse_args",
"(",
"argv",
")",
"self",
".",
"result",
"[",
"'args'",
"]",
"+=",
"args",
"# Annoying that parse_args doesn't just return a dict",
"for",
"dest",
"in"... | Parse the given argument vector. | [
"Parse",
"the",
"given",
"argument",
"vector",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/utils/cmdopts.py#L98-L107 |
222,076 | splunk/splunk-sdk-python | examples/genevents.py | feed_index | def feed_index(service, opts):
"""Feed the named index in a specific manner."""
indexname = opts.args[0]
itype = opts.kwargs['ingest']
# get index handle
try:
index = service.indexes[indexname]
except KeyError:
print("Index %s not found" % indexname)
return
if ity... | python | def feed_index(service, opts):
"""Feed the named index in a specific manner."""
indexname = opts.args[0]
itype = opts.kwargs['ingest']
# get index handle
try:
index = service.indexes[indexname]
except KeyError:
print("Index %s not found" % indexname)
return
if ity... | [
"def",
"feed_index",
"(",
"service",
",",
"opts",
")",
":",
"indexname",
"=",
"opts",
".",
"args",
"[",
"0",
"]",
"itype",
"=",
"opts",
".",
"kwargs",
"[",
"'ingest'",
"]",
"# get index handle",
"try",
":",
"index",
"=",
"service",
".",
"indexes",
"[",... | Feed the named index in a specific manner. | [
"Feed",
"the",
"named",
"index",
"in",
"a",
"specific",
"manner",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/genevents.py#L58-L106 |
222,077 | splunk/splunk-sdk-python | splunklib/modularinput/utils.py | xml_compare | def xml_compare(expected, found):
"""Checks equality of two ``ElementTree`` objects.
:param expected: An ``ElementTree`` object.
:param found: An ``ElementTree`` object.
:return: ``Boolean``, whether the two objects are equal.
"""
# if comparing the same ET object
if expected == found:
... | python | def xml_compare(expected, found):
"""Checks equality of two ``ElementTree`` objects.
:param expected: An ``ElementTree`` object.
:param found: An ``ElementTree`` object.
:return: ``Boolean``, whether the two objects are equal.
"""
# if comparing the same ET object
if expected == found:
... | [
"def",
"xml_compare",
"(",
"expected",
",",
"found",
")",
":",
"# if comparing the same ET object",
"if",
"expected",
"==",
"found",
":",
"return",
"True",
"# compare element attributes, ignoring order",
"if",
"set",
"(",
"expected",
".",
"items",
"(",
")",
")",
"... | Checks equality of two ``ElementTree`` objects.
:param expected: An ``ElementTree`` object.
:param found: An ``ElementTree`` object.
:return: ``Boolean``, whether the two objects are equal. | [
"Checks",
"equality",
"of",
"two",
"ElementTree",
"objects",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/utils.py#L19-L51 |
222,078 | splunk/splunk-sdk-python | examples/job.py | cmdline | def cmdline(argv, flags):
"""A cmdopts wrapper that takes a list of flags and builds the
corresponding cmdopts rules to match those flags."""
rules = dict([(flag, {'flags': ["--%s" % flag]}) for flag in flags])
return parse(argv, rules) | python | def cmdline(argv, flags):
"""A cmdopts wrapper that takes a list of flags and builds the
corresponding cmdopts rules to match those flags."""
rules = dict([(flag, {'flags': ["--%s" % flag]}) for flag in flags])
return parse(argv, rules) | [
"def",
"cmdline",
"(",
"argv",
",",
"flags",
")",
":",
"rules",
"=",
"dict",
"(",
"[",
"(",
"flag",
",",
"{",
"'flags'",
":",
"[",
"\"--%s\"",
"%",
"flag",
"]",
"}",
")",
"for",
"flag",
"in",
"flags",
"]",
")",
"return",
"parse",
"(",
"argv",
"... | A cmdopts wrapper that takes a list of flags and builds the
corresponding cmdopts rules to match those flags. | [
"A",
"cmdopts",
"wrapper",
"that",
"takes",
"a",
"list",
"of",
"flags",
"and",
"builds",
"the",
"corresponding",
"cmdopts",
"rules",
"to",
"match",
"those",
"flags",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L107-L111 |
222,079 | splunk/splunk-sdk-python | examples/job.py | output | def output(stream):
"""Write the contents of the given stream to stdout."""
while True:
content = stream.read(1024)
if len(content) == 0: break
sys.stdout.write(content) | python | def output(stream):
"""Write the contents of the given stream to stdout."""
while True:
content = stream.read(1024)
if len(content) == 0: break
sys.stdout.write(content) | [
"def",
"output",
"(",
"stream",
")",
":",
"while",
"True",
":",
"content",
"=",
"stream",
".",
"read",
"(",
"1024",
")",
"if",
"len",
"(",
"content",
")",
"==",
"0",
":",
"break",
"sys",
".",
"stdout",
".",
"write",
"(",
"content",
")"
] | Write the contents of the given stream to stdout. | [
"Write",
"the",
"contents",
"of",
"the",
"given",
"stream",
"to",
"stdout",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L113-L118 |
222,080 | splunk/splunk-sdk-python | examples/job.py | Program.create | def create(self, argv):
"""Create a search job."""
opts = cmdline(argv, FLAGS_CREATE)
if len(opts.args) != 1:
error("Command requires a search expression", 2)
query = opts.args[0]
job = self.service.jobs.create(opts.args[0], **opts.kwargs)
print(job.sid) | python | def create(self, argv):
"""Create a search job."""
opts = cmdline(argv, FLAGS_CREATE)
if len(opts.args) != 1:
error("Command requires a search expression", 2)
query = opts.args[0]
job = self.service.jobs.create(opts.args[0], **opts.kwargs)
print(job.sid) | [
"def",
"create",
"(",
"self",
",",
"argv",
")",
":",
"opts",
"=",
"cmdline",
"(",
"argv",
",",
"FLAGS_CREATE",
")",
"if",
"len",
"(",
"opts",
".",
"args",
")",
"!=",
"1",
":",
"error",
"(",
"\"Command requires a search expression\"",
",",
"2",
")",
"qu... | Create a search job. | [
"Create",
"a",
"search",
"job",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L127-L134 |
222,081 | splunk/splunk-sdk-python | examples/job.py | Program.events | def events(self, argv):
"""Retrieve events for the specified search jobs."""
opts = cmdline(argv, FLAGS_EVENTS)
self.foreach(opts.args, lambda job:
output(job.events(**opts.kwargs))) | python | def events(self, argv):
"""Retrieve events for the specified search jobs."""
opts = cmdline(argv, FLAGS_EVENTS)
self.foreach(opts.args, lambda job:
output(job.events(**opts.kwargs))) | [
"def",
"events",
"(",
"self",
",",
"argv",
")",
":",
"opts",
"=",
"cmdline",
"(",
"argv",
",",
"FLAGS_EVENTS",
")",
"self",
".",
"foreach",
"(",
"opts",
".",
"args",
",",
"lambda",
"job",
":",
"output",
"(",
"job",
".",
"events",
"(",
"*",
"*",
"... | Retrieve events for the specified search jobs. | [
"Retrieve",
"events",
"for",
"the",
"specified",
"search",
"jobs",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L136-L140 |
222,082 | splunk/splunk-sdk-python | examples/job.py | Program.foreach | def foreach(self, argv, func):
"""Apply the function to each job specified in the argument vector."""
if len(argv) == 0:
error("Command requires a search specifier.", 2)
for item in argv:
job = self.lookup(item)
if job is None:
error("Search jo... | python | def foreach(self, argv, func):
"""Apply the function to each job specified in the argument vector."""
if len(argv) == 0:
error("Command requires a search specifier.", 2)
for item in argv:
job = self.lookup(item)
if job is None:
error("Search jo... | [
"def",
"foreach",
"(",
"self",
",",
"argv",
",",
"func",
")",
":",
"if",
"len",
"(",
"argv",
")",
"==",
"0",
":",
"error",
"(",
"\"Command requires a search specifier.\"",
",",
"2",
")",
"for",
"item",
"in",
"argv",
":",
"job",
"=",
"self",
".",
"loo... | Apply the function to each job specified in the argument vector. | [
"Apply",
"the",
"function",
"to",
"each",
"job",
"specified",
"in",
"the",
"argument",
"vector",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L146-L154 |
222,083 | splunk/splunk-sdk-python | examples/job.py | Program.list | def list(self, argv):
"""List all current search jobs if no jobs specified, otherwise
list the properties of the specified jobs."""
def read(job):
for key in sorted(job.content.keys()):
# Ignore some fields that make the output hard to read and
# t... | python | def list(self, argv):
"""List all current search jobs if no jobs specified, otherwise
list the properties of the specified jobs."""
def read(job):
for key in sorted(job.content.keys()):
# Ignore some fields that make the output hard to read and
# t... | [
"def",
"list",
"(",
"self",
",",
"argv",
")",
":",
"def",
"read",
"(",
"job",
")",
":",
"for",
"key",
"in",
"sorted",
"(",
"job",
".",
"content",
".",
"keys",
"(",
")",
")",
":",
"# Ignore some fields that make the output hard to read and",
"# that are avail... | List all current search jobs if no jobs specified, otherwise
list the properties of the specified jobs. | [
"List",
"all",
"current",
"search",
"jobs",
"if",
"no",
"jobs",
"specified",
"otherwise",
"list",
"the",
"properties",
"of",
"the",
"specified",
"jobs",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L156-L174 |
222,084 | splunk/splunk-sdk-python | examples/job.py | Program.preview | def preview(self, argv):
"""Retrieve the preview for the specified search jobs."""
opts = cmdline(argv, FLAGS_RESULTS)
self.foreach(opts.args, lambda job:
output(job.preview(**opts.kwargs))) | python | def preview(self, argv):
"""Retrieve the preview for the specified search jobs."""
opts = cmdline(argv, FLAGS_RESULTS)
self.foreach(opts.args, lambda job:
output(job.preview(**opts.kwargs))) | [
"def",
"preview",
"(",
"self",
",",
"argv",
")",
":",
"opts",
"=",
"cmdline",
"(",
"argv",
",",
"FLAGS_RESULTS",
")",
"self",
".",
"foreach",
"(",
"opts",
".",
"args",
",",
"lambda",
"job",
":",
"output",
"(",
"job",
".",
"preview",
"(",
"*",
"*",
... | Retrieve the preview for the specified search jobs. | [
"Retrieve",
"the",
"preview",
"for",
"the",
"specified",
"search",
"jobs",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L176-L180 |
222,085 | splunk/splunk-sdk-python | examples/job.py | Program.run | def run(self, argv):
"""Dispatch the given command."""
command = argv[0]
handlers = {
'cancel': self.cancel,
'create': self.create,
'events': self.events,
'finalize': self.finalize,
'list': self.list,
'pause': self.pause,
... | python | def run(self, argv):
"""Dispatch the given command."""
command = argv[0]
handlers = {
'cancel': self.cancel,
'create': self.create,
'events': self.events,
'finalize': self.finalize,
'list': self.list,
'pause': self.pause,
... | [
"def",
"run",
"(",
"self",
",",
"argv",
")",
":",
"command",
"=",
"argv",
"[",
"0",
"]",
"handlers",
"=",
"{",
"'cancel'",
":",
"self",
".",
"cancel",
",",
"'create'",
":",
"self",
".",
"create",
",",
"'events'",
":",
"self",
".",
"events",
",",
... | Dispatch the given command. | [
"Dispatch",
"the",
"given",
"command",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L209-L231 |
222,086 | splunk/splunk-sdk-python | examples/job.py | Program.searchlog | def searchlog(self, argv):
"""Retrieve the searchlog for the specified search jobs."""
opts = cmdline(argv, FLAGS_SEARCHLOG)
self.foreach(opts.args, lambda job:
output(job.searchlog(**opts.kwargs))) | python | def searchlog(self, argv):
"""Retrieve the searchlog for the specified search jobs."""
opts = cmdline(argv, FLAGS_SEARCHLOG)
self.foreach(opts.args, lambda job:
output(job.searchlog(**opts.kwargs))) | [
"def",
"searchlog",
"(",
"self",
",",
"argv",
")",
":",
"opts",
"=",
"cmdline",
"(",
"argv",
",",
"FLAGS_SEARCHLOG",
")",
"self",
".",
"foreach",
"(",
"opts",
".",
"args",
",",
"lambda",
"job",
":",
"output",
"(",
"job",
".",
"searchlog",
"(",
"*",
... | Retrieve the searchlog for the specified search jobs. | [
"Retrieve",
"the",
"searchlog",
"for",
"the",
"specified",
"search",
"jobs",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/job.py#L233-L237 |
222,087 | splunk/splunk-sdk-python | examples/handlers/handler_certs.py | handler | def handler(ca_file=None):
"""Returns an HTTP request handler configured with the given ca_file."""
def request(url, message, **kwargs):
scheme, host, port, path = spliturl(url)
if scheme != "https":
ValueError("unsupported scheme: %s" % scheme)
connection = HTTPSConnecti... | python | def handler(ca_file=None):
"""Returns an HTTP request handler configured with the given ca_file."""
def request(url, message, **kwargs):
scheme, host, port, path = spliturl(url)
if scheme != "https":
ValueError("unsupported scheme: %s" % scheme)
connection = HTTPSConnecti... | [
"def",
"handler",
"(",
"ca_file",
"=",
"None",
")",
":",
"def",
"request",
"(",
"url",
",",
"message",
",",
"*",
"*",
"kwargs",
")",
":",
"scheme",
",",
"host",
",",
"port",
",",
"path",
"=",
"spliturl",
"(",
"url",
")",
"if",
"scheme",
"!=",
"\"... | Returns an HTTP request handler configured with the given ca_file. | [
"Returns",
"an",
"HTTP",
"request",
"handler",
"configured",
"with",
"the",
"given",
"ca_file",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/handlers/handler_certs.py#L90-L115 |
222,088 | splunk/splunk-sdk-python | examples/index.py | Program.list | def list(self, argv):
"""List available indexes if no names provided, otherwise list the
properties of the named indexes."""
def read(index):
print(index.name)
for key in sorted(index.content.keys()):
value = index.content[key]
print("... | python | def list(self, argv):
"""List available indexes if no names provided, otherwise list the
properties of the named indexes."""
def read(index):
print(index.name)
for key in sorted(index.content.keys()):
value = index.content[key]
print("... | [
"def",
"list",
"(",
"self",
",",
"argv",
")",
":",
"def",
"read",
"(",
"index",
")",
":",
"print",
"(",
"index",
".",
"name",
")",
"for",
"key",
"in",
"sorted",
"(",
"index",
".",
"content",
".",
"keys",
"(",
")",
")",
":",
"value",
"=",
"index... | List available indexes if no names provided, otherwise list the
properties of the named indexes. | [
"List",
"available",
"indexes",
"if",
"no",
"names",
"provided",
"otherwise",
"list",
"the",
"properties",
"of",
"the",
"named",
"indexes",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/index.py#L101-L116 |
222,089 | splunk/splunk-sdk-python | examples/index.py | Program.foreach | def foreach(self, argv, func):
"""Apply the function to each index named in the argument vector."""
opts = cmdline(argv)
if len(opts.args) == 0:
error("Command requires an index name", 2)
for name in opts.args:
if name not in self.service.indexes:
... | python | def foreach(self, argv, func):
"""Apply the function to each index named in the argument vector."""
opts = cmdline(argv)
if len(opts.args) == 0:
error("Command requires an index name", 2)
for name in opts.args:
if name not in self.service.indexes:
... | [
"def",
"foreach",
"(",
"self",
",",
"argv",
",",
"func",
")",
":",
"opts",
"=",
"cmdline",
"(",
"argv",
")",
"if",
"len",
"(",
"opts",
".",
"args",
")",
"==",
"0",
":",
"error",
"(",
"\"Command requires an index name\"",
",",
"2",
")",
"for",
"name",... | Apply the function to each index named in the argument vector. | [
"Apply",
"the",
"function",
"to",
"each",
"index",
"named",
"in",
"the",
"argument",
"vector",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/index.py#L134-L143 |
222,090 | splunk/splunk-sdk-python | examples/index.py | Program.update | def update(self, argv):
"""Update an index according to the given argument vector."""
if len(argv) == 0:
error("Command requires an index name", 2)
name = argv[0]
if name not in self.service.indexes:
error("Index '%s' does not exist" % name, 2)
index = ... | python | def update(self, argv):
"""Update an index according to the given argument vector."""
if len(argv) == 0:
error("Command requires an index name", 2)
name = argv[0]
if name not in self.service.indexes:
error("Index '%s' does not exist" % name, 2)
index = ... | [
"def",
"update",
"(",
"self",
",",
"argv",
")",
":",
"if",
"len",
"(",
"argv",
")",
"==",
"0",
":",
"error",
"(",
"\"Command requires an index name\"",
",",
"2",
")",
"name",
"=",
"argv",
"[",
"0",
"]",
"if",
"name",
"not",
"in",
"self",
".",
"serv... | Update an index according to the given argument vector. | [
"Update",
"an",
"index",
"according",
"to",
"the",
"given",
"argument",
"vector",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/index.py#L145-L169 |
222,091 | splunk/splunk-sdk-python | splunklib/modularinput/argument.py | Argument.add_to_document | def add_to_document(self, parent):
"""Adds an ``Argument`` object to this ElementTree document.
Adds an <arg> subelement to the parent element, typically <args>
and sets up its subelements with their respective text.
:param parent: An ``ET.Element`` to be the parent of a new <arg> sube... | python | def add_to_document(self, parent):
"""Adds an ``Argument`` object to this ElementTree document.
Adds an <arg> subelement to the parent element, typically <args>
and sets up its subelements with their respective text.
:param parent: An ``ET.Element`` to be the parent of a new <arg> sube... | [
"def",
"add_to_document",
"(",
"self",
",",
"parent",
")",
":",
"arg",
"=",
"ET",
".",
"SubElement",
"(",
"parent",
",",
"\"arg\"",
")",
"arg",
".",
"set",
"(",
"\"name\"",
",",
"self",
".",
"name",
")",
"if",
"self",
".",
"title",
"is",
"not",
"No... | Adds an ``Argument`` object to this ElementTree document.
Adds an <arg> subelement to the parent element, typically <args>
and sets up its subelements with their respective text.
:param parent: An ``ET.Element`` to be the parent of a new <arg> subelement
:returns: An ``ET.Element`` obj... | [
"Adds",
"an",
"Argument",
"object",
"to",
"this",
"ElementTree",
"document",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/argument.py#L72-L103 |
222,092 | splunk/splunk-sdk-python | examples/export/export.py | get_event_start | def get_event_start(event_buffer, event_format):
""" dispatch event start method based on event format type """
if event_format == "csv":
return get_csv_event_start(event_buffer)
elif event_format == "xml":
return get_xml_event_start(event_buffer)
else:
return get_json_event_sta... | python | def get_event_start(event_buffer, event_format):
""" dispatch event start method based on event format type """
if event_format == "csv":
return get_csv_event_start(event_buffer)
elif event_format == "xml":
return get_xml_event_start(event_buffer)
else:
return get_json_event_sta... | [
"def",
"get_event_start",
"(",
"event_buffer",
",",
"event_format",
")",
":",
"if",
"event_format",
"==",
"\"csv\"",
":",
"return",
"get_csv_event_start",
"(",
"event_buffer",
")",
"elif",
"event_format",
"==",
"\"xml\"",
":",
"return",
"get_xml_event_start",
"(",
... | dispatch event start method based on event format type | [
"dispatch",
"event",
"start",
"method",
"based",
"on",
"event",
"format",
"type"
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/export/export.py#L217-L225 |
222,093 | splunk/splunk-sdk-python | examples/export/export.py | recover | def recover(options):
""" recover from an existing export run. We do this by
finding the last time change between events, truncate the file
and restart from there """
event_format = options.kwargs['omode']
buffer_size = 64*1024
fpd = open(options.kwargs['output'], "r+")
fpd.seek(0,... | python | def recover(options):
""" recover from an existing export run. We do this by
finding the last time change between events, truncate the file
and restart from there """
event_format = options.kwargs['omode']
buffer_size = 64*1024
fpd = open(options.kwargs['output'], "r+")
fpd.seek(0,... | [
"def",
"recover",
"(",
"options",
")",
":",
"event_format",
"=",
"options",
".",
"kwargs",
"[",
"'omode'",
"]",
"buffer_size",
"=",
"64",
"*",
"1024",
"fpd",
"=",
"open",
"(",
"options",
".",
"kwargs",
"[",
"'output'",
"]",
",",
"\"r+\"",
")",
"fpd",
... | recover from an existing export run. We do this by
finding the last time change between events, truncate the file
and restart from there | [
"recover",
"from",
"an",
"existing",
"export",
"run",
".",
"We",
"do",
"this",
"by",
"finding",
"the",
"last",
"time",
"change",
"between",
"events",
"truncate",
"the",
"file",
"and",
"restart",
"from",
"there"
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/export/export.py#L227-L261 |
222,094 | splunk/splunk-sdk-python | examples/export/export.py | cleanup_tail | def cleanup_tail(options):
""" cleanup the tail of a recovery """
if options.kwargs['omode'] == "csv":
options.kwargs['fd'].write("\n")
elif options.kwargs['omode'] == "xml":
options.kwargs['fd'].write("\n</results>\n")
else:
options.kwargs['fd'].write("\n]\n") | python | def cleanup_tail(options):
""" cleanup the tail of a recovery """
if options.kwargs['omode'] == "csv":
options.kwargs['fd'].write("\n")
elif options.kwargs['omode'] == "xml":
options.kwargs['fd'].write("\n</results>\n")
else:
options.kwargs['fd'].write("\n]\n") | [
"def",
"cleanup_tail",
"(",
"options",
")",
":",
"if",
"options",
".",
"kwargs",
"[",
"'omode'",
"]",
"==",
"\"csv\"",
":",
"options",
".",
"kwargs",
"[",
"'fd'",
"]",
".",
"write",
"(",
"\"\\n\"",
")",
"elif",
"options",
".",
"kwargs",
"[",
"'omode'",... | cleanup the tail of a recovery | [
"cleanup",
"the",
"tail",
"of",
"a",
"recovery"
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/export/export.py#L263-L271 |
222,095 | splunk/splunk-sdk-python | splunklib/modularinput/scheme.py | Scheme.to_xml | def to_xml(self):
"""Creates an ``ET.Element`` representing self, then returns it.
:returns root, an ``ET.Element`` representing this scheme.
"""
root = ET.Element("scheme")
ET.SubElement(root, "title").text = self.title
# add a description subelement if it's defined
... | python | def to_xml(self):
"""Creates an ``ET.Element`` representing self, then returns it.
:returns root, an ``ET.Element`` representing this scheme.
"""
root = ET.Element("scheme")
ET.SubElement(root, "title").text = self.title
# add a description subelement if it's defined
... | [
"def",
"to_xml",
"(",
"self",
")",
":",
"root",
"=",
"ET",
".",
"Element",
"(",
"\"scheme\"",
")",
"ET",
".",
"SubElement",
"(",
"root",
",",
"\"title\"",
")",
".",
"text",
"=",
"self",
".",
"title",
"# add a description subelement if it's defined",
"if",
... | Creates an ``ET.Element`` representing self, then returns it.
:returns root, an ``ET.Element`` representing this scheme. | [
"Creates",
"an",
"ET",
".",
"Element",
"representing",
"self",
"then",
"returns",
"it",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/scheme.py#L55-L85 |
222,096 | splunk/splunk-sdk-python | splunklib/modularinput/event_writer.py | EventWriter.write_xml_document | def write_xml_document(self, document):
"""Writes a string representation of an
``ElementTree`` object to the output stream.
:param document: An ``ElementTree`` object.
"""
self._out.write(ET.tostring(document))
self._out.flush() | python | def write_xml_document(self, document):
"""Writes a string representation of an
``ElementTree`` object to the output stream.
:param document: An ``ElementTree`` object.
"""
self._out.write(ET.tostring(document))
self._out.flush() | [
"def",
"write_xml_document",
"(",
"self",
",",
"document",
")",
":",
"self",
".",
"_out",
".",
"write",
"(",
"ET",
".",
"tostring",
"(",
"document",
")",
")",
"self",
".",
"_out",
".",
"flush",
"(",
")"
] | Writes a string representation of an
``ElementTree`` object to the output stream.
:param document: An ``ElementTree`` object. | [
"Writes",
"a",
"string",
"representation",
"of",
"an",
"ElementTree",
"object",
"to",
"the",
"output",
"stream",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/event_writer.py#L74-L81 |
222,097 | splunk/splunk-sdk-python | examples/conf.py | Program.create | def create(self, opts):
"""Create a conf stanza."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# however, we must have a conf and stanza.
cpres = True if count > 0 else False
spres = True if count > 1 else False... | python | def create(self, opts):
"""Create a conf stanza."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# however, we must have a conf and stanza.
cpres = True if count > 0 else False
spres = True if count > 1 else False... | [
"def",
"create",
"(",
"self",
",",
"opts",
")",
":",
"argv",
"=",
"opts",
".",
"args",
"count",
"=",
"len",
"(",
"argv",
")",
"# unflagged arguments are conf, stanza, key. In this order",
"# however, we must have a conf and stanza.",
"cpres",
"=",
"True",
"if",
"cou... | Create a conf stanza. | [
"Create",
"a",
"conf",
"stanza",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/conf.py#L39-L72 |
222,098 | splunk/splunk-sdk-python | examples/conf.py | Program.delete | def delete(self, opts):
"""Delete a conf stanza."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# however, we must have a conf and stanza.
cpres = True if count > 0 else False
spres = True if count > 1 else False... | python | def delete(self, opts):
"""Delete a conf stanza."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# however, we must have a conf and stanza.
cpres = True if count > 0 else False
spres = True if count > 1 else False... | [
"def",
"delete",
"(",
"self",
",",
"opts",
")",
":",
"argv",
"=",
"opts",
".",
"args",
"count",
"=",
"len",
"(",
"argv",
")",
"# unflagged arguments are conf, stanza, key. In this order",
"# however, we must have a conf and stanza.",
"cpres",
"=",
"True",
"if",
"cou... | Delete a conf stanza. | [
"Delete",
"a",
"conf",
"stanza",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/conf.py#L75-L99 |
222,099 | splunk/splunk-sdk-python | examples/conf.py | Program.list | def list(self, opts):
"""List all confs or if a conf is given, all the stanzas in it."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# but all are optional
cpres = True if count > 0 else False
spres = True if cou... | python | def list(self, opts):
"""List all confs or if a conf is given, all the stanzas in it."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# but all are optional
cpres = True if count > 0 else False
spres = True if cou... | [
"def",
"list",
"(",
"self",
",",
"opts",
")",
":",
"argv",
"=",
"opts",
".",
"args",
"count",
"=",
"len",
"(",
"argv",
")",
"# unflagged arguments are conf, stanza, key. In this order",
"# but all are optional",
"cpres",
"=",
"True",
"if",
"count",
">",
"0",
"... | List all confs or if a conf is given, all the stanzas in it. | [
"List",
"all",
"confs",
"or",
"if",
"a",
"conf",
"is",
"given",
"all",
"the",
"stanzas",
"in",
"it",
"."
] | a245a4eeb93b3621730418008e31715912bcdcd8 | https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/conf.py#L101-L129 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.