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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
_TotalUsageTodaySensor.extra_state_attributes | (self) | Record the timestamp of the last measurement into state attributes. | Record the timestamp of the last measurement into state attributes. | def extra_state_attributes(self):
"""Record the timestamp of the last measurement into state attributes."""
attrs = super().extra_state_attributes
gw_usage: list[UsageMeasurement] = self._coordinator.data
if gw_usage and len(gw_usage) > 0:
last_measurement = dt.as_local(
... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"super",
"(",
")",
".",
"extra_state_attributes",
"gw_usage",
":",
"list",
"[",
"UsageMeasurement",
"]",
"=",
"self",
".",
"_coordinator",
".",
"data",
"if",
"gw_usage",
"and",
"len",
"(",... | [
166,
4
] | [
180,
20
] | python | en | ['en', 'en', 'en'] | True |
_RealtimeUsageSensor.async_added_to_hass | (self) | Subscribe to updates. | Subscribe to updates. | async def async_added_to_hass(self):
"""Subscribe to updates."""
# Setup subscriber callback
async def async_on_new_measurement(measurement: RealtimeUsageMeasurement):
_LOGGER.debug("New measurement received: %f", measurement.usage)
self._state = measurement.usage
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"# Setup subscriber callback",
"async",
"def",
"async_on_new_measurement",
"(",
"measurement",
":",
"RealtimeUsageMeasurement",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"New measurement received: %f\"",
",",
... | [
196,
4
] | [
210,
47
] | python | en | ['en', 'en', 'en'] | True |
_RealtimeUsageSensor.async_will_remove_from_hass | (self) | Undo subscription. | Undo subscription. | async def async_will_remove_from_hass(self):
"""Undo subscription."""
# Cancel the real-time data stream task
self._coordinator.realtime_cancel()
# Remove subscriber callback
self._coordinator.async_realtime_unsubscribe_from_dispatcher(
_RealtimeUsageSensor.__name__
... | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"# Cancel the real-time data stream task",
"self",
".",
"_coordinator",
".",
"realtime_cancel",
"(",
")",
"# Remove subscriber callback",
"self",
".",
"_coordinator",
".",
"async_realtime_unsubscribe_from_d... | [
212,
4
] | [
220,
9
] | python | de | ['pt', 'it', 'de'] | False |
ResultHeap.__init__ | (self, nq, k) | nq: number of query vectors, k: number of results per query | nq: number of query vectors, k: number of results per query | def __init__(self, nq, k):
" nq: number of query vectors, k: number of results per query "
self.I = np.zeros((nq, k), dtype='int64')
self.D = np.zeros((nq, k), dtype='float32')
self.nq, self.k = nq, k
heaps = faiss.float_maxheap_array_t()
heaps.k = k
heaps.nh = nq... | [
"def",
"__init__",
"(",
"self",
",",
"nq",
",",
"k",
")",
":",
"self",
".",
"I",
"=",
"np",
".",
"zeros",
"(",
"(",
"nq",
",",
"k",
")",
",",
"dtype",
"=",
"'int64'",
")",
"self",
".",
"D",
"=",
"np",
".",
"zeros",
"(",
"(",
"nq",
",",
"k... | [
77,
4
] | [
88,
26
] | python | en | ['en', 'en', 'pt'] | True |
is_good_response | (resp) |
Returns True if the response seems to be HTML, False otherwise.
|
Returns True if the response seems to be HTML, False otherwise.
| def is_good_response(resp):
"""
Returns True if the response seems to be HTML, False otherwise.
"""
content_type = resp.headers['Content-Type'].lower()
return (resp.status_code == 200
and content_type is not None
and content_type.find('html') > -1) | [
"def",
"is_good_response",
"(",
"resp",
")",
":",
"content_type",
"=",
"resp",
".",
"headers",
"[",
"'Content-Type'",
"]",
".",
"lower",
"(",
")",
"return",
"(",
"resp",
".",
"status_code",
"==",
"200",
"and",
"content_type",
"is",
"not",
"None",
"and",
... | [
39,
0
] | [
46,
47
] | python | en | ['en', 'error', 'th'] | False |
DQN.__init__ | (self, env, params) |
DQN algorithm from Mnih et al., 2015.
This implementation includes mechanisms from Universal Value Function Approximators (Schaul et al., 2015)
and Agent57 (Badia et al., 2019).
Parameters
----------
env: BaseEnv
Learning environment.
params: dict
... |
DQN algorithm from Mnih et al., 2015.
This implementation includes mechanisms from Universal Value Function Approximators (Schaul et al., 2015)
and Agent57 (Badia et al., 2019). | def __init__(self, env, params):
"""
DQN algorithm from Mnih et al., 2015.
This implementation includes mechanisms from Universal Value Function Approximators (Schaul et al., 2015)
and Agent57 (Badia et al., 2019).
Parameters
----------
env: BaseEnv
L... | [
"def",
"__init__",
"(",
"self",
",",
"env",
",",
"params",
")",
":",
"super",
"(",
"DQN",
",",
"self",
")",
".",
"__init__",
"(",
"env",
",",
"params",
")",
"# Save parameters",
"self",
".",
"batch_size",
"=",
"self",
".",
"algo_params",
"[",
"'batch_s... | [
29,
4
] | [
171,
23
] | python | en | ['en', 'error', 'th'] | False |
DQN._replace_target_network | (self) |
Replaces the target network with the evaluation network every 'self.replace_target_cnt' learning steps.
|
Replaces the target network with the evaluation network every 'self.replace_target_cnt' learning steps.
| def _replace_target_network(self):
"""
Replaces the target network with the evaluation network every 'self.replace_target_cnt' learning steps.
"""
if self.replace_target_cnt is not None and self.learn_step_counter % self.replace_target_cnt == 0:
self.Q_next.set_goal_params(se... | [
"def",
"_replace_target_network",
"(",
"self",
")",
":",
"if",
"self",
".",
"replace_target_cnt",
"is",
"not",
"None",
"and",
"self",
".",
"learn_step_counter",
"%",
"self",
".",
"replace_target_cnt",
"==",
"0",
":",
"self",
".",
"Q_next",
".",
"set_goal_param... | [
173,
4
] | [
181,
93
] | python | en | ['en', 'error', 'th'] | False |
DQN._update | (self, batch_size) |
Performs network updates according to the DQN algorithm.
Here we update several critics: one for each cost and one for each constraint.
We then use these critics at decision time: first filtering actions that are not expected to violate constraints,
then selecting actions that maximize ... |
Performs network updates according to the DQN algorithm.
Here we update several critics: one for each cost and one for each constraint.
We then use these critics at decision time: first filtering actions that are not expected to violate constraints,
then selecting actions that maximize ... | def _update(self, batch_size):
"""
Performs network updates according to the DQN algorithm.
Here we update several critics: one for each cost and one for each constraint.
We then use these critics at decision time: first filtering actions that are not expected to violate constraints,
... | [
"def",
"_update",
"(",
"self",
",",
"batch_size",
")",
":",
"# Reset gradients of optimizes",
"for",
"opt",
"in",
"self",
".",
"optimizers",
":",
"opt",
".",
"zero_grad",
"(",
")",
"if",
"self",
".",
"use_constraints",
":",
"for",
"opt",
"in",
"self",
".",... | [
183,
4
] | [
262,
21
] | python | en | ['en', 'error', 'th'] | False |
DQN.act | (self, state, deterministic=False) |
Policy that uses the learned critics.
Parameters
----------
state: 1D nd.array
Current state.
deterministic: bool
Whether the policy should be deterministic (e.g. in evaluation mode).
Returns
-------
action: nd.array
... |
Policy that uses the learned critics. | def act(self, state, deterministic=False):
"""
Policy that uses the learned critics.
Parameters
----------
state: 1D nd.array
Current state.
deterministic: bool
Whether the policy should be deterministic (e.g. in evaluation mode).
Returns... | [
"def",
"act",
"(",
"self",
",",
"state",
",",
"deterministic",
"=",
"False",
")",
":",
"if",
"np",
".",
"random",
".",
"rand",
"(",
")",
">",
"self",
".",
"epsilon",
"or",
"deterministic",
":",
"if",
"self",
".",
"use_constraints",
":",
"# If we use co... | [
279,
4
] | [
331,
51
] | python | en | ['en', 'error', 'th'] | False |
DQN.update | (self) |
Update the algorithm.
|
Update the algorithm. | def update(self):
"""
Update the algorithm.
"""
if self.env_step_counter > 0:
losses = self._update(self.batch_size)
return [np.atleast_1d(l.data)[0] for l in losses]
else:
return [0] * (2 + self.nb_constraints) | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"env_step_counter",
">",
"0",
":",
"losses",
"=",
"self",
".",
"_update",
"(",
"self",
".",
"batch_size",
")",
"return",
"[",
"np",
".",
"atleast_1d",
"(",
"l",
".",
"data",
")",
"[",
"0",
... | [
333,
4
] | [
342,
50
] | python | en | ['en', 'error', 'th'] | False |
DQN.save_model | (self, path) |
Extract model state dicts and save them.
Parameters
----------
path: str
Saving path.
|
Extract model state dicts and save them.
Parameters
----------
path: str
Saving path. | def save_model(self, path):
"""
Extract model state dicts and save them.
Parameters
----------
path: str
Saving path.
"""
q_eval = self.Q_eval.get_model()
to_save = [q_eval]
if self.use_constraints:
q_constraints = self.Q_e... | [
"def",
"save_model",
"(",
"self",
",",
"path",
")",
":",
"q_eval",
"=",
"self",
".",
"Q_eval",
".",
"get_model",
"(",
")",
"to_save",
"=",
"[",
"q_eval",
"]",
"if",
"self",
".",
"use_constraints",
":",
"q_constraints",
"=",
"self",
".",
"Q_eval_constrain... | [
344,
4
] | [
359,
34
] | python | en | ['en', 'error', 'th'] | False |
DQN.load_model | (self, path) |
Load model from file and feed critics' state dicts.
Parameters
----------
path: str
Loading path
|
Load model from file and feed critics' state dicts.
Parameters
----------
path: str
Loading path
| def load_model(self, path):
"""
Load model from file and feed critics' state dicts.
Parameters
----------
path: str
Loading path
"""
with open(path, 'rb') as f:
out = torch.load(f)
try:
self.Q_eval.set_model(out[0])
... | [
"def",
"load_model",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"out",
"=",
"torch",
".",
"load",
"(",
"f",
")",
"try",
":",
"self",
".",
"Q_eval",
".",
"set_model",
"(",
"out",
"[",
"0",
... | [
361,
4
] | [
377,
53
] | python | en | ['en', 'error', 'th'] | False |
DQN.learn | (self, num_train_steps) |
Main training loop.
Parameters
----------
num_train_steps: int
Number of training steps (environment steps)
Returns
-------
|
Main training loop. | def learn(self, num_train_steps):
"""
Main training loop.
Parameters
----------
num_train_steps: int
Number of training steps (environment steps)
Returns
-------
"""
while self.env_step_counter < num_train_steps:
if self... | [
"def",
"learn",
"(",
"self",
",",
"num_train_steps",
")",
":",
"while",
"self",
".",
"env_step_counter",
"<",
"num_train_steps",
":",
"if",
"self",
".",
"goal_conditioned",
":",
"goal",
"=",
"self",
".",
"env",
".",
"unwrapped",
".",
"sample_cost_function_para... | [
379,
4
] | [
437,
48
] | python | en | ['en', 'error', 'th'] | False |
_ibis_sqlite_regex_search | (string, regex) | Return whether `regex` exists in `string`.
Parameters
----------
string : str
regex : str
Returns
-------
found : bool
| Return whether `regex` exists in `string`. | def _ibis_sqlite_regex_search(string, regex):
"""Return whether `regex` exists in `string`.
Parameters
----------
string : str
regex : str
Returns
-------
found : bool
"""
if string is None or regex is None:
return None
return re.search(regex, string) is not None | [
"def",
"_ibis_sqlite_regex_search",
"(",
"string",
",",
"regex",
")",
":",
"if",
"string",
"is",
"None",
"or",
"regex",
"is",
"None",
":",
"return",
"None",
"return",
"re",
".",
"search",
"(",
"regex",
",",
"string",
")",
"is",
"not",
"None"
] | [
68,
0
] | [
82,
47
] | python | en | ['en', 'en', 'en'] | True |
_ibis_sqlite_regex_replace | (string, pattern, replacement) | Replace occurences of `pattern` in `string` with `replacement`.
Parameters
----------
string : str
pattern : str
replacement : str
Returns
-------
result : str
| Replace occurences of `pattern` in `string` with `replacement`. | def _ibis_sqlite_regex_replace(string, pattern, replacement):
"""Replace occurences of `pattern` in `string` with `replacement`.
Parameters
----------
string : str
pattern : str
replacement : str
Returns
-------
result : str
"""
if string is None or pattern is None or repla... | [
"def",
"_ibis_sqlite_regex_replace",
"(",
"string",
",",
"pattern",
",",
"replacement",
")",
":",
"if",
"string",
"is",
"None",
"or",
"pattern",
"is",
"None",
"or",
"replacement",
"is",
"None",
":",
"return",
"None",
"return",
"re",
".",
"sub",
"(",
"patte... | [
86,
0
] | [
101,
47
] | python | en | ['en', 'en', 'en'] | True |
_ibis_sqlite_regex_extract | (string, pattern, index) | Extract match of regular expression `pattern` from `string` at `index`.
Parameters
----------
string : str
pattern : str
index : int
Returns
-------
result : str or None
| Extract match of regular expression `pattern` from `string` at `index`. | def _ibis_sqlite_regex_extract(string, pattern, index):
"""Extract match of regular expression `pattern` from `string` at `index`.
Parameters
----------
string : str
pattern : str
index : int
Returns
-------
result : str or None
"""
if string is None or pattern is None or i... | [
"def",
"_ibis_sqlite_regex_extract",
"(",
"string",
",",
"pattern",
",",
"index",
")",
":",
"if",
"string",
"is",
"None",
"or",
"pattern",
"is",
"None",
"or",
"index",
"is",
"None",
":",
"return",
"None",
"result",
"=",
"re",
".",
"search",
"(",
"pattern... | [
105,
0
] | [
124,
15
] | python | en | ['en', 'en', 'en'] | True |
_ibis_sqlite_exp | (arg) | Exponentiate `arg`.
Parameters
----------
arg : number
Number to raise to `e`.
Returns
-------
result : Optional[number]
None If the input is None
| Exponentiate `arg`. | def _ibis_sqlite_exp(arg):
"""Exponentiate `arg`.
Parameters
----------
arg : number
Number to raise to `e`.
Returns
-------
result : Optional[number]
None If the input is None
"""
return math.exp(arg) if arg is not None else None | [
"def",
"_ibis_sqlite_exp",
"(",
"arg",
")",
":",
"return",
"math",
".",
"exp",
"(",
"arg",
")",
"if",
"arg",
"is",
"not",
"None",
"else",
"None"
] | [
128,
0
] | [
141,
53
] | python | de | ['de', 'la', 'it'] | False |
_ibis_sqlite_power | (arg, power) | Raise `arg` to the `power` power.
Parameters
----------
arg : number
Number to raise to `power`.
power : number
Number to raise `arg` to.
Returns
-------
result : Optional[number]
None If either argument is None or we're trying to take a fractional
power or ... | Raise `arg` to the `power` power. | def _ibis_sqlite_power(arg, power):
"""Raise `arg` to the `power` power.
Parameters
----------
arg : number
Number to raise to `power`.
power : number
Number to raise `arg` to.
Returns
-------
result : Optional[number]
None If either argument is None or we're tr... | [
"def",
"_ibis_sqlite_power",
"(",
"arg",
",",
"power",
")",
":",
"if",
"arg",
"is",
"None",
"or",
"power",
"is",
"None",
"or",
"(",
"arg",
"<",
"0.0",
"and",
"not",
"power",
".",
"is_integer",
"(",
")",
")",
":",
"return",
"None",
"return",
"arg",
... | [
203,
0
] | [
221,
23
] | python | en | ['en', 'ga', 'en'] | True |
_ibis_sqlite_sqrt | (arg) | Square root of `arg`.
Parameters
----------
arg : Optional[number]
Number to take the square root of
Returns
-------
result : Optional[number]
None if `arg` is None or less than 0 otherwise the square root
| Square root of `arg`. | def _ibis_sqlite_sqrt(arg):
"""Square root of `arg`.
Parameters
----------
arg : Optional[number]
Number to take the square root of
Returns
-------
result : Optional[number]
None if `arg` is None or less than 0 otherwise the square root
"""
return None if arg is Non... | [
"def",
"_ibis_sqlite_sqrt",
"(",
"arg",
")",
":",
"return",
"None",
"if",
"arg",
"is",
"None",
"or",
"arg",
"<",
"0.0",
"else",
"math",
".",
"sqrt",
"(",
"arg",
")"
] | [
225,
0
] | [
238,
63
] | python | en | ['en', 'en', 'en'] | True |
_register_function | (func, con) | Register a Python callable with a SQLite connection `con`.
Parameters
----------
func : callable
con : sqlalchemy.Connection
| Register a Python callable with a SQLite connection `con`. | def _register_function(func, con):
"""Register a Python callable with a SQLite connection `con`.
Parameters
----------
func : callable
con : sqlalchemy.Connection
"""
nargs = number_of_arguments(func)
con.connection.connection.create_function(func.__name__, nargs, func) | [
"def",
"_register_function",
"(",
"func",
",",
"con",
")",
":",
"nargs",
"=",
"number_of_arguments",
"(",
"func",
")",
"con",
".",
"connection",
".",
"connection",
".",
"create_function",
"(",
"func",
".",
"__name__",
",",
"nargs",
",",
"func",
")"
] | [
301,
0
] | [
310,
73
] | python | en | ['en', 'en', 'en'] | True |
_register_aggregate | (agg, con) | Register a Python class that performs aggregation in SQLite.
Parameters
----------
agg : type
con : sqlalchemy.Connection
| Register a Python class that performs aggregation in SQLite. | def _register_aggregate(agg, con):
"""Register a Python class that performs aggregation in SQLite.
Parameters
----------
agg : type
con : sqlalchemy.Connection
"""
nargs = number_of_arguments(agg.step) - 1 # because self
con.connection.connection.create_aggregate(agg.__name__, nargs, a... | [
"def",
"_register_aggregate",
"(",
"agg",
",",
"con",
")",
":",
"nargs",
"=",
"number_of_arguments",
"(",
"agg",
".",
"step",
")",
"-",
"1",
"# because self",
"con",
".",
"connection",
".",
"connection",
".",
"create_aggregate",
"(",
"agg",
".",
"__name__",
... | [
313,
0
] | [
322,
72
] | python | en | ['en', 'en', 'en'] | True |
SQLiteClient.attach | (self, name, path, create=False) | Connect another SQLite database file
Parameters
----------
name : string
Database name within SQLite
path : string
Path to sqlite3 file
create : boolean, optional
If file does not exist, create file if True otherwise raise an
Excep... | Connect another SQLite database file | def attach(self, name, path, create=False):
"""Connect another SQLite database file
Parameters
----------
name : string
Database name within SQLite
path : string
Path to sqlite3 file
create : boolean, optional
If file does not exist, c... | [
"def",
"attach",
"(",
"self",
",",
"name",
",",
"path",
",",
"create",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
"and",
"not",
"create",
":",
"raise",
"com",
".",
"IbisError",
"(",
"'File {!r} does not e... | [
361,
4
] | [
382,
9
] | python | en | ['en', 'en', 'en'] | True |
SQLiteClient.table | (self, name, database=None) |
Create a table expression that references a particular table in the
SQLite database
Parameters
----------
name : string
database : string, optional
name of the attached database that the table is located in.
Returns
-------
table : Tab... |
Create a table expression that references a particular table in the
SQLite database | def table(self, name, database=None):
"""
Create a table expression that references a particular table in the
SQLite database
Parameters
----------
name : string
database : string, optional
name of the attached database that the table is located in.
... | [
"def",
"table",
"(",
"self",
",",
"name",
",",
"database",
"=",
"None",
")",
":",
"alch_table",
"=",
"self",
".",
"_get_sqla_table",
"(",
"name",
",",
"schema",
"=",
"database",
")",
"node",
"=",
"self",
".",
"table_class",
"(",
"alch_table",
",",
"sel... | [
388,
4
] | [
405,
42
] | python | en | ['en', 'error', 'th'] | False |
Network.__init__ | (self, input_size, output_size, hidden_layers, drop_p=0.5) | Builds a feedforward network with arbitrary hidden layers.
Arguments
---------
input_size: integer, size of the input layer
output_size: integer, size of the output layer
hidden_layers: list of integers, the sizes of the hidden layers
... | Builds a feedforward network with arbitrary hidden layers.
Arguments
---------
input_size: integer, size of the input layer
output_size: integer, size of the output layer
hidden_layers: list of integers, the sizes of the hidden layers
... | def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5):
''' Builds a feedforward network with arbitrary hidden layers.
Arguments
---------
input_size: integer, size of the input layer
output_size: integer, size of the output layer
... | [
"def",
"__init__",
"(",
"self",
",",
"input_size",
",",
"output_size",
",",
"hidden_layers",
",",
"drop_p",
"=",
"0.5",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"# Input to a hidden layer",
"self",
".",
"hidden_layers",
"=",
"nn",
".",
"Modu... | [
6,
4
] | [
26,
43
] | python | en | ['en', 'en', 'en'] | True |
Network.forward | (self, x) | Forward pass through the network, returns the output logits | Forward pass through the network, returns the output logits | def forward(self, x):
''' Forward pass through the network, returns the output logits '''
for each in self.hidden_layers:
x = F.relu(each(x))
x = self.dropout(x)
x = self.output(x)
return F.log_softmax(x, dim=1) | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"for",
"each",
"in",
"self",
".",
"hidden_layers",
":",
"x",
"=",
"F",
".",
"relu",
"(",
"each",
"(",
"x",
")",
")",
"x",
"=",
"self",
".",
"dropout",
"(",
"x",
")",
"x",
"=",
"self",
".",
... | [
28,
4
] | [
36,
38
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check show create row policy query syntax.
```sql
SHOW CREATE [ROW] POLICY name ON [database.]table
```
| Check show create row policy query syntax. | def feature(self, node="clickhouse1"):
"""Check show create row policy query syntax.
```sql
SHOW CREATE [ROW] POLICY name ON [database.]table
```
"""
node = self.context.cluster.node(node)
@contextmanager
def cleanup(policy, on="default.foo"):
try:
with Given("I hav... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"cleanup",
"(",
"policy",
",",
"on",
"=",
"\"default.foo\"",
... | [
8,
0
] | [
50,
59
] | python | en | ['en', 'en', 'en'] | True |
simple_get | (url) |
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, return the
text content, otherwise return None.
|
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, return the
text content, otherwise return None.
| def simple_get(url):
"""
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, return the
text content, otherwise return None.
"""
try:
with closing(get(url, stream=True)) as resp:
if is_good_response(res... | [
"def",
"simple_get",
"(",
"url",
")",
":",
"try",
":",
"with",
"closing",
"(",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
")",
"as",
"resp",
":",
"if",
"is_good_response",
"(",
"resp",
")",
":",
"return",
"resp",
".",
"content",
"else",
":... | [
25,
0
] | [
40,
19
] | python | en | ['en', 'error', 'th'] | False |
is_good_response | (resp) |
Returns True if the response seems to be HTML, False otherwise.
|
Returns True if the response seems to be HTML, False otherwise.
| def is_good_response(resp):
"""
Returns True if the response seems to be HTML, False otherwise.
"""
content_type = resp.headers['Content-Type'].lower()
return (resp.status_code == 200
and content_type is not None
and content_type.find('html') > -1) | [
"def",
"is_good_response",
"(",
"resp",
")",
":",
"content_type",
"=",
"resp",
".",
"headers",
"[",
"'Content-Type'",
"]",
".",
"lower",
"(",
")",
"return",
"(",
"resp",
".",
"status_code",
"==",
"200",
"and",
"content_type",
"is",
"not",
"None",
"and",
... | [
43,
0
] | [
50,
47
] | python | en | ['en', 'error', 'th'] | False |
softmax | (x) | Compute softmax values for each sets of scores in x. | Compute softmax values for each sets of scores in x. | def softmax(x):
"""Compute softmax values for each sets of scores in x."""
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | [
"def",
"softmax",
"(",
"x",
")",
":",
"e_x",
"=",
"np",
".",
"exp",
"(",
"x",
"-",
"np",
".",
"max",
"(",
"x",
")",
")",
"return",
"e_x",
"/",
"e_x",
".",
"sum",
"(",
")"
] | [
27,
0
] | [
30,
26
] | python | en | ['en', 'en', 'en'] | True |
label_to_emoji | (label) |
Converts a label (int or string) into the corresponding emoji code (string) ready to be printed
|
Converts a label (int or string) into the corresponding emoji code (string) ready to be printed
| def label_to_emoji(label):
"""
Converts a label (int or string) into the corresponding emoji code (string) ready to be printed
"""
return emoji.emojize(emoji_dictionary[str(label)], use_aliases=True) | [
"def",
"label_to_emoji",
"(",
"label",
")",
":",
"return",
"emoji",
".",
"emojize",
"(",
"emoji_dictionary",
"[",
"str",
"(",
"label",
")",
"]",
",",
"use_aliases",
"=",
"True",
")"
] | [
60,
0
] | [
64,
72
] | python | en | ['en', 'error', 'th'] | False |
feature | (self, node="clickhouse1") | Check alter user query syntax.
```sql
ALTER USER [IF EXISTS] name [ON CLUSTER cluster_name]
[RENAME TO new_name]
[IDENTIFIED [WITH {PLAINTEXT_PASSWORD|SHA256_PASSWORD|DOUBLE_SHA1_PASSWORD}] BY {'password'|'hash'}]
[[ADD|DROP] HOST {LOCAL | NAME 'name' | REGEXP 'name_regexp' | IP 'address' | LIKE 'p... | Check alter user query syntax. | def feature(self, node="clickhouse1"):
"""Check alter user query syntax.
```sql
ALTER USER [IF EXISTS] name [ON CLUSTER cluster_name]
[RENAME TO new_name]
[IDENTIFIED [WITH {PLAINTEXT_PASSWORD|SHA256_PASSWORD|DOUBLE_SHA1_PASSWORD}] BY {'password'|'hash'}]
[[ADD|DROP] HOST {LOCAL | NAME 'name' |... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"setup",
"(",
"user",
")",
":",
"try",
":",
"with",
"Given... | [
11,
0
] | [
323,
74
] | python | en | ['pt', 'gl', 'en'] | False |
TestRestartBase._test_create_partition_insert_restart | (self, connect, collection, args) |
target: return the same row count after server restart
method: call function: create partition, then insert, restart server and assert row count
expected: status ok, and row count keep the same
|
target: return the same row count after server restart
method: call function: create partition, then insert, restart server and assert row count
expected: status ok, and row count keep the same
| def _test_create_partition_insert_restart(self, connect, collection, args):
'''
target: return the same row count after server restart
method: call function: create partition, then insert, restart server and assert row count
expected: status ok, and row count keep the same
'''
... | [
"def",
"_test_create_partition_insert_restart",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"args",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"nq",
"=",
... | [
34,
4
] | [
66,
24
] | python | en | ['en', 'error', 'th'] | False |
TestRestartBase._test_during_creating_index_restart | (self, connect, collection, args) |
target: return the same row count after server restart
method: call function: insert, flush, and create index, server do restart during creating index
expected: row count, vector-id, index info keep the same
|
target: return the same row count after server restart
method: call function: insert, flush, and create index, server do restart during creating index
expected: row count, vector-id, index info keep the same
| def _test_during_creating_index_restart(self, connect, collection, args):
'''
target: return the same row count after server restart
method: call function: insert, flush, and create index, server do restart during creating index
expected: row count, vector-id, index info keep the same
... | [
"def",
"_test_during_creating_index_restart",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"args",
")",
":",
"# reset auto_flush_interval",
"# auto_flush_interval = 100",
"get_ids_length",
"=",
"500",
"timeout",
"=",
"60",
"big_nb",
"=",
"20000",
"index_param",
... | [
69,
4
] | [
133,
61
] | python | en | ['en', 'error', 'th'] | False |
empty | (self) | Check using empty over clause.
| Check using empty over clause.
| def empty(self):
"""Check using empty over clause.
"""
expected = convert_output("""
count
-------
10
10
10
10
10
10
10
10
10
10
""")
execute_query(
"SELECT COUNT(*) OVER () AS count FROM tenk1 WHERE un... | [
"def",
"empty",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n count\n -------\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT COUNT... | [
9,
0
] | [
30,
5
] | python | en | ['en', 'en', 'en'] | True |
empty_named_window | (self) | Check using over clause with empty window.
| Check using over clause with empty window.
| def empty_named_window(self):
"""Check using over clause with empty window.
"""
expected = convert_output("""
count
-------
10
10
10
10
10
10
10
10
10
10
""")
execute_query(
"SELECT COUNT(*) OVER w AS c... | [
"def",
"empty_named_window",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n count\n -------\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n 10\n \"\"\"",
")",
"execute_query",
"(",
"\... | [
37,
0
] | [
58,
5
] | python | en | ['en', 'en', 'en'] | True |
adhoc_window | (self) | Check running aggregating `sum` function over an adhoc window.
| Check running aggregating `sum` function over an adhoc window.
| def adhoc_window(self):
"""Check running aggregating `sum` function over an adhoc window.
"""
expected = convert_output("""
depname | empno | salary | sum
-----------+-------+--------+-------
develop | 7 | 4200 | 25100
develop | 9 | 4500 | 25100
develop | 10 |... | [
"def",
"adhoc_window",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n depname | empno | salary | sum\n -----------+-------+--------+-------\n develop | 7 | 4200 | 25100\n develop | 9 | 4500 | 25100\n develop | 10 | 5200 | 251... | [
64,
0
] | [
85,
5
] | python | en | ['en', 'en', 'en'] | True |
missing_window_spec | (self) | Check missing window spec in over clause.
| Check missing window spec in over clause.
| def missing_window_spec(self):
"""Check missing window spec in over clause.
"""
exitcode = 62
message = "Exception: Syntax error"
self.context.node.query("SELECT number,sum(number) OVER FROM values('number Int8', (1),(1),(2),(3))",
exitcode=exitcode, message=message) | [
"def",
"missing_window_spec",
"(",
"self",
")",
":",
"exitcode",
"=",
"62",
"message",
"=",
"\"Exception: Syntax error\"",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER FROM values('number Int8', (1),(1),(2),(3))\"",
",",
"exitc... | [
91,
0
] | [
98,
43
] | python | en | ['en', 'en', 'en'] | True |
invalid_window_name | (self) | Check invalid window name.
| Check invalid window name.
| def invalid_window_name(self):
"""Check invalid window name.
"""
exitcode = 47
message = "Exception: Window 'w3' is not defined"
self.context.node.query("SELECT number,sum(number) OVER w3 FROM values('number Int8', (1),(1),(2),(3)) WINDOW w1 AS ()",
exitcode=exitcode, message=message) | [
"def",
"invalid_window_name",
"(",
"self",
")",
":",
"exitcode",
"=",
"47",
"message",
"=",
"\"Exception: Window 'w3' is not defined\"",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER w3 FROM values('number Int8', (1),(1),(2),(3)) WI... | [
104,
0
] | [
111,
43
] | python | en | ['en', 'ceb', 'en'] | True |
invalid_multiple_windows | (self) | Check invalid multiple window names.
| Check invalid multiple window names.
| def invalid_multiple_windows(self):
"""Check invalid multiple window names.
"""
exitcode = 47
message = "Exception: Missing columns"
self.context.node.query("SELECT number,sum(number) OVER w1, w2 FROM values('number Int8', (1),(1),(2),(3)) WINDOW w1 AS (), w2 AS (PARTITION BY number)",
exit... | [
"def",
"invalid_multiple_windows",
"(",
"self",
")",
":",
"exitcode",
"=",
"47",
"message",
"=",
"\"Exception: Missing columns\"",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER w1, w2 FROM values('number Int8', (1),(1),(2),(3)) WIND... | [
117,
0
] | [
124,
43
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check defining frame clause.
| Check defining frame clause.
| def feature(self):
"""Check defining frame clause.
"""
for scenario in loads(current_module(), Scenario):
Scenario(run=scenario, flags=TE) | [
"def",
"feature",
"(",
"self",
")",
":",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",
")",
",",
"Scenario",
")",
":",
"Scenario",
"(",
"run",
"=",
"scenario",
",",
"flags",
"=",
"TE",
")"
] | [
132,
0
] | [
136,
40
] | python | en | ['de', 'en', 'en'] | True |
array_func | (self, data_type, node=None) | Check array functions with extended precision data types.
| Check array functions with extended precision data types.
| def array_func(self, data_type, node=None):
"""Check array functions with extended precision data types.
"""
if node is None:
node = self.context.node
for func in ['arrayPopBack(',
'arrayPopFront(',
'arraySort(',
'arrayReverseSort(',
'arrayDistinct(',
'a... | [
"def",
"array_func",
"(",
"self",
",",
"data_type",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"for",
"func",
"in",
"[",
"'arrayPopBack('",
",",
"'arrayPopFront('",
",",
"'arra... | [
15,
0
] | [
261,
20
] | python | en | ['en', 'en', 'en'] | True |
tuple_func | (self, data_type, node=None) | Check tuple functions with extended precision data types.
| Check tuple functions with extended precision data types.
| def tuple_func(self, data_type, node=None):
"""Check tuple functions with extended precision data types.
"""
if node is None:
node = self.context.node
with Scenario(f"Creating a tuple with {data_type}"):
node.query(f"SELECT tuple({to_data_type(data_type,1)}, {to_data_type(data_type,1)}... | [
"def",
"tuple_func",
"(",
"self",
",",
"data_type",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Scenario",
"(",
"f\"Creating a tuple with {data_type}\"",
")",
":",
"node",
... | [
267,
0
] | [
332,
16
] | python | en | ['en', 'en', 'en'] | True |
map_func | (self, data_type, node=None) | Check Map functions with extended precision data types.
| Check Map functions with extended precision data types.
| def map_func(self, data_type, node=None):
"""Check Map functions with extended precision data types.
"""
if node is None:
node = self.context.node
with Scenario(f"Creating a map with {data_type}"):
node.query(f"SELECT map('key1', {to_data_type(data_type,1)}, 'key2', {to_data_type(data_... | [
"def",
"map_func",
"(",
"self",
",",
"data_type",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Scenario",
"(",
"f\"Creating a map with {data_type}\"",
")",
":",
"node",
".... | [
339,
0
] | [
455,
16
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check that array, tuple, and map functions work with extended precision data types.
| Check that array, tuple, and map functions work with extended precision data types.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check that array, tuple, and map functions work with extended precision data types.
"""
self.context.node = self.context.cluster.node(node)
with allow_experimental_bigint(self.context.node):
for example in self.examples:
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
466,
0
] | [
483,
61
] | python | en | ['en', 'en', 'en'] | True |
put_image_in_centre_of_other_image | (img1, img2, add=False) |
Code to add a mask to the centre of a given image (both 2D at the moment)
:param img1: image to be putting other image in the centre of
:param img2: image to put in the centre of another image
:param add: flag as to whether to add the image to the centre of the other one or replace all pixels
:retu... |
Code to add a mask to the centre of a given image (both 2D at the moment)
:param img1: image to be putting other image in the centre of
:param img2: image to put in the centre of another image
:param add: flag as to whether to add the image to the centre of the other one or replace all pixels
:retu... | def put_image_in_centre_of_other_image(img1, img2, add=False):
"""
Code to add a mask to the centre of a given image (both 2D at the moment)
:param img1: image to be putting other image in the centre of
:param img2: image to put in the centre of another image
:param add: flag as to whether to add th... | [
"def",
"put_image_in_centre_of_other_image",
"(",
"img1",
",",
"img2",
",",
"add",
"=",
"False",
")",
":",
"borderx_size",
"=",
"(",
"img1",
".",
"shape",
"[",
"1",
"]",
"-",
"img2",
".",
"shape",
"[",
"1",
"]",
")",
"/",
"2",
"bordery_size",
"=",
"(... | [
44,
0
] | [
67,
18
] | python | en | ['en', 'error', 'th'] | False |
privilege_granted_directly_or_via_role | (self, node=None) | Check that user is only able to execute KILL QUERY when they have required privilege, either directly or via role.
| Check that user is only able to execute KILL QUERY when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is only able to execute KILL QUERY when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
5,
0
] | [
27,
92
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege"):
with When("I grant the user NONE privilege"):
... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"with",
"Scenario",
"(",
"\"user without... | [
29,
0
] | [
95,
79
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of KILL QUERY.
| Check the RBAC functionality of KILL QUERY.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of KILL QUERY.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = stress
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
104,
0
] | [
115,
48
] | python | en | ['en', 'en', 'en'] | True |
TestPackageConan._build_scripts | (self) | Test compile script of automake | Test compile script of automake | def _build_scripts(self):
"""Test compile script of automake"""
compile_script = self._user_info["automake"].compile
ar_script = self._user_info["automake"].ar_lib
assert os.path.isfile(ar_script)
assert os.path.isfile(compile_script)
if self._system_cc:
with... | [
"def",
"_build_scripts",
"(",
"self",
")",
":",
"compile_script",
"=",
"self",
".",
"_user_info",
"[",
"\"automake\"",
"]",
".",
"compile",
"ar_script",
"=",
"self",
".",
"_user_info",
"[",
"\"automake\"",
"]",
".",
"ar_lib",
"assert",
"os",
".",
"path",
"... | [
49,
4
] | [
58,
157
] | python | en | ['en', 'en', 'it'] | True |
TestPackageConan._build_autotools | (self) | Test autoreconf + configure + make | Test autoreconf + configure + make | def _build_autotools(self):
"""Test autoreconf + configure + make"""
with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}):
self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows)
self.run("{} --help".format(... | [
"def",
"_build_autotools",
"(",
"self",
")",
":",
"with",
"tools",
".",
"environment_append",
"(",
"{",
"\"AUTOMAKE_CONAN_INCLUDES\"",
":",
"[",
"tools",
".",
"unix_path",
"(",
"self",
".",
"source_folder",
")",
"]",
"}",
")",
":",
"self",
".",
"run",
"(",... | [
60,
4
] | [
68,
28
] | python | fr | ['fr', 'fr', 'en'] | True |
TestCollection.test_create_collection | (self, connect) |
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
| def test_create_collection(self, connect):
'''
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': collection_nam... | [
"def",
"test_create_collection",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_size'... | [
23,
4
] | [
35,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_ip | (self, connect) |
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_ip(self, connect):
'''
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': collection_... | [
"def",
"test_create_collection_ip",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_si... | [
37,
4
] | [
49,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_jaccard | (self, connect) |
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_jaccard(self, connect):
'''
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': collec... | [
"def",
"test_create_collection_jaccard",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_fi... | [
51,
4
] | [
63,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_hamming | (self, connect) |
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_hamming(self, connect):
'''
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': collect... | [
"def",
"test_create_collection_hamming",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_fi... | [
65,
4
] | [
77,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_substructure | (self, connect) |
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_substructure(self, connect):
'''
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': co... | [
"def",
"test_create_collection_substructure",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'ind... | [
79,
4
] | [
91,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_superstructure | (self, connect) |
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_superstructure(self, connect):
'''
target: test create normal collection
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': ... | [
"def",
"test_create_collection_superstructure",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'i... | [
93,
4
] | [
105,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_auto_flush_disabled | (self, connect) |
target: test create normal collection, with large auto_flush_interval
method: create collection with corrent params
expected: create status return ok
|
target: test create normal collection, with large auto_flush_interval
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_auto_flush_disabled(self, connect):
'''
target: test create normal collection, with large auto_flush_interval
method: create collection with corrent params
expected: create status return ok
'''
disable_flush(connect)
collection_name = ge... | [
"def",
"test_create_collection_auto_flush_disabled",
"(",
"self",
",",
"connect",
")",
":",
"disable_flush",
"(",
"connect",
")",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"try",
":",
"param",
"=",
"{",
"'collection_name'",
":",
"col... | [
107,
4
] | [
131,
33
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_without_connection | (self, dis_connect) |
target: test create collection, without connection
method: create collection with correct params, with a disconnected instance
expected: create raise exception
|
target: test create collection, without connection
method: create collection with correct params, with a disconnected instance
expected: create raise exception
| def test_create_collection_without_connection(self, dis_connect):
'''
target: test create collection, without connection
method: create collection with correct params, with a disconnected instance
expected: create raise exception
'''
collection_name = gen_unique_str("test... | [
"def",
"test_create_collection_without_connection",
"(",
"self",
",",
"dis_connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",... | [
134,
4
] | [
146,
57
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_existed | (self, connect) |
target: test create collection but the collection name have already existed
method: create collection with the same collection_name
expected: create status return not ok
|
target: test create collection but the collection name have already existed
method: create collection with the same collection_name
expected: create status return not ok
| def test_create_collection_existed(self, connect):
'''
target: test create collection but the collection name have already existed
method: create collection with the same collection_name
expected: create status return not ok
'''
collection_name = gen_unique_str("test_coll... | [
"def",
"test_create_collection_existed",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_fi... | [
148,
4
] | [
161,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_existed_ip | (self, connect) |
target: test create collection but the collection name have already existed
method: create collection with the same collection_name
expected: create status return not ok
|
target: test create collection but the collection name have already existed
method: create collection with the same collection_name
expected: create status return not ok
| def test_create_collection_existed_ip(self, connect):
'''
target: test create collection but the collection name have already existed
method: create collection with the same collection_name
expected: create status return not ok
'''
collection_name = gen_unique_str("test_c... | [
"def",
"test_create_collection_existed_ip",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index... | [
164,
4
] | [
177,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_None | (self, connect) |
target: test create collection but the collection name is None
method: create collection, param collection_name is None
expected: create raise error
|
target: test create collection but the collection name is None
method: create collection, param collection_name is None
expected: create raise error
| def test_create_collection_None(self, connect):
'''
target: test create collection but the collection name is None
method: create collection, param collection_name is None
expected: create raise error
'''
param = {'collection_name': None,
'dimension': dim... | [
"def",
"test_create_collection_None",
"(",
"self",
",",
"connect",
")",
":",
"param",
"=",
"{",
"'collection_name'",
":",
"None",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_size'",
":",
"index_file_size",
",",
"'metric_type'",
":",
"MetricType",
".",
"L2"... | [
179,
4
] | [
190,
53
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_no_dimension | (self, connect) |
target: test create collection with no dimension params
method: create collection with corrent params
expected: create status return ok
|
target: test create collection with no dimension params
method: create collection with corrent params
expected: create status return ok
| def test_create_collection_no_dimension(self, connect):
'''
target: test create collection with no dimension params
method: create collection with corrent params
expected: create status return ok
'''
collection_name = gen_unique_str("test_collection")
param = {'co... | [
"def",
"test_create_collection_no_dimension",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'index_file_size'",
":",
"index_file_siz... | [
192,
4
] | [
203,
53
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_no_file_size | (self, connect) |
target: test create collection with no index_file_size params
method: create collection with corrent params
expected: create status return ok, use default 1024
|
target: test create collection with no index_file_size params
method: create collection with corrent params
expected: create status return ok, use default 1024
| def test_create_collection_no_file_size(self, connect):
'''
target: test create collection with no index_file_size params
method: create collection with corrent params
expected: create status return ok, use default 1024
'''
collection_name = gen_unique_str("test_collectio... | [
"def",
"test_create_collection_no_file_size",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'met... | [
205,
4
] | [
219,
45
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_create_collection_no_metric_type | (self, connect) |
target: test create collection with no metric_type params
method: create collection with corrent params
expected: create status return ok, use default L2
|
target: test create collection with no metric_type params
method: create collection with corrent params
expected: create status return ok, use default L2
| def test_create_collection_no_metric_type(self, connect):
'''
target: test create collection with no metric_type params
method: create collection with corrent params
expected: create status return ok, use default L2
'''
collection_name = gen_unique_str("test_collection")
... | [
"def",
"test_create_collection_no_metric_type",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'i... | [
221,
4
] | [
234,
50
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_describe_result | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def test_collection_describe_result(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
'''
collection_n... | [
"def",
"test_collection_describe_result",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_f... | [
242,
4
] | [
256,
47
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_get_collection_info_name_ip | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def test_collection_get_collection_info_name_ip(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
'''
... | [
"def",
"test_collection_get_collection_info_name_ip",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",... | [
259,
4
] | [
273,
47
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_get_collection_info_name_jaccard | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def test_collection_get_collection_info_name_jaccard(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
'''
... | [
"def",
"test_collection_get_collection_info_name_jaccard",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
... | [
276,
4
] | [
290,
52
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_get_collection_info_name_hamming | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def test_collection_get_collection_info_name_hamming(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
'''
... | [
"def",
"test_collection_get_collection_info_name_hamming",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
... | [
293,
4
] | [
307,
52
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_get_collection_info_name_substructure | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def test_collection_get_collection_info_name_substructure(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
'''... | [
"def",
"test_collection_get_collection_info_name_substructure",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"di... | [
309,
4
] | [
323,
57
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_get_collection_info_name_superstructure | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def test_collection_get_collection_info_name_superstructure(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
'... | [
"def",
"test_collection_get_collection_info_name_superstructure",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"... | [
325,
4
] | [
339,
59
] | python | en | ['en', 'error', 'th'] | False |
TestCollection._test_collection_get_collection_info_name_multiprocessing | (self, connect, args) |
target: test describe collection created with multiprocess
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
|
target: test describe collection created with multiprocess
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
| def _test_collection_get_collection_info_name_multiprocessing(self, connect, args):
'''
target: test describe collection created with multiprocess
method: create collection, assert the value returned by describe method
expected: collection_name equals with the collection name created
... | [
"def",
"_test_collection_get_collection_info_name_multiprocessing",
"(",
"self",
",",
"connect",
",",
"args",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dime... | [
343,
4
] | [
368,
20
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_collection_describe_dimension | (self, connect) |
target: test describe collection created with correct params
method: create collection, assert the dimention value returned by describe method
expected: dimention equals with dimention when created
|
target: test describe collection created with correct params
method: create collection, assert the dimention value returned by describe method
expected: dimention equals with dimention when created
| def test_collection_describe_dimension(self, connect):
'''
target: test describe collection created with correct params
method: create collection, assert the dimention value returned by describe method
expected: dimention equals with dimention when created
'''
collection... | [
"def",
"test_collection_describe_dimension",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
"+",
"1",
... | [
380,
4
] | [
393,
37
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_drop_collection | (self, connect, collection) |
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
|
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
| def test_drop_collection(self, connect, collection):
'''
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
'''
... | [
"def",
"test_drop_collection",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"drop_collection",
"(",
"collection",
")",
"assert",
"not",
"assert_has_collection",
"(",
"connect",
",",
"collection",
")"
] | [
401,
4
] | [
409,
61
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_drop_collection_ip | (self, connect, ip_collection) |
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
|
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
| def test_drop_collection_ip(self, connect, ip_collection):
'''
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
'''
... | [
"def",
"test_drop_collection_ip",
"(",
"self",
",",
"connect",
",",
"ip_collection",
")",
":",
"status",
"=",
"connect",
".",
"drop_collection",
"(",
"ip_collection",
")",
"assert",
"not",
"assert_has_collection",
"(",
"connect",
",",
"ip_collection",
")"
] | [
412,
4
] | [
420,
64
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_drop_collection_jaccard | (self, connect, jac_collection) |
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
|
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
| def test_drop_collection_jaccard(self, connect, jac_collection):
'''
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
... | [
"def",
"test_drop_collection_jaccard",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"status",
"=",
"connect",
".",
"drop_collection",
"(",
"jac_collection",
")",
"assert",
"not",
"assert_has_collection",
"(",
"connect",
",",
"jac_collection",
")"
] | [
423,
4
] | [
431,
65
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_drop_collection_hamming | (self, connect, ham_collection) |
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
|
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
| def test_drop_collection_hamming(self, connect, ham_collection):
'''
target: test delete collection created with correct params
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
... | [
"def",
"test_drop_collection_hamming",
"(",
"self",
",",
"connect",
",",
"ham_collection",
")",
":",
"status",
"=",
"connect",
".",
"drop_collection",
"(",
"ham_collection",
")",
"assert",
"not",
"assert_has_collection",
"(",
"connect",
",",
"ham_collection",
")"
] | [
434,
4
] | [
442,
65
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_drop_collection_not_existed | (self, connect) |
target: test delete collection not in index
method: delete all collections, and delete collection again,
assert the value returned by delete method
expected: status not ok
|
target: test delete collection not in index
method: delete all collections, and delete collection again,
assert the value returned by delete method
expected: status not ok
| def test_drop_collection_not_existed(self, connect):
'''
target: test delete collection not in index
method: delete all collections, and delete collection again,
assert the value returned by delete method
expected: status not ok
'''
collection_name = gen_uniq... | [
"def",
"test_drop_collection_not_existed",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"status",
"=",
"connect",
".",
"drop_collection",
"(",
"collection_name",
")",
"assert",
"not",
"status",
"."... | [
454,
4
] | [
463,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_delete_create_collection_repeatedly | (self, connect) |
target: test delete and create the same collection repeatedly
method: try to create the same collection and delete repeatedly,
assert the value returned by delete method
expected: create ok and delete ok
|
target: test delete and create the same collection repeatedly
method: try to create the same collection and delete repeatedly,
assert the value returned by delete method
expected: create ok and delete ok
| def test_delete_create_collection_repeatedly(self, connect):
'''
target: test delete and create the same collection repeatedly
method: try to create the same collection and delete repeatedly,
assert the value returned by delete method
expected: create ok and delete ok
... | [
"def",
"test_delete_create_collection_repeatedly",
"(",
"self",
",",
"connect",
")",
":",
"loops",
"=",
"2",
"timeout",
"=",
"5",
"for",
"i",
"in",
"range",
"(",
"loops",
")",
":",
"collection_name",
"=",
"\"test_collection\"",
"param",
"=",
"{",
"'collection_... | [
465,
4
] | [
489,
28
] | python | en | ['en', 'error', 'th'] | False |
TestCollection._test_drop_collection_multiprocessing | (self, args) |
target: test delete collection with multiprocess
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
|
target: test delete collection with multiprocess
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
| def _test_drop_collection_multiprocessing(self, args):
'''
target: test delete collection with multiprocess
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
'''
proces... | [
"def",
"_test_drop_collection_multiprocessing",
"(",
"self",
",",
"args",
")",
":",
"process_num",
"=",
"6",
"processes",
"=",
"[",
"]",
"def",
"deletecollection",
"(",
"milvus",
")",
":",
"status",
"=",
"milvus",
".",
"drop_collection",
"(",
"collection",
")"... | [
493,
4
] | [
514,
20
] | python | en | ['en', 'error', 'th'] | False |
TestCollection._test_drop_collection_multiprocessing_multicollection | (self, connect) |
target: test delete collection with multiprocess
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
|
target: test delete collection with multiprocess
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
| def _test_drop_collection_multiprocessing_multicollection(self, connect):
'''
target: test delete collection with multiprocess
method: create collection and then delete,
assert the value returned by delete method
expected: status ok, and no collection in collections
... | [
"def",
"_test_drop_collection_multiprocessing_multicollection",
"(",
"self",
",",
"connect",
")",
":",
"process_num",
"=",
"5",
"loop_num",
"=",
"2",
"processes",
"=",
"[",
"]",
"collection",
"=",
"[",
"]",
"j",
"=",
"0",
"while",
"j",
"<",
"(",
"process_num... | [
518,
4
] | [
556,
20
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_has_collection | (self, connect) |
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
|
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
| def test_has_collection(self, connect):
'''
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_nam... | [
"def",
"test_has_collection",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_size'",
... | [
564,
4
] | [
576,
62
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_has_collection_ip | (self, connect) |
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
|
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
| def test_has_collection_ip(self, connect):
'''
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_... | [
"def",
"test_has_collection_ip",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_size'... | [
578,
4
] | [
590,
62
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_has_collection_jaccard | (self, connect) |
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
|
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
| def test_has_collection_jaccard(self, connect):
'''
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
'''
collection_name = gen_unique_str("test_collection")
param = {'collec... | [
"def",
"test_has_collection_jaccard",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_... | [
592,
4
] | [
604,
62
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_has_collection_hamming | (self, connect) |
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
|
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
| def test_has_collection_hamming(self, connect):
'''
target: test if the created collection existed
method: create collection, assert the value returned by has_collection method
expected: True
'''
collection_name = gen_unique_str("test_collection")
param = {'collec... | [
"def",
"test_has_collection_hamming",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_... | [
606,
4
] | [
618,
62
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_has_collection_not_existed | (self, connect) |
target: test if collection not created
method: random a collection name, which not existed in db,
assert the value returned by has_collection method
expected: False
|
target: test if collection not created
method: random a collection name, which not existed in db,
assert the value returned by has_collection method
expected: False
| def test_has_collection_not_existed(self, connect):
'''
target: test if collection not created
method: random a collection name, which not existed in db,
assert the value returned by has_collection method
expected: False
'''
collection_name = gen_unique_str("... | [
"def",
"test_has_collection_not_existed",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"assert",
"not",
"assert_has_collection",
"(",
"connect",
",",
"collection_name",
")"
] | [
630,
4
] | [
638,
66
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections | (self, connect) |
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def test_list_collections(self, connect):
'''
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
collecti... | [
"def",
"test_list_collections",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_size'"... | [
646,
4
] | [
660,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections_ip | (self, connect) |
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def test_list_collections_ip(self, connect):
'''
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
colle... | [
"def",
"test_list_collections_ip",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_siz... | [
662,
4
] | [
676,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections_jaccard | (self, connect) |
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def test_list_collections_jaccard(self, connect):
'''
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
... | [
"def",
"test_list_collections_jaccard",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_fil... | [
678,
4
] | [
692,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections_hamming | (self, connect) |
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def test_list_collections_hamming(self, connect):
'''
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
col... | [
"def",
"test_list_collections_hamming",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'index_fil... | [
694,
4
] | [
708,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections_substructure | (self, connect) |
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def test_list_collections_substructure(self, connect):
'''
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
... | [
"def",
"test_list_collections_substructure",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'inde... | [
710,
4
] | [
724,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections_superstructure | (self, connect) |
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def test_list_collections_superstructure(self, connect):
'''
target: test show collections is correct or not, if collection created
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
... | [
"def",
"test_list_collections_superstructure",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"dim",
",",
"'in... | [
726,
4
] | [
740,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCollection.test_list_collections_no_collection | (self, connect) |
target: test show collections is correct or not, if no collection in db
method: delete all collections,
assert the value returned by list_collections method is equal to []
expected: the status is ok, and the result is equal to []
|
target: test show collections is correct or not, if no collection in db
method: delete all collections,
assert the value returned by list_collections method is equal to []
expected: the status is ok, and the result is equal to []
| def test_list_collections_no_collection(self, connect):
'''
target: test show collections is correct or not, if no collection in db
method: delete all collections,
assert the value returned by list_collections method is equal to []
expected: the status is ok, and the result i... | [
"def",
"test_list_collections_no_collection",
"(",
"self",
",",
"connect",
")",
":",
"status",
",",
"result",
"=",
"connect",
".",
"list_collections",
"(",
")",
"if",
"result",
":",
"for",
"collection_name",
"in",
"result",
":",
"connect",
".",
"drop_collection"... | [
753,
4
] | [
767,
31
] | python | en | ['en', 'error', 'th'] | False |
TestCollection._test_list_collections_multiprocessing | (self, connect, args) |
target: test show collections is correct or not with processes
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
|
target: test show collections is correct or not with processes
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
| def _test_list_collections_multiprocessing(self, connect, args):
'''
target: test show collections is correct or not with processes
method: create collection, assert the value returned by list_collections method is equal to 0
expected: collection_name in show collections
'''
... | [
"def",
"_test_list_collections_multiprocessing",
"(",
"self",
",",
"connect",
",",
"args",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"test_collection\"",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection_name",
",",
"'dimension'",
":",
"... | [
771,
4
] | [
797,
20
] | python | en | ['en', 'error', 'th'] | False |
table_privileges_granted_directly | (self, node=None) | Check that a user is able to execute `CHECK` and `EXISTS`
commands on a table and see the table when they execute `SHOW TABLE` command
if and only if they have any privilege on that table granted directly.
| Check that a user is able to execute `CHECK` and `EXISTS`
commands on a table and see the table when they execute `SHOW TABLE` command
if and only if they have any privilege on that table granted directly.
| def table_privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `CHECK` and `EXISTS`
commands on a table and see the table when they execute `SHOW TABLE` command
if and only if they have any privilege on that table granted directly.
"""
user_name = f"user_{getuid()}"... | [
"def",
"table_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"... | [
8,
0
] | [
25,
80
] | python | en | ['en', 'en', 'en'] | True |
table_privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `CHECK` and `EXISTS`
commands on a table and see the table when they execute `SHOW TABLE` command
if and only if they have any privilege on that table granted via role.
| Check that a user is able to execute `CHECK` and `EXISTS`
commands on a table and see the table when they execute `SHOW TABLE` command
if and only if they have any privilege on that table granted via role.
| def table_privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `CHECK` and `EXISTS`
commands on a table and see the table when they execute `SHOW TABLE` command
if and only if they have any privilege on that table granted via role.
"""
user_name = f"user_{getuid()}"... | [
"def",
"table_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",
... | [
28,
0
] | [
49,
80
] | python | en | ['en', 'en', 'en'] | True |
check_privilege | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Run checks for commands that require SHOW TABLE privilege.
| Run checks for commands that require SHOW TABLE privilege.
| def check_privilege(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Run checks for commands that require SHOW TABLE privilege.
"""
if node is None:
node = self.context.node
Suite(test=show_tables)(privilege=privilege, on=on, grant_target_name=grant_target_name, us... | [
"def",
"check_privilege",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"S... | [
63,
0
] | [
72,
130
] | python | en | ['en', 'en', 'en'] | True |
show_tables | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Check that user is only able to see a table in SHOW TABLES when they have a privilege on that table.
| Check that user is only able to see a table in SHOW TABLES when they have a privilege on that table.
| def show_tables(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Check that user is only able to see a table in SHOW TABLES when they have a privilege on that table.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.co... | [
"def",
"show_tables",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"u... | [
78,
0
] | [
120,
44
] | python | en | ['en', 'en', 'en'] | True |
exists | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Check that user is able to execute EXISTS on a table if and only if the user has SHOW TABLE privilege
on that table.
| Check that user is able to execute EXISTS on a table if and only if the user has SHOW TABLE privilege
on that table.
| def exists(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Check that user is able to execute EXISTS on a table if and only if the user has SHOW TABLE privilege
on that table.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
... | [
"def",
"exists",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_n... | [
126,
0
] | [
170,
55
] | python | en | ['en', 'en', 'en'] | True |
check | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Check that user is able to execute CHECK on a table if and only if the user has SHOW TABLE privilege
on that table.
| Check that user is able to execute CHECK on a table if and only if the user has SHOW TABLE privilege
on that table.
| def check(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Check that user is able to execute CHECK on a table if and only if the user has SHOW TABLE privilege
on that table.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
n... | [
"def",
"check",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_na... | [
176,
0
] | [
220,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SHOW TABLES.
| Check the RBAC functionality of SHOW TABLES.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SHOW TABLES.
"""
self.context.node = self.context.cluster.node(node)
Suite(run=table_privileges_granted_directly, setup=instrument_clickhouse_server_log)
Suite(run=table_privileges_granted_via_role, setup=instrument_clickhous... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"table_privileges_granted_directly",
... | [
229,
0
] | [
235,
88
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.