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
create_max_ndvi_mosaic
(dataset_in, clean_mask=None, no_data=-9999, dtype=None, intermediate_product=None, **kwargs)
Method for calculating the pixel value for the max ndvi value. Parameters ---------- dataset_in: xarray.Dataset A dataset retrieved from the Data Cube; should contain: coordinates: time, latitude, longitude variables: variables to be mosaicked (e.g. red, green, and blue bands) ...
Method for calculating the pixel value for the max ndvi value.
def create_max_ndvi_mosaic(dataset_in, clean_mask=None, no_data=-9999, dtype=None, intermediate_product=None, **kwargs): """ Method for calculating the pixel value for the max ndvi value. Parameters ---------- dataset_in: xarray.Dataset A dataset retrieved from the Data Cube; should contain...
[ "def", "create_max_ndvi_mosaic", "(", "dataset_in", ",", "clean_mask", "=", "None", ",", "no_data", "=", "-", "9999", ",", "dtype", "=", "None", ",", "intermediate_product", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dataset_in", "=", "dataset_in", "...
[ 213, 0 ]
[ 276, 22 ]
python
en
['en', 'error', 'th']
False
create_min_ndvi_mosaic
(dataset_in, clean_mask=None, no_data=-9999, dtype=None, intermediate_product=None, **kwargs)
Method for calculating the pixel value for the min ndvi value. Parameters ---------- dataset_in: xarray.Dataset A dataset retrieved from the Data Cube; should contain: coordinates: time, latitude, longitude variables: variables to be mosaicked (e.g. red, green, and blue bands) ...
Method for calculating the pixel value for the min ndvi value.
def create_min_ndvi_mosaic(dataset_in, clean_mask=None, no_data=-9999, dtype=None, intermediate_product=None, **kwargs): """ Method for calculating the pixel value for the min ndvi value. Parameters ---------- dataset_in: xarray.Dataset A dataset retrieved from the Data Cube; should contain...
[ "def", "create_min_ndvi_mosaic", "(", "dataset_in", ",", "clean_mask", "=", "None", ",", "no_data", "=", "-", "9999", ",", "dtype", "=", "None", ",", "intermediate_product", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dataset_in", "=", "dataset_in", "...
[ 279, 0 ]
[ 343, 22 ]
python
en
['en', 'error', 'th']
False
unpack_bits
(land_cover_endcoding, data_array, cover_type)
Description: Unpack bits for end of ls7 and ls8 functions ----- Input: land_cover_encoding(dict hash table) land cover endcoding provided by ls7 or ls8 data_array( xarray DataArray) cover_type(String) type of cover Output: unpacked DataArray
Description: Unpack bits for end of ls7 and ls8 functions ----- Input: land_cover_encoding(dict hash table) land cover endcoding provided by ls7 or ls8 data_array( xarray DataArray) cover_type(String) type of cover Output: unpacked DataArray
def unpack_bits(land_cover_endcoding, data_array, cover_type): """ Description: Unpack bits for end of ls7 and ls8 functions ----- Input: land_cover_encoding(dict hash table) land cover endcoding provided by ls7 or ls8 data_array( xarray DataArray) cover_type(String) type of cover Output: ...
[ "def", "unpack_bits", "(", "land_cover_endcoding", ",", "data_array", ",", "cover_type", ")", ":", "boolean_mask", "=", "np", ".", "isin", "(", "data_array", ".", "values", ",", "land_cover_endcoding", "[", "cover_type", "]", ")", "return", "xr", ".", "DataArr...
[ 345, 0 ]
[ 362, 49 ]
python
en
['en', 'error', 'th']
False
ls8_oli_unpack_qa
(data_array, cover_type)
Returns a boolean `xarray.DataArray` denoting which points in `data_array` are of the selected `cover_type` (True indicates presence and False indicates absence). For more information, see this: https://landsat.usgs.gov/collectionqualityband The most relevant section for this function is titled ...
Returns a boolean `xarray.DataArray` denoting which points in `data_array` are of the selected `cover_type` (True indicates presence and False indicates absence).
def ls8_oli_unpack_qa(data_array, cover_type): """ Returns a boolean `xarray.DataArray` denoting which points in `data_array` are of the selected `cover_type` (True indicates presence and False indicates absence). For more information, see this: https://landsat.usgs.gov/collectionqualityband Th...
[ "def", "ls8_oli_unpack_qa", "(", "data_array", ",", "cover_type", ")", ":", "land_cover_encoding", "=", "dict", "(", "fill", "=", "[", "1", "]", ",", "terrain_occ", "=", "[", "2", ",", "2722", "]", ",", "clear", "=", "[", "2720", ",", "2724", ",", "2...
[ 382, 0 ]
[ 442, 67 ]
python
en
['en', 'error', 'th']
False
create_hdmedians_multiple_band_mosaic
(dataset_in, clean_mask=None, no_data=-9999, dtype=None, intermediate_product=None, operation="median", ...
Calculates the geomedian or geomedoid using a multi-band processing method. Parameters ---------- dataset_in: xarray.Dataset A dataset retrieved from the Data Cube; should contain: coordinates: time, latitude, longitude (in that order) variables: variables to be mosaicked (e.g....
Calculates the geomedian or geomedoid using a multi-band processing method.
def create_hdmedians_multiple_band_mosaic(dataset_in, clean_mask=None, no_data=-9999, dtype=None, intermediate_product=None, ...
[ "def", "create_hdmedians_multiple_band_mosaic", "(", "dataset_in", ",", "clean_mask", "=", "None", ",", "no_data", "=", "-", "9999", ",", "dtype", "=", "None", ",", "intermediate_product", "=", "None", ",", "operation", "=", "\"median\"", ",", "*", "*", "kwarg...
[ 473, 0 ]
[ 551, 22 ]
python
en
['en', 'error', 'th']
False
restore_or_convert_dtypes
(dtype_for_all=None, band_list=None, dataset_in_dtypes=None, dataset_out=None, no_data=-9999)
Converts datatypes of data variables in a copy of an xarray Dataset. Parameters ---------- dtype_for_all: str or numpy.dtype A string denoting a Python datatype name (e.g. int, float) or a NumPy dtype (e.g. np.int16, np.float32) to convert the data to. band_list: list-like ...
Converts datatypes of data variables in a copy of an xarray Dataset.
def restore_or_convert_dtypes(dtype_for_all=None, band_list=None, dataset_in_dtypes=None, dataset_out=None, no_data=-9999): """ Converts datatypes of data variables in a copy of an xarray Dataset. Parameters ---------- dtype_for_all: str or numpy.dtype A string denoting a Python datatype na...
[ "def", "restore_or_convert_dtypes", "(", "dtype_for_all", "=", "None", ",", "band_list", "=", "None", ",", "dataset_in_dtypes", "=", "None", ",", "dataset_out", "=", "None", ",", "no_data", "=", "-", "9999", ")", ":", "assert", "dtype_for_all", "is", "None", ...
[ 553, 0 ]
[ 588, 22 ]
python
en
['en', 'error', 'th']
False
EvictionModel.run
(self)
def run(self): settings = self.config.experiment_settings(self.name()) invocations = settings["invocations"] sleep = settings["sleep"] repetitions = settings["repetitions"] invocation_idx = settings["function_copy_idx"] port = settings["client-port"] from request...
[ "def", "run", "(", "self", ")", ":", "settings", "=", "self", ".", "config", ".", "experiment_settings", "(", "self", ".", "name", "(", ")", ")", "invocations", "=", "settings", "[", "\"invocations\"", "]", "sleep", "=", "settings", "[", "\"sleep\"", "]"...
[ 206, 4 ]
[ 304, 47 ]
python
en
['en', 'error', 'th']
False
CommandTests.test_wait_for_db_ready
(self)
Test waiting for db when db is available
Test waiting for db when db is available
def test_wait_for_db_ready(self): """Test waiting for db when db is available""" with patch('django.db.utils.ConnectionHandler.__getitem__') as gi: gi.return_value = True call_command('wait_for_db') self.assertEqual(gi.call_count, 1)
[ "def", "test_wait_for_db_ready", "(", "self", ")", ":", "with", "patch", "(", "'django.db.utils.ConnectionHandler.__getitem__'", ")", "as", "gi", ":", "gi", ".", "return_value", "=", "True", "call_command", "(", "'wait_for_db'", ")", "self", ".", "assertEqual", "(...
[ 9, 4 ]
[ 14, 46 ]
python
en
['en', 'en', 'en']
True
CommandTests.test_wait_for_db
(self, ts)
Test waiting for db
Test waiting for db
def test_wait_for_db(self, ts): """Test waiting for db""" with patch('django.db.utils.ConnectionHandler.__getitem__') as gi: gi.side_effect = [OperationalError] * 5 + [True] call_command('wait_for_db') self.assertEqual(gi.call_count, 6)
[ "def", "test_wait_for_db", "(", "self", ",", "ts", ")", ":", "with", "patch", "(", "'django.db.utils.ConnectionHandler.__getitem__'", ")", "as", "gi", ":", "gi", ".", "side_effect", "=", "[", "OperationalError", "]", "*", "5", "+", "[", "True", "]", "call_co...
[ 17, 4 ]
[ 22, 46 ]
python
en
['en', 'en', 'en']
True
ConfiguredAssetSqlDataConnector.add_data_asset
( self, name: str, config: dict, )
Add data_asset to DataConnector using data_asset name as key, and data_asset configuration as value.
Add data_asset to DataConnector using data_asset name as key, and data_asset configuration as value.
def add_data_asset( self, name: str, config: dict, ): """ Add data_asset to DataConnector using data_asset name as key, and data_asset configuration as value. """ self._assets[name] = config
[ "def", "add_data_asset", "(", "self", ",", "name", ":", "str", ",", "config", ":", "dict", ",", ")", ":", "self", ".", "_assets", "[", "name", "]", "=", "config" ]
[ 57, 4 ]
[ 65, 35 ]
python
en
['en', 'error', 'th']
False
ConfiguredAssetSqlDataConnector.get_available_data_asset_names
(self)
Return the list of asset names known by this DataConnector. Returns: A list of available names
Return the list of asset names known by this DataConnector.
def get_available_data_asset_names(self) -> List[str]: """ Return the list of asset names known by this DataConnector. Returns: A list of available names """ return list(self.assets.keys())
[ "def", "get_available_data_asset_names", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "list", "(", "self", ".", "assets", ".", "keys", "(", ")", ")" ]
[ 122, 4 ]
[ 129, 39 ]
python
en
['en', 'error', 'th']
False
ConfiguredAssetSqlDataConnector.get_unmatched_data_references
(self)
Returns the list of data_references unmatched by configuration by looping through items in _data_references_cache and returning data_reference that do not have an associated data_asset. Returns: list of data_references that are not matched by configuration.
Returns the list of data_references unmatched by configuration by looping through items in _data_references_cache and returning data_reference that do not have an associated data_asset.
def get_unmatched_data_references(self) -> List[str]: """ Returns the list of data_references unmatched by configuration by looping through items in _data_references_cache and returning data_reference that do not have an associated data_asset. Returns: list of data_reference...
[ "def", "get_unmatched_data_references", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "[", "]" ]
[ 131, 4 ]
[ 139, 17 ]
python
en
['en', 'error', 'th']
False
ConfiguredAssetSqlDataConnector.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 ) -> SqlAlchemyDatasourceBatchSpec: """ Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function. Args: batch_definition (BatchDefinition): to be used to build batch_spec ...
[ "def", "build_batch_spec", "(", "self", ",", "batch_definition", ":", "BatchDefinition", ")", "->", "SqlAlchemyDatasourceBatchSpec", ":", "data_asset_name", ":", "str", "=", "batch_definition", ".", "data_asset_name", "if", "(", "data_asset_name", "in", "self", ".", ...
[ 187, 4 ]
[ 223, 56 ]
python
en
['en', 'error', 'th']
False
ConfiguredAssetSqlDataConnector._generate_batch_spec_parameters_from_batch_definition
( self, batch_definition: BatchDefinition )
Build BatchSpec parameters from batch_definition with the following components: 1. data_asset_name from batch_definition 2. batch_identifiers from batch_definition 3. data_asset from data_connector Args: batch_definition (BatchDefinition): to be used to ...
Build BatchSpec parameters from batch_definition with the following components: 1. data_asset_name from batch_definition 2. batch_identifiers from batch_definition 3. data_asset from data_connector
def _generate_batch_spec_parameters_from_batch_definition( self, batch_definition: BatchDefinition ) -> dict: """ Build BatchSpec parameters from batch_definition with the following components: 1. data_asset_name from batch_definition 2. batch_identifiers from batch_d...
[ "def", "_generate_batch_spec_parameters_from_batch_definition", "(", "self", ",", "batch_definition", ":", "BatchDefinition", ")", "->", "dict", ":", "data_asset_name", ":", "str", "=", "batch_definition", ".", "data_asset_name", "return", "{", "\"data_asset_name\"", ":",...
[ 225, 4 ]
[ 246, 9 ]
python
en
['en', 'error', 'th']
False
ConfiguredAssetSqlDataConnector._split_on_whole_table
( self, table_name: str, )
'Split' by returning the whole table Note: the table_name parameter is a required to keep the signature of this method consistent with other methods.
'Split' by returning the whole table
def _split_on_whole_table( self, table_name: str, ): """ 'Split' by returning the whole table Note: the table_name parameter is a required to keep the signature of this method consistent with other methods. """ return sa.select([sa.true()])
[ "def", "_split_on_whole_table", "(", "self", ",", "table_name", ":", "str", ",", ")", ":", "return", "sa", ".", "select", "(", "[", "sa", ".", "true", "(", ")", "]", ")" ]
[ 250, 4 ]
[ 260, 37 ]
python
en
['en', 'error', 'th']
False
ConfiguredAssetSqlDataConnector._split_on_column_value
( self, table_name: str, column_name: str, )
Split using the values in the named column
Split using the values in the named column
def _split_on_column_value( self, table_name: str, column_name: str, ): """Split using the values in the named column""" # query = f"SELECT DISTINCT(\"{self.column_name}\") FROM {self.table_name}" return sa.select([sa.func.distinct(sa.column(column_name))]).select_fr...
[ "def", "_split_on_column_value", "(", "self", ",", "table_name", ":", "str", ",", "column_name", ":", "str", ",", ")", ":", "# query = f\"SELECT DISTINCT(\\\"{self.column_name}\\\") FROM {self.table_name}\"", "return", "sa", ".", "select", "(", "[", "sa", ".", "func",...
[ 262, 4 ]
[ 272, 9 ]
python
en
['en', 'no', 'en']
True
ConfiguredAssetSqlDataConnector._split_on_converted_datetime
( self, table_name: str, column_name: str, date_format_string: str = "%Y-%m-%d", )
Convert the values in the named column to the given date_format, and split on that
Convert the values in the named column to the given date_format, and split on that
def _split_on_converted_datetime( self, table_name: str, column_name: str, date_format_string: str = "%Y-%m-%d", ): """Convert the values in the named column to the given date_format, and split on that""" # query = f"SELECT DISTINCT( strftime(\"{date_format_string}\",...
[ "def", "_split_on_converted_datetime", "(", "self", ",", "table_name", ":", "str", ",", "column_name", ":", "str", ",", "date_format_string", ":", "str", "=", "\"%Y-%m-%d\"", ",", ")", ":", "# query = f\"SELECT DISTINCT( strftime(\\\"{date_format_string}\\\", \\\"{self.colu...
[ 274, 4 ]
[ 292, 42 ]
python
en
['en', 'en', 'en']
True
ConfiguredAssetSqlDataConnector._split_on_divided_integer
( self, table_name: str, column_name: str, divisor: int )
Divide the values in the named column by `divisor`, and split on that
Divide the values in the named column by `divisor`, and split on that
def _split_on_divided_integer( self, table_name: str, column_name: str, divisor: int ): """Divide the values in the named column by `divisor`, and split on that""" # query = f"SELECT DISTINCT(\"{self.column_name}\" / {divisor}) AS my_var FROM {self.table_name}" return sa.select( ...
[ "def", "_split_on_divided_integer", "(", "self", ",", "table_name", ":", "str", ",", "column_name", ":", "str", ",", "divisor", ":", "int", ")", ":", "# query = f\"SELECT DISTINCT(\\\"{self.column_name}\\\" / {divisor}) AS my_var FROM {self.table_name}\"", "return", "sa", "...
[ 294, 4 ]
[ 302, 42 ]
python
en
['en', 'en', 'en']
True
ConfiguredAssetSqlDataConnector._split_on_mod_integer
(self, table_name: str, column_name: str, mod: int)
Divide the values in the named column by `divisor`, and split on that
Divide the values in the named column by `divisor`, and split on that
def _split_on_mod_integer(self, table_name: str, column_name: str, mod: int): """Divide the values in the named column by `divisor`, and split on that""" # query = f"SELECT DISTINCT(\"{self.column_name}\" / {divisor}) AS my_var FROM {self.table_name}" return sa.select( [sa.func.dist...
[ "def", "_split_on_mod_integer", "(", "self", ",", "table_name", ":", "str", ",", "column_name", ":", "str", ",", "mod", ":", "int", ")", ":", "# query = f\"SELECT DISTINCT(\\\"{self.column_name}\\\" / {divisor}) AS my_var FROM {self.table_name}\"", "return", "sa", ".", "s...
[ 304, 4 ]
[ 310, 42 ]
python
en
['en', 'en', 'en']
True
ConfiguredAssetSqlDataConnector._split_on_multi_column_values
( self, table_name: str, column_names: List[str], )
Split on the joint values in the named columns
Split on the joint values in the named columns
def _split_on_multi_column_values( self, table_name: str, column_names: List[str], ): """Split on the joint values in the named columns""" # query = f"SELECT DISTINCT(\"{self.column_name}\") FROM {self.table_name}" return ( sa.select([sa.column(column_nam...
[ "def", "_split_on_multi_column_values", "(", "self", ",", "table_name", ":", "str", ",", "column_names", ":", "List", "[", "str", "]", ",", ")", ":", "# query = f\"SELECT DISTINCT(\\\"{self.column_name}\\\") FROM {self.table_name}\"", "return", "(", "sa", ".", "select",...
[ 312, 4 ]
[ 324, 9 ]
python
en
['en', 'en', 'en']
True
ConfiguredAssetSqlDataConnector._split_on_hashed_column
( self, table_name: str, column_name: str, hash_digits: int, )
Note: this method is experimental. It does not work with all SQL dialects.
Note: this method is experimental. It does not work with all SQL dialects.
def _split_on_hashed_column( self, table_name: str, column_name: str, hash_digits: int, ): """Note: this method is experimental. It does not work with all SQL dialects.""" # query = f"SELECT MD5(\"{self.column_name}\") = {matching_hash}) AS hashed_var FROM {self.table...
[ "def", "_split_on_hashed_column", "(", "self", ",", "table_name", ":", "str", ",", "column_name", ":", "str", ",", "hash_digits", ":", "int", ",", ")", ":", "# query = f\"SELECT MD5(\\\"{self.column_name}\\\") = {matching_hash}) AS hashed_var FROM {self.table_name}\"", "retur...
[ 326, 4 ]
[ 337, 9 ]
python
en
['en', 'en', 'en']
True
download
(name, test_size=None, data_path=DATA_PATH)
Load the CSV with the given name from S3. If the CSV has never been loaded before, it will be downloaded from the [d3-ai-orion bucket](https://d3-ai-orion.s3.amazonaws.com) or the S3 bucket specified following the `s3://{bucket}/path/to/the.csv` format, and then cached inside the `data` folder, within ...
Load the CSV with the given name from S3.
def download(name, test_size=None, data_path=DATA_PATH): """Load the CSV with the given name from S3. If the CSV has never been loaded before, it will be downloaded from the [d3-ai-orion bucket](https://d3-ai-orion.s3.amazonaws.com) or the S3 bucket specified following the `s3://{bucket}/path/to/the.cs...
[ "def", "download", "(", "name", ",", "test_size", "=", "None", ",", "data_path", "=", "DATA_PATH", ")", ":", "url", "=", "None", "if", "name", ".", "startswith", "(", "'s3://'", ")", ":", "parts", "=", "name", "[", "5", ":", "]", ".", "split", "(",...
[ 42, 0 ]
[ 90, 15 ]
python
en
['en', 'en', 'en']
True
SubdirReaderBatchKwargsGenerator._build_batch_kwargs
(self, batch_parameters)
Args: batch_parameters: Returns: batch_kwargs
def _build_batch_kwargs(self, batch_parameters): """ Args: batch_parameters: Returns: batch_kwargs """ try: data_asset_name = batch_parameters.pop("data_asset_name") except KeyError: raise BatchKwargsError( ...
[ "def", "_build_batch_kwargs", "(", "self", ",", "batch_parameters", ")", ":", "try", ":", "data_asset_name", "=", "batch_parameters", ".", "pop", "(", "\"data_asset_name\"", ")", "except", "KeyError", ":", "raise", "BatchKwargsError", "(", "\"Unable to build BatchKwar...
[ 123, 4 ]
[ 183, 13 ]
python
en
['en', 'error', 'th']
False
IRTLSContext.from_legacy
(cls, ir: 'IR', name: str, rkey: str, location: str, cert: 'IRAmbassadorTLS', termination: bool, validation_ca: Optional['IRAmbassadorTLS'])
Create an IRTLSContext from a legacy TLS-module style definition. 'cert' is the TLS certificate that we'll offer to our peer -- for a termination context, this is our server cert, and for an origination context, it's our client cert. For termination contexts, 'validation_ca' m...
Create an IRTLSContext from a legacy TLS-module style definition.
def from_legacy(cls, ir: 'IR', name: str, rkey: str, location: str, cert: 'IRAmbassadorTLS', termination: bool, validation_ca: Optional['IRAmbassadorTLS']) -> 'IRTLSContext': """ Create an IRTLSContext from a legacy TLS-module style definition. 'cert' is ...
[ "def", "from_legacy", "(", "cls", ",", "ir", ":", "'IR'", ",", "name", ":", "str", ",", "rkey", ":", "str", ",", "location", ":", "str", ",", "cert", ":", "'IRAmbassadorTLS'", ",", "termination", ":", "bool", ",", "validation_ca", ":", "Optional", "[",...
[ 332, 4 ]
[ 396, 18 ]
python
en
['en', 'error', 'th']
False
Rule.__init__
( self, name: str, domain_builder: Optional[DomainBuilder] = None, parameter_builders: Optional[List[ParameterBuilder]] = None, expectation_configuration_builders: Optional[ List[ExpectationConfigurationBuilder] ] = None, variables: Optional[ParameterC...
Sets Profiler rule name, domain builders, parameters builders, configuration builders, and other necessary instance data (variables) :param name: A string representing the name of the ProfilerRule :param domain_builder: A Domain Builder object used to build rule data domain :par...
Sets Profiler rule name, domain builders, parameters builders, configuration builders, and other necessary instance data (variables) :param name: A string representing the name of the ProfilerRule :param domain_builder: A Domain Builder object used to build rule data domain :par...
def __init__( self, name: str, domain_builder: Optional[DomainBuilder] = None, parameter_builders: Optional[List[ParameterBuilder]] = None, expectation_configuration_builders: Optional[ List[ExpectationConfigurationBuilder] ] = None, variables: Optiona...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "domain_builder", ":", "Optional", "[", "DomainBuilder", "]", "=", "None", ",", "parameter_builders", ":", "Optional", "[", "List", "[", "ParameterBuilder", "]", "]", "=", "None", ",", "expectat...
[ 15, 4 ]
[ 41, 29 ]
python
en
['en', 'error', 'th']
False
Rule.generate
( self, )
Builds a list of Expectation Configurations, returning a single Expectation Configuration entry for every ConfigurationBuilder available based on the instantiation. :return: List of Corresponding Expectation Configurations representing every configured rule
Builds a list of Expectation Configurations, returning a single Expectation Configuration entry for every ConfigurationBuilder available based on the instantiation.
def generate( self, ) -> List[ExpectationConfiguration]: """ Builds a list of Expectation Configurations, returning a single Expectation Configuration entry for every ConfigurationBuilder available based on the instantiation. :return: List of Corresponding Expectation Config...
[ "def", "generate", "(", "self", ",", ")", "->", "List", "[", "ExpectationConfiguration", "]", ":", "expectation_configurations", ":", "List", "[", "ExpectationConfiguration", "]", "=", "[", "]", "domains", ":", "List", "[", "Domain", "]", "=", "self", ".", ...
[ 43, 4 ]
[ 85, 41 ]
python
en
['en', 'error', 'th']
False
venv
(request)
Prepares a virtual environment for nose. :rtype : virtual_environments.VirtualEnvDescription
Prepares a virtual environment for nose. :rtype : virtual_environments.VirtualEnvDescription
def venv(request): """ Prepares a virtual environment for nose. :rtype : virtual_environments.VirtualEnvDescription """ return virtual_environments.prepare_virtualenv([request.param])
[ "def", "venv", "(", "request", ")", ":", "return", "virtual_environments", ".", "prepare_virtualenv", "(", "[", "request", ".", "param", "]", ")" ]
[ 13, 0 ]
[ 18, 67 ]
python
en
['en', 'error', 'th']
False
RunVar.get
(self, default=_NO_DEFAULT)
Gets the value of this :class:`RunVar` for the current run call.
Gets the value of this :class:`RunVar` for the current run call.
def get(self, default=_NO_DEFAULT): """Gets the value of this :class:`RunVar` for the current run call.""" try: return _run.GLOBAL_RUN_CONTEXT.runner._locals[self] except AttributeError: raise RuntimeError("Cannot be used outside of a run context") from None excep...
[ "def", "get", "(", "self", ",", "default", "=", "_NO_DEFAULT", ")", ":", "try", ":", "return", "_run", ".", "GLOBAL_RUN_CONTEXT", ".", "runner", ".", "_locals", "[", "self", "]", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "\"Cannot be use...
[ 37, 4 ]
[ 51, 45 ]
python
en
['en', 'en', 'en']
True
RunVar.set
(self, value)
Sets the value of this :class:`RunVar` for this current run call.
Sets the value of this :class:`RunVar` for this current run call.
def set(self, value): """Sets the value of this :class:`RunVar` for this current run call. """ try: old_value = self.get() except LookupError: token = _RunVarToken.empty(self) else: token = _RunVarToken(self, old_value) # This...
[ "def", "set", "(", "self", ",", "value", ")", ":", "try", ":", "old_value", "=", "self", ".", "get", "(", ")", "except", "LookupError", ":", "token", "=", "_RunVarToken", ".", "empty", "(", "self", ")", "else", ":", "token", "=", "_RunVarToken", "(",...
[ 53, 4 ]
[ 68, 20 ]
python
en
['en', 'en', 'en']
True
RunVar.reset
(self, token)
Resets the value of this :class:`RunVar` to what it was previously specified by the token.
Resets the value of this :class:`RunVar` to what it was previously specified by the token.
def reset(self, token): """Resets the value of this :class:`RunVar` to what it was previously specified by the token. """ if token is None: raise TypeError("token must not be none") if token.redeemed: raise ValueError("token has already been used") ...
[ "def", "reset", "(", "self", ",", "token", ")", ":", "if", "token", "is", "None", ":", "raise", "TypeError", "(", "\"token must not be none\"", ")", "if", "token", ".", "redeemed", ":", "raise", "ValueError", "(", "\"token has already been used\"", ")", "if", ...
[ 70, 4 ]
[ 93, 29 ]
python
en
['en', 'en', 'en']
True
parse_result_format
(result_format)
This is a simple helper utility that can be used to parse a string result_format into the dict format used internally by great_expectations. It is not necessary but allows shorthand for result_format in cases where there is no need to specify a custom partial_unexpected_count.
This is a simple helper utility that can be used to parse a string result_format into the dict format used internally by great_expectations. It is not necessary but allows shorthand for result_format in cases where there is no need to specify a custom partial_unexpected_count.
def parse_result_format(result_format): """This is a simple helper utility that can be used to parse a string result_format into the dict format used internally by great_expectations. It is not necessary but allows shorthand for result_format in cases where there is no need to specify a custom partial_unexp...
[ "def", "parse_result_format", "(", "result_format", ")", ":", "if", "isinstance", "(", "result_format", ",", "str", ")", ":", "result_format", "=", "{", "\"result_format\"", ":", "result_format", ",", "\"partial_unexpected_count\"", ":", "20", "}", "else", ":", ...
[ 18, 0 ]
[ 28, 24 ]
python
en
['en', 'en', 'en']
True
recursively_convert_to_json_serializable
(test_obj)
Helper function to convert a dict object to one that is serializable Args: test_obj: an object to attempt to convert a corresponding json-serializable object Returns: (dict) A converted test_object Warning: test_obj may also be converted in place.
Helper function to convert a dict object to one that is serializable
def recursively_convert_to_json_serializable(test_obj): """ Helper function to convert a dict object to one that is serializable Args: test_obj: an object to attempt to convert a corresponding json-serializable object Returns: (dict) A converted test_object Warning: test_o...
[ "def", "recursively_convert_to_json_serializable", "(", "test_obj", ")", ":", "# If it's one of our types, we pass", "if", "isinstance", "(", "test_obj", ",", "(", "ExpectationConfiguration", ",", "ExpectationSuite", ",", "ExpectationValidationResult", ",", "ExpectationSuiteVal...
[ 85, 0 ]
[ 202, 9 ]
python
en
['en', 'error', 'th']
False
TeamcityFormatter._report_suite_started
(self, suite, suite_name)
:param suite: behave suite :param suite_name: suite name that must be reported, be sure to use it instead of suite.name
:param suite: behave suite :param suite_name: suite name that must be reported, be sure to use it instead of suite.name
def _report_suite_started(self, suite, suite_name): """ :param suite: behave suite :param suite_name: suite name that must be reported, be sure to use it instead of suite.name """ self._messages.testSuiteStarted(suite_name)
[ "def", "_report_suite_started", "(", "self", ",", "suite", ",", "suite_name", ")", ":", "self", ".", "_messages", ".", "testSuiteStarted", "(", "suite_name", ")" ]
[ 78, 4 ]
[ 84, 51 ]
python
en
['en', 'error', 'th']
False
TeamcityFormatter._report_test_started
(self, test, test_name)
Suite name is always stripped, be sure to strip() it too :param test: behave test :param test_name: test name that must be reported, be sure to use it instead of test.name
Suite name is always stripped, be sure to strip() it too :param test: behave test :param test_name: test name that must be reported, be sure to use it instead of test.name
def _report_test_started(self, test, test_name): """ Suite name is always stripped, be sure to strip() it too :param test: behave test :param test_name: test name that must be reported, be sure to use it instead of test.name """ self._messages.testStarted(test_name)
[ "def", "_report_test_started", "(", "self", ",", "test", ",", "test_name", ")", ":", "self", ".", "_messages", ".", "testStarted", "(", "test_name", ")" ]
[ 86, 4 ]
[ 92, 45 ]
python
en
['en', 'error', 'th']
False
Template.load
(self)
Load this Template as an MLPipeline. Returns: MLPipeline
Load this Template as an MLPipeline.
def load(self): """Load this Template as an MLPipeline. Returns: MLPipeline """ return MLPipeline(self.json)
[ "def", "load", "(", "self", ")", ":", "return", "MLPipeline", "(", "self", ".", "json", ")" ]
[ 91, 4 ]
[ 97, 36 ]
python
en
['en', 'en', 'en']
True
Pipeline.load
(self)
Load this Pipeline as an MLPipeline. Returns: MLPipeline
Load this Pipeline as an MLPipeline.
def load(self): """Load this Pipeline as an MLPipeline. Returns: MLPipeline """ return MLPipeline(self.json)
[ "def", "load", "(", "self", ")", ":", "return", "MLPipeline", "(", "self", ".", "json", ")" ]
[ 118, 4 ]
[ 124, 36 ]
python
en
['en', 'en', 'en']
True
Datarun.start
(self)
Mark this Datarun as started on DB. The ``start_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to RUNNING and the software versions will be captured.
Mark this Datarun as started on DB.
def start(self): """Mark this Datarun as started on DB. The ``start_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to RUNNING and the software versions will be captured. """ self.start_time = datetime.utcnow() self.status = self.STATUS_RU...
[ "def", "start", "(", "self", ")", ":", "self", ".", "start_time", "=", "datetime", ".", "utcnow", "(", ")", "self", ".", "status", "=", "self", ".", "STATUS_RUNNING", "self", ".", "software_versions", "=", "self", ".", "_software_versions", "self", ".", ...
[ 176, 4 ]
[ 186, 19 ]
python
en
['en', 'en', 'en']
True
Datarun.end
(self, status)
Mark this Datarun as ended on DB. The ``end_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to the given value, and the ``num_events`` field will be populated with the sum of the events detected by the children Signalruns.
Mark this Datarun as ended on DB.
def end(self, status): """Mark this Datarun as ended on DB. The ``end_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to the given value, and the ``num_events`` field will be populated with the sum of the events detected by the children Signalruns. """ ...
[ "def", "end", "(", "self", ",", "status", ")", ":", "self", ".", "end_time", "=", "datetime", ".", "utcnow", "(", ")", "self", ".", "status", "=", "status", "self", ".", "num_events", "=", "Event", ".", "find", "(", "signalrun__in", "=", "self", ".",...
[ 188, 4 ]
[ 198, 19 ]
python
en
['en', 'en', 'en']
True
Signalrun.start
(self)
Mark this Signalrun as started on DB. The ``start_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to RUNNING.
Mark this Signalrun as started on DB.
def start(self): """Mark this Signalrun as started on DB. The ``start_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to RUNNING. """ self.start_time = datetime.utcnow() self.status = self.STATUS_RUNNING self.save()
[ "def", "start", "(", "self", ")", ":", "self", ".", "start_time", "=", "datetime", ".", "utcnow", "(", ")", "self", ".", "status", "=", "self", ".", "STATUS_RUNNING", "self", ".", "save", "(", ")" ]
[ 223, 4 ]
[ 231, 19 ]
python
en
['en', 'en', 'en']
True
Signalrun.end
(self, status, events)
Mark this Signalrun as ended on DB. The ``end_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to the given value, and the given events will be inserted into the Database.
Mark this Signalrun as ended on DB.
def end(self, status, events): """Mark this Signalrun as ended on DB. The ``end_time`` will be set to ``datetime.utcnow()``, the ``status`` will be set to the given value, and the given events will be inserted into the Database. """ try: if events is None: ...
[ "def", "end", "(", "self", ",", "status", ",", "events", ")", ":", "try", ":", "if", "events", "is", "None", ":", "events", "=", "[", "]", "for", "start_time", ",", "stop_time", ",", "severity", "in", "events", ":", "Event", ".", "insert", "(", "si...
[ 233, 4 ]
[ 259, 19 ]
python
en
['en', 'en', 'en']
True
docs
(ctx)
Data Docs operations
Data Docs operations
def docs(ctx): """Data Docs operations""" directory: str = toolkit.parse_cli_config_file_location( config_file_location=ctx.obj.config_file_location ).get("directory") context: DataContext = toolkit.load_data_context_with_error_handling( directory=directory, from_cli_upgrade_comm...
[ "def", "docs", "(", "ctx", ")", ":", "directory", ":", "str", "=", "toolkit", ".", "parse_cli_config_file_location", "(", "config_file_location", "=", "ctx", ".", "obj", ".", "config_file_location", ")", ".", "get", "(", "\"directory\"", ")", "context", ":", ...
[ 11, 0 ]
[ 29, 57 ]
python
en
['en', 'bg', 'en']
True
docs_build
(ctx, site_name=None, no_view=False)
Build Data Docs for a project.
Build Data Docs for a project.
def docs_build(ctx, site_name=None, no_view=False): """Build Data Docs for a project.""" context: DataContext = ctx.obj.data_context usage_event_end: str = ctx.obj.usage_event_end if site_name is not None and site_name not in context.get_site_names(): toolkit.exit_with_failure_message_and_stats...
[ "def", "docs_build", "(", "ctx", ",", "site_name", "=", "None", ",", "no_view", "=", "False", ")", ":", "context", ":", "DataContext", "=", "ctx", ".", "obj", ".", "data_context", "usage_event_end", ":", "str", "=", "ctx", ".", "obj", ".", "usage_event_e...
[ 47, 0 ]
[ 72, 5 ]
python
en
['en', 'en', 'en']
True
docs_list
(ctx)
List known Data Docs sites.
List known Data Docs sites.
def docs_list(ctx): """List known Data Docs sites.""" context = ctx.obj.data_context usage_event_end: str = ctx.obj.usage_event_end docs_sites_url_dicts = context.get_docs_sites_urls() try: if len(docs_sites_url_dicts) == 0: cli_message("No Data Docs sites found") else: ...
[ "def", "docs_list", "(", "ctx", ")", ":", "context", "=", "ctx", ".", "obj", ".", "data_context", "usage_event_end", ":", "str", "=", "ctx", ".", "obj", ".", "usage_event_end", "docs_sites_url_dicts", "=", "context", ".", "get_docs_sites_urls", "(", ")", "tr...
[ 77, 0 ]
[ 109, 14 ]
python
en
['en', 'fr', 'en']
True
docs_clean
(ctx, site_name=None, all_sites=False)
Remove all files from a Data Docs site. This is a useful first step if you wish to completely re-build a site from scratch.
Remove all files from a Data Docs site.
def docs_clean(ctx, site_name=None, all_sites=False): """ Remove all files from a Data Docs site. This is a useful first step if you wish to completely re-build a site from scratch. """ context = ctx.obj.data_context usage_event_end: str = ctx.obj.usage_event_end if (site_name is None and ...
[ "def", "docs_clean", "(", "ctx", ",", "site_name", "=", "None", ",", "all_sites", "=", "False", ")", ":", "context", "=", "ctx", ".", "obj", ".", "data_context", "usage_event_end", ":", "str", "=", "ctx", ".", "obj", ".", "usage_event_end", "if", "(", ...
[ 126, 0 ]
[ 154, 9 ]
python
en
['en', 'error', 'th']
False
visual_baseline_folder_setup
()
Handle Logging
Handle Logging
def visual_baseline_folder_setup(): """ Handle Logging """ if not os.path.exists(visual_baseline_path): try: os.makedirs(visual_baseline_path) except Exception: pass
[ "def", "visual_baseline_folder_setup", "(", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "visual_baseline_path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "visual_baseline_path", ")", "except", "Exception", ":", "pass" ]
[ 12, 0 ]
[ 18, 16 ]
python
en
['it', 'ja', 'en']
False
get_filetype_from_buffer
(buf, max_lines=5)
Scan the buffer for modelines and return filetype if one is found.
Scan the buffer for modelines and return filetype if one is found.
def get_filetype_from_buffer(buf, max_lines=5): """ Scan the buffer for modelines and return filetype if one is found. """ lines = buf.splitlines() for l in lines[-1:-max_lines-1:-1]: ret = get_filetype_from_line(l) if ret: return ret for l in lines[max_lines:-1:-1]: ...
[ "def", "get_filetype_from_buffer", "(", "buf", ",", "max_lines", "=", "5", ")", ":", "lines", "=", "buf", ".", "splitlines", "(", ")", "for", "l", "in", "lines", "[", "-", "1", ":", "-", "max_lines", "-", "1", ":", "-", "1", "]", ":", "ret", "=",...
[ 28, 0 ]
[ 42, 15 ]
python
en
['en', 'error', 'th']
False
cli
(verbose)
Welcome to the great_expectations CLI! Most commands follow this format: great_expectations <NOUN> <VERB> The nouns are: datasource, docs, project, suite, validation-operator Most nouns accept the following verbs: new, list, edit In particular, the CLI supports the following special commands: ...
Welcome to the great_expectations CLI!
def cli(verbose): """ Welcome to the great_expectations CLI! Most commands follow this format: great_expectations <NOUN> <VERB> The nouns are: datasource, docs, project, suite, validation-operator Most nouns accept the following verbs: new, list, edit In particular, the CLI supports the foll...
[ "def", "cli", "(", "verbose", ")", ":", "logger", "=", "_set_up_logger", "(", ")", "if", "verbose", ":", "# Note we are explicitly not using a logger in all CLI output to have", "# more control over console UI.", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ...
[ 35, 0 ]
[ 56, 38 ]
python
en
['en', 'error', 'th']
False
Skeleton.remove_joints
(self, joints_to_remove)
Remove the joints specified in 'joints_to_remove'.
Remove the joints specified in 'joints_to_remove'.
def remove_joints(self, joints_to_remove): """ Remove the joints specified in 'joints_to_remove'. """ valid_joints = [] for joint in range(len(self._parents)): if joint not in joints_to_remove: valid_joints.append(joint) for i in range(len(sel...
[ "def", "remove_joints", "(", "self", ",", "joints_to_remove", ")", ":", "valid_joints", "=", "[", "]", "for", "joint", "in", "range", "(", "len", "(", "self", ".", "_parents", ")", ")", ":", "if", "joint", "not", "in", "joints_to_remove", ":", "valid_joi...
[ 29, 4 ]
[ 66, 27 ]
python
en
['en', 'error', 'th']
False
test_password_masker_mask_db_url
(monkeypatch, tmp_path)
What does this test and why? The PasswordMasker.mask_db_url() should mask passwords consistently in database urls. The output of mask_db_url should be the same whether user_urlparse is set to True or False. This test uses database url examples from https://docs.sqlalchemy.org/en/14/core/engines.html#da...
What does this test and why? The PasswordMasker.mask_db_url() should mask passwords consistently in database urls. The output of mask_db_url should be the same whether user_urlparse is set to True or False. This test uses database url examples from https://docs.sqlalchemy.org/en/14/core/engines.html#da...
def test_password_masker_mask_db_url(monkeypatch, tmp_path): """ What does this test and why? The PasswordMasker.mask_db_url() should mask passwords consistently in database urls. The output of mask_db_url should be the same whether user_urlparse is set to True or False. This test uses database url exam...
[ "def", "test_password_masker_mask_db_url", "(", "monkeypatch", ",", "tmp_path", ")", ":", "# PostgreSQL", "# default", "db_hostname", "=", "os", ".", "getenv", "(", "\"GE_TEST_LOCAL_DB_HOSTNAME\"", ",", "\"localhost\"", ")", "assert", "(", "PasswordMasker", ".", "mask...
[ 50, 0 ]
[ 272, 84 ]
python
en
['en', 'error', 'th']
False
test_parse_substitution_variable
()
What does this test and why? Ensure parse_substitution_variable works as expected. Returns:
What does this test and why? Ensure parse_substitution_variable works as expected. Returns:
def test_parse_substitution_variable(): """ What does this test and why? Ensure parse_substitution_variable works as expected. Returns: """ assert parse_substitution_variable("${SOME_VAR}") == "SOME_VAR" assert parse_substitution_variable("$SOME_VAR") == "SOME_VAR" assert parse_substitu...
[ "def", "test_parse_substitution_variable", "(", ")", ":", "assert", "parse_substitution_variable", "(", "\"${SOME_VAR}\"", ")", "==", "\"SOME_VAR\"", "assert", "parse_substitution_variable", "(", "\"$SOME_VAR\"", ")", "==", "\"SOME_VAR\"", "assert", "parse_substitution_variab...
[ 275, 0 ]
[ 291, 65 ]
python
en
['en', 'error', 'th']
False
BaseDRLearner.__init__
( self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=0.05, control_name=0, )
Initialize a DR-learner. Args: learner (optional): a model to estimate outcomes and treatment effects in both the control and treatment groups control_outcome_learner (optional): a model to estimate outcomes in the control group treatment_outcome_learner (opt...
Initialize a DR-learner.
def __init__( self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=0.05, control_name=0, ): """Initialize a DR-learner. Args: learner (optional): a model to esti...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "control_outcome_learner", "=", "None", ",", "treatment_outcome_learner", "=", "None", ",", "treatment_effect_learner", "=", "None", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ...
[ 30, 4 ]
[ 74, 30 ]
python
en
['en', 'en', 'it']
True
BaseDRLearner.fit
(self, X, treatment, y, p=None, seed=None)
Fit the inference model. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector p (np.ndarray or pd.Series or dict, optional): an array of propensity sco...
Fit the inference model.
def fit(self, X, treatment, y, p=None, seed=None): """Fit the inference model. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector p (np.ndarr...
[ "def", "fit", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "seed", "=", "None", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_to_np", "(", "X", ",", "treatment", ",", "y", ")", "check_treatment_vector...
[ 88, 4 ]
[ 202, 61 ]
python
en
['en', 'en', 'en']
True
BaseDRLearner.predict
(self, X, treatment=None, y=None, p=None, return_components=False, verbose=True)
Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Series, optional): an outcome vector verbose (bool, optional): whether to output progres...
Predict treatment effects.
def predict(self, X, treatment=None, y=None, p=None, return_components=False, verbose=True): """Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or...
[ "def", "predict", "(", "self", ",", "X", ",", "treatment", "=", "None", ",", "y", "=", "None", ",", "p", "=", "None", ",", "return_components", "=", "False", ",", "verbose", "=", "True", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_t...
[ 204, 4 ]
[ 245, 39 ]
python
en
['fr', 'en', 'en']
True
BaseDRLearner.fit_predict
( self, X, treatment, y, p=None, return_ci=False, n_bootstraps=1000, bootstrap_size=10000, return_components=False, verbose=True, seed=None, )
Fit the treatment effect and outcome models of the R learner and predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector p (np....
Fit the treatment effect and outcome models of the R learner and predict treatment effects.
def fit_predict( self, X, treatment, y, p=None, return_ci=False, n_bootstraps=1000, bootstrap_size=10000, return_components=False, verbose=True, seed=None, ): """Fit the treatment effect and outcome models of the R learn...
[ "def", "fit_predict", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "return_ci", "=", "False", ",", "n_bootstraps", "=", "1000", ",", "bootstrap_size", "=", "10000", ",", "return_components", "=", "False", ",", "verbose",...
[ 247, 4 ]
[ 328, 43 ]
python
en
['en', 'en', 'en']
True
BaseDRLearner.estimate_ate
( self, X, treatment, y, p=None, bootstrap_ci=False, n_bootstraps=1000, bootstrap_size=10000, seed=None, )
Estimate the Average Treatment Effect (ATE). Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector p (np.ndarray or pd.Series or dict, optional): an arr...
Estimate the Average Treatment Effect (ATE).
def estimate_ate( self, X, treatment, y, p=None, bootstrap_ci=False, n_bootstraps=1000, bootstrap_size=10000, seed=None, ): """Estimate the Average Treatment Effect (ATE). Args: X (np.matrix or np.array or pd.Datafr...
[ "def", "estimate_ate", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "bootstrap_ci", "=", "False", ",", "n_bootstraps", "=", "1000", ",", "bootstrap_size", "=", "10000", ",", "seed", "=", "None", ",", ")", ":", "te", ...
[ 330, 4 ]
[ 434, 44 ]
python
en
['en', 'it', 'en']
True
BaseDRRegressor.__init__
(self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=.05, control_name=0)
Initialize an DR-learner regressor. Args: learner (optional): a model to estimate outcomes and treatment effects in both the control and treatment groups control_outcome_learner (optional): a model to estimate outcomes in the control group treatment_outcome_l...
Initialize an DR-learner regressor.
def __init__(self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=.05, control_name=0): """Initialize an DR-learner regressor. Args...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "control_outcome_learner", "=", "None", ",", "treatment_outcome_learner", "=", "None", ",", "treatment_effect_learner", "=", "None", ",", "ate_alpha", "=", ".05", ",", "control_name", "=", "0", ...
[ 442, 4 ]
[ 467, 38 ]
python
en
['en', 'en', 'nl']
True
XGBDRRegressor.__init__
(self, ate_alpha=.05, control_name=0, *args, **kwargs)
Initialize a DR-learner with two XGBoost models.
Initialize a DR-learner with two XGBoost models.
def __init__(self, ate_alpha=.05, control_name=0, *args, **kwargs): """Initialize a DR-learner with two XGBoost models.""" super().__init__(learner=XGBRegressor(*args, **kwargs), ate_alpha=ate_alpha, control_name=control_name)
[ "def", "__init__", "(", "self", ",", "ate_alpha", "=", ".05", ",", "control_name", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "learner", "=", "XGBRegressor", "(", "*", "args", ",", "*", ...
[ 470, 4 ]
[ 474, 51 ]
python
en
['en', 'en', 'en']
True
gaussian_fit
(x, y, x_smooth=None, n_pts=n_pts_smooth)
Fits a Gaussian to some data - x and y. Returns predicted interpolation values. Parameters ---------- x: list-like The x values of the data to fit to. Must have range [0,1]. y: list-like The y values of the data to fit to. x_smooth: list-like The exact x values to inter...
Fits a Gaussian to some data - x and y. Returns predicted interpolation values.
def gaussian_fit(x, y, x_smooth=None, n_pts=n_pts_smooth): """ Fits a Gaussian to some data - x and y. Returns predicted interpolation values. Parameters ---------- x: list-like The x values of the data to fit to. Must have range [0,1]. y: list-like The y values of the data to f...
[ "def", "gaussian_fit", "(", "x", ",", "y", ",", "x_smooth", "=", "None", ",", "n_pts", "=", "n_pts_smooth", ")", ":", "if", "x_smooth", "is", "None", ":", "x_smooth_inds", "=", "np", ".", "linspace", "(", "0", ",", "len", "(", "x", ")", ",", "n_pts...
[ 13, 0 ]
[ 40, 29 ]
python
en
['en', 'error', 'th']
False
gaussian_filter_fit
(x, y, x_smooth=None, n_pts=n_pts_smooth, sigma=None)
Fits a Gaussian filter to some data - x and y. Returns predicted interpolation values. Currently, smoothing is achieved by fitting a cubic spline to the gaussian filter fit of `x` and `y`. Parameters ---------- x: list-like The x values of the data to fit to. y: list-like T...
Fits a Gaussian filter to some data - x and y. Returns predicted interpolation values. Currently, smoothing is achieved by fitting a cubic spline to the gaussian filter fit of `x` and `y`.
def gaussian_filter_fit(x, y, x_smooth=None, n_pts=n_pts_smooth, sigma=None): """ Fits a Gaussian filter to some data - x and y. Returns predicted interpolation values. Currently, smoothing is achieved by fitting a cubic spline to the gaussian filter fit of `x` and `y`. Parameters ---------- ...
[ "def", "gaussian_filter_fit", "(", "x", ",", "y", ",", "x_smooth", "=", "None", ",", "n_pts", "=", "n_pts_smooth", ",", "sigma", "=", "None", ")", ":", "if", "x_smooth", "is", "None", ":", "x_smooth_inds", "=", "np", ".", "linspace", "(", "0", ",", "...
[ 43, 0 ]
[ 75, 29 ]
python
en
['en', 'error', 'th']
False
poly_fit
(x, y, degree, x_smooth=None, n_pts=n_pts_smooth)
Fits a polynomial of any positive integer degree to some data - x and y. Returns predicted interpolation values. Parameters ---------- x: list-like The x values of the data to fit to. y: list-like The y values of the data to fit to. x_smooth: list-like The exact x value...
Fits a polynomial of any positive integer degree to some data - x and y. Returns predicted interpolation values.
def poly_fit(x, y, degree, x_smooth=None, n_pts=n_pts_smooth): """ Fits a polynomial of any positive integer degree to some data - x and y. Returns predicted interpolation values. Parameters ---------- x: list-like The x values of the data to fit to. y: list-like The y values of...
[ "def", "poly_fit", "(", "x", ",", "y", ",", "degree", ",", "x_smooth", "=", "None", ",", "n_pts", "=", "n_pts_smooth", ")", ":", "if", "x_smooth", "is", "None", ":", "x_smooth_inds", "=", "np", ".", "linspace", "(", "0", ",", "len", "(", "x", ")", ...
[ 78, 0 ]
[ 106, 29 ]
python
en
['en', 'error', 'th']
False
fourier_fit
(x, y, n_predict=0, x_smooth=None, n_pts=n_pts_smooth, n_harm=default_fourier_n_harm)
Creates a Fourier fit of a NumPy array. Also supports extrapolation. Credit goes to https://gist.github.com/tartakynov/83f3cd8f44208a1856ce. Parameters ---------- x, y: numpy.ndarray 1D NumPy arrays of the x and y values to fit to. Must not contain NaNs. n_predict: int ...
Creates a Fourier fit of a NumPy array. Also supports extrapolation. Credit goes to https://gist.github.com/tartakynov/83f3cd8f44208a1856ce.
def fourier_fit(x, y, n_predict=0, x_smooth=None, n_pts=n_pts_smooth, n_harm=default_fourier_n_harm): """ Creates a Fourier fit of a NumPy array. Also supports extrapolation. Credit goes to https://gist.github.com/tartakynov/83f3cd8f44208a1856ce. Parameters ---------- x, y: nump...
[ "def", "fourier_fit", "(", "x", ",", "y", ",", "n_predict", "=", "0", ",", "x_smooth", "=", "None", ",", "n_pts", "=", "n_pts_smooth", ",", "n_harm", "=", "default_fourier_n_harm", ")", ":", "if", "x_smooth", "is", "None", ":", "x_smooth_inds", "=", "np"...
[ 109, 0 ]
[ 184, 29 ]
python
en
['en', 'error', 'th']
False
RslLexer.analyse_text
(text)
Check for the most common text in the beginning of a RSL file.
Check for the most common text in the beginning of a RSL file.
def analyse_text(text): """ Check for the most common text in the beginning of a RSL file. """ if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None: return 1.0
[ "def", "analyse_text", "(", "text", ")", ":", "if", "re", ".", "search", "(", "r'scheme\\s*.*?=\\s*class\\s*type'", ",", "text", ",", "re", ".", "I", ")", "is", "not", "None", ":", "return", "1.0" ]
[ 407, 4 ]
[ 412, 22 ]
python
en
['en', 'error', 'th']
False
RunawayRegexTest.assert_single_token
(self, s, token)
Show that a given string generates only one token.
Show that a given string generates only one token.
def assert_single_token(self, s, token): """Show that a given string generates only one token.""" tokens = list(self.lexer.get_tokens_unprocessed(s)) self.assertEqual(len(tokens), 1, tokens) self.assertEqual(s, tokens[0][2]) self.assertEqual(token, tokens[0][1])
[ "def", "assert_single_token", "(", "self", ",", "s", ",", "token", ")", ":", "tokens", "=", "list", "(", "self", ".", "lexer", ".", "get_tokens_unprocessed", "(", "s", ")", ")", "self", ".", "assertEqual", "(", "len", "(", "tokens", ")", ",", "1", ",...
[ 26, 4 ]
[ 31, 45 ]
python
en
['en', 'en', 'en']
True
RunawayRegexTest.assert_tokens
(self, strings, expected_tokens)
Show that a given string generates the expected tokens.
Show that a given string generates the expected tokens.
def assert_tokens(self, strings, expected_tokens): """Show that a given string generates the expected tokens.""" tokens = list(self.lexer.get_tokens_unprocessed(''.join(strings))) self.assertEqual(len(tokens), len(expected_tokens), tokens) for index, s in enumerate(strings): ...
[ "def", "assert_tokens", "(", "self", ",", "strings", ",", "expected_tokens", ")", ":", "tokens", "=", "list", "(", "self", ".", "lexer", ".", "get_tokens_unprocessed", "(", "''", ".", "join", "(", "strings", ")", ")", ")", "self", ".", "assertEqual", "("...
[ 33, 4 ]
[ 39, 70 ]
python
en
['en', 'en', 'en']
True
RunawayRegexTest.assert_fast_tokenization
(self, s)
Show that a given string is tokenized quickly.
Show that a given string is tokenized quickly.
def assert_fast_tokenization(self, s): """Show that a given string is tokenized quickly.""" start = time.time() tokens = list(self.lexer.get_tokens_unprocessed(s)) end = time.time() # Isn't 10 seconds kind of a long time? Yes, but we don't want false # positives when the...
[ "def", "assert_fast_tokenization", "(", "self", ",", "s", ")", ":", "start", "=", "time", ".", "time", "(", ")", "tokens", "=", "list", "(", "self", ".", "lexer", ".", "get_tokens_unprocessed", "(", "s", ")", ")", "end", "=", "time", ".", "time", "("...
[ 41, 4 ]
[ 50, 21 ]
python
en
['en', 'en', 'en']
True
CALLING_CONVENTION_TYPES.extract
(text, default=UNKNOWN)
extracts calling convention from the text. If the calling convention could not be found, the "default"is used
extracts calling convention from the text. If the calling convention could not be found, the "default"is used
def extract(text, default=UNKNOWN): """extracts calling convention from the text. If the calling convention could not be found, the "default"is used""" if not text: return default found = CALLING_CONVENTION_TYPES.pattern.match(text) if found: return found....
[ "def", "extract", "(", "text", ",", "default", "=", "UNKNOWN", ")", ":", "if", "not", "text", ":", "return", "default", "found", "=", "CALLING_CONVENTION_TYPES", ".", "pattern", ".", "match", "(", "text", ")", "if", "found", ":", "return", "found", ".", ...
[ 37, 4 ]
[ 46, 26 ]
python
en
['en', 'en', 'en']
True
S3LoggingBucket.get_key
(self, _name)
Create a new Key instance with the given name.
Create a new Key instance with the given name.
def get_key(self, _name): """ Create a new Key instance with the given name. """ return Key(bucket=self.bucket, name=_name)
[ "def", "get_key", "(", "self", ",", "_name", ")", ":", "return", "Key", "(", "bucket", "=", "self", ".", "bucket", ",", "name", "=", "_name", ")" ]
[ 27, 4 ]
[ 29, 50 ]
python
en
['en', 'en', 'en']
True
S3LoggingBucket.get_bucket
(self)
Return the bucket being used.
Return the bucket being used.
def get_bucket(self): """ Return the bucket being used. """ return self.bucket
[ "def", "get_bucket", "(", "self", ")", ":", "return", "self", ".", "bucket" ]
[ 31, 4 ]
[ 33, 26 ]
python
en
['en', 'en', 'en']
True
S3LoggingBucket.upload_file
(self, file_name, file_path)
Upload a given file from the file_path to the bucket with the new name/path file_name.
Upload a given file from the file_path to the bucket with the new name/path file_name.
def upload_file(self, file_name, file_path): """ Upload a given file from the file_path to the bucket with the new name/path file_name. """ upload_key = Key(bucket=self.bucket, name=file_name) content_type = "text/plain" if file_name.endswith(".html"): content_typ...
[ "def", "upload_file", "(", "self", ",", "file_name", ",", "file_path", ")", ":", "upload_key", "=", "Key", "(", "bucket", "=", "self", ".", "bucket", ",", "name", "=", "file_name", ")", "content_type", "=", "\"text/plain\"", "if", "file_name", ".", "endswi...
[ 35, 4 ]
[ 54, 16 ]
python
en
['en', 'en', 'en']
True
S3LoggingBucket.upload_index_file
(self, test_address, timestamp)
Create an index.html file with links to all the log files that were just uploaded.
Create an index.html file with links to all the log files that were just uploaded.
def upload_index_file(self, test_address, timestamp): """ Create an index.html file with links to all the log files that were just uploaded. """ global already_uploaded_files already_uploaded_files = list(set(already_uploaded_files)) already_uploaded_files.sort() file...
[ "def", "upload_index_file", "(", "self", ",", "test_address", ",", "timestamp", ")", ":", "global", "already_uploaded_files", "already_uploaded_files", "=", "list", "(", "set", "(", "already_uploaded_files", ")", ")", "already_uploaded_files", ".", "sort", "(", ")",...
[ 56, 4 ]
[ 72, 52 ]
python
en
['en', 'en', 'en']
True
S3LoggingBucket.save_uploaded_file_names
(self, files)
Keep a record of all file names that've been uploaded. Upload log files related to each test after its execution. Once done, use already_uploaded_files to create an index file.
Keep a record of all file names that've been uploaded. Upload log files related to each test after its execution. Once done, use already_uploaded_files to create an index file.
def save_uploaded_file_names(self, files): """ Keep a record of all file names that've been uploaded. Upload log files related to each test after its execution. Once done, use already_uploaded_files to create an index file. """ global already_uploaded_files already_upload...
[ "def", "save_uploaded_file_names", "(", "self", ",", "files", ")", ":", "global", "already_uploaded_files", "already_uploaded_files", ".", "extend", "(", "files", ")" ]
[ 74, 4 ]
[ 79, 44 ]
python
en
['en', 'en', 'en']
True
System.get_function
(self, code_package: Benchmark, func_name: Optional[str] = None)
There's no function with that name? a) yes -> create new function. Implementation might check if a function with that name already exists in the cloud and update its code. b) no -> retrieve function from the cache. Function code in cloud will be updated if th...
There's no function with that name? a) yes -> create new function. Implementation might check if a function with that name already exists in the cloud and update its code. b) no -> retrieve function from the cache. Function code in cloud will be updated if th...
def get_function(self, code_package: Benchmark, func_name: Optional[str] = None) -> Function: if code_package.language_version not in self.system_config.supported_language_versions( self.name(), code_package.language_name ): raise Exception( "Unsupported {languag...
[ "def", "get_function", "(", "self", ",", "code_package", ":", "Benchmark", ",", "func_name", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Function", ":", "if", "code_package", ".", "language_version", "not", "in", "self", ".", "system_config", ...
[ 121, 4 ]
[ 189, 27 ]
python
en
['en', 'error', 'th']
False
eval_data_from_json
(filename: str, max_docs: Union[int, bool] = None, preprocessor: PreProcessor = None)
Read Documents + Labels from a SQuAD-style file. Document and Labels can then be indexed to the DocumentStore and be used for evaluation. :param filename: Path to file in SQuAD format :param max_docs: This sets the number of documents that will be loaded. By default, this is set to None, thus reading ...
Read Documents + Labels from a SQuAD-style file. Document and Labels can then be indexed to the DocumentStore and be used for evaluation.
def eval_data_from_json(filename: str, max_docs: Union[int, bool] = None, preprocessor: PreProcessor = None) -> Tuple[List[Document], List[Label]]: """ Read Documents + Labels from a SQuAD-style file. Document and Labels can then be indexed to the DocumentStore and be used for evaluation. :param filena...
[ "def", "eval_data_from_json", "(", "filename", ":", "str", ",", "max_docs", ":", "Union", "[", "int", ",", "bool", "]", "=", "None", ",", "preprocessor", ":", "PreProcessor", "=", "None", ")", "->", "Tuple", "[", "List", "[", "Document", "]", ",", "Lis...
[ 24, 0 ]
[ 55, 23 ]
python
en
['en', 'error', 'th']
False
eval_data_from_jsonl
(filename: str, batch_size: Optional[int] = None, max_docs: Union[int, bool] = None, preprocessor: PreProcessor = None)
Read Documents + Labels from a SQuAD-style file in jsonl format, i.e. one document per line. Document and Labels can then be indexed to the DocumentStore and be used for evaluation. This is a generator which will yield one tuple per iteration containing a list of batch_size documents and a list with t...
Read Documents + Labels from a SQuAD-style file in jsonl format, i.e. one document per line. Document and Labels can then be indexed to the DocumentStore and be used for evaluation.
def eval_data_from_jsonl(filename: str, batch_size: Optional[int] = None, max_docs: Union[int, bool] = None, preprocessor: PreProcessor = None) -> Generator[Tuple[List[Document], List[Label]], None, None]: """ Read Documents + Labels from a SQuAD-style file in jsonl format, i.e. one doc...
[ "def", "eval_data_from_jsonl", "(", "filename", ":", "str", ",", "batch_size", ":", "Optional", "[", "int", "]", "=", "None", ",", "max_docs", ":", "Union", "[", "int", ",", "bool", "]", "=", "None", ",", "preprocessor", ":", "PreProcessor", "=", "None",...
[ 58, 0 ]
[ 99, 22 ]
python
en
['en', 'error', 'th']
False
convert_files_to_dicts
(dir_path: str, clean_func: Optional[Callable] = None, split_paragraphs: bool = False)
Convert all files(.txt, .pdf, .docx) in the sub-directories of the given path to Python dicts that can be written to a Document Store. :param dir_path: path for the documents to be written to the DocumentStore :param clean_func: a custom cleaning function that gets applied to each doc (input: str, out...
Convert all files(.txt, .pdf, .docx) in the sub-directories of the given path to Python dicts that can be written to a Document Store.
def convert_files_to_dicts(dir_path: str, clean_func: Optional[Callable] = None, split_paragraphs: bool = False) -> \ List[dict]: """ Convert all files(.txt, .pdf, .docx) in the sub-directories of the given path to Python dicts that can be written to a Document Store. :param dir_path: path for ...
[ "def", "convert_files_to_dicts", "(", "dir_path", ":", "str", ",", "clean_func", ":", "Optional", "[", "Callable", "]", "=", "None", ",", "split_paragraphs", ":", "bool", "=", "False", ")", "->", "List", "[", "dict", "]", ":", "file_paths", "=", "[", "p"...
[ 198, 0 ]
[ 253, 20 ]
python
en
['en', 'error', 'th']
False
tika_convert_files_to_dicts
( dir_path: str, clean_func: Optional[Callable] = None, split_paragraphs: bool = False, merge_short: bool = True, merge_lowercase: bool = True )
Convert all files(.txt, .pdf) in the sub-directories of the given path to Python dicts that can be written to a Document Store. :param merge_lowercase: allow conversion of merged paragraph to lowercase :param merge_short: allow merging of short paragraphs :param dir_path: path for the documents to...
Convert all files(.txt, .pdf) in the sub-directories of the given path to Python dicts that can be written to a Document Store.
def tika_convert_files_to_dicts( dir_path: str, clean_func: Optional[Callable] = None, split_paragraphs: bool = False, merge_short: bool = True, merge_lowercase: bool = True ) -> List[dict]: """ Convert all files(.txt, .pdf) in the sub-directories of the given path to Pyt...
[ "def", "tika_convert_files_to_dicts", "(", "dir_path", ":", "str", ",", "clean_func", ":", "Optional", "[", "Callable", "]", "=", "None", ",", "split_paragraphs", ":", "bool", "=", "False", ",", "merge_short", ":", "bool", "=", "True", ",", "merge_lowercase", ...
[ 256, 0 ]
[ 336, 20 ]
python
en
['en', 'error', 'th']
False
fetch_archive_from_http
(url: str, output_dir: str, proxies: Optional[dict] = None)
Fetch an archive (zip or tar.gz) from a url via http and extract content to an output directory. :param url: http address :type url: str :param output_dir: local path :type output_dir: str :param proxies: proxies details as required by requests library :type proxies: dict :return: bool...
Fetch an archive (zip or tar.gz) from a url via http and extract content to an output directory.
def fetch_archive_from_http(url: str, output_dir: str, proxies: Optional[dict] = None): """ Fetch an archive (zip or tar.gz) from a url via http and extract content to an output directory. :param url: http address :type url: str :param output_dir: local path :type output_dir: str :param pro...
[ "def", "fetch_archive_from_http", "(", "url", ":", "str", ",", "output_dir", ":", "str", ",", "proxies", ":", "Optional", "[", "dict", "]", "=", "None", ")", ":", "# verify & prepare local directory", "path", "=", "Path", "(", "output_dir", ")", "if", "not",...
[ 339, 0 ]
[ 387, 19 ]
python
en
['en', 'error', 'th']
False
squad_json_to_jsonl
(squad_file: str, output_file: str)
Converts a SQuAD-json-file into jsonl format with one document per line. :param squad_file: SQuAD-file in json format. :type squad_file: str :param output_file: Name of output file (SQuAD in jsonl format) :type output_file: str
Converts a SQuAD-json-file into jsonl format with one document per line.
def squad_json_to_jsonl(squad_file: str, output_file: str): """ Converts a SQuAD-json-file into jsonl format with one document per line. :param squad_file: SQuAD-file in json format. :type squad_file: str :param output_file: Name of output file (SQuAD in jsonl format) :type output_file: str ...
[ "def", "squad_json_to_jsonl", "(", "squad_file", ":", "str", ",", "output_file", ":", "str", ")", ":", "with", "open", "(", "squad_file", ",", "encoding", "=", "'utf-8'", ")", "as", "json_file", ",", "open", "(", "output_file", ",", "\"w\"", ",", "encoding...
[ 390, 0 ]
[ 404, 34 ]
python
en
['en', 'error', 'th']
False
RtfFormatter.__init__
(self, **options)
r""" Additional options accepted: ``fontface`` Name of the font used. Could for example be ``'Courier New'`` to further specify the default which is ``'\fmodern'``. The RTF specification claims that ``\fmodern`` are "Fixed-pitch serif and sans serif fonts...
r""" Additional options accepted:
def __init__(self, **options): r""" Additional options accepted: ``fontface`` Name of the font used. Could for example be ``'Courier New'`` to further specify the default which is ``'\fmodern'``. The RTF specification claims that ``\fmodern`` are "Fixed-pitch...
[ "def", "__init__", "(", "self", ",", "*", "*", "options", ")", ":", "Formatter", ".", "__init__", "(", "self", ",", "*", "*", "options", ")", "self", ".", "fontface", "=", "options", ".", "get", "(", "'fontface'", ")", "or", "''", "self", ".", "fon...
[ 50, 4 ]
[ 64, 59 ]
python
cy
['en', 'cy', 'hi']
False
critical_suite_with_citations
()
This hand made fixture has a wide range of expectations, and has a mix of metadata including an BasicSuiteBuilderProfiler entry, and citations.
This hand made fixture has a wide range of expectations, and has a mix of metadata including an BasicSuiteBuilderProfiler entry, and citations.
def critical_suite_with_citations(): """ This hand made fixture has a wide range of expectations, and has a mix of metadata including an BasicSuiteBuilderProfiler entry, and citations. """ schema = ExpectationSuiteSchema() critical_suite = { "expectation_suite_name": "critical", ...
[ "def", "critical_suite_with_citations", "(", ")", ":", "schema", "=", "ExpectationSuiteSchema", "(", ")", "critical_suite", "=", "{", "\"expectation_suite_name\"", ":", "\"critical\"", ",", "\"meta\"", ":", "{", "\"great_expectations_version\"", ":", "\"0.9.1+9.gf17eff1f....
[ 22, 0 ]
[ 91, 51 ]
python
en
['en', 'error', 'th']
False
suite_with_multiple_citations
()
A handmade suite with multiple citations each with different batch_kwargs. The most recent citation does not have batch_kwargs
A handmade suite with multiple citations each with different batch_kwargs.
def suite_with_multiple_citations(): """ A handmade suite with multiple citations each with different batch_kwargs. The most recent citation does not have batch_kwargs """ schema = ExpectationSuiteSchema() critical_suite = { "expectation_suite_name": "critical", "meta": { ...
[ "def", "suite_with_multiple_citations", "(", ")", ":", "schema", "=", "ExpectationSuiteSchema", "(", ")", "critical_suite", "=", "{", "\"expectation_suite_name\"", ":", "\"critical\"", ",", "\"meta\"", ":", "{", "\"great_expectations_version\"", ":", "\"0.9.1+9.gf17eff1f....
[ 95, 0 ]
[ 146, 51 ]
python
en
['en', 'error', 'th']
False
warning_suite
()
This hand made fixture has a wide range of expectations, and has a mix of metadata including BasicSuiteBuilderProfiler entries.
This hand made fixture has a wide range of expectations, and has a mix of metadata including BasicSuiteBuilderProfiler entries.
def warning_suite(): """ This hand made fixture has a wide range of expectations, and has a mix of metadata including BasicSuiteBuilderProfiler entries. """ schema = ExpectationSuiteSchema() warning_suite = { "expectation_suite_name": "warning", "meta": { "great_expec...
[ "def", "warning_suite", "(", ")", ":", "schema", "=", "ExpectationSuiteSchema", "(", ")", "warning_suite", "=", "{", "\"expectation_suite_name\"", ":", "\"warning\"", ",", "\"meta\"", ":", "{", "\"great_expectations_version\"", ":", "\"0.8.4.post0\"", ",", "\"citation...
[ 150, 0 ]
[ 388, 50 ]
python
en
['en', 'error', 'th']
False
test_notebook_execution_with_pandas_backend
(titanic_data_context_no_data_docs)
To set this test up we: - create a suite - add a few expectations (both table and column level) - verify that no validations have happened - create the suite edit notebook by hijacking the private cli method We then: - execute that notebook (Note this will raise various errors like C...
To set this test up we:
def test_notebook_execution_with_pandas_backend(titanic_data_context_no_data_docs): """ To set this test up we: - create a suite - add a few expectations (both table and column level) - verify that no validations have happened - create the suite edit notebook by hijacking the private cli method...
[ "def", "test_notebook_execution_with_pandas_backend", "(", "titanic_data_context_no_data_docs", ")", ":", "# Since we'll run the notebook, we use a context with no data docs to avoid", "# the renderer's default behavior of building and opening docs, which is not", "# part of this test.", "context"...
[ 1319, 0 ]
[ 1406, 34 ]
python
en
['en', 'error', 'th']
False
test_notebook_execution_with_custom_notebooks_wrong_module
( suite_with_multiple_citations, data_context_with_bad_notebooks )
Test the error message in case of "bad" custom module is clear
Test the error message in case of "bad" custom module is clear
def test_notebook_execution_with_custom_notebooks_wrong_module( suite_with_multiple_citations, data_context_with_bad_notebooks ): """ Test the error message in case of "bad" custom module is clear """ with pytest.raises( SuiteEditNotebookCustomTemplateModuleNotFoundError, match=r"invalid\.mo...
[ "def", "test_notebook_execution_with_custom_notebooks_wrong_module", "(", "suite_with_multiple_citations", ",", "data_context_with_bad_notebooks", ")", ":", "with", "pytest", ".", "raises", "(", "SuiteEditNotebookCustomTemplateModuleNotFoundError", ",", "match", "=", "r\"invalid\\....
[ 1409, 0 ]
[ 1420, 47 ]
python
en
['en', 'error', 'th']
False
test_notebook_execution_with_custom_notebooks
( suite_with_multiple_citations, data_context_custom_notebooks )
Test the different parts of the notebooks can be modified
Test the different parts of the notebooks can be modified
def test_notebook_execution_with_custom_notebooks( suite_with_multiple_citations, data_context_custom_notebooks ): """ Test the different parts of the notebooks can be modified """ obs = SuiteEditNotebookRenderer.from_data_context( data_context_custom_notebooks ).render(suite_with_multip...
[ "def", "test_notebook_execution_with_custom_notebooks", "(", "suite_with_multiple_citations", ",", "data_context_custom_notebooks", ")", ":", "obs", "=", "SuiteEditNotebookRenderer", ".", "from_data_context", "(", "data_context_custom_notebooks", ")", ".", "render", "(", "suite...
[ 1423, 0 ]
[ 1505, 26 ]
python
en
['en', 'error', 'th']
False
plot
(dfs, anomalies=[])
Line plot for time series. This function plots time series and highlights anomalous regions. The first anomaly in anomalies is considered the ground truth. Args: dfs (list or `pd.DataFrame`): List of time series in `pd.DataFrame`. Or a single dataframe. All dataframes must hav...
Line plot for time series. This function plots time series and highlights anomalous regions. The first anomaly in anomalies is considered the ground truth. Args: dfs (list or `pd.DataFrame`): List of time series in `pd.DataFrame`. Or a single dataframe. All dataframes must hav...
def plot(dfs, anomalies=[]): """ Line plot for time series. This function plots time series and highlights anomalous regions. The first anomaly in anomalies is considered the ground truth. Args: dfs (list or `pd.DataFrame`): List of time series in `pd.DataFrame`. Or a singl...
[ "def", "plot", "(", "dfs", ",", "anomalies", "=", "[", "]", ")", ":", "if", "isinstance", "(", "dfs", ",", "pd", ".", "DataFrame", ")", ":", "dfs", "=", "[", "dfs", "]", "if", "not", "isinstance", "(", "anomalies", ",", "list", ")", ":", "anomali...
[ 90, 0 ]
[ 146, 14 ]
python
en
['en', 'en', 'en']
True
StatsmodelsOLS.__init__
(self, cov_type='HC1', alpha=.05)
Initialize a statsmodels' OLS wrapper class object. Args: cov_type (str, optional): covariance estimator type. alpha (float, optional): the confidence level alpha.
Initialize a statsmodels' OLS wrapper class object. Args: cov_type (str, optional): covariance estimator type. alpha (float, optional): the confidence level alpha.
def __init__(self, cov_type='HC1', alpha=.05): """Initialize a statsmodels' OLS wrapper class object. Args: cov_type (str, optional): covariance estimator type. alpha (float, optional): the confidence level alpha. """ self.cov_type = cov_type self.alpha = ...
[ "def", "__init__", "(", "self", ",", "cov_type", "=", "'HC1'", ",", "alpha", "=", ".05", ")", ":", "self", ".", "cov_type", "=", "cov_type", "self", ".", "alpha", "=", "alpha" ]
[ 20, 4 ]
[ 27, 26 ]
python
en
['ca', 'en', 'en']
True
StatsmodelsOLS.fit
(self, X, y)
Fit OLS. Args: X (np.matrix): a feature matrix y (np.array): a label vector
Fit OLS. Args: X (np.matrix): a feature matrix y (np.array): a label vector
def fit(self, X, y): """Fit OLS. Args: X (np.matrix): a feature matrix y (np.array): a label vector """ # Append ones. The first column is for the treatment indicator. X = sm.add_constant(X, prepend=False, has_constant='add') self.model = sm.OLS(y,...
[ "def", "fit", "(", "self", ",", "X", ",", "y", ")", ":", "# Append ones. The first column is for the treatment indicator.", "X", "=", "sm", ".", "add_constant", "(", "X", ",", "prepend", "=", "False", ",", "has_constant", "=", "'add'", ")", "self", ".", "mod...
[ 29, 4 ]
[ 39, 62 ]
python
en
['en', 'id', 'en']
False
BaseSLearner.__init__
(self, learner=None, ate_alpha=0.05, control_name=0)
Initialize an S-learner. Args: learner (optional): a model to estimate the treatment effect control_name (str or int, optional): name of control group
Initialize an S-learner. Args: learner (optional): a model to estimate the treatment effect control_name (str or int, optional): name of control group
def __init__(self, learner=None, ate_alpha=0.05, control_name=0): """Initialize an S-learner. Args: learner (optional): a model to estimate the treatment effect control_name (str or int, optional): name of control group """ if learner is not None: self...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ")", ":", "if", "learner", "is", "not", "None", ":", "self", ".", "model", "=", "learner", "else", ":", "self", ".", "model", ...
[ 53, 4 ]
[ 64, 40 ]
python
en
['en', 'en', 'nl']
True
BaseSLearner.fit
(self, X, treatment, y, p=None)
Fit the inference model Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector
Fit the inference model Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector
def fit(self, X, treatment, y, p=None): """Fit the inference model Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector """ X, treatment, y =...
[ "def", "fit", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_to_np", "(", "X", ",", "treatment", ",", "y", ")", "check_treatment_vector", "(", "treatment", ",", ...
[ 70, 4 ]
[ 92, 49 ]
python
en
['en', 'en', 'en']
True
BaseSLearner.predict
(self, X, treatment=None, y=None, p=None, return_components=False, verbose=True)
Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Series, optional): an outcome vector return_components (bool, optional): whether to retur...
Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Series, optional): an outcome vector return_components (bool, optional): whether to retur...
def predict(self, X, treatment=None, y=None, p=None, return_components=False, verbose=True): """Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or ...
[ "def", "predict", "(", "self", ",", "X", ",", "treatment", "=", "None", ",", "y", "=", "None", ",", "p", "=", "None", ",", "return_components", "=", "False", ",", "verbose", "=", "True", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_t...
[ 94, 4 ]
[ 140, 39 ]
python
en
['fr', 'en', 'en']
True
BaseSLearner.fit_predict
(self, X, treatment, y, p=None, return_ci=False, n_bootstraps=1000, bootstrap_size=10000, return_components=False, verbose=True)
Fit the inference model of the S learner and predict treatment effects. Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector return_ci (bool, optional): ...
Fit the inference model of the S learner and predict treatment effects. Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector return_ci (bool, optional): ...
def fit_predict(self, X, treatment, y, p=None, return_ci=False, n_bootstraps=1000, bootstrap_size=10000, return_components=False, verbose=True): """Fit the inference model of the S learner and predict treatment effects. Args: X (np.matrix, np.array, or pd.Dataframe): a fe...
[ "def", "fit_predict", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "return_ci", "=", "False", ",", "n_bootstraps", "=", "1000", ",", "bootstrap_size", "=", "10000", ",", "return_components", "=", "False", ",", "verbose",...
[ 142, 4 ]
[ 183, 43 ]
python
en
['en', 'en', 'en']
True
BaseSLearner.estimate_ate
(self, X, treatment, y, p=None, return_ci=False, bootstrap_ci=False, n_bootstraps=1000, bootstrap_size=10000)
Estimate the Average Treatment Effect (ATE). Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector return_ci (bool, optional): whether to return confiden...
Estimate the Average Treatment Effect (ATE).
def estimate_ate(self, X, treatment, y, p=None, return_ci=False, bootstrap_ci=False, n_bootstraps=1000, bootstrap_size=10000): """Estimate the Average Treatment Effect (ATE). Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.arra...
[ "def", "estimate_ate", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "return_ci", "=", "False", ",", "bootstrap_ci", "=", "False", ",", "n_bootstraps", "=", "1000", ",", "bootstrap_size", "=", "10000", ")", ":", "X", ...
[ 185, 4 ]
[ 258, 44 ]
python
en
['en', 'it', 'en']
True
BaseSRegressor.__init__
(self, learner=None, ate_alpha=0.05, control_name=0)
Initialize an S-learner regressor. Args: learner (optional): a model to estimate the treatment effect control_name (str or int, optional): name of control group
Initialize an S-learner regressor. Args: learner (optional): a model to estimate the treatment effect control_name (str or int, optional): name of control group
def __init__(self, learner=None, ate_alpha=0.05, control_name=0): """Initialize an S-learner regressor. Args: learner (optional): a model to estimate the treatment effect control_name (str or int, optional): name of control group """ super().__init__( ...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ")", ":", "super", "(", ")", ".", "__init__", "(", "learner", "=", "learner", ",", "ate_alpha", "=", "ate_alpha", ",", "control_n...
[ 266, 4 ]
[ 275, 38 ]
python
en
['en', 'fy', 'nl']
False
BaseSClassifier.__init__
(self, learner=None, ate_alpha=0.05, control_name=0)
Initialize an S-learner classifier. Args: learner (optional): a model to estimate the treatment effect. Should have a predict_proba() method. control_name (str or int, optional): name of control group
Initialize an S-learner classifier. Args: learner (optional): a model to estimate the treatment effect. Should have a predict_proba() method. control_name (str or int, optional): name of control group
def __init__(self, learner=None, ate_alpha=0.05, control_name=0): """Initialize an S-learner classifier. Args: learner (optional): a model to estimate the treatment effect. Should have a predict_proba() method. control_name (str or int, optional): name of control ...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ")", ":", "super", "(", ")", ".", "__init__", "(", "learner", "=", "learner", ",", "ate_alpha", "=", "ate_alpha", ",", "control_n...
[ 283, 4 ]
[ 293, 38 ]
python
en
['en', 'fy', 'nl']
False
BaseSClassifier.predict
(self, X, treatment=None, y=None, p=None, return_components=False, verbose=True)
Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Series, optional): an outcome vector return_components (bool, optional): whether to retur...
Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Series, optional): an outcome vector return_components (bool, optional): whether to retur...
def predict(self, X, treatment=None, y=None, p=None, return_components=False, verbose=True): """Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or ...
[ "def", "predict", "(", "self", ",", "X", ",", "treatment", "=", "None", ",", "y", "=", "None", ",", "p", "=", "None", ",", "return_components", "=", "False", ",", "verbose", "=", "True", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_t...
[ 295, 4 ]
[ 341, 39 ]
python
en
['fr', 'en', 'en']
True
LRSRegressor.__init__
(self, ate_alpha=.05, control_name=0)
Initialize an S-learner with a linear regression model. Args: ate_alpha (float, optional): the confidence level alpha of the ATE estimate control_name (str or int, optional): name of control group
Initialize an S-learner with a linear regression model. Args: ate_alpha (float, optional): the confidence level alpha of the ATE estimate control_name (str or int, optional): name of control group
def __init__(self, ate_alpha=.05, control_name=0): """Initialize an S-learner with a linear regression model. Args: ate_alpha (float, optional): the confidence level alpha of the ATE estimate control_name (str or int, optional): name of control group """ super()._...
[ "def", "__init__", "(", "self", ",", "ate_alpha", "=", ".05", ",", "control_name", "=", "0", ")", ":", "super", "(", ")", ".", "__init__", "(", "StatsmodelsOLS", "(", "alpha", "=", "ate_alpha", ")", ",", "ate_alpha", ",", "control_name", ")" ]
[ 345, 4 ]
[ 351, 82 ]
python
en
['en', 'en', 'en']
True
LRSRegressor.estimate_ate
(self, X, treatment, y, p=None)
Estimate the Average Treatment Effect (ATE). Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector Returns: The mean and confidence interval (LB, ...
Estimate the Average Treatment Effect (ATE). Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector Returns: The mean and confidence interval (LB, ...
def estimate_ate(self, X, treatment, y, p=None): """Estimate the Average Treatment Effect (ATE). Args: X (np.matrix, np.array, or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector ...
[ "def", "estimate_ate", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_to_np", "(", "X", ",", "treatment", ",", "y", ")", "self", ".", "fit", "(", "X", ",", "...
[ 353, 4 ]
[ 374, 34 ]
python
en
['en', 'it', 'en']
True
S3Logging.configure
(self, options, conf)
Get the options.
Get the options.
def configure(self, options, conf): """ Get the options. """ super(S3Logging, self).configure(options, conf) self.options = options
[ "def", "configure", "(", "self", ",", "options", ",", "conf", ")", ":", "super", "(", "S3Logging", ",", "self", ")", ".", "configure", "(", "options", ",", "conf", ")", "self", ".", "options", "=", "options" ]
[ 17, 4 ]
[ 20, 30 ]
python
en
['en', 'en', 'en']
True
S3Logging.afterTest
(self, test)
After each testcase, upload logs to the S3 bucket.
After each testcase, upload logs to the S3 bucket.
def afterTest(self, test): """ After each testcase, upload logs to the S3 bucket. """ s3_bucket = S3LoggingBucket() guid = str(uuid.uuid4().hex) path = "%s/%s" % (self.options.log_path, test.test.id()) uploaded_files = [] for logfile in os.listdi...
[ "def", "afterTest", "(", "self", ",", "test", ")", ":", "s3_bucket", "=", "S3LoggingBucket", "(", ")", "guid", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ".", "hex", ")", "path", "=", "\"%s/%s\"", "%", "(", "self", ".", "options", ".", "log_p...
[ 22, 4 ]
[ 50, 71 ]
python
en
['en', 'en', 'en']
True