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
partition
stringclasses
1 value
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
tob
def tob(data, enc='utf8'): """ Convert anything to bytes """ return data.encode(enc) if isinstance(data, six.text_type) else bytes(data)
python
def tob(data, enc='utf8'): """ Convert anything to bytes """ return data.encode(enc) if isinstance(data, six.text_type) else bytes(data)
[ "def", "tob", "(", "data", ",", "enc", "=", "'utf8'", ")", ":", "return", "data", ".", "encode", "(", "enc", ")", "if", "isinstance", "(", "data", ",", "six", ".", "text_type", ")", "else", "bytes", "(", "data", ")" ]
Convert anything to bytes
[ "Convert", "anything", "to", "bytes" ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L91-L93
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
make_default_app_wrapper
def make_default_app_wrapper(name): ''' Return a callable that relays calls to the current default app. ''' @functools.wraps(getattr(Bottle, name)) def wrapper(*a, **ka): return getattr(app(), name)(*a, **ka) return wrapper
python
def make_default_app_wrapper(name): ''' Return a callable that relays calls to the current default app. ''' @functools.wraps(getattr(Bottle, name)) def wrapper(*a, **ka): return getattr(app(), name)(*a, **ka) return wrapper
[ "def", "make_default_app_wrapper", "(", "name", ")", ":", "@", "functools", ".", "wraps", "(", "getattr", "(", "Bottle", ",", "name", ")", ")", "def", "wrapper", "(", "*", "a", ",", "*", "*", "ka", ")", ":", "return", "getattr", "(", "app", "(", ")...
Return a callable that relays calls to the current default app.
[ "Return", "a", "callable", "that", "relays", "calls", "to", "the", "current", "default", "app", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L1644-L1649
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
load_app
def load_app(target): """ Load a bottle application based on a target string and return the application object. If the target is an import path (e.g. package.module), the application stack is used to isolate the routes defined in that module. If the target contains a colon (e.g. pac...
python
def load_app(target): """ Load a bottle application based on a target string and return the application object. If the target is an import path (e.g. package.module), the application stack is used to isolate the routes defined in that module. If the target contains a colon (e.g. pac...
[ "def", "load_app", "(", "target", ")", ":", "tmp", "=", "app", ".", "push", "(", ")", "# Create a new \"default application\"", "rv", "=", "_load", "(", "target", ")", "# Import the target module", "app", ".", "remove", "(", "tmp", ")", "# Remove the temporary a...
Load a bottle application based on a target string and return the application object. If the target is an import path (e.g. package.module), the application stack is used to isolate the routes defined in that module. If the target contains a colon (e.g. package.module:myapp) the ...
[ "Load", "a", "bottle", "application", "based", "on", "a", "target", "string", "and", "return", "the", "application", "object", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L1935-L1947
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
run
def run(app=None, server='wsgiref', host='127.0.0.1', port=8080, interval=1, reloader=False, quiet=False, **kargs): """ Start a server instance. This method blocks until the server terminates. :param app: WSGI application or target string supported by :func:`load_app`. (default: :fun...
python
def run(app=None, server='wsgiref', host='127.0.0.1', port=8080, interval=1, reloader=False, quiet=False, **kargs): """ Start a server instance. This method blocks until the server terminates. :param app: WSGI application or target string supported by :func:`load_app`. (default: :fun...
[ "def", "run", "(", "app", "=", "None", ",", "server", "=", "'wsgiref'", ",", "host", "=", "'127.0.0.1'", ",", "port", "=", "8080", ",", "interval", "=", "1", ",", "reloader", "=", "False", ",", "quiet", "=", "False", ",", "*", "*", "kargs", ")", ...
Start a server instance. This method blocks until the server terminates. :param app: WSGI application or target string supported by :func:`load_app`. (default: :func:`default_app`) :param server: Server adapter to use. See :data:`server_names` keys for valid names or pass ...
[ "Start", "a", "server", "instance", ".", "This", "method", "blocks", "until", "the", "server", "terminates", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L1950-L1995
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Router.build
def build(self, _name, *anon, **args): ''' Return a string that matches a named route. Use keyword arguments to fill out named wildcards. Remaining arguments are appended as a query string. Raises RouteBuildError or KeyError.''' if _name not in self.named: raise Route...
python
def build(self, _name, *anon, **args): ''' Return a string that matches a named route. Use keyword arguments to fill out named wildcards. Remaining arguments are appended as a query string. Raises RouteBuildError or KeyError.''' if _name not in self.named: raise Route...
[ "def", "build", "(", "self", ",", "_name", ",", "*", "anon", ",", "*", "*", "args", ")", ":", "if", "_name", "not", "in", "self", ".", "named", ":", "raise", "RouteBuildError", "(", "\"No route with that name.\"", ",", "_name", ")", "rule", ",", "pairs...
Return a string that matches a named route. Use keyword arguments to fill out named wildcards. Remaining arguments are appended as a query string. Raises RouteBuildError or KeyError.
[ "Return", "a", "string", "that", "matches", "a", "named", "route", ".", "Use", "keyword", "arguments", "to", "fill", "out", "named", "wildcards", ".", "Remaining", "arguments", "are", "appended", "as", "a", "query", "string", ".", "Raises", "RouteBuildError", ...
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L278-L304
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Router._match_path
def _match_path(self, environ): ''' Optimized PATH_INFO matcher. ''' path = environ['PATH_INFO'] or '/' # Assume we are in a warm state. Search compiled rules first. match = self.static.get(path) if match: return match, {} for combined, rules in self.dynamic: ...
python
def _match_path(self, environ): ''' Optimized PATH_INFO matcher. ''' path = environ['PATH_INFO'] or '/' # Assume we are in a warm state. Search compiled rules first. match = self.static.get(path) if match: return match, {} for combined, rules in self.dynamic: ...
[ "def", "_match_path", "(", "self", ",", "environ", ")", ":", "path", "=", "environ", "[", "'PATH_INFO'", "]", "or", "'/'", "# Assume we are in a warm state. Search compiled rules first.", "match", "=", "self", ".", "static", ".", "get", "(", "path", ")", "if", ...
Optimized PATH_INFO matcher.
[ "Optimized", "PATH_INFO", "matcher", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L324-L350
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Router._compile
def _compile(self): ''' Prepare static and dynamic search structures. ''' self.static = {} self.dynamic = [] def fpat_sub(m): return m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:' for rule in self.rules: target = self.routes[rule] if...
python
def _compile(self): ''' Prepare static and dynamic search structures. ''' self.static = {} self.dynamic = [] def fpat_sub(m): return m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:' for rule in self.rules: target = self.routes[rule] if...
[ "def", "_compile", "(", "self", ")", ":", "self", ".", "static", "=", "{", "}", "self", ".", "dynamic", "=", "[", "]", "def", "fpat_sub", "(", "m", ")", ":", "return", "m", ".", "group", "(", "0", ")", "if", "len", "(", "m", ".", "group", "("...
Prepare static and dynamic search structures.
[ "Prepare", "static", "and", "dynamic", "search", "structures", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L352-L374
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Router._compile_pattern
def _compile_pattern(self, rule): ''' Return a regular expression with named groups for each wildcard. ''' out = '' for i, part in enumerate(self.syntax.split(rule)): if i%3 == 0: out += re.escape(part.replace('\\:',':')) elif i%3 == 1: out += '(?P<%s>' % part if part e...
python
def _compile_pattern(self, rule): ''' Return a regular expression with named groups for each wildcard. ''' out = '' for i, part in enumerate(self.syntax.split(rule)): if i%3 == 0: out += re.escape(part.replace('\\:',':')) elif i%3 == 1: out += '(?P<%s>' % part if part e...
[ "def", "_compile_pattern", "(", "self", ",", "rule", ")", ":", "out", "=", "''", "for", "i", ",", "part", "in", "enumerate", "(", "self", ".", "syntax", ".", "split", "(", "rule", ")", ")", ":", "if", "i", "%", "3", "==", "0", ":", "out", "+=",...
Return a regular expression with named groups for each wildcard.
[ "Return", "a", "regular", "expression", "with", "named", "groups", "for", "each", "wildcard", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L376-L383
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Bottle.mount
def mount(self, app, prefix, **options): ''' Mount an application to a specific URL prefix. The prefix is added to SCIPT_PATH and removed from PATH_INFO before the sub-application is called. :param app: an instance of :class:`Bottle`. :param prefix: path prefix u...
python
def mount(self, app, prefix, **options): ''' Mount an application to a specific URL prefix. The prefix is added to SCIPT_PATH and removed from PATH_INFO before the sub-application is called. :param app: an instance of :class:`Bottle`. :param prefix: path prefix u...
[ "def", "mount", "(", "self", ",", "app", ",", "prefix", ",", "*", "*", "options", ")", ":", "if", "not", "isinstance", "(", "app", ",", "Bottle", ")", ":", "raise", "TypeError", "(", "'Only Bottle instances are supported for now.'", ")", "prefix", "=", "'/...
Mount an application to a specific URL prefix. The prefix is added to SCIPT_PATH and removed from PATH_INFO before the sub-application is called. :param app: an instance of :class:`Bottle`. :param prefix: path prefix used as a mount-point. All other paramete...
[ "Mount", "an", "application", "to", "a", "specific", "URL", "prefix", ".", "The", "prefix", "is", "added", "to", "SCIPT_PATH", "and", "removed", "from", "PATH_INFO", "before", "the", "sub", "-", "application", "is", "called", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L424-L449
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Bottle.uninstall
def uninstall(self, plugin): ''' Uninstall plugins. Pass an instance to remove a specific plugin. Pass a type object to remove all plugins that match that type. Subclasses are not removed. Pass a string to remove all plugins with a matching ``name`` attribute. Pass ``True`` t...
python
def uninstall(self, plugin): ''' Uninstall plugins. Pass an instance to remove a specific plugin. Pass a type object to remove all plugins that match that type. Subclasses are not removed. Pass a string to remove all plugins with a matching ``name`` attribute. Pass ``True`` t...
[ "def", "uninstall", "(", "self", ",", "plugin", ")", ":", "removed", ",", "remove", "=", "[", "]", ",", "plugin", "for", "i", ",", "plugin", "in", "list", "(", "enumerate", "(", "self", ".", "plugins", ")", ")", "[", ":", ":", "-", "1", "]", ":...
Uninstall plugins. Pass an instance to remove a specific plugin. Pass a type object to remove all plugins that match that type. Subclasses are not removed. Pass a string to remove all plugins with a matching ``name`` attribute. Pass ``True`` to remove all plugins. The lis...
[ "Uninstall", "plugins", ".", "Pass", "an", "instance", "to", "remove", "a", "specific", "plugin", ".", "Pass", "a", "type", "object", "to", "remove", "all", "plugins", "that", "match", "that", "type", ".", "Subclasses", "are", "not", "removed", ".", "Pass"...
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L467-L481
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Bottle.close
def close(self): ''' Close the application and all installed plugins. ''' for plugin in self.plugins: if hasattr(plugin, 'close'): plugin.close() self.stopped = True
python
def close(self): ''' Close the application and all installed plugins. ''' for plugin in self.plugins: if hasattr(plugin, 'close'): plugin.close() self.stopped = True
[ "def", "close", "(", "self", ")", ":", "for", "plugin", "in", "self", ".", "plugins", ":", "if", "hasattr", "(", "plugin", ",", "'close'", ")", ":", "plugin", ".", "close", "(", ")", "self", ".", "stopped", "=", "True" ]
Close the application and all installed plugins.
[ "Close", "the", "application", "and", "all", "installed", "plugins", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L493-L497
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Bottle._build_callback
def _build_callback(self, config): ''' Apply plugins to a route and return a new callable. ''' wrapped = config['callback'] plugins = self.plugins + config['apply'] skip = config['skip'] try: for plugin in reversed(plugins): if True in skip: break ...
python
def _build_callback(self, config): ''' Apply plugins to a route and return a new callable. ''' wrapped = config['callback'] plugins = self.plugins + config['apply'] skip = config['skip'] try: for plugin in reversed(plugins): if True in skip: break ...
[ "def", "_build_callback", "(", "self", ",", "config", ")", ":", "wrapped", "=", "config", "[", "'callback'", "]", "plugins", "=", "self", ".", "plugins", "+", "config", "[", "'apply'", "]", "skip", "=", "config", "[", "'skip'", "]", "try", ":", "for", ...
Apply plugins to a route and return a new callable.
[ "Apply", "plugins", "to", "a", "route", "and", "return", "a", "new", "callable", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L520-L538
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Bottle.hook
def hook(self, name): """ Return a decorator that attaches a callback to a hook. """ def wrapper(func): self.hooks.add(name, func) return func return wrapper
python
def hook(self, name): """ Return a decorator that attaches a callback to a hook. """ def wrapper(func): self.hooks.add(name, func) return func return wrapper
[ "def", "hook", "(", "self", ",", "name", ")", ":", "def", "wrapper", "(", "func", ")", ":", "self", ".", "hooks", ".", "add", "(", "name", ",", "func", ")", "return", "func", "return", "wrapper" ]
Return a decorator that attaches a callback to a hook.
[ "Return", "a", "decorator", "that", "attaches", "a", "callback", "to", "a", "hook", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L624-L629
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Request.bind
def bind(self, environ): """ Bind a new WSGI environment. This is done automatically for the global `bottle.request` instance on every request. """ self.environ = environ # These attributes are used anyway, so it is ok to compute them here self.path = '/'...
python
def bind(self, environ): """ Bind a new WSGI environment. This is done automatically for the global `bottle.request` instance on every request. """ self.environ = environ # These attributes are used anyway, so it is ok to compute them here self.path = '/'...
[ "def", "bind", "(", "self", ",", "environ", ")", ":", "self", ".", "environ", "=", "environ", "# These attributes are used anyway, so it is ok to compute them here", "self", ".", "path", "=", "'/'", "+", "environ", ".", "get", "(", "'PATH_INFO'", ",", "'/'", ")"...
Bind a new WSGI environment. This is done automatically for the global `bottle.request` instance on every request.
[ "Bind", "a", "new", "WSGI", "environment", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L787-L796
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Request._body
def _body(self): """ The HTTP request body as a seekable file-like object. This property returns a copy of the `wsgi.input` stream and should be used instead of `environ['wsgi.input']`. """ maxread = max(0, self.content_length) stream = self.environ['wsgi.input'...
python
def _body(self): """ The HTTP request body as a seekable file-like object. This property returns a copy of the `wsgi.input` stream and should be used instead of `environ['wsgi.input']`. """ maxread = max(0, self.content_length) stream = self.environ['wsgi.input'...
[ "def", "_body", "(", "self", ")", ":", "maxread", "=", "max", "(", "0", ",", "self", ".", "content_length", ")", "stream", "=", "self", ".", "environ", "[", "'wsgi.input'", "]", "body", "=", "BytesIO", "(", ")", "if", "maxread", "<", "MEMFILE_MAX", "...
The HTTP request body as a seekable file-like object. This property returns a copy of the `wsgi.input` stream and should be used instead of `environ['wsgi.input']`.
[ "The", "HTTP", "request", "body", "as", "a", "seekable", "file", "-", "like", "object", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L953-L969
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Response.bind
def bind(self): """ Resets the Response object to its factory defaults. """ self._COOKIES = None self.status = 200 self.headers = HeaderDict() self.content_type = 'text/html; charset=UTF-8'
python
def bind(self): """ Resets the Response object to its factory defaults. """ self._COOKIES = None self.status = 200 self.headers = HeaderDict() self.content_type = 'text/html; charset=UTF-8'
[ "def", "bind", "(", "self", ")", ":", "self", ".", "_COOKIES", "=", "None", "self", ".", "status", "=", "200", "self", ".", "headers", "=", "HeaderDict", "(", ")", "self", ".", "content_type", "=", "'text/html; charset=UTF-8'" ]
Resets the Response object to its factory defaults.
[ "Resets", "the", "Response", "object", "to", "its", "factory", "defaults", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L1022-L1027
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
Response.delete_cookie
def delete_cookie(self, key, **kwargs): ''' Delete a cookie. Be sure to use the same `domain` and `path` parameters as used to create the cookie. ''' kwargs['max_age'] = -1 kwargs['expires'] = 0 self.set_cookie(key, '', **kwargs)
python
def delete_cookie(self, key, **kwargs): ''' Delete a cookie. Be sure to use the same `domain` and `path` parameters as used to create the cookie. ''' kwargs['max_age'] = -1 kwargs['expires'] = 0 self.set_cookie(key, '', **kwargs)
[ "def", "delete_cookie", "(", "self", ",", "key", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'max_age'", "]", "=", "-", "1", "kwargs", "[", "'expires'", "]", "=", "0", "self", ".", "set_cookie", "(", "key", ",", "''", ",", "*", "*", "kwarg...
Delete a cookie. Be sure to use the same `domain` and `path` parameters as used to create the cookie.
[ "Delete", "a", "cookie", ".", "Be", "sure", "to", "use", "the", "same", "domain", "and", "path", "parameters", "as", "used", "to", "create", "the", "cookie", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L1110-L1115
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
HooksPlugin.add
def add(self, name, func): ''' Attach a callback to a hook. ''' if name not in self.hooks: raise ValueError("Unknown hook name %s" % name) was_empty = self._empty() self.hooks[name].append(func) if self.app and was_empty and not self._empty(): self.app.reset()
python
def add(self, name, func): ''' Attach a callback to a hook. ''' if name not in self.hooks: raise ValueError("Unknown hook name %s" % name) was_empty = self._empty() self.hooks[name].append(func) if self.app and was_empty and not self._empty(): self.app.reset()
[ "def", "add", "(", "self", ",", "name", ",", "func", ")", ":", "if", "name", "not", "in", "self", ".", "hooks", ":", "raise", "ValueError", "(", "\"Unknown hook name %s\"", "%", "name", ")", "was_empty", "=", "self", ".", "_empty", "(", ")", "self", ...
Attach a callback to a hook.
[ "Attach", "a", "callback", "to", "a", "hook", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L1170-L1176
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
BaseTemplate.global_config
def global_config(cls, key, *args): ''' This reads or sets the global settings stored in class.settings. ''' if args: cls.settings[key] = args[0] else: return cls.settings[key]
python
def global_config(cls, key, *args): ''' This reads or sets the global settings stored in class.settings. ''' if args: cls.settings[key] = args[0] else: return cls.settings[key]
[ "def", "global_config", "(", "cls", ",", "key", ",", "*", "args", ")", ":", "if", "args", ":", "cls", ".", "settings", "[", "key", "]", "=", "args", "[", "0", "]", "else", ":", "return", "cls", ".", "settings", "[", "key", "]" ]
This reads or sets the global settings stored in class.settings.
[ "This", "reads", "or", "sets", "the", "global", "settings", "stored", "in", "class", ".", "settings", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L2137-L2142
train
splunk/splunk-sdk-python
splunklib/modularinput/script.py
Script.service
def service(self): """ Returns a Splunk service object for this script invocation. The service object is created from the Splunkd URI and session key passed to the command invocation on the modular input stream. It is available as soon as the :code:`Script.stream_events` method is ...
python
def service(self): """ Returns a Splunk service object for this script invocation. The service object is created from the Splunkd URI and session key passed to the command invocation on the modular input stream. It is available as soon as the :code:`Script.stream_events` method is ...
[ "def", "service", "(", "self", ")", ":", "if", "self", ".", "_service", "is", "not", "None", ":", "return", "self", ".", "_service", "if", "self", ".", "_input_definition", "is", "None", ":", "return", "None", "splunkd_uri", "=", "self", ".", "_input_def...
Returns a Splunk service object for this script invocation. The service object is created from the Splunkd URI and session key passed to the command invocation on the modular input stream. It is available as soon as the :code:`Script.stream_events` method is called. :return: :c...
[ "Returns", "a", "Splunk", "service", "object", "for", "this", "script", "invocation", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/script.py#L113-L144
train
splunk/splunk-sdk-python
examples/random_numbers/random_numbers.py
MyScript.validate_input
def validate_input(self, validation_definition): """In this example we are using external validation to verify that min is less than max. If validate_input does not raise an Exception, the input is assumed to be valid. Otherwise it prints the exception as an error message when telling sp...
python
def validate_input(self, validation_definition): """In this example we are using external validation to verify that min is less than max. If validate_input does not raise an Exception, the input is assumed to be valid. Otherwise it prints the exception as an error message when telling sp...
[ "def", "validate_input", "(", "self", ",", "validation_definition", ")", ":", "# Get the parameters from the ValidationDefinition object,", "# then typecast the values as floats", "minimum", "=", "float", "(", "validation_definition", ".", "parameters", "[", "\"min\"", "]", "...
In this example we are using external validation to verify that min is less than max. If validate_input does not raise an Exception, the input is assumed to be valid. Otherwise it prints the exception as an error message when telling splunkd that the configuration is invalid. When using...
[ "In", "this", "example", "we", "are", "using", "external", "validation", "to", "verify", "that", "min", "is", "less", "than", "max", ".", "If", "validate_input", "does", "not", "raise", "an", "Exception", "the", "input", "is", "assumed", "to", "be", "valid...
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/random_numbers/random_numbers.py#L73-L93
train
splunk/splunk-sdk-python
splunklib/modularinput/event.py
Event.write_to
def write_to(self, stream): """Write an XML representation of self, an ``Event`` object, to the given stream. The ``Event`` object will only be written if its data field is defined, otherwise a ``ValueError`` is raised. :param stream: stream to write XML to. """ if self...
python
def write_to(self, stream): """Write an XML representation of self, an ``Event`` object, to the given stream. The ``Event`` object will only be written if its data field is defined, otherwise a ``ValueError`` is raised. :param stream: stream to write XML to. """ if self...
[ "def", "write_to", "(", "self", ",", "stream", ")", ":", "if", "self", ".", "data", "is", "None", ":", "raise", "ValueError", "(", "\"Events must have at least the data field set to be written to XML.\"", ")", "event", "=", "ET", ".", "Element", "(", "\"event\"", ...
Write an XML representation of self, an ``Event`` object, to the given stream. The ``Event`` object will only be written if its data field is defined, otherwise a ``ValueError`` is raised. :param stream: stream to write XML to.
[ "Write", "an", "XML", "representation", "of", "self", "an", "Event", "object", "to", "the", "given", "stream", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/event.py#L72-L108
train
splunk/splunk-sdk-python
splunklib/client.py
Service.capabilities
def capabilities(self): """Returns the list of system capabilities. :return: A ``list`` of capabilities. """ response = self.get(PATH_CAPABILITIES) return _load_atom(response, MATCH_ENTRY_CONTENT).capabilities
python
def capabilities(self): """Returns the list of system capabilities. :return: A ``list`` of capabilities. """ response = self.get(PATH_CAPABILITIES) return _load_atom(response, MATCH_ENTRY_CONTENT).capabilities
[ "def", "capabilities", "(", "self", ")", ":", "response", "=", "self", ".", "get", "(", "PATH_CAPABILITIES", ")", "return", "_load_atom", "(", "response", ",", "MATCH_ENTRY_CONTENT", ")", ".", "capabilities" ]
Returns the list of system capabilities. :return: A ``list`` of capabilities.
[ "Returns", "the", "list", "of", "system", "capabilities", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L423-L429
train
splunk/splunk-sdk-python
splunklib/client.py
Service.modular_input_kinds
def modular_input_kinds(self): """Returns the collection of the modular input kinds on this Splunk instance. :return: A :class:`ReadOnlyCollection` of :class:`ModularInputKind` entities. """ if self.splunk_version >= (5,): return ReadOnlyCollection(self, PATH_MODULAR_INPUTS,...
python
def modular_input_kinds(self): """Returns the collection of the modular input kinds on this Splunk instance. :return: A :class:`ReadOnlyCollection` of :class:`ModularInputKind` entities. """ if self.splunk_version >= (5,): return ReadOnlyCollection(self, PATH_MODULAR_INPUTS,...
[ "def", "modular_input_kinds", "(", "self", ")", ":", "if", "self", ".", "splunk_version", ">=", "(", "5", ",", ")", ":", "return", "ReadOnlyCollection", "(", "self", ",", "PATH_MODULAR_INPUTS", ",", "item", "=", "ModularInputKind", ")", "else", ":", "raise",...
Returns the collection of the modular input kinds on this Splunk instance. :return: A :class:`ReadOnlyCollection` of :class:`ModularInputKind` entities.
[ "Returns", "the", "collection", "of", "the", "modular", "input", "kinds", "on", "this", "Splunk", "instance", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L506-L514
train
splunk/splunk-sdk-python
splunklib/client.py
Service.restart_required
def restart_required(self): """Indicates whether splunkd is in a state that requires a restart. :return: A ``boolean`` that indicates whether a restart is required. """ response = self.get("messages").body.read() messages = data.load(response)['feed'] if 'entry' not in ...
python
def restart_required(self): """Indicates whether splunkd is in a state that requires a restart. :return: A ``boolean`` that indicates whether a restart is required. """ response = self.get("messages").body.read() messages = data.load(response)['feed'] if 'entry' not in ...
[ "def", "restart_required", "(", "self", ")", ":", "response", "=", "self", ".", "get", "(", "\"messages\"", ")", ".", "body", ".", "read", "(", ")", "messages", "=", "data", ".", "load", "(", "response", ")", "[", "'feed'", "]", "if", "'entry'", "not...
Indicates whether splunkd is in a state that requires a restart. :return: A ``boolean`` that indicates whether a restart is required.
[ "Indicates", "whether", "splunkd", "is", "in", "a", "state", "that", "requires", "a", "restart", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L580-L596
train
splunk/splunk-sdk-python
splunklib/client.py
Service.splunk_version
def splunk_version(self): """Returns the version of the splunkd instance this object is attached to. The version is returned as a tuple of the version components as integers (for example, `(4,3,3)` or `(5,)`). :return: A ``tuple`` of ``integers``. """ if self._s...
python
def splunk_version(self): """Returns the version of the splunkd instance this object is attached to. The version is returned as a tuple of the version components as integers (for example, `(4,3,3)` or `(5,)`). :return: A ``tuple`` of ``integers``. """ if self._s...
[ "def", "splunk_version", "(", "self", ")", ":", "if", "self", ".", "_splunk_version", "is", "None", ":", "self", ".", "_splunk_version", "=", "tuple", "(", "[", "int", "(", "p", ")", "for", "p", "in", "self", ".", "info", "[", "'version'", "]", ".", ...
Returns the version of the splunkd instance this object is attached to. The version is returned as a tuple of the version components as integers (for example, `(4,3,3)` or `(5,)`). :return: A ``tuple`` of ``integers``.
[ "Returns", "the", "version", "of", "the", "splunkd", "instance", "this", "object", "is", "attached", "to", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L656-L667
train
splunk/splunk-sdk-python
splunklib/client.py
Endpoint.get
def get(self, path_segment="", owner=None, app=None, sharing=None, **query): """Performs a GET operation on the path segment relative to this endpoint. This method is named to match the HTTP method. This method makes at least one roundtrip to the server, one additional round trip for ea...
python
def get(self, path_segment="", owner=None, app=None, sharing=None, **query): """Performs a GET operation on the path segment relative to this endpoint. This method is named to match the HTTP method. This method makes at least one roundtrip to the server, one additional round trip for ea...
[ "def", "get", "(", "self", ",", "path_segment", "=", "\"\"", ",", "owner", "=", "None", ",", "app", "=", "None", ",", "sharing", "=", "None", ",", "*", "*", "query", ")", ":", "# self.path to the Endpoint is relative in the SDK, so passing", "# owner, app, shari...
Performs a GET operation on the path segment relative to this endpoint. This method is named to match the HTTP method. This method makes at least one roundtrip to the server, one additional round trip for each 303 status returned, plus at most two additional round trips if the `...
[ "Performs", "a", "GET", "operation", "on", "the", "path", "segment", "relative", "to", "this", "endpoint", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L697-L759
train
splunk/splunk-sdk-python
splunklib/client.py
Entity._run_action
def _run_action(self, path_segment, **kwargs): """Run a method and return the content Record from the returned XML. A method is a relative path from an Entity that is not itself an Entity. _run_action assumes that the returned XML is an Atom field containing one Entry, and the contents ...
python
def _run_action(self, path_segment, **kwargs): """Run a method and return the content Record from the returned XML. A method is a relative path from an Entity that is not itself an Entity. _run_action assumes that the returned XML is an Atom field containing one Entry, and the contents ...
[ "def", "_run_action", "(", "self", ",", "path_segment", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "get", "(", "path_segment", ",", "*", "*", "kwargs", ")", "data", "=", "self", ".", "_load_atom_entry", "(", "response", ")", "rec"...
Run a method and return the content Record from the returned XML. A method is a relative path from an Entity that is not itself an Entity. _run_action assumes that the returned XML is an Atom field containing one Entry, and the contents of Entry is what should be the return value. This ...
[ "Run", "a", "method", "and", "return", "the", "content", "Record", "from", "the", "returned", "XML", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L958-L970
train
splunk/splunk-sdk-python
splunklib/client.py
Entity._proper_namespace
def _proper_namespace(self, owner=None, app=None, sharing=None): """Produce a namespace sans wildcards for use in entity requests. This method tries to fill in the fields of the namespace which are `None` or wildcard (`'-'`) from the entity's namespace. If that fails, it uses the servic...
python
def _proper_namespace(self, owner=None, app=None, sharing=None): """Produce a namespace sans wildcards for use in entity requests. This method tries to fill in the fields of the namespace which are `None` or wildcard (`'-'`) from the entity's namespace. If that fails, it uses the servic...
[ "def", "_proper_namespace", "(", "self", ",", "owner", "=", "None", ",", "app", "=", "None", ",", "sharing", "=", "None", ")", ":", "if", "owner", "is", "None", "and", "app", "is", "None", "and", "sharing", "is", "None", ":", "# No namespace provided", ...
Produce a namespace sans wildcards for use in entity requests. This method tries to fill in the fields of the namespace which are `None` or wildcard (`'-'`) from the entity's namespace. If that fails, it uses the service's namespace. :param owner: :param app: :param sha...
[ "Produce", "a", "namespace", "sans", "wildcards", "for", "use", "in", "entity", "requests", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L972-L994
train
splunk/splunk-sdk-python
splunklib/client.py
Entity.refresh
def refresh(self, state=None): """Refreshes the state of this entity. If *state* is provided, load it as the new state for this entity. Otherwise, make a roundtrip to the server (by calling the :meth:`read` method of ``self``) to fetch an updated state, plus at most two addition...
python
def refresh(self, state=None): """Refreshes the state of this entity. If *state* is provided, load it as the new state for this entity. Otherwise, make a roundtrip to the server (by calling the :meth:`read` method of ``self``) to fetch an updated state, plus at most two addition...
[ "def", "refresh", "(", "self", ",", "state", "=", "None", ")", ":", "if", "state", "is", "not", "None", ":", "self", ".", "_state", "=", "state", "else", ":", "self", ".", "_state", "=", "self", ".", "read", "(", "self", ".", "get", "(", ")", "...
Refreshes the state of this entity. If *state* is provided, load it as the new state for this entity. Otherwise, make a roundtrip to the server (by calling the :meth:`read` method of ``self``) to fetch an updated state, plus at most two additional round trips if the ``autologin`...
[ "Refreshes", "the", "state", "of", "this", "entity", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1008-L1033
train
splunk/splunk-sdk-python
splunklib/client.py
Entity.disable
def disable(self): """Disables the entity at this endpoint.""" self.post("disable") if self.service.restart_required: self.service.restart(120) return self
python
def disable(self): """Disables the entity at this endpoint.""" self.post("disable") if self.service.restart_required: self.service.restart(120) return self
[ "def", "disable", "(", "self", ")", ":", "self", ".", "post", "(", "\"disable\"", ")", "if", "self", ".", "service", ".", "restart_required", ":", "self", ".", "service", ".", "restart", "(", "120", ")", "return", "self" ]
Disables the entity at this endpoint.
[ "Disables", "the", "entity", "at", "this", "endpoint", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1052-L1057
train
splunk/splunk-sdk-python
splunklib/client.py
ReadOnlyCollection._entity_path
def _entity_path(self, state): """Calculate the path to an entity to be returned. *state* should be the dictionary returned by :func:`_parse_atom_entry`. :func:`_entity_path` extracts the link to this entity from *state*, and strips all the namespace prefixes from it to leave on...
python
def _entity_path(self, state): """Calculate the path to an entity to be returned. *state* should be the dictionary returned by :func:`_parse_atom_entry`. :func:`_entity_path` extracts the link to this entity from *state*, and strips all the namespace prefixes from it to leave on...
[ "def", "_entity_path", "(", "self", ",", "state", ")", ":", "# This has been factored out so that it can be easily", "# overloaded by Configurations, which has to switch its", "# entities' endpoints from its own properties/ to configs/.", "raw_path", "=", "urllib", ".", "parse", ".",...
Calculate the path to an entity to be returned. *state* should be the dictionary returned by :func:`_parse_atom_entry`. :func:`_entity_path` extracts the link to this entity from *state*, and strips all the namespace prefixes from it to leave only the relative path of the entity ...
[ "Calculate", "the", "path", "to", "an", "entity", "to", "be", "returned", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1291-L1312
train
splunk/splunk-sdk-python
splunklib/client.py
ReadOnlyCollection.itemmeta
def itemmeta(self): """Returns metadata for members of the collection. Makes a single roundtrip to the server, plus two more at most if the ``autologin`` field of :func:`connect` is set to ``True``. :return: A :class:`splunklib.data.Record` object containing the metadata. **Ex...
python
def itemmeta(self): """Returns metadata for members of the collection. Makes a single roundtrip to the server, plus two more at most if the ``autologin`` field of :func:`connect` is set to ``True``. :return: A :class:`splunklib.data.Record` object containing the metadata. **Ex...
[ "def", "itemmeta", "(", "self", ")", ":", "response", "=", "self", ".", "get", "(", "\"_new\"", ")", "content", "=", "_load_atom", "(", "response", ",", "MATCH_ENTRY_CONTENT", ")", "return", "_parse_atom_metadata", "(", "content", ")" ]
Returns metadata for members of the collection. Makes a single roundtrip to the server, plus two more at most if the ``autologin`` field of :func:`connect` is set to ``True``. :return: A :class:`splunklib.data.Record` object containing the metadata. **Example**:: import s...
[ "Returns", "metadata", "for", "members", "of", "the", "collection", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1351-L1388
train
splunk/splunk-sdk-python
splunklib/client.py
ReadOnlyCollection.iter
def iter(self, offset=0, count=None, pagesize=None, **kwargs): """Iterates over the collection. This method is equivalent to the :meth:`list` method, but it returns an iterator and can load a certain number of entities at a time from the server. :param offset: The index of the ...
python
def iter(self, offset=0, count=None, pagesize=None, **kwargs): """Iterates over the collection. This method is equivalent to the :meth:`list` method, but it returns an iterator and can load a certain number of entities at a time from the server. :param offset: The index of the ...
[ "def", "iter", "(", "self", ",", "offset", "=", "0", ",", "count", "=", "None", ",", "pagesize", "=", "None", ",", "*", "*", "kwargs", ")", ":", "assert", "pagesize", "is", "None", "or", "pagesize", ">", "0", "if", "count", "is", "None", ":", "co...
Iterates over the collection. This method is equivalent to the :meth:`list` method, but it returns an iterator and can load a certain number of entities at a time from the server. :param offset: The index of the first entity to return (optional). :type offset: ``integer`` ...
[ "Iterates", "over", "the", "collection", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1390-L1440
train
splunk/splunk-sdk-python
splunklib/client.py
ReadOnlyCollection.list
def list(self, count=None, **kwargs): """Retrieves a list of entities in this collection. The entire collection is loaded at once and is returned as a list. This function makes a single roundtrip to the server, plus at most two more if the ``autologin`` field of :func:`connect` is set t...
python
def list(self, count=None, **kwargs): """Retrieves a list of entities in this collection. The entire collection is loaded at once and is returned as a list. This function makes a single roundtrip to the server, plus at most two more if the ``autologin`` field of :func:`connect` is set t...
[ "def", "list", "(", "self", ",", "count", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# response = self.get(count=count, **kwargs)", "# return self._load_list(response)", "return", "list", "(", "self", ".", "iter", "(", "count", "=", "count", ",", "*", "*...
Retrieves a list of entities in this collection. The entire collection is loaded at once and is returned as a list. This function makes a single roundtrip to the server, plus at most two more if the ``autologin`` field of :func:`connect` is set to ``True``. There is no caching--every ca...
[ "Retrieves", "a", "list", "of", "entities", "in", "this", "collection", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1443-L1472
train
splunk/splunk-sdk-python
splunklib/client.py
Collection.delete
def delete(self, name, **params): """Deletes a specified entity from the collection. :param name: The name of the entity to delete. :type name: ``string`` :return: The collection. :rtype: ``self`` This method is implemented for consistency with the REST API's DELETE ...
python
def delete(self, name, **params): """Deletes a specified entity from the collection. :param name: The name of the entity to delete. :type name: ``string`` :return: The collection. :rtype: ``self`` This method is implemented for consistency with the REST API's DELETE ...
[ "def", "delete", "(", "self", ",", "name", ",", "*", "*", "params", ")", ":", "name", "=", "UrlEncoded", "(", "name", ",", "encode_slash", "=", "True", ")", "if", "'namespace'", "in", "params", ":", "namespace", "=", "params", ".", "pop", "(", "'name...
Deletes a specified entity from the collection. :param name: The name of the entity to delete. :type name: ``string`` :return: The collection. :rtype: ``self`` This method is implemented for consistency with the REST API's DELETE method. If there is no *name* e...
[ "Deletes", "a", "specified", "entity", "from", "the", "collection", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1572-L1613
train
splunk/splunk-sdk-python
splunklib/client.py
Collection.get
def get(self, name="", owner=None, app=None, sharing=None, **query): """Performs a GET request to the server on the collection. If *owner*, *app*, and *sharing* are omitted, this method takes a default namespace from the :class:`Service` object for this :class:`Endpoint`. All other keyw...
python
def get(self, name="", owner=None, app=None, sharing=None, **query): """Performs a GET request to the server on the collection. If *owner*, *app*, and *sharing* are omitted, this method takes a default namespace from the :class:`Service` object for this :class:`Endpoint`. All other keyw...
[ "def", "get", "(", "self", ",", "name", "=", "\"\"", ",", "owner", "=", "None", ",", "app", "=", "None", ",", "sharing", "=", "None", ",", "*", "*", "query", ")", ":", "name", "=", "UrlEncoded", "(", "name", ",", "encode_slash", "=", "True", ")",...
Performs a GET request to the server on the collection. If *owner*, *app*, and *sharing* are omitted, this method takes a default namespace from the :class:`Service` object for this :class:`Endpoint`. All other keyword arguments are included in the URL as query parameters. :raises Auth...
[ "Performs", "a", "GET", "request", "to", "the", "server", "on", "the", "collection", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1615-L1661
train
splunk/splunk-sdk-python
splunklib/client.py
Stanza.submit
def submit(self, stanza): """Adds keys to the current configuration stanza as a dictionary of key-value pairs. :param stanza: A dictionary of key-value pairs for the stanza. :type stanza: ``dict`` :return: The :class:`Stanza` object. """ body = _encode(**stanza) ...
python
def submit(self, stanza): """Adds keys to the current configuration stanza as a dictionary of key-value pairs. :param stanza: A dictionary of key-value pairs for the stanza. :type stanza: ``dict`` :return: The :class:`Stanza` object. """ body = _encode(**stanza) ...
[ "def", "submit", "(", "self", ",", "stanza", ")", ":", "body", "=", "_encode", "(", "*", "*", "stanza", ")", "self", ".", "service", ".", "post", "(", "self", ".", "path", ",", "body", "=", "body", ")", "return", "self" ]
Adds keys to the current configuration stanza as a dictionary of key-value pairs. :param stanza: A dictionary of key-value pairs for the stanza. :type stanza: ``dict`` :return: The :class:`Stanza` object.
[ "Adds", "keys", "to", "the", "current", "configuration", "stanza", "as", "a", "dictionary", "of", "key", "-", "value", "pairs", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1757-L1767
train
splunk/splunk-sdk-python
splunklib/client.py
Indexes.delete
def delete(self, name): """ Deletes a given index. **Note**: This method is only supported in Splunk 5.0 and later. :param name: The name of the index to delete. :type name: ``string`` """ if self.service.splunk_version >= (5,): Collection.delete(self, name)...
python
def delete(self, name): """ Deletes a given index. **Note**: This method is only supported in Splunk 5.0 and later. :param name: The name of the index to delete. :type name: ``string`` """ if self.service.splunk_version >= (5,): Collection.delete(self, name)...
[ "def", "delete", "(", "self", ",", "name", ")", ":", "if", "self", ".", "service", ".", "splunk_version", ">=", "(", "5", ",", ")", ":", "Collection", ".", "delete", "(", "self", ",", "name", ")", "else", ":", "raise", "IllegalOperationException", "(",...
Deletes a given index. **Note**: This method is only supported in Splunk 5.0 and later. :param name: The name of the index to delete. :type name: ``string``
[ "Deletes", "a", "given", "index", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1913-L1925
train
splunk/splunk-sdk-python
splunklib/client.py
Index.attached_socket
def attached_socket(self, *args, **kwargs): """Opens a raw socket in a ``with`` block to write data to Splunk. The arguments are identical to those for :meth:`attach`. The socket is automatically closed at the end of the ``with`` block, even if an exception is raised in the block. ...
python
def attached_socket(self, *args, **kwargs): """Opens a raw socket in a ``with`` block to write data to Splunk. The arguments are identical to those for :meth:`attach`. The socket is automatically closed at the end of the ``with`` block, even if an exception is raised in the block. ...
[ "def", "attached_socket", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "sock", "=", "self", ".", "attach", "(", "*", "args", ",", "*", "*", "kwargs", ")", "yield", "sock", "finally", ":", "sock", ".", "shutdown", ...
Opens a raw socket in a ``with`` block to write data to Splunk. The arguments are identical to those for :meth:`attach`. The socket is automatically closed at the end of the ``with`` block, even if an exception is raised in the block. :param host: The host value for events written to t...
[ "Opens", "a", "raw", "socket", "in", "a", "with", "block", "to", "write", "data", "to", "Splunk", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1977-L2008
train
splunk/splunk-sdk-python
splunklib/client.py
Index.clean
def clean(self, timeout=60): """Deletes the contents of the index. This method blocks until the index is empty, because it needs to restore values at the end of the operation. :param timeout: The time-out period for the operation, in seconds (the default is 60). :ty...
python
def clean(self, timeout=60): """Deletes the contents of the index. This method blocks until the index is empty, because it needs to restore values at the end of the operation. :param timeout: The time-out period for the operation, in seconds (the default is 60). :ty...
[ "def", "clean", "(", "self", ",", "timeout", "=", "60", ")", ":", "self", ".", "refresh", "(", ")", "tds", "=", "self", "[", "'maxTotalDataSizeMB'", "]", "ftp", "=", "self", "[", "'frozenTimePeriodInSecs'", "]", "was_disabled_initially", "=", "self", ".", ...
Deletes the contents of the index. This method blocks until the index is empty, because it needs to restore values at the end of the operation. :param timeout: The time-out period for the operation, in seconds (the default is 60). :type timeout: ``integer`` :return...
[ "Deletes", "the", "contents", "of", "the", "index", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2010-L2053
train
splunk/splunk-sdk-python
splunklib/client.py
Index.submit
def submit(self, event, host=None, source=None, sourcetype=None): """Submits a single event to the index using ``HTTP POST``. :param event: The event to submit. :type event: ``string`` :param `host`: The host value of the event. :type host: ``string`` :param `source`: Th...
python
def submit(self, event, host=None, source=None, sourcetype=None): """Submits a single event to the index using ``HTTP POST``. :param event: The event to submit. :type event: ``string`` :param `host`: The host value of the event. :type host: ``string`` :param `source`: Th...
[ "def", "submit", "(", "self", ",", "event", ",", "host", "=", "None", ",", "source", "=", "None", ",", "sourcetype", "=", "None", ")", ":", "args", "=", "{", "'index'", ":", "self", ".", "name", "}", "if", "host", "is", "not", "None", ":", "args"...
Submits a single event to the index using ``HTTP POST``. :param event: The event to submit. :type event: ``string`` :param `host`: The host value of the event. :type host: ``string`` :param `source`: The source value of the event. :type source: ``string`` :param ...
[ "Submits", "a", "single", "event", "to", "the", "index", "using", "HTTP", "POST", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2063-L2087
train
splunk/splunk-sdk-python
splunklib/client.py
Index.upload
def upload(self, filename, **kwargs): """Uploads a file for immediate indexing. **Note**: The file must be locally accessible from the server. :param filename: The name of the file to upload. The file can be a plain, compressed, or archived file. :type filename: ``string`` ...
python
def upload(self, filename, **kwargs): """Uploads a file for immediate indexing. **Note**: The file must be locally accessible from the server. :param filename: The name of the file to upload. The file can be a plain, compressed, or archived file. :type filename: ``string`` ...
[ "def", "upload", "(", "self", ",", "filename", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'index'", "]", "=", "self", ".", "name", "path", "=", "'data/inputs/oneshot'", "self", ".", "service", ".", "post", "(", "path", ",", "name", "=", "file...
Uploads a file for immediate indexing. **Note**: The file must be locally accessible from the server. :param filename: The name of the file to upload. The file can be a plain, compressed, or archived file. :type filename: ``string`` :param kwargs: Additional arguments (opti...
[ "Uploads", "a", "file", "for", "immediate", "indexing", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2090-L2107
train
splunk/splunk-sdk-python
splunklib/client.py
Input.update
def update(self, **kwargs): """Updates the server with any changes you've made to the current input along with any additional arguments you specify. :param kwargs: Additional arguments (optional). For more about the available parameters, see `Input parameters <http://dev.splunk.com/...
python
def update(self, **kwargs): """Updates the server with any changes you've made to the current input along with any additional arguments you specify. :param kwargs: Additional arguments (optional). For more about the available parameters, see `Input parameters <http://dev.splunk.com/...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# UDP and TCP inputs require special handling due to their restrictToHost", "# field. For all other inputs kinds, we can dispatch to the superclass method.", "if", "self", ".", "kind", "not", "in", "[", "'tcp'", ...
Updates the server with any changes you've made to the current input along with any additional arguments you specify. :param kwargs: Additional arguments (optional). For more about the available parameters, see `Input parameters <http://dev.splunk.com/view/SP-CAAAEE6#inputparams>`_ on Splun...
[ "Updates", "the", "server", "with", "any", "changes", "you", "ve", "made", "to", "the", "current", "input", "along", "with", "any", "additional", "arguments", "you", "specify", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2137-L2173
train
splunk/splunk-sdk-python
splunklib/client.py
Inputs.create
def create(self, name, kind, **kwargs): """Creates an input of a specific kind in this collection, with any arguments you specify. :param `name`: The input name. :type name: ``string`` :param `kind`: The kind of input: - "ad": Active Directory - "monito...
python
def create(self, name, kind, **kwargs): """Creates an input of a specific kind in this collection, with any arguments you specify. :param `name`: The input name. :type name: ``string`` :param `kind`: The kind of input: - "ad": Active Directory - "monito...
[ "def", "create", "(", "self", ",", "name", ",", "kind", ",", "*", "*", "kwargs", ")", ":", "kindpath", "=", "self", ".", "kindpath", "(", "kind", ")", "self", ".", "post", "(", "kindpath", ",", "name", "=", "name", ",", "*", "*", "kwargs", ")", ...
Creates an input of a specific kind in this collection, with any arguments you specify. :param `name`: The input name. :type name: ``string`` :param `kind`: The kind of input: - "ad": Active Directory - "monitor": Files and directories - "registry"...
[ "Creates", "an", "input", "of", "a", "specific", "kind", "in", "this", "collection", "with", "any", "arguments", "you", "specify", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2264-L2314
train
splunk/splunk-sdk-python
splunklib/client.py
Inputs.delete
def delete(self, name, kind=None): """Removes an input from the collection. :param `kind`: The kind of input: - "ad": Active Directory - "monitor": Files and directories - "registry": Windows Registry - "script": Scripts - "splunktcp": TC...
python
def delete(self, name, kind=None): """Removes an input from the collection. :param `kind`: The kind of input: - "ad": Active Directory - "monitor": Files and directories - "registry": Windows Registry - "script": Scripts - "splunktcp": TC...
[ "def", "delete", "(", "self", ",", "name", ",", "kind", "=", "None", ")", ":", "if", "kind", "is", "None", ":", "self", ".", "service", ".", "delete", "(", "self", "[", "name", "]", ".", "path", ")", "else", ":", "self", ".", "service", ".", "d...
Removes an input from the collection. :param `kind`: The kind of input: - "ad": Active Directory - "monitor": Files and directories - "registry": Windows Registry - "script": Scripts - "splunktcp": TCP, processed - "tcp": TCP, unproc...
[ "Removes", "an", "input", "from", "the", "collection", "." ]
a245a4eeb93b3621730418008e31715912bcdcd8
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2316-L2351
train