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
ImpalaClient.drop_udf
(self, name, input_types=None, database=None, force=False, aggregate=False)
Drops a UDF If only name is given, this will search for the relevant UDF and drop it. To delete an overloaded UDF, give only a name and force=True Parameters ---------- name : string input_types : list of strings (optional) force : boolean, defau...
Drops a UDF If only name is given, this will search for the relevant UDF and drop it. To delete an overloaded UDF, give only a name and force=True
def drop_udf(self, name, input_types=None, database=None, force=False, aggregate=False): """ Drops a UDF If only name is given, this will search for the relevant UDF and drop it. To delete an overloaded UDF, give only a name and force=True Parameters ...
[ "def", "drop_udf", "(", "self", ",", "name", ",", "input_types", "=", "None", ",", "database", "=", "None", ",", "force", "=", "False", ",", "aggregate", "=", "False", ")", ":", "if", "not", "input_types", ":", "if", "not", "database", ":", "database",...
[ 1452, 4 ]
[ 1494, 55 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.drop_uda
(self, name, input_types=None, database=None, force=False)
Drop aggregate function. See drop_udf for more information on the parameters.
Drop aggregate function. See drop_udf for more information on the parameters.
def drop_uda(self, name, input_types=None, database=None, force=False): """ Drop aggregate function. See drop_udf for more information on the parameters. """ return self.drop_udf(name, input_types=input_types, database=database, force=force)
[ "def", "drop_uda", "(", "self", ",", "name", ",", "input_types", "=", "None", ",", "database", "=", "None", ",", "force", "=", "False", ")", ":", "return", "self", ".", "drop_udf", "(", "name", ",", "input_types", "=", "input_types", ",", "database", "...
[ 1496, 4 ]
[ 1502, 41 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.list_udfs
(self, database=None, like=None)
Lists all UDFs associated with given database Parameters ---------- database : string like : string for searching (optional)
Lists all UDFs associated with given database
def list_udfs(self, database=None, like=None): """ Lists all UDFs associated with given database Parameters ---------- database : string like : string for searching (optional) """ if not database: database = self.current_database state...
[ "def", "list_udfs", "(", "self", ",", "database", "=", "None", ",", "like", "=", "None", ")", ":", "if", "not", "database", ":", "database", "=", "self", ".", "current_database", "statement", "=", "ddl", ".", "ListFunction", "(", "database", ",", "like",...
[ 1522, 4 ]
[ 1536, 21 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.list_udas
(self, database=None, like=None)
Lists all UDAFs associated with a given database Parameters ---------- database : string like : string for searching (optional)
Lists all UDAFs associated with a given database
def list_udas(self, database=None, like=None): """ Lists all UDAFs associated with a given database Parameters ---------- database : string like : string for searching (optional) """ if not database: database = self.current_database st...
[ "def", "list_udas", "(", "self", ",", "database", "=", "None", ",", "like", "=", "None", ")", ":", "if", "not", "database", ":", "database", "=", "self", ".", "current_database", "statement", "=", "ddl", ".", "ListFunction", "(", "database", ",", "like",...
[ 1538, 4 ]
[ 1553, 21 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.exists_udf
(self, name, database=None)
Checks if a given UDF exists within a specified database Parameters ---------- name : string, UDF name database : string, database name Returns ------- if_exists : boolean
Checks if a given UDF exists within a specified database
def exists_udf(self, name, database=None): """ Checks if a given UDF exists within a specified database Parameters ---------- name : string, UDF name database : string, database name Returns ------- if_exists : boolean """ return ...
[ "def", "exists_udf", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "return", "len", "(", "self", ".", "list_udfs", "(", "database", "=", "database", ",", "like", "=", "name", ")", ")", ">", "0" ]
[ 1588, 4 ]
[ 1601, 68 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.exists_uda
(self, name, database=None)
Checks if a given UDAF exists within a specified database Parameters ---------- name : string, UDAF name database : string, database name Returns ------- if_exists : boolean
Checks if a given UDAF exists within a specified database
def exists_uda(self, name, database=None): """ Checks if a given UDAF exists within a specified database Parameters ---------- name : string, UDAF name database : string, database name Returns ------- if_exists : boolean """ retur...
[ "def", "exists_uda", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "return", "len", "(", "self", ".", "list_udas", "(", "database", "=", "database", ",", "like", "=", "name", ")", ")", ">", "0" ]
[ 1603, 4 ]
[ 1616, 68 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.compute_stats
(self, name, database=None, incremental=False)
Issue COMPUTE STATS command for a given table Parameters ---------- name : string Can be fully qualified (with database name) database : string, optional incremental : boolean, default False If True, issue COMPUTE INCREMENTAL STATS
Issue COMPUTE STATS command for a given table
def compute_stats(self, name, database=None, incremental=False): """ Issue COMPUTE STATS command for a given table Parameters ---------- name : string Can be fully qualified (with database name) database : string, optional incremental : boolean, default...
[ "def", "compute_stats", "(", "self", ",", "name", ",", "database", "=", "None", ",", "incremental", "=", "False", ")", ":", "maybe_inc", "=", "'INCREMENTAL '", "if", "incremental", "else", "''", "cmd", "=", "'COMPUTE {0}STATS'", ".", "format", "(", "maybe_in...
[ 1618, 4 ]
[ 1634, 27 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.invalidate_metadata
(self, name=None, database=None)
Issue INVALIDATE METADATA command, optionally only applying to a particular table. See Impala documentation. Parameters ---------- name : string, optional Table name. Can be fully qualified (with database) database : string, optional
Issue INVALIDATE METADATA command, optionally only applying to a particular table. See Impala documentation.
def invalidate_metadata(self, name=None, database=None): """ Issue INVALIDATE METADATA command, optionally only applying to a particular table. See Impala documentation. Parameters ---------- name : string, optional Table name. Can be fully qualified (with data...
[ "def", "invalidate_metadata", "(", "self", ",", "name", "=", "None", ",", "database", "=", "None", ")", ":", "stmt", "=", "'INVALIDATE METADATA'", "if", "name", "is", "not", "None", ":", "stmt", "=", "self", ".", "_table_command", "(", "stmt", ",", "name...
[ 1636, 4 ]
[ 1650, 27 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.refresh
(self, name, database=None)
Reload HDFS block location metadata for a table, for example after ingesting data as part of an ETL pipeline. Related to INVALIDATE METADATA. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with databa...
Reload HDFS block location metadata for a table, for example after ingesting data as part of an ETL pipeline. Related to INVALIDATE METADATA. See Impala documentation for more.
def refresh(self, name, database=None): """ Reload HDFS block location metadata for a table, for example after ingesting data as part of an ETL pipeline. Related to INVALIDATE METADATA. See Impala documentation for more. Parameters ---------- name : string ...
[ "def", "refresh", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "# TODO(wesm): can this statement be cancelled?", "stmt", "=", "self", ".", "_table_command", "(", "'REFRESH'", ",", "name", ",", "database", "=", "database", ")", "self", ".",...
[ 1652, 4 ]
[ 1666, 27 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.describe_formatted
(self, name, database=None)
Retrieve results of DESCRIBE FORMATTED command. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with database) database : string, optional
Retrieve results of DESCRIBE FORMATTED command. See Impala documentation for more.
def describe_formatted(self, name, database=None): """ Retrieve results of DESCRIBE FORMATTED command. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with database) database : string, optional ...
[ "def", "describe_formatted", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "from", "ibis", ".", "impala", ".", "metadata", "import", "parse_metadata", "stmt", "=", "self", ".", "_table_command", "(", "'DESCRIBE FORMATTED'", ",", "name", "...
[ 1668, 4 ]
[ 1690, 37 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.show_files
(self, name, database=None)
Retrieve results of SHOW FILES command for a table. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with database) database : string, optional
Retrieve results of SHOW FILES command for a table. See Impala documentation for more.
def show_files(self, name, database=None): """ Retrieve results of SHOW FILES command for a table. See Impala documentation for more. Parameters ---------- name : string Table name. Can be fully qualified (with database) database : string, optional ...
[ "def", "show_files", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "stmt", "=", "self", ".", "_table_command", "(", "'SHOW FILES IN'", ",", "name", ",", "database", "=", "database", ")", "return", "self", ".", "_exec_statement", "(", ...
[ 1692, 4 ]
[ 1704, 41 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.table_stats
(self, name, database=None)
Return results of SHOW TABLE STATS for indicated table. See also ImpalaTable.stats
Return results of SHOW TABLE STATS for indicated table. See also ImpalaTable.stats
def table_stats(self, name, database=None): """ Return results of SHOW TABLE STATS for indicated table. See also ImpalaTable.stats """ stmt = self._table_command('SHOW TABLE STATS', name, database=database) return self._exec_statement(stmt)
[ "def", "table_stats", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "stmt", "=", "self", ".", "_table_command", "(", "'SHOW TABLE STATS'", ",", "name", ",", "database", "=", "database", ")", "return", "self", ".", "_exec_statement", "("...
[ 1710, 4 ]
[ 1716, 41 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.column_stats
(self, name, database=None)
Return results of SHOW COLUMN STATS for indicated table. See also ImpalaTable.column_stats
Return results of SHOW COLUMN STATS for indicated table. See also ImpalaTable.column_stats
def column_stats(self, name, database=None): """ Return results of SHOW COLUMN STATS for indicated table. See also ImpalaTable.column_stats """ stmt = self._table_command('SHOW COLUMN STATS', name, database=database) return self._exec_st...
[ "def", "column_stats", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "stmt", "=", "self", ".", "_table_command", "(", "'SHOW COLUMN STATS'", ",", "name", ",", "database", "=", "database", ")", "return", "self", ".", "_exec_statement", "...
[ 1718, 4 ]
[ 1725, 41 ]
python
en
['en', 'error', 'th']
False
ImpalaClient.write_dataframe
(self, df, path, format='csv')
Write a pandas DataFrame to indicated file path (default: HDFS) in the indicated format Parameters ---------- df : DataFrame path : string Absolute output path format : {'csv'}, default 'csv' Returns ------- None (for now) ...
Write a pandas DataFrame to indicated file path (default: HDFS) in the indicated format
def write_dataframe(self, df, path, format='csv'): """ Write a pandas DataFrame to indicated file path (default: HDFS) in the indicated format Parameters ---------- df : DataFrame path : string Absolute output path format : {'csv'}, default 'csv...
[ "def", "write_dataframe", "(", "self", ",", "df", ",", "path", ",", "format", "=", "'csv'", ")", ":", "from", "ibis", ".", "impala", ".", "pandas_interop", "import", "DataFrameWriter", "writer", "=", "DataFrameWriter", "(", "self", ",", "df", ")", "return"...
[ 1753, 4 ]
[ 1772, 37 ]
python
en
['en', 'error', 'th']
False
privileges_granted_directly
(self, node=None)
Check that a user is able to execute `DROP ROLE` with privileges are granted directly.
Check that a user is able to execute `DROP ROLE` with privileges are granted directly.
def privileges_granted_directly(self, node=None): """Check that a user is able to execute `DROP ROLE` with privileges are granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite(run=drop_role, ...
[ "def", "privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\"{user_...
[ 8, 0 ]
[ 22, 74 ]
python
en
['en', 'en', 'en']
True
privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `DROP ROLE` with privileges are granted through a role.
Check that a user is able to execute `DROP ROLE` with privileges are granted through a role.
def privileges_granted_via_role(self, node=None): """Check that a user is able to execute `DROP ROLE` with privileges are granted through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}")...
[ "def", "privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with"...
[ 25, 0 ]
[ 43, 74 ]
python
en
['en', 'en', 'en']
True
drop_role
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `DROP ROLE` when they have the necessary privilege.
Check that user is only able to execute `DROP ROLE` when they have the necessary privilege.
def drop_role(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `DROP ROLE` when they have the necessary privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenar...
[ "def", "drop_role", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "i...
[ 51, 0 ]
[ 114, 55 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of DROP ROLE.
Check the RBAC functionality of DROP ROLE.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of DROP ROLE. """ self.context.node = self.context.cluster.node(node) Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "privileges_granted_directly", ",", ...
[ 123, 0 ]
[ 129, 82 ]
python
en
['en', 'en', 'en']
True
wrap_uda
(hdfs_file, inputs, output, update_fn, init_fn=None, merge_fn=None, finalize_fn=None, serialize_fn=None, close_fn=None, name=None)
Creates a callable aggregation function object. Must be created in Impala to be used Parameters ---------- hdfs_file: .so file that contains relevant UDA inputs: list of strings denoting ibis datatypes output: string denoting ibis datatype update_fn: string Library symbol name fo...
Creates a callable aggregation function object. Must be created in Impala to be used
def wrap_uda(hdfs_file, inputs, output, update_fn, init_fn=None, merge_fn=None, finalize_fn=None, serialize_fn=None, close_fn=None, name=None): """ Creates a callable aggregation function object. Must be created in Impala to be used Parameters ---------- hdfs_file: .so...
[ "def", "wrap_uda", "(", "hdfs_file", ",", "inputs", ",", "output", ",", "update_fn", ",", "init_fn", "=", "None", ",", "merge_fn", "=", "None", ",", "finalize_fn", "=", "None", ",", "serialize_fn", "=", "None", ",", "close_fn", "=", "None", ",", "name", ...
[ 157, 0 ]
[ 192, 15 ]
python
en
['en', 'error', 'th']
False
wrap_udf
(hdfs_file, inputs, output, so_symbol, name=None)
Creates a callable scalar function object. Must be created in Impala to be used Parameters ---------- hdfs_file: .so file that contains relevant UDF inputs: list of strings or sig.TypeSignature Input types to UDF output: string Ibis data type so_symbol: string, C++ function...
Creates a callable scalar function object. Must be created in Impala to be used
def wrap_udf(hdfs_file, inputs, output, so_symbol, name=None): """ Creates a callable scalar function object. Must be created in Impala to be used Parameters ---------- hdfs_file: .so file that contains relevant UDF inputs: list of strings or sig.TypeSignature Input types to UDF o...
[ "def", "wrap_udf", "(", "hdfs_file", ",", "inputs", ",", "output", ",", "so_symbol", ",", "name", "=", "None", ")", ":", "func", "=", "ImpalaUDF", "(", "inputs", ",", "output", ",", "so_symbol", ",", "name", "=", "name", ",", "lib_path", "=", "hdfs_fil...
[ 195, 0 ]
[ 216, 15 ]
python
en
['en', 'error', 'th']
False
scalar_function
(inputs, output, name=None)
Creates an operator class that can be passed to add_operation() Parameters: inputs: list of strings Ibis data type names output: string Ibis data type name: string, optional Used internally to track function Returns ------- klass, user_api : class, function
Creates an operator class that can be passed to add_operation()
def scalar_function(inputs, output, name=None): """ Creates an operator class that can be passed to add_operation() Parameters: inputs: list of strings Ibis data type names output: string Ibis data type name: string, optional Used internally to track function Returns ...
[ "def", "scalar_function", "(", "inputs", ",", "output", ",", "name", "=", "None", ")", ":", "return", "ScalarFunction", "(", "inputs", ",", "output", ",", "name", "=", "name", ")" ]
[ 219, 0 ]
[ 235, 52 ]
python
en
['en', 'error', 'th']
False
aggregate_function
(inputs, output, name=None)
Creates an operator class that can be passed to add_operation() Parameters: inputs: list of strings Ibis data type names output: string Ibis data type name: string, optional Used internally to track function Returns ------- klass, user_api : class, function
Creates an operator class that can be passed to add_operation()
def aggregate_function(inputs, output, name=None): """ Creates an operator class that can be passed to add_operation() Parameters: inputs: list of strings Ibis data type names output: string Ibis data type name: string, optional Used internally to track function Returns...
[ "def", "aggregate_function", "(", "inputs", ",", "output", ",", "name", "=", "None", ")", ":", "return", "AggregateFunction", "(", "inputs", ",", "output", ",", "name", "=", "name", ")" ]
[ 238, 0 ]
[ 254, 55 ]
python
en
['en', 'error', 'th']
False
add_operation
(op, func_name, db)
Registers the given operation within the Ibis SQL translation toolchain Parameters ---------- op: operator class name: used in issuing statements to SQL engine database: database the relevant operator is registered to
Registers the given operation within the Ibis SQL translation toolchain
def add_operation(op, func_name, db): """ Registers the given operation within the Ibis SQL translation toolchain Parameters ---------- op: operator class name: used in issuing statements to SQL engine database: database the relevant operator is registered to """ full_name = '{0}.{1...
[ "def", "add_operation", "(", "op", ",", "func_name", ",", "db", ")", ":", "full_name", "=", "'{0}.{1}'", ".", "format", "(", "db", ",", "func_name", ")", "# TODO", "# if op.input_type is rlz.listof:", "# translator = comp.varargs(full_name)", "# else:", "arity", ...
[ 275, 0 ]
[ 293, 45 ]
python
en
['en', 'error', 'th']
False
Function.register
(self, name, database)
Registers the given operation within the Ibis SQL translation toolchain. Can also use add_operation API Parameters ---------- name: used in issuing statements to SQL engine database: database the relevant operator is registered to
Registers the given operation within the Ibis SQL translation toolchain. Can also use add_operation API
def register(self, name, database): """ Registers the given operation within the Ibis SQL translation toolchain. Can also use add_operation API Parameters ---------- name: used in issuing statements to SQL engine database: database the relevant operator is regist...
[ "def", "register", "(", "self", ",", "name", ",", "database", ")", ":", "add_operation", "(", "self", ".", "_klass", ",", "name", ",", "database", ")" ]
[ 49, 4 ]
[ 59, 50 ]
python
en
['en', 'error', 'th']
False
CaseFormatter.get_result
(self)
:return:
def get_result(self): """ :return: """ self.buf.seek(0) self.buf.write('CASE') if self.base is not None: base_str = self._trans(self.base) self.buf.write(' {0}'.format(base_str)) for case, result in zip(self.cases, self.results): ...
[ "def", "get_result", "(", "self", ")", ":", "self", ".", "buf", ".", "seek", "(", "0", ")", "self", ".", "buf", ".", "write", "(", "'CASE'", ")", "if", "self", ".", "base", "is", "not", "None", ":", "base_str", "=", "self", ".", "_trans", "(", ...
[ 391, 4 ]
[ 419, 34 ]
python
en
['en', 'error', 'th']
False
BaseMultiCostFunction.__init__
(self, use_constraints=False)
Base class for unique cost functions. Parameters ---------- use_constraints: bool Whether to use constraints on maximum cumulative costs.
Base class for unique cost functions.
def __init__(self, use_constraints=False): """ Base class for unique cost functions. Parameters ---------- use_constraints: bool Whether to use constraints on maximum cumulative costs. """ self.use_constraints = use_constraints
[ "def", "__init__", "(", "self", ",", "use_constraints", "=", "False", ")", ":", "self", ".", "use_constraints", "=", "use_constraints" ]
[ 6, 4 ]
[ 16, 46 ]
python
en
['en', 'error', 'th']
False
BaseMultiCostFunction.sample_goal_params
(self)
Sample goal parameters. Returns ------- goal: 1D nd.array Made of three params in [0, 1]: beta is the mixing parameter, the following are normalized constraints on the maximal values of cumulative costs.
Sample goal parameters.
def sample_goal_params(self): """ Sample goal parameters. Returns ------- goal: 1D nd.array Made of three params in [0, 1]: beta is the mixing parameter, the following are normalized constraints on the maximal values of cumulative costs. """ ...
[ "def", "sample_goal_params", "(", "self", ")", ":", "pass" ]
[ 19, 4 ]
[ 30, 12 ]
python
en
['en', 'error', 'th']
False
BaseMultiCostFunction.set_goal_params
(self, goal)
Set a goal. Parameters ---------- goal: 1D nd.array
Set a goal.
def set_goal_params(self, goal): """ Set a goal. Parameters ---------- goal: 1D nd.array """ pass
[ "def", "set_goal_params", "(", "self", ",", "goal", ")", ":", "pass" ]
[ 64, 4 ]
[ 74, 12 ]
python
en
['en', 'error', 'th']
False
BaseMultiCostFunction.compute_cost
(self, previous_state, state, label_to_id, action, others={})
Compute each cost and an aggregated measure of costs as well as constraints. Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimension # of states). state: 2D nd.array Current model states (either 1D or...
Compute each cost and an aggregated measure of costs as well as constraints.
def compute_cost(self, previous_state, state, label_to_id, action, others={}): """ Compute each cost and an aggregated measure of costs as well as constraints. Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimensi...
[ "def", "compute_cost", "(", "self", ",", "previous_state", ",", "state", ",", "label_to_id", ",", "action", ",", "others", "=", "{", "}", ")", ":", "pass" ]
[ 77, 4 ]
[ 101, 12 ]
python
en
['en', 'error', 'th']
False
BaseMultiCostFunction.compute_deaths
(self, previous_state, state, label_to_id, action, others={})
Compute death toll Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimension # of states). state: 2D nd.array Current model states (either 1D or 2D with first dimension # of states). label_to_id:...
Compute death toll
def compute_deaths(self, previous_state, state, label_to_id, action, others={}): """ Compute death toll Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimension # of states). state: 2D nd.array C...
[ "def", "compute_deaths", "(", "self", ",", "previous_state", ",", "state", ",", "label_to_id", ",", "action", ",", "others", "=", "{", "}", ")", ":", "pass" ]
[ 104, 4 ]
[ 124, 12 ]
python
en
['en', 'error', 'th']
False
BaseMultiCostFunction.compute_aggregated_cost
(self, costs, constraints=None)
Compute aggregated measure of cost with mixing beta and optional constraints. Parameters ---------- costs: 2D nd.array Array of costs (n_points, n_costs). constraints: nd.array of bools, optional Whether constraints are violated (n_point, n_costs). ...
Compute aggregated measure of cost with mixing beta and optional constraints. Parameters ---------- costs: 2D nd.array Array of costs (n_points, n_costs). constraints: nd.array of bools, optional Whether constraints are violated (n_point, n_costs).
def compute_aggregated_cost(self, costs, constraints=None): """ Compute aggregated measure of cost with mixing beta and optional constraints. Parameters ---------- costs: 2D nd.array Array of costs (n_points, n_costs). constraints: nd.array of bools, optional ...
[ "def", "compute_aggregated_cost", "(", "self", ",", "costs", ",", "constraints", "=", "None", ")", ":", "pass" ]
[ 127, 4 ]
[ 142, 12 ]
python
en
['en', 'error', 'th']
False
read_ground_truth
(directory, valid_sequences=None, start_index=0, end_index=-1)
Read all the ground truth from all the sequences in the given folder. Each sequence is a folder containing a json file and some number of mask images Folder structure is is: 000000/ labels.json 0.png 1.png ... 000001/ labels.json 0.png 1.png ...
Read all the ground truth from all the sequences in the given folder. Each sequence is a folder containing a json file and some number of mask images
def read_ground_truth(directory, valid_sequences=None, start_index=0, end_index=-1): """ Read all the ground truth from all the sequences in the given folder. Each sequence is a folder containing a json file and some number of mask images Folder structure is is: 000000/ labels.json ...
[ "def", "read_ground_truth", "(", "directory", ",", "valid_sequences", "=", "None", ",", "start_index", "=", "0", ",", "end_index", "=", "-", "1", ")", ":", "sequences", "=", "{", "}", "for", "sequence_dir", "in", "os", ".", "listdir", "(", "directory", "...
[ 11, 0 ]
[ 41, 20 ]
python
en
['en', 'error', 'th']
False
read_sequence
(sequence_directory, start_index=0, end_index=-1)
Create a generator to read all the ground truth information for a particular sequence. Each iteration of the generator returns another generator over the ground truth instances for that image. Given that the image ids are integers, it is guaranteed to return the ground truth in numerical frame orde...
Create a generator to read all the ground truth information for a particular sequence. Each iteration of the generator returns another generator over the ground truth instances for that image. Given that the image ids are integers, it is guaranteed to return the ground truth in numerical frame orde...
def read_sequence(sequence_directory, start_index=0, end_index=-1): """ Create a generator to read all the ground truth information for a particular sequence. Each iteration of the generator returns another generator over the ground truth instances for that image. Given that the image ids are intege...
[ "def", "read_sequence", "(", "sequence_directory", ",", "start_index", "=", "0", ",", "end_index", "=", "-", "1", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "sequence_directory", ",", "'labels.json'", ")", ",", "'r'", ")", "as", ...
[ 44, 0 ]
[ 109, 20 ]
python
en
['en', 'error', 'th']
False
read_gt_for_image
(image_id, image_data, masks)
Read ground truth for a particular image :param image_id: The id of the image from the labels :param image_data: The image data from the labels json :param masks: A greyscale image containing all the masks in the image :return: image_generator: generator of GroundTruthInstances objects for each gt ...
Read ground truth for a particular image :param image_id: The id of the image from the labels :param image_data: The image data from the labels json :param masks: A greyscale image containing all the masks in the image :return: image_generator: generator of GroundTruthInstances objects for each gt ...
def read_gt_for_image(image_id, image_data, masks): """ Read ground truth for a particular image :param image_id: The id of the image from the labels :param image_data: The image data from the labels json :param masks: A greyscale image containing all the masks in the image :return: image_genera...
[ "def", "read_gt_for_image", "(", "image_id", ",", "image_data", ",", "masks", ")", ":", "if", "len", "(", "image_data", ")", ">", "0", ":", "for", "instance_name", "in", "sorted", "(", "image_data", ".", "keys", "(", ")", ")", ":", "if", "not", "instan...
[ 112, 0 ]
[ 135, 21 ]
python
en
['en', 'error', 'th']
False
match_sequences
(ground_truth_sequences, detection_sequences)
Match ground truth sequences with detection :param ground_truth_sequences: :param detection_sequences: :return: A generator over pairs of frame ground truth and frame detections, which are both lists
Match ground truth sequences with detection :param ground_truth_sequences: :param detection_sequences: :return: A generator over pairs of frame ground truth and frame detections, which are both lists
def match_sequences(ground_truth_sequences, detection_sequences): """ Match ground truth sequences with detection :param ground_truth_sequences: :param detection_sequences: :return: A generator over pairs of frame ground truth and frame detections, which are both lists """ extra = set(detect...
[ "def", "match_sequences", "(", "ground_truth_sequences", ",", "detection_sequences", ")", ":", "extra", "=", "set", "(", "detection_sequences", ".", "keys", "(", ")", ")", "-", "set", "(", "ground_truth_sequences", ".", "keys", "(", ")", ")", "if", "len", "(...
[ 138, 0 ]
[ 166, 46 ]
python
en
['en', 'error', 'th']
False
getArticlesOn_n_pages
(num_pages_to_check, driver)
clanki se pojavijo na strani sele, ko se zloada javascript, zato se uporabi selenium knjiznjica
clanki se pojavijo na strani sele, ko se zloada javascript, zato se uporabi selenium knjiznjica
def getArticlesOn_n_pages(num_pages_to_check, driver): ''' clanki se pojavijo na strani sele, ko se zloada javascript, zato se uporabi selenium knjiznjica ''' articles = [] print('\tgathering articles ...') for year in range(2016, 2019): print('year:' + str(year)) if ...
[ "def", "getArticlesOn_n_pages", "(", "num_pages_to_check", ",", "driver", ")", ":", "articles", "=", "[", "]", "print", "(", "'\\tgathering articles ...'", ")", "for", "year", "in", "range", "(", "2016", ",", "2019", ")", ":", "print", "(", "'year:'", "+", ...
[ 36, 0 ]
[ 62, 19 ]
python
en
['en', 'error', 'th']
False
remove_ldap_groups_in_parallel
(groups, i, iterations=10)
Remove LDAP groups.
Remove LDAP groups.
def remove_ldap_groups_in_parallel(groups, i, iterations=10): """Remove LDAP groups. """ with When(f"LDAP groups are removed #{i}"): for j in range(iterations): for group in groups: with When(f"I delete group #{j}", description=f"{group}"): delete_grou...
[ "def", "remove_ldap_groups_in_parallel", "(", "groups", ",", "i", ",", "iterations", "=", "10", ")", ":", "with", "When", "(", "f\"LDAP groups are removed #{i}\"", ")", ":", "for", "j", "in", "range", "(", "iterations", ")", ":", "for", "group", "in", "group...
[ 14, 0 ]
[ 21, 64 ]
python
en
['en', 'su', 'en']
True
add_ldap_groups_in_parallel
(ldap_user, names, i, iterations=10)
Add LDAP groups.
Add LDAP groups.
def add_ldap_groups_in_parallel(ldap_user, names, i, iterations=10): """Add LDAP groups. """ with When(f"LDAP groups are added #{i}"): for j in range(iterations): for name in names: with When(f"I add group {name} #{j}", description=f"{name}"): group = ...
[ "def", "add_ldap_groups_in_parallel", "(", "ldap_user", ",", "names", ",", "i", ",", "iterations", "=", "10", ")", ":", "with", "When", "(", "f\"LDAP groups are added #{i}\"", ")", ":", "for", "j", "in", "range", "(", "iterations", ")", ":", "for", "name", ...
[ 23, 0 ]
[ 33, 93 ]
python
en
['en', 'lb', 'en']
True
add_user_to_ldap_groups_in_parallel
(ldap_user, groups, i, iterations=10)
Add user to LDAP groups.
Add user to LDAP groups.
def add_user_to_ldap_groups_in_parallel(ldap_user, groups, i, iterations=10): """Add user to LDAP groups. """ with When(f"user is added to LDAP groups #{i}"): for j in range(iterations): for group in groups: with When(f"I add user to the group {group['dn']} #{j}"): ...
[ "def", "add_user_to_ldap_groups_in_parallel", "(", "ldap_user", ",", "groups", ",", "i", ",", "iterations", "=", "10", ")", ":", "with", "When", "(", "f\"user is added to LDAP groups #{i}\"", ")", ":", "for", "j", "in", "range", "(", "iterations", ")", ":", "f...
[ 35, 0 ]
[ 42, 89 ]
python
en
['en', 'en', 'en']
True
remove_user_from_ldap_groups_in_parallel
(ldap_user, groups, i, iterations=10)
Remove user from LDAP groups.
Remove user from LDAP groups.
def remove_user_from_ldap_groups_in_parallel(ldap_user, groups, i, iterations=10): """Remove user from LDAP groups. """ with When(f"user is removed from LDAP groups #{i}"): for j in range(iterations): for group in groups: with When(f"I remove user from the group {group['d...
[ "def", "remove_user_from_ldap_groups_in_parallel", "(", "ldap_user", ",", "groups", ",", "i", ",", "iterations", "=", "10", ")", ":", "with", "When", "(", "f\"user is removed from LDAP groups #{i}\"", ")", ":", "for", "j", "in", "range", "(", "iterations", ")", ...
[ 44, 0 ]
[ 51, 94 ]
python
en
['en', 'en', 'en']
True
add_roles_in_parallel
(role_names, i, iterations=10)
Add roles.
Add roles.
def add_roles_in_parallel(role_names, i, iterations=10): """Add roles. """ with When(f"roles are added #{i}"): for j in range(iterations): for role_name in role_names: with When(f"I add role {role_name} #{j}"): current().context.node.query(f"CREATE ROL...
[ "def", "add_roles_in_parallel", "(", "role_names", ",", "i", ",", "iterations", "=", "10", ")", ":", "with", "When", "(", "f\"roles are added #{i}\"", ")", ":", "for", "j", "in", "range", "(", "iterations", ")", ":", "for", "role_name", "in", "role_names", ...
[ 53, 0 ]
[ 60, 87 ]
python
en
['en', 'en', 'en']
False
remove_roles_in_parallel
(role_names, i, iterations=10)
Remove roles.
Remove roles.
def remove_roles_in_parallel(role_names, i, iterations=10): """Remove roles. """ with When(f"roles are removed #{i}"): for j in range(iterations): for role_name in role_names: with When(f"I remove role {role_name} #{j}"): current().context.node.query(f...
[ "def", "remove_roles_in_parallel", "(", "role_names", ",", "i", ",", "iterations", "=", "10", ")", ":", "with", "When", "(", "f\"roles are removed #{i}\"", ")", ":", "for", "j", "in", "range", "(", "iterations", ")", ":", "for", "role_name", "in", "role_name...
[ 62, 0 ]
[ 69, 84 ]
python
en
['en', 'it', 'en']
False
multiple_roles
(self, ldap_server, ldap_user)
Check that users authenticated using LDAP external user directory can be assigned multiple LDAP mapped roles.
Check that users authenticated using LDAP external user directory can be assigned multiple LDAP mapped roles.
def multiple_roles(self, ldap_server, ldap_user): """Check that users authenticated using LDAP external user directory can be assigned multiple LDAP mapped roles. """ uid = getuid() role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", "attribute": "cn", ...
[ "def", "multiple_roles", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attribute\"", ":", "\"cn\"", ",", "\"search_filte...
[ 75, 0 ]
[ 112, 48 ]
python
en
['en', 'en', 'en']
True
with_fixed_roles
(self, ldap_server, ldap_user)
Check that LDAP users can be assigned roles dynamically and statically using the `<roles>` section.
Check that LDAP users can be assigned roles dynamically and statically using the `<roles>` section.
def with_fixed_roles(self, ldap_server, ldap_user): """Check that LDAP users can be assigned roles dynamically and statically using the `<roles>` section. """ uid = getuid() role_name = f"role_{uid}" fixed_role_name = f"role_fixed_{uid}" role_mappings = [ { "base_dn": "o...
[ "def", "with_fixed_roles", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "fixed_role_name", "=", "f\"role_fixed_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"o...
[ 118, 0 ]
[ 159, 48 ]
python
en
['en', 'en', 'en']
True
map_role
(self, role_name, ldap_server, ldap_user, rbac_role_name=None, role_mappings=None)
Check that we can map a role with a given name.
Check that we can map a role with a given name.
def map_role(self, role_name, ldap_server, ldap_user, rbac_role_name=None, role_mappings=None): """Check that we can map a role with a given name. """ if role_mappings is None: role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", "attribute": "cn"...
[ "def", "map_role", "(", "self", ",", "role_name", ",", "ldap_server", ",", "ldap_user", ",", "rbac_role_name", "=", "None", ",", "role_mappings", "=", "None", ")", ":", "if", "role_mappings", "is", "None", ":", "role_mappings", "=", "[", "{", "\"base_dn\"", ...
[ 162, 0 ]
[ 197, 59 ]
python
en
['en', 'en', 'en']
True
role_name_with_utf8_characters
(self, ldap_server, ldap_user)
Check that we can map a role that contains UTF8 characters.
Check that we can map a role that contains UTF8 characters.
def role_name_with_utf8_characters(self, ldap_server, ldap_user): """Check that we can map a role that contains UTF8 characters. """ uid = getuid() role_name = f"role_{uid}_Gãńdåłf_Thê_Gręât" map_role(role_name=role_name, ldap_server=ldap_server, ldap_user=ldap_user)
[ "def", "role_name_with_utf8_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}_Gãńdåłf_Thê_Gręât\"", "map_role", "(", "role_name", "=", "role_name", ",", "ldap_server", "=", "l...
[ 203, 0 ]
[ 209, 79 ]
python
en
['en', 'en', 'en']
True
role_name_with_more_than_128_characters
(self, ldap_server, ldap_user)
Check that we can map a role that contains more than 128 characters.
Check that we can map a role that contains more than 128 characters.
def role_name_with_more_than_128_characters(self, ldap_server, ldap_user): """Check that we can map a role that contains more than 128 characters. """ uid = getuid() role_name = f"role_{uid}_{'r'*128}" map_role(role_name=role_name, ldap_server=ldap_server, ldap_user=ldap_user)
[ "def", "role_name_with_more_than_128_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}_{'r'*128}\"", "map_role", "(", "role_name", "=", "role_name", ",", "ldap_server", "=", "...
[ 215, 0 ]
[ 221, 79 ]
python
en
['en', 'en', 'en']
True
role_name_with_special_xml_characters
(self, ldap_server, ldap_user)
Check that we can map a role that contains special XML characters that must be escaped.
Check that we can map a role that contains special XML characters that must be escaped.
def role_name_with_special_xml_characters(self, ldap_server, ldap_user): """Check that we can map a role that contains special XML characters that must be escaped. """ uid = getuid() role_name = f"role_{uid}_\\<\\>" rbac_role_name = f"role_{uid}_<>" map_role(role_name=role_name, ldap_server...
[ "def", "role_name_with_special_xml_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}_\\\\<\\\\>\"", "rbac_role_name", "=", "f\"role_{uid}_<>\"", "map_role", "(", "role_name", "=",...
[ 227, 0 ]
[ 235, 110 ]
python
en
['en', 'en', 'en']
True
role_name_with_special_regex_characters
(self, ldap_server, ldap_user)
Check that we can map a role that contains special regex characters that must be escaped.
Check that we can map a role that contains special regex characters that must be escaped.
def role_name_with_special_regex_characters(self, ldap_server, ldap_user): """Check that we can map a role that contains special regex characters that must be escaped. """ uid = getuid() role_name = f"role_{uid}_\\+.?$" rbac_role_name = f"role_{uid}_+.?$" map_role(role_name=role_name, ldap_...
[ "def", "role_name_with_special_regex_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}_\\\\+.?$\"", "rbac_role_name", "=", "f\"role_{uid}_+.?$\"", "map_role", "(", "role_name", "=...
[ 241, 0 ]
[ 249, 110 ]
python
en
['en', 'en', 'en']
True
map_groups_with_prefixes
(self, prefixes, group_names, role_names, expected, not_expected, ldap_server, ldap_user)
Check that we can map multiple groups to roles whith one or more prefixes.
Check that we can map multiple groups to roles whith one or more prefixes.
def map_groups_with_prefixes(self, prefixes, group_names, role_names, expected, not_expected, ldap_server, ldap_user): """Check that we can map multiple groups to roles whith one or more prefixes. """ role_mappings = [] for prefix in prefixes: role_mappings.append({ "base_dn...
[ "def", "map_groups_with_prefixes", "(", "self", ",", "prefixes", ",", "group_names", ",", "role_names", ",", "expected", ",", "not_expected", ",", "ldap_server", ",", "ldap_user", ")", ":", "role_mappings", "=", "[", "]", "for", "prefix", "in", "prefixes", ":"...
[ 252, 0 ]
[ 292, 52 ]
python
en
['en', 'en', 'en']
True
prefix_non_empty
(self, ldap_server, ldap_user)
Check that only group names with specified prefix are mapped to roles when prefix is not empty.
Check that only group names with specified prefix are mapped to roles when prefix is not empty.
def prefix_non_empty(self, ldap_server, ldap_user): """Check that only group names with specified prefix are mapped to roles when prefix is not empty. """ uid = getuid() with Given("I define group names"): group_names=[ f"clickhouse_role_{uid}", f"role0_{uid}" ...
[ "def", "prefix_non_empty", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "with", "Given", "(", "\"I define group names\"", ")", ":", "group_names", "=", "[", "f\"clickhouse_role_{uid}\"", ",", "f\"role0_{uid}\"", "]...
[ 299, 0 ]
[ 326, 53 ]
python
en
['en', 'en', 'en']
True
prefix_default_value
(self, ldap_server, ldap_user)
Check that when prefix is not specified the default value of prefix is empty and therefore ldap groups are mapped directly to roles.
Check that when prefix is not specified the default value of prefix is empty and therefore ldap groups are mapped directly to roles.
def prefix_default_value(self, ldap_server, ldap_user): """Check that when prefix is not specified the default value of prefix is empty and therefore ldap groups are mapped directly to roles. """ uid = getuid() role_name = f"role_{uid}" role_mappings = [ { "base_dn": "ou=gro...
[ "def", "prefix_default_value", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attribut...
[ 332, 0 ]
[ 347, 108 ]
python
en
['en', 'en', 'en']
True
prefix_with_utf8_characters
(self, ldap_server, ldap_user)
Check that we can map a role when prefix contains UTF8 characters.
Check that we can map a role when prefix contains UTF8 characters.
def prefix_with_utf8_characters(self, ldap_server, ldap_user): """Check that we can map a role when prefix contains UTF8 characters. """ uid = getuid() with Given("I define group names"): group_names=[ f"Gãńdåłf_Thê_Gręât_role_{uid}", f"role0_{uid}" ] with A...
[ "def", "prefix_with_utf8_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "with", "Given", "(", "\"I define group names\"", ")", ":", "group_names", "=", "[", "f\"Gãńdåłf_Thê_Gręât_role_{uid}\",", "", "f\"ro...
[ 353, 0 ]
[ 379, 53 ]
python
en
['en', 'en', 'en']
True
prefix_with_special_xml_characters
(self, ldap_server, ldap_user)
Check that we can map a role when prefix contains special XML characters.
Check that we can map a role when prefix contains special XML characters.
def prefix_with_special_xml_characters(self, ldap_server, ldap_user): """Check that we can map a role when prefix contains special XML characters. """ uid = getuid() with Given("I define group names"): group_names=[ f"clickhouse\\<\\>_role_{uid}", f"role0_{uid}" ...
[ "def", "prefix_with_special_xml_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "with", "Given", "(", "\"I define group names\"", ")", ":", "group_names", "=", "[", "f\"clickhouse\\\\<\\\\>_role_{uid}\"", ","...
[ 386, 0 ]
[ 412, 53 ]
python
en
['en', 'en', 'en']
True
prefix_with_special_regex_characters
(self, ldap_server, ldap_user)
Check that we can map a role when prefix contains special regex characters.
Check that we can map a role when prefix contains special regex characters.
def prefix_with_special_regex_characters(self, ldap_server, ldap_user): """Check that we can map a role when prefix contains special regex characters. """ uid = getuid() with Given("I define group names"): group_names=[ f"clickhouse\\+.?\\$_role_{uid}", f"role0_{uid}" ...
[ "def", "prefix_with_special_regex_characters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "with", "Given", "(", "\"I define group names\"", ")", ":", "group_names", "=", "[", "f\"clickhouse\\\\+.?\\\\$_role_{uid}\"", ...
[ 418, 0 ]
[ 444, 53 ]
python
en
['en', 'en', 'en']
True
multiple_sections_with_different_prefixes
(self, ldap_server, ldap_user)
Check that we can map multiple roles with multiple role mapping sections that use different prefixes.
Check that we can map multiple roles with multiple role mapping sections that use different prefixes.
def multiple_sections_with_different_prefixes(self, ldap_server, ldap_user): """Check that we can map multiple roles with multiple role mapping sections that use different prefixes. """ uid = getuid() with Given("I define group names"): group_names=[ f"clickhouse0_role0_{uid}", ...
[ "def", "multiple_sections_with_different_prefixes", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "with", "Given", "(", "\"I define group names\"", ")", ":", "group_names", "=", "[", "f\"clickhouse0_role0_{uid}\"", ",",...
[ 450, 0 ]
[ 479, 53 ]
python
en
['en', 'en', 'en']
True
group_removed
(self, ldap_server, ldap_user)
Check that roles are not mapped after the corresponding LDAP group is removed.
Check that roles are not mapped after the corresponding LDAP group is removed.
def group_removed(self, ldap_server, ldap_user): """Check that roles are not mapped after the corresponding LDAP group is removed. """ uid = getuid() role_name = f"role_{uid}" role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", "attribute": "cn", ...
[ "def", "group_removed", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attribute\"", ...
[ 485, 0 ]
[ 532, 53 ]
python
en
['en', 'en', 'en']
True
user_removed_from_group
(self, ldap_server, ldap_user)
Check that roles are not mapped after the user has been removed from the corresponding LDAP group.
Check that roles are not mapped after the user has been removed from the corresponding LDAP group.
def user_removed_from_group(self, ldap_server, ldap_user): """Check that roles are not mapped after the user has been removed from the corresponding LDAP group. """ uid = getuid() role_name = f"role_{uid}" role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", ...
[ "def", "user_removed_from_group", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attri...
[ 538, 0 ]
[ 584, 53 ]
python
en
['en', 'en', 'en']
True
role_not_present
(self, ldap_server, ldap_user)
Check that LDAP users can still be authenticated even if the mapped role is not present.
Check that LDAP users can still be authenticated even if the mapped role is not present.
def role_not_present(self, ldap_server, ldap_user): """Check that LDAP users can still be authenticated even if the mapped role is not present. """ uid = getuid() role_name = f"role_{uid}" role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", "attribute":...
[ "def", "role_not_present", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attribute\""...
[ 590, 0 ]
[ 624, 38 ]
python
en
['en', 'en', 'en']
True
add_new_role_not_present
(self, ldap_server, ldap_user)
Check that LDAP user can still authenticate when the LDAP user is added to a new LDAP group that does not match any existing RBAC roles while having other role being already mapped.
Check that LDAP user can still authenticate when the LDAP user is added to a new LDAP group that does not match any existing RBAC roles while having other role being already mapped.
def add_new_role_not_present(self, ldap_server, ldap_user): """Check that LDAP user can still authenticate when the LDAP user is added to a new LDAP group that does not match any existing RBAC roles while having other role being already mapped. """ uid = getuid() role_name = f"role_{uid}" r...
[ "def", "add_new_role_not_present", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attr...
[ 630, 0 ]
[ 700, 62 ]
python
en
['en', 'lb', 'en']
True
role_removed_and_readded
(self, ldap_server, ldap_user)
Check that when a mapped role is removed the privileges provided by the role are revoked from all the authenticated LDAP users and when the role is added back the privileges to the authenticated LDAP users are re-granted.
Check that when a mapped role is removed the privileges provided by the role are revoked from all the authenticated LDAP users and when the role is added back the privileges to the authenticated LDAP users are re-granted.
def role_removed_and_readded(self, ldap_server, ldap_user): """Check that when a mapped role is removed the privileges provided by the role are revoked from all the authenticated LDAP users and when the role is added back the privileges to the authenticated LDAP users are re-granted. """ uid = getui...
[ "def", "role_removed_and_readded", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attr...
[ 707, 0 ]
[ 783, 61 ]
python
en
['en', 'en', 'en']
True
privilege_new_and_removed
(self, ldap_server, ldap_user)
Check that when a new privilege is added to the mapped role it is granted to all authenticated LDAP users and when the privilege is removed from the role it is also revoked from all authenticated LDAP users.
Check that when a new privilege is added to the mapped role it is granted to all authenticated LDAP users and when the privilege is removed from the role it is also revoked from all authenticated LDAP users.
def privilege_new_and_removed(self, ldap_server, ldap_user): """Check that when a new privilege is added to the mapped role it is granted to all authenticated LDAP users and when the privilege is removed from the role it is also revoked from all authenticated LDAP users. """ uid = getuid() r...
[ "def", "privilege_new_and_removed", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"att...
[ 790, 0 ]
[ 863, 61 ]
python
en
['en', 'en', 'en']
True
role_added
(self, ldap_server, ldap_user)
Check that when the mapped role is not present during LDAP user authentication but is later added then the authenticated LDAP users is granted the privileges provided by the mapped role.
Check that when the mapped role is not present during LDAP user authentication but is later added then the authenticated LDAP users is granted the privileges provided by the mapped role.
def role_added(self, ldap_server, ldap_user): """Check that when the mapped role is not present during LDAP user authentication but is later added then the authenticated LDAP users is granted the privileges provided by the mapped role. """ uid = getuid() role_name = f"role_{uid}" role_mappi...
[ "def", "role_added", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attribute\"", ":...
[ 869, 0 ]
[ 929, 61 ]
python
en
['en', 'en', 'en']
True
role_new
(self, ldap_server, ldap_user)
Check that no new roles can be granted to LDAP authenticated users.
Check that no new roles can be granted to LDAP authenticated users.
def role_new(self, ldap_server, ldap_user): """Check that no new roles can be granted to LDAP authenticated users. """ uid = getuid() role_name = f"role_{uid}" role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", "attribute": "cn", "search_filter...
[ "def", "role_new", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"", ",", "\"attribute\"", ":",...
[ 935, 0 ]
[ 969, 59 ]
python
en
['en', 'en', 'en']
True
multiple_sections_with_identical_parameters
(self, ldap_server, ldap_user)
Check behaviour when multiple role mapping sections have exactly the same parameters.
Check behaviour when multiple role mapping sections have exactly the same parameters.
def multiple_sections_with_identical_parameters(self, ldap_server, ldap_user): """Check behaviour when multiple role mapping sections have exactly the same parameters. """ uid = getuid() role_name = f"role_{uid}" role_mappings = [ { "base_dn": "ou=groups,dc=company,dc=com", ...
[ "def", "multiple_sections_with_identical_parameters", "(", "self", ",", "ldap_server", ",", "ldap_user", ")", ":", "uid", "=", "getuid", "(", ")", "role_name", "=", "f\"role_{uid}\"", "role_mappings", "=", "[", "{", "\"base_dn\"", ":", "\"ou=groups,dc=company,dc=com\"...
[ 975, 0 ]
[ 1010, 59 ]
python
en
['en', 'en', 'en']
True
group_removed_and_added_in_parallel
(self, ldap_server, ldap_user, count=20, timeout=200)
Check that user can be authenticated successfully when LDAP groups are removed and added in parallel.
Check that user can be authenticated successfully when LDAP groups are removed and added in parallel.
def group_removed_and_added_in_parallel(self, ldap_server, ldap_user, count=20, timeout=200): """Check that user can be authenticated successfully when LDAP groups are removed and added in parallel. """ uid = getuid() role_names = [f"role{i}_{uid}" for i in range(count)] users = [{"cn": ldap_use...
[ "def", "group_removed_and_added_in_parallel", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "count", "=", "20", ",", "timeout", "=", "200", ")", ":", "uid", "=", "getuid", "(", ")", "role_names", "=", "[", "f\"role{i}_{uid}\"", "for", "i", "in", ...
[ 1016, 0 ]
[ 1064, 60 ]
python
en
['en', 'en', 'en']
True
user_removed_and_added_in_ldap_groups_in_parallel
(self, ldap_server, ldap_user, count=20, timeout=200)
Check that user can be authenticated successfully when it is removed and added from mapping LDAP groups in parallel.
Check that user can be authenticated successfully when it is removed and added from mapping LDAP groups in parallel.
def user_removed_and_added_in_ldap_groups_in_parallel(self, ldap_server, ldap_user, count=20, timeout=200): """Check that user can be authenticated successfully when it is removed and added from mapping LDAP groups in parallel. """ uid = getuid() role_names = [f"role{i}_{uid}" for i in range(count)]...
[ "def", "user_removed_and_added_in_ldap_groups_in_parallel", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "count", "=", "20", ",", "timeout", "=", "200", ")", ":", "uid", "=", "getuid", "(", ")", "role_names", "=", "[", "f\"role{i}_{uid}\"", "for", "...
[ 1070, 0 ]
[ 1112, 36 ]
python
en
['en', 'en', 'en']
True
roles_removed_and_added_in_parallel
(self, ldap_server, ldap_user, count=20, timeout=200)
Check that user can be authenticated successfully when roles that are mapped by the LDAP groups are removed and added in parallel.
Check that user can be authenticated successfully when roles that are mapped by the LDAP groups are removed and added in parallel.
def roles_removed_and_added_in_parallel(self, ldap_server, ldap_user, count=20, timeout=200): """Check that user can be authenticated successfully when roles that are mapped by the LDAP groups are removed and added in parallel. """ uid = getuid() role_names = [f"role{i}_{uid}" for i in range(count)]...
[ "def", "roles_removed_and_added_in_parallel", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "count", "=", "20", ",", "timeout", "=", "200", ")", ":", "uid", "=", "getuid", "(", ")", "role_names", "=", "[", "f\"role{i}_{uid}\"", "for", "i", "in", ...
[ 1118, 0 ]
[ 1166, 83 ]
python
en
['en', 'en', 'en']
True
parallel_login
(self, ldap_server, ldap_user, user_count=10, timeout=200, role_count=10)
Check that login of valid and invalid LDAP authenticated users with mapped roles works in parallel.
Check that login of valid and invalid LDAP authenticated users with mapped roles works in parallel.
def parallel_login(self, ldap_server, ldap_user, user_count=10, timeout=200, role_count=10): """Check that login of valid and invalid LDAP authenticated users with mapped roles works in parallel. """ uid = getuid() role_names = [f"role{i}_{uid}" for i in range(role_count)] users = [{"cn": f"par...
[ "def", "parallel_login", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "user_count", "=", "10", ",", "timeout", "=", "200", ",", "role_count", "=", "10", ")", ":", "uid", "=", "getuid", "(", ")", "role_names", "=", "[", "f\"role{i}_{uid}\"", "f...
[ 1169, 0 ]
[ 1220, 36 ]
python
en
['en', 'en', 'en']
True
parallel_login_of_multiple_users
(self, ldap_server, ldap_user, timeout=200, role_count=10)
Check that valid and invalid logins of multiple LDAP authenticated users with mapped roles works in parallel.
Check that valid and invalid logins of multiple LDAP authenticated users with mapped roles works in parallel.
def parallel_login_of_multiple_users(self, ldap_server, ldap_user, timeout=200, role_count=10): """Check that valid and invalid logins of multiple LDAP authenticated users with mapped roles works in parallel. """ parallel_login(user_count=10, ldap_user=ldap_user,ldap_server=ldap_server, timeout=...
[ "def", "parallel_login_of_multiple_users", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "timeout", "=", "200", ",", "role_count", "=", "10", ")", ":", "parallel_login", "(", "user_count", "=", "10", ",", "ldap_user", "=", "ldap_user", ",", "ldap_ser...
[ 1227, 0 ]
[ 1232, 47 ]
python
en
['en', 'en', 'en']
True
parallel_login_of_the_same_user
(self, ldap_server, ldap_user, timeout=200, role_count=10)
Check that valid and invalid logins of the same LDAP authenticated user with mapped roles works in parallel.
Check that valid and invalid logins of the same LDAP authenticated user with mapped roles works in parallel.
def parallel_login_of_the_same_user(self, ldap_server, ldap_user, timeout=200, role_count=10): """Check that valid and invalid logins of the same LDAP authenticated user with mapped roles works in parallel. """ parallel_login(user_count=10, ldap_user=ldap_user,ldap_server=ldap_server, timeout=ti...
[ "def", "parallel_login_of_the_same_user", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "timeout", "=", "200", ",", "role_count", "=", "10", ")", ":", "parallel_login", "(", "user_count", "=", "10", ",", "ldap_user", "=", "ldap_user", ",", "ldap_serv...
[ 1239, 0 ]
[ 1244, 47 ]
python
en
['en', 'en', 'en']
True
parallel_login_of_ldap_users_with_multiple_servers
(self, ldap_server, ldap_user, timeout=200)
Check that valid and invalid logins of multiple LDAP users that have mapped roles works in parallel using multiple LDAP external user directories.
Check that valid and invalid logins of multiple LDAP users that have mapped roles works in parallel using multiple LDAP external user directories.
def parallel_login_of_ldap_users_with_multiple_servers(self, ldap_server, ldap_user, timeout=200): """Check that valid and invalid logins of multiple LDAP users that have mapped roles works in parallel using multiple LDAP external user directories. """ parallel_login_with_multiple_servers(ldap_server=ld...
[ "def", "parallel_login_of_ldap_users_with_multiple_servers", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "timeout", "=", "200", ")", ":", "parallel_login_with_multiple_servers", "(", "ldap_server", "=", "ldap_server", ",", "ldap_user", "=", "ldap_user", ",",...
[ 1251, 0 ]
[ 1256, 99 ]
python
en
['en', 'en', 'en']
True
parallel_login_of_local_and_ldap_users_with_multiple_servers
(self, ldap_server, ldap_user, timeout=200)
Check that valid and invalid logins of local users and LDAP users that have mapped roles works in parallel using multiple LDAP external user directories.
Check that valid and invalid logins of local users and LDAP users that have mapped roles works in parallel using multiple LDAP external user directories.
def parallel_login_of_local_and_ldap_users_with_multiple_servers(self, ldap_server, ldap_user, timeout=200): """Check that valid and invalid logins of local users and LDAP users that have mapped roles works in parallel using multiple LDAP external user directories. """ parallel_login_with_multiple_serve...
[ "def", "parallel_login_of_local_and_ldap_users_with_multiple_servers", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "timeout", "=", "200", ")", ":", "parallel_login_with_multiple_servers", "(", "ldap_server", "=", "ldap_server", ",", "ldap_user", "=", "ldap_use...
[ 1263, 0 ]
[ 1268, 99 ]
python
en
['en', 'en', 'en']
True
parallel_login_of_local_users
(self, ldap_server, ldap_user, timeout=200)
Check that valid and invalid logins of local users works in parallel when multiple LDAP external user directories with role mapping are configured.
Check that valid and invalid logins of local users works in parallel when multiple LDAP external user directories with role mapping are configured.
def parallel_login_of_local_users(self, ldap_server, ldap_user, timeout=200): """Check that valid and invalid logins of local users works in parallel when multiple LDAP external user directories with role mapping are configured. """ parallel_login_with_multiple_servers(ldap_server=ldap_server, ldap_...
[ "def", "parallel_login_of_local_users", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "timeout", "=", "200", ")", ":", "parallel_login_with_multiple_servers", "(", "ldap_server", "=", "ldap_server", ",", "ldap_user", "=", "ldap_user", ",", "user_count", "=...
[ 1274, 0 ]
[ 1280, 100 ]
python
en
['en', 'en', 'en']
True
parallel_login_with_multiple_servers
(self, ldap_server, ldap_user, user_count=10, role_count=10, timeout=200, with_ldap_users=True, with_local_users=False)
Check that login of valid and invalid local users or LDAP users that have mapped roles works in parallel using multiple LDAP external user directories.
Check that login of valid and invalid local users or LDAP users that have mapped roles works in parallel using multiple LDAP external user directories.
def parallel_login_with_multiple_servers(self, ldap_server, ldap_user, user_count=10, role_count=10, timeout=200, with_ldap_users=True, with_local_users=False): """Check that login of valid and invalid local users or LDAP users that have mapped roles works in parallel using multiple LDAP external user d...
[ "def", "parallel_login_with_multiple_servers", "(", "self", ",", "ldap_server", ",", "ldap_user", ",", "user_count", "=", "10", ",", "role_count", "=", "10", ",", "timeout", "=", "200", ",", "with_ldap_users", "=", "True", ",", "with_local_users", "=", "False", ...
[ 1283, 0 ]
[ 1400, 36 ]
python
en
['en', 'en', 'en']
True
feature
(self)
Check role LDAP role mapping.
Check role LDAP role mapping.
def feature(self): """Check role LDAP role mapping. """ self.context.node = self.context.cluster.node("clickhouse1") self.context.ldap_node = self.context.cluster.node("openldap1") servers = { "openldap1": { "host": "openldap1", "port": "389", "enable_tls...
[ "def", "feature", "(", "self", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "\"clickhouse1\"", ")", "self", ".", "context", ".", "ldap_node", "=", "self", ".", "context", ".", "cluster", ...
[ 1407, 0 ]
[ 1441, 61 ]
python
en
['fr', 'en', 'en']
True
alter_settings_profile_granted_directly
(self, node=None)
Check that a user is able to execute `ALTER SETTINGS PROFILE` with privileges are granted directly.
Check that a user is able to execute `ALTER SETTINGS PROFILE` with privileges are granted directly.
def alter_settings_profile_granted_directly(self, node=None): """Check that a user is able to execute `ALTER SETTINGS PROFILE` with privileges are granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite...
[ "def", "alter_settings_profile_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", ...
[ 22, 0 ]
[ 36, 80 ]
python
en
['en', 'en', 'en']
True
alter_settings_profile_granted_via_role
(self, node=None)
Check that a user is able to execute `ALTER SETTINGS PROFILE` with privileges are granted through a role.
Check that a user is able to execute `ALTER SETTINGS PROFILE` with privileges are granted through a role.
def alter_settings_profile_granted_via_role(self, node=None): """Check that a user is able to execute `ALTER SETTINGS PROFILE` with privileges are granted through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with u...
[ "def", "alter_settings_profile_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "nod...
[ 39, 0 ]
[ 57, 80 ]
python
en
['en', 'en', 'en']
True
alter_settings_profile
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `ALTER SETTINGS PROFILE` when they have the necessary privilege.
Check that user is only able to execute `ALTER SETTINGS PROFILE` when they have the necessary privilege.
def alter_settings_profile(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `ALTER SETTINGS PROFILE` when they have the necessary privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.con...
[ "def", "alter_settings_profile", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", ...
[ 66, 0 ]
[ 131, 55 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of ALTER SETTINGS PROFILE.
Check the RBAC functionality of ALTER SETTINGS PROFILE.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of ALTER SETTINGS PROFILE. """ self.context.node = self.context.cluster.node(node) Suite(run=alter_settings_profile_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=alter_settings_profile_granted_via_role, set...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "alter_settings_profile_granted_directl...
[ 140, 0 ]
[ 146, 94 ]
python
en
['en', 'en', 'en']
True
calc_scale
(created_in='matplotlib')
Convert to correct size in pixels. There's a bizarre issue that makes it so the size of the figure saved out from matplotlib as an svg is not the same as the SVG element created here. this wouldn't be an issue (because SVGs scale nicely and all that) except for the font size. So, here's the issue: ...
Convert to correct size in pixels.
def calc_scale(created_in='matplotlib'): """Convert to correct size in pixels. There's a bizarre issue that makes it so the size of the figure saved out from matplotlib as an svg is not the same as the SVG element created here. this wouldn't be an issue (because SVGs scale nicely and all that) except ...
[ "def", "calc_scale", "(", "created_in", "=", "'matplotlib'", ")", ":", "dpi", "=", "{", "'matplotlib'", ":", "72", ",", "'svgutils'", ":", "72", ",", "'inkscape'", ":", "96", "}", "[", "created_in", "]", "return", "90", "/", "dpi" ]
[ 8, 0 ]
[ 44, 17 ]
python
en
['en', 'en', 'en']
True
_convert_to_pix
(val)
Convert value into pixels to make our lives easier.
Convert value into pixels to make our lives easier.
def _convert_to_pix(val): """Convert value into pixels to make our lives easier.""" if not isinstance(val, str): return val else: v, units = re.findall('([\d\.]+)([a-z]+)', val)[0] # svgutils can't convert out of inches or pts, so we do that ourselves # (it supposedly can do ...
[ "def", "_convert_to_pix", "(", "val", ")", ":", "if", "not", "isinstance", "(", "val", ",", "str", ")", ":", "return", "val", "else", ":", "v", ",", "units", "=", "re", ".", "findall", "(", "'([\\d\\.]+)([a-z]+)'", ",", "val", ")", "[", "0", "]", "...
[ 68, 0 ]
[ 82, 51 ]
python
en
['en', 'en', 'en']
True
model_schematic
(schematic_fig, contour_fig_large, contour_figs_small, save_path, fig_size='full', context='paper')
Add window contours to the model schematic figure. Parameters ---------- schematic_fig, contour_fig_large, contour_figs_small : str Paths to the model schematic figure and two versions of the window contour figure, one which will be displayed relatively large and one that will be a ...
Add window contours to the model schematic figure.
def model_schematic(schematic_fig, contour_fig_large, contour_figs_small, save_path, fig_size='full', context='paper'): """Add window contours to the model schematic figure. Parameters ---------- schematic_fig, contour_fig_large, contour_figs_small : str Paths to the model s...
[ "def", "model_schematic", "(", "schematic_fig", ",", "contour_fig_large", ",", "contour_figs_small", ",", "save_path", ",", "fig_size", "=", "'full'", ",", "context", "=", "'paper'", ")", ":", "text_params", ",", "figure_width", "=", "style", ".", "plotting_style"...
[ 85, 0 ]
[ 128, 21 ]
python
en
['en', 'en', 'en']
True
metamer_comparison
(metamer_fig, scaling_vals, save_path, cutout_fig=False, context='paper')
Add text labeling model metamer scaling values. Parameters ---------- metamer_fig : str Path to the metamer comparison figure. scaling_vals : list List of strings or floats, the scaling values to use for labeling the figure. save_path : str path to save the composed ...
Add text labeling model metamer scaling values.
def metamer_comparison(metamer_fig, scaling_vals, save_path, cutout_fig=False, context='paper'): """Add text labeling model metamer scaling values. Parameters ---------- metamer_fig : str Path to the metamer comparison figure. scaling_vals : list List of strin...
[ "def", "metamer_comparison", "(", "metamer_fig", ",", "scaling_vals", ",", "save_path", ",", "cutout_fig", "=", "False", ",", "context", "=", "'paper'", ")", ":", "text_params", ",", "figure_width", "=", "style", ".", "plotting_style", "(", "context", ",", "'s...
[ 131, 0 ]
[ 174, 21 ]
python
en
['nl', 'en', 'en']
True
performance_metamer_comparison_small
(performance_fig, metamer_fig, scaling_vals, save_path, context='paper')
Add text labeling model metamer scaling values. Parameters ---------- performance_fig, metamer_fig : str Paths to the performance and small metamer comparison figures. scaling_vals : list List of strings or floats, the scaling values to use for labeling the figure. save_path...
Add text labeling model metamer scaling values.
def performance_metamer_comparison_small(performance_fig, metamer_fig, scaling_vals, save_path, context='paper'): """Add text labeling model metamer scaling values. Parameters ---------- performance_fig, metamer_fig : str...
[ "def", "performance_metamer_comparison_small", "(", "performance_fig", ",", "metamer_fig", ",", "scaling_vals", ",", "save_path", ",", "context", "=", "'paper'", ")", ":", "text_params", ",", "figure_width", "=", "style", ".", "plotting_style", "(", "context", ",", ...
[ 177, 0 ]
[ 215, 21 ]
python
en
['nl', 'en', 'en']
True
indent
(lines, spaces=4)
Indent `lines` by `spaces` spaces. Parameters ---------- lines : Union[str, List[str]] A string or list of strings to indent spaces : int The number of spaces to indent `lines` Returns ------- indented_lines : str
Indent `lines` by `spaces` spaces.
def indent(lines, spaces=4): """Indent `lines` by `spaces` spaces. Parameters ---------- lines : Union[str, List[str]] A string or list of strings to indent spaces : int The number of spaces to indent `lines` Returns ------- indented_lines : str """ if isinstanc...
[ "def", "indent", "(", "lines", ",", "spaces", "=", "4", ")", ":", "if", "isinstance", "(", "lines", ",", "six", ".", "string_types", ")", ":", "text", "=", "[", "lines", "]", "text", "=", "'\\n'", ".", "join", "(", "lines", ")", "return", "textwrap...
[ 35, 0 ]
[ 52, 46 ]
python
en
['en', 'en', 'en']
True
semicolon
(f)
Add a semicolon to the result of a visit_* call. Parameters ---------- f : callable
Add a semicolon to the result of a visit_* call.
def semicolon(f): """Add a semicolon to the result of a visit_* call. Parameters ---------- f : callable """ @functools.wraps(f) def wrapper(*args, **kwargs): return f(*args, **kwargs) + ';' return wrapper
[ "def", "semicolon", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "+", "';'", "return", ...
[ 55, 0 ]
[ 65, 18 ]
python
en
['en', 'en', 'en']
True
PythonToJavaScriptTranslator.local_scope
(self)
Assign symbols to local variables.
Assign symbols to local variables.
def local_scope(self): """Assign symbols to local variables. """ self.scope = self.scope.new_child() try: yield self.scope finally: self.scope = self.scope.parents
[ "def", "local_scope", "(", "self", ")", ":", "self", ".", "scope", "=", "self", ".", "scope", ".", "new_child", "(", ")", "try", ":", "yield", "self", ".", "scope", "finally", ":", "self", ".", "scope", "=", "self", ".", "scope", ".", "parents" ]
[ 443, 4 ]
[ 450, 43 ]
python
en
['en', 'en', 'en']
True
PythonToJavaScriptTranslator.visit_ListComp
(self, node)
Generate a curried lambda function [x + y for x, y in [[1, 4], [2, 5], [3, 6]]] becomes [[1, 4], [2, 5], [3, 6]]].map(([x, y]) => x + y)
Generate a curried lambda function
def visit_ListComp(self, node): """Generate a curried lambda function [x + y for x, y in [[1, 4], [2, 5], [3, 6]]] becomes [[1, 4], [2, 5], [3, 6]]].map(([x, y]) => x + y) """ try: generator, = node.generators except ValueError: raise No...
[ "def", "visit_ListComp", "(", "self", ",", "node", ")", ":", "try", ":", "generator", ",", "=", "node", ".", "generators", "except", "ValueError", ":", "raise", "NotImplementedError", "(", "'Only single loop comprehensions are allowed'", ")", "names", "=", "find_n...
[ 498, 4 ]
[ 544, 21 ]
python
en
['es', 'en', 'en']
True
async_setup_entry
(hass, entry, async_add_entities)
Setup sensor platform.
Setup sensor platform.
async def async_setup_entry(hass, entry, async_add_entities): """Setup sensor platform.""" data = hass.data[DOMAIN][entry.entry_id] coordinator = data["coordinator"] if not coordinator: return False meter = data["meter"] if not meter: return False gateway = data["gateway"]...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "coordinator", "=", "data", "[", "\"coordinator\"", "]", "if", ...
[ 23, 0 ]
[ 63, 31 ]
python
en
['en', 'pt', 'en']
True
DukeEnergyGatewaySensor.__init__
( self, coordinator: DukeEnergyGatewayUsageDataUpdateCoordinator, entry, meter: MeterInfo, gateway: GatewayStatus, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, coordinator: DukeEnergyGatewayUsageDataUpdateCoordinator, entry, meter: MeterInfo, gateway: GatewayStatus, ): """Initialize the sensor.""" self._state = None self._sensor_metadata = self.get_sensor_metadata() super().__init_...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "DukeEnergyGatewayUsageDataUpdateCoordinator", ",", "entry", ",", "meter", ":", "MeterInfo", ",", "gateway", ":", "GatewayStatus", ",", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_sensor...
[ 80, 4 ]
[ 96, 9 ]
python
en
['en', 'en', 'en']
True
DukeEnergyGatewaySensor.get_sensor_metadata
()
Get the sensor metadata for this sensor. Override in base class.
Get the sensor metadata for this sensor. Override in base class.
def get_sensor_metadata() -> _SensorMetadata: """Get the sensor metadata for this sensor. Override in base class.""" return None
[ "def", "get_sensor_metadata", "(", ")", "->", "_SensorMetadata", ":", "return", "None" ]
[ 100, 4 ]
[ 102, 19 ]
python
en
['en', 'en', 'en']
True
DukeEnergyGatewaySensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"Duke Energy {self._sensor_metadata.name}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"Duke Energy {self._sensor_metadata.name}\"" ]
[ 105, 4 ]
[ 107, 58 ]
python
en
['en', 'mi', 'en']
True
DukeEnergyGatewaySensor.state
(self)
By default, current state is stored in the _state instance variable.
By default, current state is stored in the _state instance variable.
def state(self): """By default, current state is stored in the _state instance variable.""" self.update() return self._state
[ "def", "state", "(", "self", ")", ":", "self", ".", "update", "(", ")", "return", "self", ".", "_state" ]
[ 110, 4 ]
[ 113, 26 ]
python
en
['en', 'en', 'en']
True
DukeEnergyGatewaySensor.update
(self)
Override this to update the _state instance variable for a state update.
Override this to update the _state instance variable for a state update.
def update(self): """Override this to update the _state instance variable for a state update."""
[ "def", "update", "(", "self", ")", ":" ]
[ 115, 4 ]
[ 116, 86 ]
python
en
['en', 'en', 'en']
True
DukeEnergyGatewaySensor.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return self._sensor_metadata.unit
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_sensor_metadata", ".", "unit" ]
[ 123, 4 ]
[ 125, 41 ]
python
en
['en', 'la', 'en']
True
DukeEnergyGatewaySensor.icon
(self)
Return the icon of the sensor.
Return the icon of the sensor.
def icon(self): """Return the icon of the sensor.""" return self._sensor_metadata.icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_sensor_metadata", ".", "icon" ]
[ 128, 4 ]
[ 130, 41 ]
python
en
['en', 'en', 'en']
True
DukeEnergyGatewaySensor.device_class
(self)
Return the device class of the sensor.
Return the device class of the sensor.
def device_class(self): """Return the device class of the sensor.""" return self._sensor_metadata.device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_sensor_metadata", ".", "device_class" ]
[ 133, 4 ]
[ 135, 49 ]
python
en
['en', 'en', 'en']
True
DukeEnergyGatewaySensor.state_class
(self)
Return the state class of the sensor
Return the state class of the sensor
def state_class(self): """Return the state class of the sensor""" return self._sensor_metadata.state_class
[ "def", "state_class", "(", "self", ")", ":", "return", "self", ".", "_sensor_metadata", ".", "state_class" ]
[ 138, 4 ]
[ 140, 48 ]
python
en
['en', 'en', 'en']
True
_TotalUsageTodaySensor.update
(self)
Return today's usage by summing all measurements.
Return today's usage by summing all measurements.
def update(self): """Return today's usage by summing all measurements.""" gw_usage: list[UsageMeasurement] = self._coordinator.data if gw_usage and len(gw_usage) > 0: today_usage = round(sum(x.usage for x in gw_usage) / 1000, 5) else: today_usage = 0 self....
[ "def", "update", "(", "self", ")", ":", "gw_usage", ":", "list", "[", "UsageMeasurement", "]", "=", "self", ".", "_coordinator", ".", "data", "if", "gw_usage", "and", "len", "(", "gw_usage", ")", ">", "0", ":", "today_usage", "=", "round", "(", "sum", ...
[ 156, 4 ]
[ 163, 33 ]
python
en
['en', 'en', 'en']
True