Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
find_container_traits
(cls_or_string)
Find the container traits type of a declaration. Args: cls_or_string (str | declarations.declaration_t): a string Returns: declarations.container_traits: a container traits
Find the container traits type of a declaration.
def find_container_traits(cls_or_string): """ Find the container traits type of a declaration. Args: cls_or_string (str | declarations.declaration_t): a string Returns: declarations.container_traits: a container traits """ if utils.is_str(cls_or_string): if not templat...
[ "def", "find_container_traits", "(", "cls_or_string", ")", ":", "if", "utils", ".", "is_str", "(", "cls_or_string", ")", ":", "if", "not", "templates", ".", "is_instantiation", "(", "cls_or_string", ")", ":", "return", "None", "name", "=", "templates", ".", ...
[ 697, 0 ]
[ 732, 33 ]
python
en
['en', 'error', 'th']
False
container_traits_impl_t.__init__
( self, container_name, element_type_index, element_type_typedef, eraser, key_type_index=None, key_type_typedef=None, unordered_maps_and_sets=False)
:param container_name: std container name :param element_type_index: position of value\\mapped type within template arguments list :param element_type_typedef: class typedef to the value\\mapped type :param key_type_index: position of key type within template arguments l...
:param container_name: std container name :param element_type_index: position of value\\mapped type within template arguments list :param element_type_typedef: class typedef to the value\\mapped type :param key_type_index: position of key type within template arguments l...
def __init__( self, container_name, element_type_index, element_type_typedef, eraser, key_type_index=None, key_type_typedef=None, unordered_maps_and_sets=False): """ :param container_name: std container name ...
[ "def", "__init__", "(", "self", ",", "container_name", ",", "element_type_index", ",", "element_type_typedef", ",", "eraser", ",", "key_type_index", "=", "None", ",", "key_type_typedef", "=", "None", ",", "unordered_maps_and_sets", "=", "False", ")", ":", "self", ...
[ 342, 4 ]
[ 369, 61 ]
python
en
['en', 'error', 'th']
False
container_traits_impl_t.get_container_or_none
(self, type_)
Returns reference to the class declaration or None.
Returns reference to the class declaration or None.
def get_container_or_none(self, type_): """ Returns reference to the class declaration or None. """ type_ = type_traits.remove_alias(type_) type_ = type_traits.remove_cv(type_) utils.loggers.queries_engine.debug( "Container traits: cleaned up search %s", ty...
[ "def", "get_container_or_none", "(", "self", ",", "type_", ")", ":", "type_", "=", "type_traits", ".", "remove_alias", "(", "type_", ")", "type_", "=", "type_traits", ".", "remove_cv", "(", "type_", ")", "utils", ".", "loggers", ".", "queries_engine", ".", ...
[ 374, 4 ]
[ 429, 75 ]
python
en
['en', 'error', 'th']
False
container_traits_impl_t.is_my_case
(self, type_)
Checks, whether type is STD container or not.
Checks, whether type is STD container or not.
def is_my_case(self, type_): """ Checks, whether type is STD container or not. """ return bool(self.get_container_or_none(type_))
[ "def", "is_my_case", "(", "self", ",", "type_", ")", ":", "return", "bool", "(", "self", ".", "get_container_or_none", "(", "type_", ")", ")" ]
[ 431, 4 ]
[ 437, 54 ]
python
en
['en', 'error', 'th']
False
container_traits_impl_t.class_declaration
(self, type_)
Returns reference to the class declaration.
Returns reference to the class declaration.
def class_declaration(self, type_): """ Returns reference to the class declaration. """ utils.loggers.queries_engine.debug( "Container traits: searching class declaration for %s", type_) cls_declaration = self.get_container_or_none(type_) if not cls_declara...
[ "def", "class_declaration", "(", "self", ",", "type_", ")", ":", "utils", ".", "loggers", ".", "queries_engine", ".", "debug", "(", "\"Container traits: searching class declaration for %s\"", ",", "type_", ")", "cls_declaration", "=", "self", ".", "get_container_or_no...
[ 439, 4 ]
[ 453, 30 ]
python
en
['en', 'error', 'th']
False
container_traits_impl_t.element_type
(self, type_)
returns reference to the class value\\mapped type declaration
returns reference to the class value\\mapped type declaration
def element_type(self, type_): """returns reference to the class value\\mapped type declaration""" return self.__find_xxx_type( type_, self.element_type_index, self.element_type_typedef, 'container_element_type')
[ "def", "element_type", "(", "self", ",", "type_", ")", ":", "return", "self", ".", "__find_xxx_type", "(", "type_", ",", "self", ".", "element_type_index", ",", "self", ".", "element_type_typedef", ",", "'container_element_type'", ")" ]
[ 487, 4 ]
[ 493, 37 ]
python
en
['en', 'en', 'en']
True
container_traits_impl_t.key_type
(self, type_)
returns reference to the class key type declaration
returns reference to the class key type declaration
def key_type(self, type_): """returns reference to the class key type declaration""" if not self.is_mapping(type_): raise TypeError( 'Type "%s" is not "mapping" container' % str(type_)) return self.__find_xxx_type( type_, self.k...
[ "def", "key_type", "(", "self", ",", "type_", ")", ":", "if", "not", "self", ".", "is_mapping", "(", "type_", ")", ":", "raise", "TypeError", "(", "'Type \"%s\" is not \"mapping\" container'", "%", "str", "(", "type_", ")", ")", "return", "self", ".", "__f...
[ 495, 4 ]
[ 505, 33 ]
python
en
['en', 'en', 'en']
True
container_traits_impl_t.remove_defaults
(self, type_or_string)
Removes template defaults from a templated class instantiation. For example: .. code-block:: c++ std::vector< int, std::allocator< int > > will become: .. code-block:: c++ std::vector< int >
Removes template defaults from a templated class instantiation.
def remove_defaults(self, type_or_string): """ Removes template defaults from a templated class instantiation. For example: .. code-block:: c++ std::vector< int, std::allocator< int > > will become: .. code-block:: c++ std::vector...
[ "def", "remove_defaults", "(", "self", ",", "type_or_string", ")", ":", "name", "=", "type_or_string", "if", "not", "utils", ".", "is_str", "(", "type_or_string", ")", ":", "name", "=", "self", ".", "class_declaration", "(", "type_or_string", ")", ".", "name...
[ 507, 4 ]
[ 532, 30 ]
python
en
['en', 'error', 'th']
False
linker_t.instance
(self, inst)
Called by __parse_xml_file in source_reader.
Called by __parse_xml_file in source_reader.
def instance(self, inst): """ Called by __parse_xml_file in source_reader. """ self.__inst = inst # use inst, to reduce attribute access time if isinstance(inst, declarations.declaration_t) and \ inst.location is not None and \ inst.loca...
[ "def", "instance", "(", "self", ",", "inst", ")", ":", "self", ".", "__inst", "=", "inst", "# use inst, to reduce attribute access time", "if", "isinstance", "(", "inst", ",", "declarations", ".", "declaration_t", ")", "and", "inst", ".", "location", "is", "no...
[ 34, 4 ]
[ 46, 75 ]
python
en
['en', 'error', 'th']
False
CIDRRange.__init__
(self, spec: str)
Initialize a CIDRRange from a spec, which can look like any of: 127.0.0.1 -- an exact IPv4 match ::1 -- an exact IPv6 match 192.168.0.0/16 -- an IPv4 range 2001:2000::/64 -- an IPv6 range If the prefix is not a valid IP address, or if the prefix length isn't a ...
Initialize a CIDRRange from a spec, which can look like any of:
def __init__(self, spec: str) -> None: """ Initialize a CIDRRange from a spec, which can look like any of: 127.0.0.1 -- an exact IPv4 match ::1 -- an exact IPv6 match 192.168.0.0/16 -- an IPv4 range 2001:2000::/64 -- an IPv6 range If the prefix is not a valid IP...
[ "def", "__init__", "(", "self", ",", "spec", ":", "str", ")", "->", "None", ":", "self", ".", "error", ":", "Optional", "[", "str", "]", "=", "None", "self", ".", "address", ":", "Optional", "[", "str", "]", "=", "None", "self", ".", "prefix_len", ...
[ 10, 4 ]
[ 65, 33 ]
python
en
['en', 'error', 'th']
False
CIDRRange.__bool__
(self)
A CIDRRange will evaluate as True IFF there is no error, the address is not None, and the prefix_len is not None.
A CIDRRange will evaluate as True IFF there is no error, the address is not None, and the prefix_len is not None.
def __bool__(self) -> bool: """ A CIDRRange will evaluate as True IFF there is no error, the address is not None, and the prefix_len is not None. """ return ((not self.error) and (self.address is not None) and (self.prefix_len is not None))
[ "def", "__bool__", "(", "self", ")", "->", "bool", ":", "return", "(", "(", "not", "self", ".", "error", ")", "and", "(", "self", ".", "address", "is", "not", "None", ")", "and", "(", "self", ".", "prefix_len", "is", "not", "None", ")", ")" ]
[ 67, 4 ]
[ 75, 46 ]
python
en
['en', 'error', 'th']
False
CIDRRange.as_dict
(self)
Return a dictionary version of a CIDRRange, suitable for use in an Envoy config as an envoy.api.v3.core.CidrRange.
Return a dictionary version of a CIDRRange, suitable for use in an Envoy config as an envoy.api.v3.core.CidrRange.
def as_dict(self) -> dict: """ Return a dictionary version of a CIDRRange, suitable for use in an Envoy config as an envoy.api.v3.core.CidrRange. """ return { "address_prefix": self.address, "prefix_len": self.prefix_len }
[ "def", "as_dict", "(", "self", ")", "->", "dict", ":", "return", "{", "\"address_prefix\"", ":", "self", ".", "address", ",", "\"prefix_len\"", ":", "self", ".", "prefix_len", "}" ]
[ 83, 4 ]
[ 92, 9 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler.__init__
( self, profile_dataset, excluded_expectations: list = None, ignored_columns: list = None, not_null_only: bool = False, primary_or_compound_key: list = False, semantic_types_dict: dict = None, table_expectations_only: bool = False, value_set_thresh...
The UserConfigurableProfiler is used to build an expectation suite from a dataset. The profiler may be instantiated with or without a config. The config may contain a semantic_types dict or not. Once a profiler is instantiated, if config items change, a new profiler will be needed. Wri...
The UserConfigurableProfiler is used to build an expectation suite from a dataset. The profiler may be instantiated with or without a config. The config may contain a semantic_types dict or not. Once a profiler is instantiated, if config items change, a new profiler will be needed.
def __init__( self, profile_dataset, excluded_expectations: list = None, ignored_columns: list = None, not_null_only: bool = False, primary_or_compound_key: list = False, semantic_types_dict: dict = None, table_expectations_only: bool = False, valu...
[ "def", "__init__", "(", "self", ",", "profile_dataset", ",", "excluded_expectations", ":", "list", "=", "None", ",", "ignored_columns", ":", "list", "=", "None", ",", "not_null_only", ":", "bool", "=", "False", ",", "primary_or_compound_key", ":", "list", "=",...
[ 58, 4 ]
[ 192, 9 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler.build_suite
(self)
User-facing expectation-suite building function. Works with an instantiated UserConfigurableProfiler object. Args: Returns: An expectation suite built either with or without a semantic_types dict
User-facing expectation-suite building function. Works with an instantiated UserConfigurableProfiler object. Args:
def build_suite(self): """ User-facing expectation-suite building function. Works with an instantiated UserConfigurableProfiler object. Args: Returns: An expectation suite built either with or without a semantic_types dict """ if len(self.profile_dataset.get...
[ "def", "build_suite", "(", "self", ")", ":", "if", "len", "(", "self", ".", "profile_dataset", ".", "get_expectation_suite", "(", ")", ".", "expectations", ")", ">", "0", ":", "# noinspection PyProtectedMember", "suite_name", "=", "self", ".", "profile_dataset",...
[ 194, 4 ]
[ 211, 58 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectation_suite_from_semantic_types_dict
(self)
Uses a semantic_type dict to determine which expectations to add to the suite, then builds the suite Args: Returns: An expectation suite built from a semantic_types dict
Uses a semantic_type dict to determine which expectations to add to the suite, then builds the suite Args:
def _build_expectation_suite_from_semantic_types_dict(self): """ Uses a semantic_type dict to determine which expectations to add to the suite, then builds the suite Args: Returns: An expectation suite built from a semantic_types dict """ if not self.semantic...
[ "def", "_build_expectation_suite_from_semantic_types_dict", "(", "self", ")", ":", "if", "not", "self", ".", "semantic_types_dict", ":", "raise", "ValueError", "(", "\"A config with a semantic_types dict must be included in order to use this profiler.\"", ")", "self", ".", "_bu...
[ 213, 4 ]
[ 260, 32 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._profile_and_build_expectation_suite
(self)
Profiles the provided dataset to determine which expectations to add to the suite, then builds the suite Args: Returns: An expectation suite built after profiling the dataset
Profiles the provided dataset to determine which expectations to add to the suite, then builds the suite Args:
def _profile_and_build_expectation_suite(self): """ Profiles the provided dataset to determine which expectations to add to the suite, then builds the suite Args: Returns: An expectation suite built after profiling the dataset """ if self.primary_or_compound_...
[ "def", "_profile_and_build_expectation_suite", "(", "self", ")", ":", "if", "self", ".", "primary_or_compound_key", ":", "self", ".", "_build_expectations_primary_or_compound_key", "(", "profile_dataset", "=", "self", ".", "profile_dataset", ",", "column_list", "=", "se...
[ 262, 4 ]
[ 313, 32 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._validate_semantic_types_dict
(self, profile_dataset)
Validates a semantic_types dict to ensure correct formatting, that all semantic_types are recognized, and that the semantic_types align with the column data types Args: profile_dataset: A GE dataset config: A config dictionary Returns: The validated ...
Validates a semantic_types dict to ensure correct formatting, that all semantic_types are recognized, and that the semantic_types align with the column data types Args: profile_dataset: A GE dataset config: A config dictionary
def _validate_semantic_types_dict(self, profile_dataset): """ Validates a semantic_types dict to ensure correct formatting, that all semantic_types are recognized, and that the semantic_types align with the column data types Args: profile_dataset: A GE dataset con...
[ "def", "_validate_semantic_types_dict", "(", "self", ",", "profile_dataset", ")", ":", "if", "not", "isinstance", "(", "self", ".", "semantic_types_dict", ",", "dict", ")", ":", "raise", "ValueError", "(", "f\"The semantic_types dict in the config must be a dictionary, bu...
[ 315, 4 ]
[ 374, 39 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._add_column_type_to_column_info
(self, profile_dataset, column_name)
Adds the data type of a column to the column_info dictionary on self Args: profile_dataset: A GE dataset column_name: The name of the column for which to retrieve the data type Returns: The type of the column
Adds the data type of a column to the column_info dictionary on self Args: profile_dataset: A GE dataset column_name: The name of the column for which to retrieve the data type
def _add_column_type_to_column_info(self, profile_dataset, column_name): """ Adds the data type of a column to the column_info dictionary on self Args: profile_dataset: A GE dataset column_name: The name of the column for which to retrieve the data type Returns: ...
[ "def", "_add_column_type_to_column_info", "(", "self", ",", "profile_dataset", ",", "column_name", ")", ":", "if", "\"expect_column_values_to_be_in_type_list\"", "in", "self", ".", "excluded_expectations", ":", "logger", ".", "info", "(", "\"expect_column_values_to_be_in_ty...
[ 376, 4 ]
[ 401, 26 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._get_column_type
(self, profile_dataset, column)
Determines the data type of a column by evaluating the success of `expect_column_values_to_be_in_type_list`. In the case of type Decimal, this data type is returned as NUMERIC, which contains the type lists for both INTs and FLOATs. The type_list expectation used here is removed, since...
Determines the data type of a column by evaluating the success of `expect_column_values_to_be_in_type_list`. In the case of type Decimal, this data type is returned as NUMERIC, which contains the type lists for both INTs and FLOATs.
def _get_column_type(self, profile_dataset, column): """ Determines the data type of a column by evaluating the success of `expect_column_values_to_be_in_type_list`. In the case of type Decimal, this data type is returned as NUMERIC, which contains the type lists for both INTs and FLOATs...
[ "def", "_get_column_type", "(", "self", ",", "profile_dataset", ",", "column", ")", ":", "# list of types is used to support pandas and sqlalchemy", "type_", "=", "None", "try", ":", "if", "(", "profile_dataset", ".", "expect_column_values_to_be_in_type_list", "(", "colum...
[ 403, 4 ]
[ 477, 20 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._add_column_cardinality_to_column_info
(self, profile_dataset, column_name)
Adds the cardinality of a column to the column_info dictionary on self Args: profile_dataset: A GE Dataset column_name: The name of the column for which to add cardinality Returns: The cardinality of the column
Adds the cardinality of a column to the column_info dictionary on self Args: profile_dataset: A GE Dataset column_name: The name of the column for which to add cardinality
def _add_column_cardinality_to_column_info(self, profile_dataset, column_name): """ Adds the cardinality of a column to the column_info dictionary on self Args: profile_dataset: A GE Dataset column_name: The name of the column for which to add cardinality Returns...
[ "def", "_add_column_cardinality_to_column_info", "(", "self", ",", "profile_dataset", ",", "column_name", ")", ":", "column_info_entry", "=", "self", ".", "column_info", ".", "get", "(", "column_name", ")", "if", "not", "column_info_entry", ":", "column_info_entry", ...
[ 479, 4 ]
[ 513, 33 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._get_column_cardinality
(self, profile_dataset, column)
Determines the cardinality of a column using the get_basic_column_cardinality method from OrderedProfilerCardinality Args: profile_dataset: A GE Dataset column: The column for which to get cardinality Returns: The cardinality of the specified column ...
Determines the cardinality of a column using the get_basic_column_cardinality method from OrderedProfilerCardinality Args: profile_dataset: A GE Dataset column: The column for which to get cardinality
def _get_column_cardinality(self, profile_dataset, column): """ Determines the cardinality of a column using the get_basic_column_cardinality method from OrderedProfilerCardinality Args: profile_dataset: A GE Dataset column: The column for which to get cardinality...
[ "def", "_get_column_cardinality", "(", "self", ",", "profile_dataset", ",", "column", ")", ":", "num_unique", "=", "None", "pct_unique", "=", "None", "try", ":", "num_unique", "=", "profile_dataset", ".", "expect_column_unique_value_count_to_be_between", "(", "column"...
[ 515, 4 ]
[ 550, 31 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._add_semantic_types_by_column_from_config_to_column_info
(self, column_name)
Adds the semantic type of a column to the column_info dict on self, for display purposes after suite creation Args: column_name: The name of the column Returns: A list of semantic_types for a given column
Adds the semantic type of a column to the column_info dict on self, for display purposes after suite creation Args: column_name: The name of the column
def _add_semantic_types_by_column_from_config_to_column_info(self, column_name): """ Adds the semantic type of a column to the column_info dict on self, for display purposes after suite creation Args: column_name: The name of the column Returns: A list of semanti...
[ "def", "_add_semantic_types_by_column_from_config_to_column_info", "(", "self", ",", "column_name", ")", ":", "column_info_entry", "=", "self", ".", "column_info", ".", "get", "(", "column_name", ")", "if", "not", "column_info_entry", ":", "column_info_entry", "=", "{...
[ 552, 4 ]
[ 589, 29 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_column_description_metadata
(self, profile_dataset)
Adds column description metadata to the suite on a Dataset object Args: profile_dataset: A GE Dataset Returns: An expectation suite with column description metadata
Adds column description metadata to the suite on a Dataset object Args: profile_dataset: A GE Dataset
def _build_column_description_metadata(self, profile_dataset): """ Adds column description metadata to the suite on a Dataset object Args: profile_dataset: A GE Dataset Returns: An expectation suite with column description metadata """ columns = s...
[ "def", "_build_column_description_metadata", "(", "self", ",", "profile_dataset", ")", ":", "columns", "=", "self", ".", "all_table_columns", "expectation_suite", "=", "profile_dataset", ".", "get_expectation_suite", "(", "suppress_warnings", "=", "True", ",", "discard_...
[ 591, 4 ]
[ 613, 32 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._display_suite_by_column
(self, suite)
Displays the expectations of a suite by column, along with the column cardinality, and semantic or data type so that a user can easily see which expectations were created for which columns Args: suite: An ExpectationSuite Returns: The ExpectationSuite
Displays the expectations of a suite by column, along with the column cardinality, and semantic or data type so that a user can easily see which expectations were created for which columns Args: suite: An ExpectationSuite
def _display_suite_by_column(self, suite): """ Displays the expectations of a suite by column, along with the column cardinality, and semantic or data type so that a user can easily see which expectations were created for which columns Args: suite: An ExpectationSuite ...
[ "def", "_display_suite_by_column", "(", "self", ",", "suite", ")", ":", "expectations", "=", "suite", ".", "expectations", "expectations_by_column", "=", "{", "}", "for", "expectation", "in", "expectations", ":", "domain", "=", "expectation", "[", "\"kwargs\"", ...
[ 615, 4 ]
[ 685, 19 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_value_set
(self, profile_dataset, column, **kwargs)
Adds a value_set expectation for a given column Args: profile_dataset: A GE Dataset column: The column for which to add an expectation **kwargs: Returns: The GE Dataset
Adds a value_set expectation for a given column Args: profile_dataset: A GE Dataset column: The column for which to add an expectation **kwargs:
def _build_expectations_value_set(self, profile_dataset, column, **kwargs): """ Adds a value_set expectation for a given column Args: profile_dataset: A GE Dataset column: The column for which to add an expectation **kwargs: Returns: The G...
[ "def", "_build_expectations_value_set", "(", "self", ",", "profile_dataset", ",", "column", ",", "*", "*", "kwargs", ")", ":", "if", "\"expect_column_values_to_be_in_set\"", "not", "in", "self", ".", "excluded_expectations", ":", "value_set", "=", "profile_dataset", ...
[ 687, 4 ]
[ 714, 30 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_numeric
(self, profile_dataset, column, **kwargs)
Adds a set of numeric expectations for a given column Args: profile_dataset: A GE Dataset column: The column for which to add expectations **kwargs: Returns: The GE Dataset
Adds a set of numeric expectations for a given column Args: profile_dataset: A GE Dataset column: The column for which to add expectations **kwargs:
def _build_expectations_numeric(self, profile_dataset, column, **kwargs): """ Adds a set of numeric expectations for a given column Args: profile_dataset: A GE Dataset column: The column for which to add expectations **kwargs: Returns: The...
[ "def", "_build_expectations_numeric", "(", "self", ",", "profile_dataset", ",", "column", ",", "*", "*", "kwargs", ")", ":", "# min", "if", "\"expect_column_min_to_be_between\"", "not", "in", "self", ".", "excluded_expectations", ":", "observed_min", "=", "profile_d...
[ 716, 4 ]
[ 893, 30 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_primary_or_compound_key
( self, profile_dataset, column_list, **kwargs )
Adds a uniqueness expectation for a given column or set of columns Args: profile_dataset: A GE Dataset column_list: A list containing one or more columns for which to add a uniqueness expectation **kwargs: Returns: The GE Dataset
Adds a uniqueness expectation for a given column or set of columns Args: profile_dataset: A GE Dataset column_list: A list containing one or more columns for which to add a uniqueness expectation **kwargs:
def _build_expectations_primary_or_compound_key( self, profile_dataset, column_list, **kwargs ): """ Adds a uniqueness expectation for a given column or set of columns Args: profile_dataset: A GE Dataset column_list: A list containing one or more columns for w...
[ "def", "_build_expectations_primary_or_compound_key", "(", "self", ",", "profile_dataset", ",", "column_list", ",", "*", "*", "kwargs", ")", ":", "# uniqueness", "if", "(", "len", "(", "column_list", ")", ">", "1", "and", "\"expect_compound_columns_to_be_unique\"", ...
[ 895, 4 ]
[ 931, 30 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_string
(self, profile_dataset, column, **kwargs)
Adds a set of string expectations for a given column. Currently does not do anything. With the 0.12 API there isn't a quick way to introspect for value_lengths - if we did that, we could build a potentially useful value_lengths expectation here. Args: profile_dataset: A GE D...
Adds a set of string expectations for a given column. Currently does not do anything. With the 0.12 API there isn't a quick way to introspect for value_lengths - if we did that, we could build a potentially useful value_lengths expectation here. Args: profile_dataset: A GE D...
def _build_expectations_string(self, profile_dataset, column, **kwargs): """ Adds a set of string expectations for a given column. Currently does not do anything. With the 0.12 API there isn't a quick way to introspect for value_lengths - if we did that, we could build a potentially usef...
[ "def", "_build_expectations_string", "(", "self", ",", "profile_dataset", ",", "column", ",", "*", "*", "kwargs", ")", ":", "if", "(", "\"expect_column_value_lengths_to_be_between\"", "not", "in", "self", ".", "excluded_expectations", ")", ":", "pass", "return", "...
[ 933, 4 ]
[ 953, 30 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_datetime
(self, profile_dataset, column, **kwargs)
Adds `expect_column_values_to_be_between` for a given column Args: profile_dataset: A GE Dataset column: The column for which to add the expectation **kwargs: Returns: The GE Dataset
Adds `expect_column_values_to_be_between` for a given column Args: profile_dataset: A GE Dataset column: The column for which to add the expectation **kwargs:
def _build_expectations_datetime(self, profile_dataset, column, **kwargs): """ Adds `expect_column_values_to_be_between` for a given column Args: profile_dataset: A GE Dataset column: The column for which to add the expectation **kwargs: Returns: ...
[ "def", "_build_expectations_datetime", "(", "self", ",", "profile_dataset", ",", "column", ",", "*", "*", "kwargs", ")", ":", "if", "\"expect_column_values_to_be_between\"", "not", "in", "self", ".", "excluded_expectations", ":", "min_value", "=", "profile_dataset", ...
[ 955, 4 ]
[ 1017, 30 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_for_all_column_types
( self, profile_dataset, column, **kwargs )
Adds these expectations for all included columns irrespective of type. Includes: - `expect_column_values_to_not_be_null` (or `expect_column_values_to_be_null`) - `expect_column_proportion_of_unique_values_to_be_between` - `expect_column_values_to_be_in_type_list` Arg...
Adds these expectations for all included columns irrespective of type. Includes: - `expect_column_values_to_not_be_null` (or `expect_column_values_to_be_null`) - `expect_column_proportion_of_unique_values_to_be_between` - `expect_column_values_to_be_in_type_list` Arg...
def _build_expectations_for_all_column_types( self, profile_dataset, column, **kwargs ): """ Adds these expectations for all included columns irrespective of type. Includes: - `expect_column_values_to_not_be_null` (or `expect_column_values_to_be_null`) - `expect_colum...
[ "def", "_build_expectations_for_all_column_types", "(", "self", ",", "profile_dataset", ",", "column", ",", "*", "*", "kwargs", ")", ":", "if", "\"expect_column_values_to_not_be_null\"", "not", "in", "self", ".", "excluded_expectations", ":", "not_null_result", "=", "...
[ 1019, 4 ]
[ 1110, 17 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._build_expectations_table
(self, profile_dataset, **kwargs)
Adds two table level expectations to the dataset Args: profile_dataset: A GE Dataset **kwargs: Returns: The GE Dataset
Adds two table level expectations to the dataset Args: profile_dataset: A GE Dataset **kwargs:
def _build_expectations_table(self, profile_dataset, **kwargs): """ Adds two table level expectations to the dataset Args: profile_dataset: A GE Dataset **kwargs: Returns: The GE Dataset """ if ( "expect_table_columns_to_m...
[ "def", "_build_expectations_table", "(", "self", ",", "profile_dataset", ",", "*", "*", "kwargs", ")", ":", "if", "(", "\"expect_table_columns_to_match_ordered_list\"", "not", "in", "self", ".", "excluded_expectations", ")", ":", "columns", "=", "self", ".", "all_...
[ 1112, 4 ]
[ 1139, 13 ]
python
en
['en', 'error', 'th']
False
UserConfigurableProfiler._is_nan
(self, value)
If value is an array, test element-wise for NaN and return result as a boolean array. If value is a scalar, return boolean. Args: value: The value to test Returns: The results of the test
If value is an array, test element-wise for NaN and return result as a boolean array. If value is a scalar, return boolean. Args: value: The value to test
def _is_nan(self, value): """ If value is an array, test element-wise for NaN and return result as a boolean array. If value is a scalar, return boolean. Args: value: The value to test Returns: The results of the test """ try: ...
[ "def", "_is_nan", "(", "self", ",", "value", ")", ":", "try", ":", "return", "np", ".", "isnan", "(", "value", ")", "except", "TypeError", ":", "return", "True" ]
[ 1141, 4 ]
[ 1154, 23 ]
python
en
['en', 'error', 'th']
False
ExpectTableColumnCountToBeBetween.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An opt...
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. ...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "self", ".", "validate_metric_value_between_configuration", ...
[ 94, 4 ]
[ 106, 85 ]
python
en
['en', 'error', 'th']
False
is_valid_partition_object
(partition_object)
Tests whether a given object is a valid continuous or categorical partition object. :param partition_object: The partition_object to evaluate :return: Boolean
Tests whether a given object is a valid continuous or categorical partition object. :param partition_object: The partition_object to evaluate :return: Boolean
def is_valid_partition_object(partition_object): """Tests whether a given object is a valid continuous or categorical partition object. :param partition_object: The partition_object to evaluate :return: Boolean """ return is_valid_continuous_partition_object( partition_object ) or is_val...
[ "def", "is_valid_partition_object", "(", "partition_object", ")", ":", "return", "is_valid_continuous_partition_object", "(", "partition_object", ")", "or", "is_valid_categorical_partition_object", "(", "partition_object", ")" ]
[ 21, 0 ]
[ 28, 64 ]
python
en
['en', 'en', 'en']
True
is_valid_categorical_partition_object
(partition_object)
Tests whether a given object is a valid categorical partition object. :param partition_object: The partition_object to evaluate :return: Boolean
Tests whether a given object is a valid categorical partition object. :param partition_object: The partition_object to evaluate :return: Boolean
def is_valid_categorical_partition_object(partition_object): """Tests whether a given object is a valid categorical partition object. :param partition_object: The partition_object to evaluate :return: Boolean """ if ( partition_object is None or ("weights" not in partition_object) ...
[ "def", "is_valid_categorical_partition_object", "(", "partition_object", ")", ":", "if", "(", "partition_object", "is", "None", "or", "(", "\"weights\"", "not", "in", "partition_object", ")", "or", "(", "\"values\"", "not", "in", "partition_object", ")", ")", ":",...
[ 31, 0 ]
[ 45, 61 ]
python
en
['en', 'en', 'en']
True
is_valid_continuous_partition_object
(partition_object)
Tests whether a given object is a valid continuous partition object. See :ref:`partition_object`. :param partition_object: The partition_object to evaluate :return: Boolean
Tests whether a given object is a valid continuous partition object. See :ref:`partition_object`.
def is_valid_continuous_partition_object(partition_object): """Tests whether a given object is a valid continuous partition object. See :ref:`partition_object`. :param partition_object: The partition_object to evaluate :return: Boolean """ if ( (partition_object is None) or ("weight...
[ "def", "is_valid_continuous_partition_object", "(", "partition_object", ")", ":", "if", "(", "(", "partition_object", "is", "None", ")", "or", "(", "\"weights\"", "not", "in", "partition_object", ")", "or", "(", "\"bins\"", "not", "in", "partition_object", ")", ...
[ 48, 0 ]
[ 77, 5 ]
python
en
['en', 'en', 'en']
True
build_continuous_partition_object
( execution_engine, domain_kwargs, bins="auto", n_bins=10, allow_relative_error=False )
Convenience method for building a partition object on continuous data from a dataset and column Args: execution_engine (ExecutionEngine): the execution engine with which to compute the partition domain_kwargs (dict): The domain kwargs describing the domain for which to compute the partition ...
Convenience method for building a partition object on continuous data from a dataset and column
def build_continuous_partition_object( execution_engine, domain_kwargs, bins="auto", n_bins=10, allow_relative_error=False ): """Convenience method for building a partition object on continuous data from a dataset and column Args: execution_engine (ExecutionEngine): the execution engine with which ...
[ "def", "build_continuous_partition_object", "(", "execution_engine", ",", "domain_kwargs", ",", "bins", "=", "\"auto\"", ",", "n_bins", "=", "10", ",", "allow_relative_error", "=", "False", ")", ":", "partition_metric_configuration", "=", "MetricConfiguration", "(", "...
[ 80, 0 ]
[ 150, 27 ]
python
en
['en', 'en', 'en']
True
build_categorical_partition_object
(execution_engine, domain_kwargs, sort="value")
Convenience method for building a partition object on categorical data from a dataset and column Args: execution_engine (ExecutionEngine): the execution engine with which to compute the partition domain_kwargs (dict): The domain kwargs describing the domain for which to compute the partition ...
Convenience method for building a partition object on categorical data from a dataset and column
def build_categorical_partition_object(execution_engine, domain_kwargs, sort="value"): """Convenience method for building a partition object on categorical data from a dataset and column Args: execution_engine (ExecutionEngine): the execution engine with which to compute the partition domain_kw...
[ "def", "build_categorical_partition_object", "(", "execution_engine", ",", "domain_kwargs", ",", "sort", "=", "\"value\"", ")", ":", "counts_configuration", "=", "MetricConfiguration", "(", "\"column.partition\"", ",", "metric_domain_kwargs", "=", "domain_kwargs", ",", "m...
[ 153, 0 ]
[ 194, 5 ]
python
en
['en', 'en', 'en']
True
infer_distribution_parameters
(data, distribution, params=None)
Convenience method for determining the shape parameters of a given distribution Args: data (list-like): The data to build shape parameters from. distribution (string): Scipy distribution, determines which parameters to build. params (dict or None): The known parameters. Parameters given her...
Convenience method for determining the shape parameters of a given distribution
def infer_distribution_parameters(data, distribution, params=None): """Convenience method for determining the shape parameters of a given distribution Args: data (list-like): The data to build shape parameters from. distribution (string): Scipy distribution, determines which parameters to build...
[ "def", "infer_distribution_parameters", "(", "data", ",", "distribution", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "dict", "(", ")", "elif", "not", "isinstance", "(", "params", ",", "dict", ")", ":", "raise"...
[ 197, 0 ]
[ 290, 17 ]
python
en
['en', 'en', 'en']
True
_scipy_distribution_positional_args_from_dict
(distribution, params)
Helper function that returns positional arguments for a scipy distribution using a dict of parameters. See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\ to see an example of scipy's positional arguments. This function returns the arguments s...
Helper function that returns positional arguments for a scipy distribution using a dict of parameters.
def _scipy_distribution_positional_args_from_dict(distribution, params): """Helper function that returns positional arguments for a scipy distribution using a dict of parameters. See the `cdf()` function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods\ to see a...
[ "def", "_scipy_distribution_positional_args_from_dict", "(", "distribution", ",", "params", ")", ":", "params", "[", "\"loc\"", "]", "=", "params", ".", "get", "(", "\"loc\"", ",", "0", ")", "if", "\"scale\"", "not", "in", "params", ":", "params", "[", "\"sc...
[ 293, 0 ]
[ 328, 45 ]
python
en
['en', 'en', 'en']
True
validate_distribution_parameters
(distribution, params)
Ensures that necessary parameters for a distribution are present and that all parameters are sensical. If parameters necessary to construct a distribution are missing or invalid, this function raises ValueError\ with an informative description. Note that 'loc' and 'scale' are optional arguments, and that...
Ensures that necessary parameters for a distribution are present and that all parameters are sensical.
def validate_distribution_parameters(distribution, params): """Ensures that necessary parameters for a distribution are present and that all parameters are sensical. If parameters necessary to construct a distribution are missing or invalid, this function raises ValueError\ with an informative descri...
[ "def", "validate_distribution_parameters", "(", "distribution", ",", "params", ")", ":", "norm_msg", "=", "(", "\"norm distributions require 0 parameters and optionally 'mean', 'std_dev'.\"", ")", "beta_msg", "=", "\"beta distributions require 2 positive parameters 'alpha', 'beta' and ...
[ 331, 0 ]
[ 470, 10 ]
python
en
['en', 'en', 'en']
True
create_multiple_expectations
(df, columns, expectation_type, *args, **kwargs)
Creates an identical expectation for each of the given columns with the specified arguments, if any. Args: df (great_expectations.dataset): A great expectations dataset object. columns (list): A list of column names represented as strings. expectation_type (string): The expectation type. ...
Creates an identical expectation for each of the given columns with the specified arguments, if any.
def create_multiple_expectations(df, columns, expectation_type, *args, **kwargs): """Creates an identical expectation for each of the given columns with the specified arguments, if any. Args: df (great_expectations.dataset): A great expectations dataset object. columns (list): A list of column ...
[ "def", "create_multiple_expectations", "(", "df", ",", "columns", ",", "expectation_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "expectation", "=", "getattr", "(", "df", ",", "expectation_type", ")", "results", "=", "list", "(", ")", "for",...
[ 473, 0 ]
[ 496, 18 ]
python
en
['en', 'en', 'en']
True
escape_html
(text, table=_escape_html_table)
Escape &, <, > as well as single and double quotes for HTML.
Escape &, <, > as well as single and double quotes for HTML.
def escape_html(text, table=_escape_html_table): """Escape &, <, > as well as single and double quotes for HTML.""" return text.translate(table)
[ "def", "escape_html", "(", "text", ",", "table", "=", "_escape_html_table", ")", ":", "return", "text", ".", "translate", "(", "table", ")" ]
[ 39, 0 ]
[ 41, 32 ]
python
en
['en', 'en', 'en']
True
HtmlFormatter._get_css_class
(self, ttype)
Return the css class of this token type prefixed with the classprefix option.
Return the css class of this token type prefixed with the classprefix option.
def _get_css_class(self, ttype): """Return the css class of this token type prefixed with the classprefix option.""" ttypeclass = _get_ttype_class(ttype) if ttypeclass: return self.classprefix + ttypeclass return ''
[ "def", "_get_css_class", "(", "self", ",", "ttype", ")", ":", "ttypeclass", "=", "_get_ttype_class", "(", "ttype", ")", "if", "ttypeclass", ":", "return", "self", ".", "classprefix", "+", "ttypeclass", "return", "''" ]
[ 429, 4 ]
[ 435, 17 ]
python
en
['en', 'en', 'en']
True
HtmlFormatter._get_css_classes
(self, ttype)
Return the css classes of this token type prefixed with the classprefix option.
Return the css classes of this token type prefixed with the classprefix option.
def _get_css_classes(self, ttype): """Return the css classes of this token type prefixed with the classprefix option.""" cls = self._get_css_class(ttype) while ttype not in STANDARD_TYPES: ttype = ttype.parent cls = self._get_css_class(ttype) + ' ' + cls r...
[ "def", "_get_css_classes", "(", "self", ",", "ttype", ")", ":", "cls", "=", "self", ".", "_get_css_class", "(", "ttype", ")", "while", "ttype", "not", "in", "STANDARD_TYPES", ":", "ttype", "=", "ttype", ".", "parent", "cls", "=", "self", ".", "_get_css_c...
[ 437, 4 ]
[ 444, 18 ]
python
en
['en', 'en', 'en']
True
HtmlFormatter.get_style_defs
(self, arg=None)
Return CSS style definitions for the classes produced by the current highlighting style. ``arg`` can be a string or list of selectors to insert before the token type classes.
Return CSS style definitions for the classes produced by the current highlighting style. ``arg`` can be a string or list of selectors to insert before the token type classes.
def get_style_defs(self, arg=None): """ Return CSS style definitions for the classes produced by the current highlighting style. ``arg`` can be a string or list of selectors to insert before the token type classes. """ if arg is None: arg = ('cssclass' in self...
[ "def", "get_style_defs", "(", "self", ",", "arg", "=", "None", ")", ":", "if", "arg", "is", "None", ":", "arg", "=", "(", "'cssclass'", "in", "self", ".", "options", "and", "'.'", "+", "self", ".", "cssclass", "or", "''", ")", "if", "isinstance", "...
[ 470, 4 ]
[ 507, 31 ]
python
en
['en', 'error', 'th']
False
HtmlFormatter._format_lines
(self, tokensource)
Just format the tokens, without any wrapping tags. Yield individual lines.
Just format the tokens, without any wrapping tags. Yield individual lines.
def _format_lines(self, tokensource): """ Just format the tokens, without any wrapping tags. Yield individual lines. """ nocls = self.noclasses lsep = self.lineseparator # for <span style=""> lookup only getcls = self.ttype2class.get c2s = self.cla...
[ "def", "_format_lines", "(", "self", ",", "tokensource", ")", ":", "nocls", "=", "self", ".", "noclasses", "lsep", "=", "self", ".", "lineseparator", "# for <span style=\"\"> lookup only", "getcls", "=", "self", ".", "ttype2class", ".", "get", "c2s", "=", "sel...
[ 711, 4 ]
[ 780, 34 ]
python
en
['en', 'error', 'th']
False
HtmlFormatter._highlight_lines
(self, tokensource)
Highlighted the lines specified in the `hl_lines` option by post-processing the token stream coming from `_format_lines`.
Highlighted the lines specified in the `hl_lines` option by post-processing the token stream coming from `_format_lines`.
def _highlight_lines(self, tokensource): """ Highlighted the lines specified in the `hl_lines` option by post-processing the token stream coming from `_format_lines`. """ hls = self.hl_lines for i, (t, value) in enumerate(tokensource): if t != 1: ...
[ "def", "_highlight_lines", "(", "self", ",", "tokensource", ")", ":", "hls", "=", "self", ".", "hl_lines", "for", "i", ",", "(", "t", ",", "value", ")", "in", "enumerate", "(", "tokensource", ")", ":", "if", "t", "!=", "1", ":", "yield", "t", ",", ...
[ 789, 4 ]
[ 809, 30 ]
python
en
['en', 'error', 'th']
False
HtmlFormatter.wrap
(self, source, outfile)
Wrap the ``source``, which is a generator yielding individual lines, in custom generators. See docstring for `format`. Can be overridden.
Wrap the ``source``, which is a generator yielding individual lines, in custom generators. See docstring for `format`. Can be overridden.
def wrap(self, source, outfile): """ Wrap the ``source``, which is a generator yielding individual lines, in custom generators. See docstring for `format`. Can be overridden. """ return self._wrap_div(self._wrap_pre(source))
[ "def", "wrap", "(", "self", ",", "source", ",", "outfile", ")", ":", "return", "self", ".", "_wrap_div", "(", "self", ".", "_wrap_pre", "(", "source", ")", ")" ]
[ 811, 4 ]
[ 817, 53 ]
python
en
['en', 'error', 'th']
False
HtmlFormatter.format_unencoded
(self, tokensource, outfile)
The formatting process uses several nested generators; which of them are used is determined by the user's options. Each generator should take at least one argument, ``inner``, and wrap the pieces of text generated by this. Always yield 2-tuples: (code, text). If "code" is 1, t...
The formatting process uses several nested generators; which of them are used is determined by the user's options.
def format_unencoded(self, tokensource, outfile): """ The formatting process uses several nested generators; which of them are used is determined by the user's options. Each generator should take at least one argument, ``inner``, and wrap the pieces of text generated by this. ...
[ "def", "format_unencoded", "(", "self", ",", "tokensource", ",", "outfile", ")", ":", "source", "=", "self", ".", "_format_lines", "(", "tokensource", ")", "if", "self", ".", "hl_lines", ":", "source", "=", "self", ".", "_highlight_lines", "(", "source", "...
[ 819, 4 ]
[ 850, 32 ]
python
en
['en', 'error', 'th']
False
alice_columnar_table_single_batch
()
About the "Alice" User Workflow Fixture Alice has a single table of columnar data called user_events (DataAsset) that she wants to check periodically as new data is added. - She knows what some of the columns mean, but not all - and there are MANY of them (only a subset currently shown in examples and ...
About the "Alice" User Workflow Fixture
def alice_columnar_table_single_batch(): """ About the "Alice" User Workflow Fixture Alice has a single table of columnar data called user_events (DataAsset) that she wants to check periodically as new data is added. - She knows what some of the columns mean, but not all - and there are MANY of them...
[ "def", "alice_columnar_table_single_batch", "(", ")", ":", "verbose_profiler_config_file_path", ":", "str", "=", "file_relative_path", "(", "__file__", ",", "\"alice_user_workflow_verbose_profiler_config.yml\"", ")", "verbose_profiler_config", ":", "str", "with", "open", "(",...
[ 14, 0 ]
[ 196, 5 ]
python
en
['en', 'error', 'th']
False
get_document_store
(document_store_type, similarity='dot_product')
TODO This method is taken from test/conftest.py but maybe should be within Haystack. Perhaps a class method of DocStore that just takes string for type of DocStore
TODO This method is taken from test/conftest.py but maybe should be within Haystack. Perhaps a class method of DocStore that just takes string for type of DocStore
def get_document_store(document_store_type, similarity='dot_product'): """ TODO This method is taken from test/conftest.py but maybe should be within Haystack. Perhaps a class method of DocStore that just takes string for type of DocStore""" if document_store_type == "sql": if os.path.exists("haysta...
[ "def", "get_document_store", "(", "document_store_type", ",", "similarity", "=", "'dot_product'", ")", ":", "if", "document_store_type", "==", "\"sql\"", ":", "if", "os", ".", "path", ".", "exists", "(", "\"haystack_test.db\"", ")", ":", "os", ".", "remove", "...
[ 24, 0 ]
[ 61, 25 ]
python
en
['en', 'en', 'en']
True
SelectPort.__init__
(self, parent)
if sys.platform == "win32": self.iconbitmap("data/Floppy_icon.ico") elif sys.platform == "linux": self.icon = Image("photo", file="data/Floppy_icon.png") self.tk.call("wm", "iconphoto", self._w, self.icon)
if sys.platform == "win32": self.iconbitmap("data/Floppy_icon.ico") elif sys.platform == "linux": self.icon = Image("photo", file="data/Floppy_icon.png") self.tk.call("wm", "iconphoto", self._w, self.icon)
def __init__(self, parent): super(SelectPort, self).__init__() self.parent = parent self.transient(self.parent) width = 300 height = 100 pos_x = self.parent.winfo_x() + (self.parent.winfo_width() // 2) - (width // 2) pos_y = self.parent.winfo_y() + (self.paren...
[ "def", "__init__", "(", "self", ",", "parent", ")", ":", "super", "(", "SelectPort", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "parent", "=", "parent", "self", ".", "transient", "(", "self", ".", "parent", ")", "width", "=", "300", ...
[ 11, 4 ]
[ 66, 23 ]
python
en
['en', 'en', 'en']
True
SelectPort.connect_button
(self, event=None)
Enable connect button if port selected.
Enable connect button if port selected.
def connect_button(self, event=None): """Enable connect button if port selected.""" # Force focus to avoid blue selection on combobox. self.focus_set() if self.combo_box.get() != "": self.connect_button.config(state=NORMAL)
[ "def", "connect_button", "(", "self", ",", "event", "=", "None", ")", ":", "# Force focus to avoid blue selection on combobox.", "self", ".", "focus_set", "(", ")", "if", "self", ".", "combo_box", ".", "get", "(", ")", "!=", "\"\"", ":", "self", ".", "connec...
[ 68, 4 ]
[ 76, 52 ]
python
en
['en', 'en', 'en']
True
SelectPort.serial_ports
(self)
Lists available serial port names.
Lists available serial port names.
def serial_ports(self): """Lists available serial port names.""" if sys.platform == "win32": ports = ["COM%s" % (i + 1) for i in range(256)] elif sys.platform == "linux": ports = glob.glob("/dev/tty[A-Za-z]*") else: raise EnvironmentError("Unsupporte...
[ "def", "serial_ports", "(", "self", ")", ":", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "ports", "=", "[", "\"COM%s\"", "%", "(", "i", "+", "1", ")", "for", "i", "in", "range", "(", "256", ")", "]", "elif", "sys", ".", "platform", "==...
[ 78, 4 ]
[ 98, 44 ]
python
en
['fr', 'en', 'en']
True
SelectPort.connect
(self)
If a port is selected, close this window and connect to the board.
If a port is selected, close this window and connect to the board.
def connect(self): """If a port is selected, close this window and connect to the board.""" if self.combo_box.get() == "": messagebox.showwarning("Warning", "No port selected. Please select one.") else: self.parent.connect(self.combo_box.get()) self.destroy(...
[ "def", "connect", "(", "self", ")", ":", "if", "self", ".", "combo_box", ".", "get", "(", ")", "==", "\"\"", ":", "messagebox", ".", "showwarning", "(", "\"Warning\"", ",", "\"No port selected. Please select one.\"", ")", "else", ":", "self", ".", "parent", ...
[ 100, 4 ]
[ 108, 26 ]
python
en
['en', 'en', 'en']
True
SelectPort.close
(self)
If close button is pressed, destroy parent window
If close button is pressed, destroy parent window
def close(self): """If close button is pressed, destroy parent window""" self.parent.destroy()
[ "def", "close", "(", "self", ")", ":", "self", ".", "parent", ".", "destroy", "(", ")" ]
[ 110, 4 ]
[ 114, 29 ]
python
en
['en', 'en', 'en']
True
FilePathDataConnector.__init__
( self, name: str, datasource_name: str, execution_engine: Optional[ExecutionEngine] = None, default_regex: Optional[dict] = None, sorters: Optional[list] = None, batch_spec_passthrough: Optional[dict] = None, )
Base class for DataConnectors that connect to filesystem-like data. This class supports the configuration of default_regex and sorters for filtering and sorting data_references. Args: name (str): name of FilePathDataConnector datasource_name (str): Name of datasource th...
Base class for DataConnectors that connect to filesystem-like data. This class supports the configuration of default_regex and sorters for filtering and sorting data_references.
def __init__( self, name: str, datasource_name: str, execution_engine: Optional[ExecutionEngine] = None, default_regex: Optional[dict] = None, sorters: Optional[list] = None, batch_spec_passthrough: Optional[dict] = None, ): """ Base class for ...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "datasource_name", ":", "str", ",", "execution_engine", ":", "Optional", "[", "ExecutionEngine", "]", "=", "None", ",", "default_regex", ":", "Optional", "[", "dict", "]", "=", "None", ",", "s...
[ 38, 4 ]
[ 73, 46 ]
python
en
['en', 'error', 'th']
False
FilePathDataConnector._get_data_reference_list_from_cache_by_data_asset_name
( self, data_asset_name: str )
Fetch data_references corresponding to data_asset_name from the cache.
Fetch data_references corresponding to data_asset_name from the cache.
def _get_data_reference_list_from_cache_by_data_asset_name( self, data_asset_name: str ) -> List[str]: """ Fetch data_references corresponding to data_asset_name from the cache. """ regex_config: dict = self._get_regex_config(data_asset_name=data_asset_name) pattern: ...
[ "def", "_get_data_reference_list_from_cache_by_data_asset_name", "(", "self", ",", "data_asset_name", ":", "str", ")", "->", "List", "[", "str", "]", ":", "regex_config", ":", "dict", "=", "self", ".", "_get_regex_config", "(", "data_asset_name", "=", "data_asset_na...
[ 79, 4 ]
[ 111, 24 ]
python
en
['en', 'error', 'th']
False
FilePathDataConnector.get_batch_definition_list_from_batch_request
( self, batch_request: BatchRequest, )
Retrieve batch_definitions and that match batch_request. First retrieves all batch_definitions that match batch_request - if batch_request also has a batch_filter, then select batch_definitions that match batch_filter. - if data_connector has sorters configured, then sort the b...
Retrieve batch_definitions and that match batch_request.
def get_batch_definition_list_from_batch_request( self, batch_request: BatchRequest, ) -> List[BatchDefinition]: """ Retrieve batch_definitions and that match batch_request. First retrieves all batch_definitions that match batch_request - if batch_request also ha...
[ "def", "get_batch_definition_list_from_batch_request", "(", "self", ",", "batch_request", ":", "BatchRequest", ",", ")", "->", "List", "[", "BatchDefinition", "]", ":", "batch_request_base", ":", "BatchRequestBase", "=", "cast", "(", "BatchRequestBase", ",", "batch_re...
[ 113, 4 ]
[ 134, 9 ]
python
en
['en', 'error', 'th']
False
FilePathDataConnector._get_batch_definition_list_from_batch_request
( self, batch_request: BatchRequestBase, )
Retrieve batch_definitions that match batch_request. First retrieves all batch_definitions that match batch_request - if batch_request also has a batch_filter, then select batch_definitions that match batch_filter. - if data_connector has sorters configured, then sort the batch...
Retrieve batch_definitions that match batch_request.
def _get_batch_definition_list_from_batch_request( self, batch_request: BatchRequestBase, ) -> List[BatchDefinition]: """ Retrieve batch_definitions that match batch_request. First retrieves all batch_definitions that match batch_request - if batch_request also h...
[ "def", "_get_batch_definition_list_from_batch_request", "(", "self", ",", "batch_request", ":", "BatchRequestBase", ",", ")", "->", "List", "[", "BatchDefinition", "]", ":", "self", ".", "_validate_batch_request", "(", "batch_request", "=", "batch_request", ")", "if",...
[ 136, 4 ]
[ 180, 36 ]
python
en
['en', 'error', 'th']
False
FilePathDataConnector._sort_batch_definition_list
( self, batch_definition_list: List[BatchDefinition] )
Use configured sorters to sort batch_definition Args: batch_definition_list (list): list of batch_definitions to sort Returns: sorted list of batch_definitions
Use configured sorters to sort batch_definition
def _sort_batch_definition_list( self, batch_definition_list: List[BatchDefinition] ) -> List[BatchDefinition]: """ Use configured sorters to sort batch_definition Args: batch_definition_list (list): list of batch_definitions to sort Returns: sorted ...
[ "def", "_sort_batch_definition_list", "(", "self", ",", "batch_definition_list", ":", "List", "[", "BatchDefinition", "]", ")", "->", "List", "[", "BatchDefinition", "]", ":", "sorters", ":", "Iterator", "[", "Sorter", "]", "=", "reversed", "(", "list", "(", ...
[ 182, 4 ]
[ 200, 36 ]
python
en
['en', 'error', 'th']
False
FilePathDataConnector.build_batch_spec
(self, batch_definition: BatchDefinition)
Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function. Args: batch_definition (BatchDefinition): to be used to build batch_spec Returns: BatchSpec built from batch_definition
Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function.
def build_batch_spec(self, batch_definition: BatchDefinition) -> PathBatchSpec: """ Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function. Args: batch_definition (BatchDefinition): to be used to build batch_spec Returns: Batc...
[ "def", "build_batch_spec", "(", "self", ",", "batch_definition", ":", "BatchDefinition", ")", "->", "PathBatchSpec", ":", "batch_spec", ":", "BatchSpec", "=", "super", "(", ")", ".", "build_batch_spec", "(", "batch_definition", "=", "batch_definition", ")", "retur...
[ 230, 4 ]
[ 243, 40 ]
python
en
['en', 'error', 'th']
False
score5
(fa, matrix=None)
Calculate 5' splice site strength (exon)XXX|XXXXXX(intron) ** >>> round(score5('cagGTAAGT'), 2) 10.86 >>> round(score5('gagGTAAGT'), 2) 11.08 >>> round(score5('taaATAAGT'), 2) -0.12 >>> matrix = load_matrix5() >>> round(score5('cagGTAAGT', matrix=matrix), 2) 10...
Calculate 5' splice site strength (exon)XXX|XXXXXX(intron) ** >>> round(score5('cagGTAAGT'), 2) 10.86 >>> round(score5('gagGTAAGT'), 2) 11.08 >>> round(score5('taaATAAGT'), 2) -0.12 >>> matrix = load_matrix5() >>> round(score5('cagGTAAGT', matrix=matrix), 2) 10...
def score5(fa, matrix=None): ''' Calculate 5' splice site strength (exon)XXX|XXXXXX(intron) ** >>> round(score5('cagGTAAGT'), 2) 10.86 >>> round(score5('gagGTAAGT'), 2) 11.08 >>> round(score5('taaATAAGT'), 2) -0.12 >>> matrix = load_matrix5() >>> round(score5('c...
[ "def", "score5", "(", "fa", ",", "matrix", "=", "None", ")", ":", "# check length of fa", "if", "len", "(", "fa", ")", "!=", "9", ":", "sys", ".", "exit", "(", "'Wrong length of fa!'", ")", "# check matrix", "if", "not", "matrix", ":", "matrix", "=", "...
[ 33, 0 ]
[ 61, 42 ]
python
en
['en', 'error', 'th']
False
score3
(fa, matrix=None)
Calculate 3' splice site strength (intron)XXXXXXXXXXXXXXXXXXXX|XXX(exon) ** >>> round(score3('ttccaaacgaacttttgtAGgga'), 2) 2.89 >>> round(score3('tgtctttttctgtgtggcAGtgg'), 2) 8.19 >>> round(score3('ttctctcttcagacttatAGcaa'), 2) -0.08 >>> matrix = load...
Calculate 3' splice site strength (intron)XXXXXXXXXXXXXXXXXXXX|XXX(exon) ** >>> round(score3('ttccaaacgaacttttgtAGgga'), 2) 2.89 >>> round(score3('tgtctttttctgtgtggcAGtgg'), 2) 8.19 >>> round(score3('ttctctcttcagacttatAGcaa'), 2) -0.08 >>> matrix = load...
def score3(fa, matrix=None): ''' Calculate 3' splice site strength (intron)XXXXXXXXXXXXXXXXXXXX|XXX(exon) ** >>> round(score3('ttccaaacgaacttttgtAGgga'), 2) 2.89 >>> round(score3('tgtctttttctgtgtggcAGtgg'), 2) 8.19 >>> round(score3('ttctctcttcagacttatAGcaa')...
[ "def", "score3", "(", "fa", ",", "matrix", "=", "None", ")", ":", "# check length of fa", "if", "len", "(", "fa", ")", "!=", "23", ":", "sys", ".", "exit", "(", "'Wrong length of fa!'", ")", "# check matrix", "if", "not", "matrix", ":", "matrix", "=", ...
[ 74, 0 ]
[ 111, 42 ]
python
en
['en', 'error', 'th']
False
checkpoint
()
Checkpoint operations A checkpoint is a bundle of one or more batches of data with one or more Expectation Suites. A checkpoint can be as simple as one batch of data paired with one Expectation Suite. A checkpoint can be as complex as many batches of data across different datasources pai...
Checkpoint operations
def checkpoint(): """ Checkpoint operations A checkpoint is a bundle of one or more batches of data with one or more Expectation Suites. A checkpoint can be as simple as one batch of data paired with one Expectation Suite. A checkpoint can be as complex as many batches of data across diff...
[ "def", "checkpoint", "(", ")", ":", "pass" ]
[ 59, 0 ]
[ 72, 8 ]
python
en
['en', 'error', 'th']
False
checkpoint_new
(checkpoint, suite, directory, datasource)
Create a new checkpoint for easy deployments. (Experimental)
Create a new checkpoint for easy deployments. (Experimental)
def checkpoint_new(checkpoint, suite, directory, datasource): """Create a new checkpoint for easy deployments. (Experimental)""" suite_name = suite usage_event = "cli.checkpoint.new" context = toolkit.load_data_context_with_error_handling(directory) _verify_checkpoint_does_not_exist(context, checkp...
[ "def", "checkpoint_new", "(", "checkpoint", ",", "suite", ",", "directory", ",", "datasource", ")", ":", "suite_name", "=", "suite", "usage_event", "=", "\"cli.checkpoint.new\"", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory"...
[ 86, 0 ]
[ 119, 66 ]
python
en
['en', 'en', 'en']
True
checkpoint_list
(directory)
List configured checkpoints. (Experimental)
List configured checkpoints. (Experimental)
def checkpoint_list(directory): """List configured checkpoints. (Experimental)""" context = toolkit.load_data_context_with_error_handling(directory) checkpoints = context.list_checkpoints() if not checkpoints: cli_message( "No checkpoints found.\n" " - Use the command `g...
[ "def", "checkpoint_list", "(", "directory", ")", ":", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory", ")", "checkpoints", "=", "context", ".", "list_checkpoints", "(", ")", "if", "not", "checkpoints", ":", "cli_message", ...
[ 171, 0 ]
[ 188, 82 ]
python
en
['en', 'en', 'en']
True
checkpoint_run
(checkpoint, directory)
Run a checkpoint. (Experimental)
Run a checkpoint. (Experimental)
def checkpoint_run(checkpoint, directory): """Run a checkpoint. (Experimental)""" usage_event = "cli.checkpoint.run" context = toolkit.load_data_context_with_error_handling( directory=directory, from_cli_upgrade_command=False ) checkpoint: Checkpoint = toolkit.load_checkpoint( conte...
[ "def", "checkpoint_run", "(", "checkpoint", ",", "directory", ")", ":", "usage_event", "=", "\"cli.checkpoint.run\"", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory", "=", "directory", ",", "from_cli_upgrade_command", "=", "Fals...
[ 200, 0 ]
[ 229, 15 ]
python
en
['it', 'gd', 'en']
False
checkpoint_script
(checkpoint, directory)
Create a python script to run a checkpoint. (Experimental) Checkpoints can be run directly without this script using the `great_expectations checkpoint run` command. This script is provided for those who wish to run checkpoints via python.
Create a python script to run a checkpoint. (Experimental)
def checkpoint_script(checkpoint, directory): """ Create a python script to run a checkpoint. (Experimental) Checkpoints can be run directly without this script using the `great_expectations checkpoint run` command. This script is provided for those who wish to run checkpoints via python. """ ...
[ "def", "checkpoint_script", "(", "checkpoint", ",", "directory", ")", ":", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory", ")", "usage_event", "=", "\"cli.checkpoint.script\"", "# Attempt to load the checkpoint and deal with errors", ...
[ 270, 0 ]
[ 304, 72 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.get_dataset_by_extent
(self, product, product_type=None, platform=None, time=None, longitude=None, latitude=None, measurements=None,...
Gets and returns data based on lat/long bounding box inputs. All params are optional. Leaving one out will just query the dc without it, (eg leaving out lat/lng but giving product returns dataset containing entire product.) Args: product (string): The name of the product as...
Gets and returns data based on lat/long bounding box inputs. All params are optional. Leaving one out will just query the dc without it, (eg leaving out lat/lng but giving product returns dataset containing entire product.)
def get_dataset_by_extent(self, product, product_type=None, platform=None, time=None, longitude=None, latitude=None, ...
[ "def", "get_dataset_by_extent", "(", "self", ",", "product", ",", "product_type", "=", "None", ",", "platform", "=", "None", ",", "time", "=", "None", ",", "longitude", "=", "None", ",", "latitude", "=", "None", ",", "measurements", "=", "None", ",", "ou...
[ 44, 4 ]
[ 97, 19 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.get_stacked_datasets_by_extent
(self, products, product_type=None, platforms=None, time=None, longitude=None, latitud...
Gets and returns data based on lat/long bounding box inputs. All params are optional. Leaving one out will just query the dc without it, (eg leaving out lat/lng but giving product returns dataset containing entire product.) Args: products (array of strings): The n...
Gets and returns data based on lat/long bounding box inputs. All params are optional. Leaving one out will just query the dc without it, (eg leaving out lat/lng but giving product returns dataset containing entire product.)
def get_stacked_datasets_by_extent(self, products, product_type=None, platforms=None, time=None, longitude=None, ...
[ "def", "get_stacked_datasets_by_extent", "(", "self", ",", "products", ",", "product_type", "=", "None", ",", "platforms", "=", "None", ",", "time", "=", "None", ",", "longitude", "=", "None", ",", "latitude", "=", "None", ",", "measurements", "=", "None", ...
[ 99, 4 ]
[ 161, 19 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.get_query_metadata
(self, product, platform=None, longitude=None, latitude=None, time=None, **kwargs)
Gets a descriptor based on a request. Args: platform (string): Platform for which data is requested product (string): The name of the product associated with the desired dataset. longitude (tuple): Tuple of min,max floats for longitude latitude (tuple): ...
Gets a descriptor based on a request.
def get_query_metadata(self, product, platform=None, longitude=None, latitude=None, time=None, **kwargs): """ Gets a descriptor based on a request. Args: platform (string): Platform for which data is requested product (string): The name of the product associated with the...
[ "def", "get_query_metadata", "(", "self", ",", "product", ",", "platform", "=", "None", ",", "longitude", "=", "None", ",", "latitude", "=", "None", ",", "time", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dataset", "=", "self", ".", "get_dataset_...
[ 167, 4 ]
[ 208, 9 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.list_acquisition_dates
(self, product, platform=None, longitude=None, latitude=None, time=None, **kwargs)
Get a list of all acquisition dates for a query. Args: platform (string): Platform for which data is requested product (string): The name of the product associated with the desired dataset. longitude (tuple): Tuple of min,max floats for longitude latitud...
Get a list of all acquisition dates for a query.
def list_acquisition_dates(self, product, platform=None, longitude=None, latitude=None, time=None, **kwargs): """ Get a list of all acquisition dates for a query. Args: platform (string): Platform for which data is requested product (string): The name of the product asso...
[ "def", "list_acquisition_dates", "(", "self", ",", "product", ",", "platform", "=", "None", ",", "longitude", "=", "None", ",", "latitude", "=", "None", ",", "time", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dataset", "=", "self", ".", "get_data...
[ 210, 4 ]
[ 230, 60 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.list_combined_acquisition_dates
(self, products, platforms=None, longitude=None, latitude=None, time=None, **kwa...
Get a list of all acquisition dates for a query. Args: platforms (list): Platforms for which data is requested products (list): The name of the products associated with the desired dataset. longitude (tuple): Tuple of min,max floats for longitude latitud...
Get a list of all acquisition dates for a query.
def list_combined_acquisition_dates(self, products, platforms=None, longitude=None, latitude=None, time=None, ...
[ "def", "list_combined_acquisition_dates", "(", "self", ",", "products", ",", "platforms", "=", "None", ",", "longitude", "=", "None", ",", "latitude", "=", "None", ",", "time", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dates", "=", "[", "]", "fo...
[ 232, 4 ]
[ 268, 20 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.get_full_dataset_extent
(self, product, platform=None, longitude=None, latitude=None, time=None, **kwargs)
Get a list of all dimensions for a query. Args: platform (string): Platform for which data is requested product (string): The name of the product associated with the desired dataset. longitude (tuple): Tuple of min,max floats for longitude latitude (tupl...
Get a list of all dimensions for a query.
def get_full_dataset_extent(self, product, platform=None, longitude=None, latitude=None, time=None, **kwargs): """ Get a list of all dimensions for a query. Args: platform (string): Platform for which data is requested product (string): The name of the product associated...
[ "def", "get_full_dataset_extent", "(", "self", ",", "product", ",", "platform", "=", "None", ",", "longitude", "=", "None", ",", "latitude", "=", "None", ",", "time", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dataset", "=", "self", ".", "get_dat...
[ 270, 4 ]
[ 289, 99 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.get_datacube_metadata
(self, product, platform=None)
Gets some details on the cube and its contents. Args: platform (string): Desired platform for requested data. product (string): Desired product for requested data. Returns: datacube_metadata (dict): a dict with multiple keys containing relevant metadata. ...
Gets some details on the cube and its contents.
def get_datacube_metadata(self, product, platform=None): """ Gets some details on the cube and its contents. Args: platform (string): Desired platform for requested data. product (string): Desired product for requested data. Returns: datacube_metadat...
[ "def", "get_datacube_metadata", "(", "self", ",", "product", ",", "platform", "=", "None", ")", ":", "return", "self", ".", "get_query_metadata", "(", "product", ",", "platform", "=", "platform", ")" ]
[ 291, 4 ]
[ 303, 66 ]
python
en
['en', 'error', 'th']
False
DataAccessApi.validate_measurements
(self, product, measurements, **kwargs)
Ensure that your measurements exist for the product before loading.
Ensure that your measurements exist for the product before loading.
def validate_measurements(self, product, measurements, **kwargs): """Ensure that your measurements exist for the product before loading. """ measurement_list = self.dc.list_measurements(with_pandas=False) measurements_for_product = filter(lambda x: x['product'] == product, measurement_li...
[ "def", "validate_measurements", "(", "self", ",", "product", ",", "measurements", ",", "*", "*", "kwargs", ")", ":", "measurement_list", "=", "self", ".", "dc", ".", "list_measurements", "(", "with_pandas", "=", "False", ")", "measurements_for_product", "=", "...
[ 305, 4 ]
[ 312, 77 ]
python
en
['en', 'en', 'en']
True
smd
(feature, treatment)
Calculate the standard mean difference (SMD) of a feature between the treatment and control groups. The definition is available at https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3144483/#s11title Args: feature (pandas.Series): a column of a feature to calculate SMD for treatment (pandas....
Calculate the standard mean difference (SMD) of a feature between the treatment and control groups.
def smd(feature, treatment): """Calculate the standard mean difference (SMD) of a feature between the treatment and control groups. The definition is available at https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3144483/#s11title Args: feature (pandas.Series): a column of a feature to calculat...
[ "def", "smd", "(", "feature", ",", "treatment", ")", ":", "t", "=", "feature", "[", "treatment", "==", "1", "]", "c", "=", "feature", "[", "treatment", "==", "0", "]", "return", "(", "t", ".", "mean", "(", ")", "-", "c", ".", "mean", "(", ")", ...
[ 13, 0 ]
[ 30, 68 ]
python
en
['en', 'en', 'en']
True
create_table_one
(data, treatment_col, features)
Report balance in input features between the treatment and control groups. References: R's tableone at CRAN: https://github.com/kaz-yos/tableone Python's tableone at PyPi: https://github.com/tompollard/tableone Args: data (pandas.DataFrame): total or matched sample data treatme...
Report balance in input features between the treatment and control groups.
def create_table_one(data, treatment_col, features): """Report balance in input features between the treatment and control groups. References: R's tableone at CRAN: https://github.com/kaz-yos/tableone Python's tableone at PyPi: https://github.com/tompollard/tableone Args: data (pan...
[ "def", "create_table_one", "(", "data", ",", "treatment_col", ",", "features", ")", ":", "t1", "=", "pd", ".", "pivot_table", "(", "data", "[", "features", "+", "[", "treatment_col", "]", "]", ",", "columns", "=", "treatment_col", ",", "aggfunc", "=", "[...
[ 33, 0 ]
[ 71, 13 ]
python
en
['en', 'en', 'en']
True
NearestNeighborMatch.__init__
(self, caliper=.2, replace=False, ratio=1, shuffle=True, random_state=None, n_jobs=-1)
Initialize a propensity score matching model. Args: caliper (float): threshold to be considered as a match. replace (bool): whether to match with replacement or not shuffle (bool): whether to shuffle the treatment group data before matching or not ...
Initialize a propensity score matching model.
def __init__(self, caliper=.2, replace=False, ratio=1, shuffle=True, random_state=None, n_jobs=-1): """Initialize a propensity score matching model. Args: caliper (float): threshold to be considered as a match. replace (bool): whether to match with replacement o...
[ "def", "__init__", "(", "self", ",", "caliper", "=", ".2", ",", "replace", "=", "False", ",", "ratio", "=", "1", ",", "shuffle", "=", "True", ",", "random_state", "=", "None", ",", "n_jobs", "=", "-", "1", ")", ":", "self", ".", "caliper", "=", "...
[ 91, 4 ]
[ 110, 28 ]
python
en
['en', 'en', 'en']
True
NearestNeighborMatch.match
(self, data, treatment_col, score_cols)
Find matches from the control group by matching on specified columns (propensity preferred). Args: data (pandas.DataFrame): total input data treatment_col (str): the column name for the treatment score_cols (list): list of column names for matching (propensity ...
Find matches from the control group by matching on specified columns (propensity preferred).
def match(self, data, treatment_col, score_cols): """Find matches from the control group by matching on specified columns (propensity preferred). Args: data (pandas.DataFrame): total input data treatment_col (str): the column name for the treatment score_cols...
[ "def", "match", "(", "self", ",", "data", ",", "treatment_col", ",", "score_cols", ")", ":", "assert", "type", "(", "score_cols", ")", "is", "list", ",", "'score_cols must be a list'", "treatment", "=", "data", ".", "loc", "[", "data", "[", "treatment_col", ...
[ 112, 4 ]
[ 188, 66 ]
python
en
['en', 'en', 'en']
True
NearestNeighborMatch.match_by_group
(self, data, treatment_col, score_cols, groupby_col)
Find matches from the control group stratified by groupby_col, by matching on specified columns (propensity preferred). Args: data (pandas.DataFrame): total sample data treatment_col (str): the column name for the treatment score_cols (list): list of column names for...
Find matches from the control group stratified by groupby_col, by matching on specified columns (propensity preferred).
def match_by_group(self, data, treatment_col, score_cols, groupby_col): """Find matches from the control group stratified by groupby_col, by matching on specified columns (propensity preferred). Args: data (pandas.DataFrame): total sample data treatment_col (str): the co...
[ "def", "match_by_group", "(", "self", ",", "data", ",", "treatment_col", ",", "score_cols", ",", "groupby_col", ")", ":", "matched", "=", "data", ".", "groupby", "(", "groupby_col", ")", ".", "apply", "(", "lambda", "x", ":", "self", ".", "match", "(", ...
[ 190, 4 ]
[ 209, 54 ]
python
en
['en', 'en', 'en']
True
MatchOptimizer.__init__
(self, treatment_col='is_treatment', ps_col='pihat', user_col=None, matching_covariates=['pihat'], max_smd=0.1, max_deviation=0.1, caliper_range=(0.01, 0.5), max_pihat_range=(0.95, 0.999), max_iter_per_param=5, min_users_per_group=1000, smd_cols=['piha...
Finds the set of parameters that gives the best matching result. Score = (number of features with SMD > max_smd) + (sum of deviations for important variables * deviation factor) The logic behind the scoring is that we are most concerned with minimizing the nu...
Finds the set of parameters that gives the best matching result.
def __init__(self, treatment_col='is_treatment', ps_col='pihat', user_col=None, matching_covariates=['pihat'], max_smd=0.1, max_deviation=0.1, caliper_range=(0.01, 0.5), max_pihat_range=(0.95, 0.999), max_iter_per_param=5, min_users_per_group=1000, smd...
[ "def", "__init__", "(", "self", ",", "treatment_col", "=", "'is_treatment'", ",", "ps_col", "=", "'pihat'", ",", "user_col", "=", "None", ",", "matching_covariates", "=", "[", "'pihat'", "]", ",", "max_smd", "=", "0.1", ",", "max_deviation", "=", "0.1", ",...
[ 213, 4 ]
[ 276, 29 ]
python
en
['en', 'en', 'en']
True
generate_messages_with_defaults
( defaults: Dict[str, Any], message_stubs: List[Dict[str, Any]] )
Create a list of messages by overriding defaults with message_stubs Args: defaults: Dict of default message items message_stubs: Unique parts of message Returns: List of messages same len(message_stubs) combining defaults overridden by message stubs
Create a list of messages by overriding defaults with message_stubs Args: defaults: Dict of default message items message_stubs: Unique parts of message
def generate_messages_with_defaults( defaults: Dict[str, Any], message_stubs: List[Dict[str, Any]] ) -> List[Dict[str, Any]]: """ Create a list of messages by overriding defaults with message_stubs Args: defaults: Dict of default message items message_stubs: Unique parts of message ...
[ "def", "generate_messages_with_defaults", "(", "defaults", ":", "Dict", "[", "str", ",", "Any", "]", ",", "message_stubs", ":", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ...
[ 14, 0 ]
[ 32, 22 ]
python
en
['en', 'error', 'th']
False
test_usage_statistics_message
(message)
known message formats should be valid
known message formats should be valid
def test_usage_statistics_message(message): """known message formats should be valid""" res = requests.post(USAGE_STATISTICS_QA_URL, json=message, timeout=2) assert res.status_code == 201 assert res.json() == {"event_count": 1}
[ "def", "test_usage_statistics_message", "(", "message", ")", ":", "res", "=", "requests", ".", "post", "(", "USAGE_STATISTICS_QA_URL", ",", "json", "=", "message", ",", "timeout", "=", "2", ")", "assert", "res", ".", "status_code", "==", "201", "assert", "re...
[ 1595, 0 ]
[ 1599, 43 ]
python
en
['en', 'en', 'en']
True
r
(xyz, src_loc)
Distance from source to points on an xyz grid
Distance from source to points on an xyz grid
def r(xyz, src_loc): """ Distance from source to points on an xyz grid """ return ( np.sqrt( (xyz[:, 0] - src_loc[0]) ** 2 + (xyz[:, 1] - src_loc[1]) ** 2 + (xyz[:, 2] - src_loc[2]) ** 2 ) + eps )
[ "def", "r", "(", "xyz", ",", "src_loc", ")", ":", "return", "(", "np", ".", "sqrt", "(", "(", "xyz", "[", ":", ",", "0", "]", "-", "src_loc", "[", "0", "]", ")", "**", "2", "+", "(", "xyz", "[", ":", ",", "1", "]", "-", "src_loc", "[", ...
[ 34, 0 ]
[ 45, 5 ]
python
en
['en', 'error', 'th']
False
layer_potentials
(rho1, rho2, h, A, B, xyz)
Compute analytic solution of surface potential for 2-layered Earth (Ref Telford 1990, section 8.3.4)s
Compute analytic solution of surface potential for 2-layered Earth (Ref Telford 1990, section 8.3.4)s
def layer_potentials(rho1, rho2, h, A, B, xyz): """ Compute analytic solution of surface potential for 2-layered Earth (Ref Telford 1990, section 8.3.4)s """ def V(I, src_loc): return (I * rho1 / (2.0 * np.pi * r(xyz, src_loc))) * ( 1 + 2 * sum_term(rho1, rho2, h, r(xyz, src_lo...
[ "def", "layer_potentials", "(", "rho1", ",", "rho2", ",", "h", ",", "A", ",", "B", ",", "xyz", ")", ":", "def", "V", "(", "I", ",", "src_loc", ")", ":", "return", "(", "I", "*", "rho1", "/", "(", "2.0", "*", "np", ".", "pi", "*", "r", "(", ...
[ 69, 0 ]
[ 85, 14 ]
python
en
['en', 'error', 'th']
False
G
(A, B, M, N)
Geometric factor
Geometric factor
def G(A, B, M, N): """ Geometric factor """ bot = 1.0 / (np.abs(A[0] - M) + eps) if B is not None: bot -= 1.0 / (np.abs(M - B[0]) + eps) if N is not None: bot -= 1.0 / (np.abs(N - A[0]) + eps) if B is not None: bot += 1.0 / (np.abs(N - B[0]) + eps) return ...
[ "def", "G", "(", "A", ",", "B", ",", "M", ",", "N", ")", ":", "bot", "=", "1.0", "/", "(", "np", ".", "abs", "(", "A", "[", "0", "]", "-", "M", ")", "+", "eps", ")", "if", "B", "is", "not", "None", ":", "bot", "-=", "1.0", "/", "(", ...
[ 140, 0 ]
[ 151, 20 ]
python
en
['en', 'error', 'th']
False
rho_a
(VM, VN, A, B, M, N)
Apparent Resistivity
Apparent Resistivity
def rho_a(VM, VN, A, B, M, N): """ Apparent Resistivity """ if VN is None: return VM * 2.0 * np.pi * G(A, B, M, None) else: return (VM - VN) * 2.0 * np.pi * G(A, B, M, N)
[ "def", "rho_a", "(", "VM", ",", "VN", ",", "A", ",", "B", ",", "M", ",", "N", ")", ":", "if", "VN", "is", "None", ":", "return", "VM", "*", "2.0", "*", "np", ".", "pi", "*", "G", "(", "A", ",", "B", ",", "M", ",", "None", ")", "else", ...
[ 154, 0 ]
[ 161, 54 ]
python
en
['en', 'error', 'th']
False
solve_2D_potentials
(rho1, rho2, h, A, B)
Here we solve the 2D DC problem for potentials (using SimPEG Mesh Class)
Here we solve the 2D DC problem for potentials (using SimPEG Mesh Class)
def solve_2D_potentials(rho1, rho2, h, A, B): """ Here we solve the 2D DC problem for potentials (using SimPEG Mesh Class) """ sigma = 1.0 / rho2 * np.ones(mesh.nC) sigma[mesh.gridCC[:, 1] >= -h] = 1.0 / rho1 # since the model is 2D q = np.zeros(mesh.nC) a = utils.closestPoints(mesh, A[:2]...
[ "def", "solve_2D_potentials", "(", "rho1", ",", "rho2", ",", "h", ",", "A", ",", "B", ")", ":", "sigma", "=", "1.0", "/", "rho2", "*", "np", ".", "ones", "(", "mesh", ".", "nC", ")", "sigma", "[", "mesh", ".", "gridCC", "[", ":", ",", "1", "]...
[ 164, 0 ]
[ 223, 12 ]
python
en
['en', 'error', 'th']
False
solve_2D_E
(rho1, rho2, h, A, B)
solve the 2D DC resistivity problem for electric fields
solve the 2D DC resistivity problem for electric fields
def solve_2D_E(rho1, rho2, h, A, B): """ solve the 2D DC resistivity problem for electric fields """ V = solve_2D_potentials(rho1, rho2, h, A, B) E = -mesh.cellGrad * V E = mesh.aveF2CCV * E ex = E[: mesh.nC] ez = E[mesh.nC :] return ex, ez, V
[ "def", "solve_2D_E", "(", "rho1", ",", "rho2", ",", "h", ",", "A", ",", "B", ")", ":", "V", "=", "solve_2D_potentials", "(", "rho1", ",", "rho2", ",", "h", ",", "A", ",", "B", ")", "E", "=", "-", "mesh", ".", "cellGrad", "*", "V", "E", "=", ...
[ 226, 0 ]
[ 236, 20 ]
python
en
['en', 'error', 'th']
False
random_string
(min_length=5, max_length=10)
Get a random string. Args: min_length: Minimal length of string max_length: Maximal length of string Returns: Random string of ascii characters
Get a random string.
def random_string(min_length=5, max_length=10) -> str: """ Get a random string. Args: min_length: Minimal length of string max_length: Maximal length of string Returns: Random string of ascii characters """ length = random.randint(min_length, max_length) return "".j...
[ "def", "random_string", "(", "min_length", "=", "5", ",", "max_length", "=", "10", ")", "->", "str", ":", "length", "=", "random", ".", "randint", "(", "min_length", ",", "max_length", ")", "return", "\"\"", ".", "join", "(", "random", ".", "choice", "...
[ 9, 0 ]
[ 24, 5 ]
python
en
['en', 'error', 'th']
False
iterative_tree
( basedir: Union[str, PurePath], nfolders_func: Callable, nfiles_func: Callable, repeat=1, maxdepth=None, filename=random_string, payload: Optional[Callable[[Path], Generator[Path, None, None]]] = None, )
Create a random set of files and folders by repeatedly walking through the current tree and creating random files or subfolders (the number of files and folders created is chosen by evaluating a depth dependent function). Args: basedir: Directory to create files and folders in nfolder...
Create a random set of files and folders by repeatedly walking through the current tree and creating random files or subfolders (the number of files and folders created is chosen by evaluating a depth dependent function).
def iterative_tree( basedir: Union[str, PurePath], nfolders_func: Callable, nfiles_func: Callable, repeat=1, maxdepth=None, filename=random_string, payload: Optional[Callable[[Path], Generator[Path, None, None]]] = None, ) -> Tuple[List[Path], List[Path]]: """ Create a random set of ...
[ "def", "iterative_tree", "(", "basedir", ":", "Union", "[", "str", ",", "PurePath", "]", ",", "nfolders_func", ":", "Callable", ",", "nfiles_func", ":", "Callable", ",", "repeat", "=", "1", ",", "maxdepth", "=", "None", ",", "filename", "=", "random_string...
[ 27, 0 ]
[ 92, 28 ]
python
en
['en', 'error', 'th']
False
iterative_gaussian_tree
( basedir: Union[str, PurePath], nfiles=2, nfolders=1, repeat=1, maxdepth=None, sigma_folders=1, sigma_files=1, min_folders=0, min_files=0, filename=random_string, payload: Optional[Callable[[Path], Generator[Path, None, None]]] = None, )
Create a random set of files and folders by repeatedly walking through the current tree and creating random files or subfolders (the number of files and folders created is chosen from a Gaussian distribution). Args: basedir: Directory to create files and folders in nfiles: Average numb...
Create a random set of files and folders by repeatedly walking through the current tree and creating random files or subfolders (the number of files and folders created is chosen from a Gaussian distribution).
def iterative_gaussian_tree( basedir: Union[str, PurePath], nfiles=2, nfolders=1, repeat=1, maxdepth=None, sigma_folders=1, sigma_files=1, min_folders=0, min_files=0, filename=random_string, payload: Optional[Callable[[Path], Generator[Path, None, None]]] = None, ): """ ...
[ "def", "iterative_gaussian_tree", "(", "basedir", ":", "Union", "[", "str", ",", "PurePath", "]", ",", "nfiles", "=", "2", ",", "nfolders", "=", "1", ",", "repeat", "=", "1", ",", "maxdepth", "=", "None", ",", "sigma_folders", "=", "1", ",", "sigma_fil...
[ 95, 0 ]
[ 154, 5 ]
python
en
['en', 'error', 'th']
False
choose_random_elements
(basedir, n_dirs, n_files, onfail="raise")
Select random files and directories. If all directories and files must be unique, use sample_random_elements instead. Args: basedir: Directory to scan n_dirs: Number of directories to pick n_files: Number of files to pick onfail: What to do if there are no files or folders ...
Select random files and directories. If all directories and files must be unique, use sample_random_elements instead.
def choose_random_elements(basedir, n_dirs, n_files, onfail="raise"): """ Select random files and directories. If all directories and files must be unique, use sample_random_elements instead. Args: basedir: Directory to scan n_dirs: Number of directories to pick n_files: Number ...
[ "def", "choose_random_elements", "(", "basedir", ",", "n_dirs", ",", "n_files", ",", "onfail", "=", "\"raise\"", ")", ":", "alldirs", "=", "[", "]", "allfiles", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "s...
[ 157, 0 ]
[ 198, 40 ]
python
en
['en', 'error', 'th']
False
sample_random_elements
(basedir, n_dirs, n_files, onfail="raise")
Select random distinct files and directories. If the directories and files do not have to be distinct, use choose_random_elements instead. Args: basedir: Directory to scan n_dirs: Number of directories to pick n_files: Number of files to pick onfail: What to do if there are...
Select random distinct files and directories. If the directories and files do not have to be distinct, use choose_random_elements instead.
def sample_random_elements(basedir, n_dirs, n_files, onfail="raise"): """ Select random distinct files and directories. If the directories and files do not have to be distinct, use choose_random_elements instead. Args: basedir: Directory to scan n_dirs: Number of directories to pick ...
[ "def", "sample_random_elements", "(", "basedir", ",", "n_dirs", ",", "n_files", ",", "onfail", "=", "\"raise\"", ")", ":", "alldirs", "=", "[", "]", "allfiles", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "s...
[ 201, 0 ]
[ 247, 40 ]
python
en
['en', 'error', 'th']
False
ElasticsearchDocumentStore.__init__
( self, host: Union[str, List[str]] = "localhost", port: Union[int, List[int]] = 9200, username: str = "", password: str = "", api_key_id: Optional[str] = None, api_key: Optional[str] = None, index: str = "document", label_index: str = "label", ...
A DocumentStore using Elasticsearch to store and query the documents for our search. * Keeps all the logic to store and query documents from Elastic, incl. mapping of fields, adding filters or boosts to your queries, and storing embeddings * You can either use an existing Elasticsearch...
A DocumentStore using Elasticsearch to store and query the documents for our search.
def __init__( self, host: Union[str, List[str]] = "localhost", port: Union[int, List[int]] = 9200, username: str = "", password: str = "", api_key_id: Optional[str] = None, api_key: Optional[str] = None, index: str = "document", label_index: str = ...
[ "def", "__init__", "(", "self", ",", "host", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", "=", "\"localhost\"", ",", "port", ":", "Union", "[", "int", ",", "List", "[", "int", "]", "]", "=", "9200", ",", "username", ":", "str", ...
[ 20, 4 ]
[ 127, 40 ]
python
en
['en', 'error', 'th']
False
ElasticsearchDocumentStore._create_document_index
(self, index_name: str)
Create a new index for storing documents. In case if an index with the name already exists, it ensures that the embedding_field is present.
Create a new index for storing documents. In case if an index with the name already exists, it ensures that the embedding_field is present.
def _create_document_index(self, index_name: str): """ Create a new index for storing documents. In case if an index with the name already exists, it ensures that the embedding_field is present. """ # check if the existing index has the embedding field; if not create it i...
[ "def", "_create_document_index", "(", "self", ",", "index_name", ":", "str", ")", ":", "# check if the existing index has the embedding field; if not create it", "if", "self", ".", "client", ".", "indices", ".", "exists", "(", "index", "=", "index_name", ")", ":", "...
[ 174, 4 ]
[ 229, 23 ]
python
en
['en', 'error', 'th']
False
ElasticsearchDocumentStore.get_document_by_id
(self, id: str, index: Optional[str] = None)
Fetch a document by specifying its text id string
Fetch a document by specifying its text id string
def get_document_by_id(self, id: str, index: Optional[str] = None) -> Optional[Document]: """Fetch a document by specifying its text id string""" index = index or self.index documents = self.get_documents_by_id([id], index=index) if documents: return documents[0] else...
[ "def", "get_document_by_id", "(", "self", ",", "id", ":", "str", ",", "index", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Optional", "[", "Document", "]", ":", "index", "=", "index", "or", "self", ".", "index", "documents", "=", "self...
[ 271, 4 ]
[ 278, 23 ]
python
en
['en', 'en', 'en']
True