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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
length | (self) | Check usage of length function with map data type.
| Check usage of length function with map data type.
| def length(self):
"""Check usage of length function with map data type.
"""
table_map(type="Map(String, String)",
data="(map('a','b','c','d')),(map('e','f'))",
select="length(m) AS len, m",
filter="length(m) = 1",
exitcode=0, message='{"len":"1","m":{"e":"f"}}') | [
"def",
"length",
"(",
"self",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('a','b','c','d')),(map('e','f'))\"",
",",
"select",
"=",
"\"length(m) AS len, m\"",
",",
"filter",
"=",
"\"length(m) = 1\"",
",",
"exitcode",
... | [
839,
0
] | [
846,
56
] | python | en | ['en', 'en', 'en'] | True |
empty | (self) | Check usage of empty function with map data type.
| Check usage of empty function with map data type.
| def empty(self):
"""Check usage of empty function with map data type.
"""
table_map(type="Map(String, String)",
data="(map('e','f'))",
select="empty(m) AS em, m",
filter="empty(m) <> 1",
exitcode=0, message='{"em":0,"m":{"e":"f"}}') | [
"def",
"empty",
"(",
"self",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('e','f'))\"",
",",
"select",
"=",
"\"empty(m) AS em, m\"",
",",
"filter",
"=",
"\"empty(m) <> 1\"",
",",
"exitcode",
"=",
"0",
",",
"mess... | [
852,
0
] | [
859,
53
] | python | en | ['en', 'en', 'en'] | True |
notempty | (self) | Check usage of notEmpty function with map data type.
| Check usage of notEmpty function with map data type.
| def notempty(self):
"""Check usage of notEmpty function with map data type.
"""
table_map(type="Map(String, String)",
data="(map('e','f'))",
select="notEmpty(m) AS em, m",
filter="notEmpty(m) = 1",
exitcode=0, message='{"em":1,"m":{"e":"f"}}') | [
"def",
"notempty",
"(",
"self",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('e','f'))\"",
",",
"select",
"=",
"\"notEmpty(m) AS em, m\"",
",",
"filter",
"=",
"\"notEmpty(m) = 1\"",
",",
"exitcode",
"=",
"0",
",",... | [
865,
0
] | [
872,
53
] | python | en | ['en', 'en', 'en'] | True |
cast_from_mapadd | (self) | Check converting the result of mapAdd function to a map data type.
| Check converting the result of mapAdd function to a map data type.
| def cast_from_mapadd(self):
"""Check converting the result of mapAdd function to a map data type.
"""
select_map(map="CAST(mapAdd(([toUInt8(1), 2], [1, 1]), ([toUInt8(1), 2], [1, 1])), 'Map(Int8, Int8)')", output="{1:2,2:2}") | [
"def",
"cast_from_mapadd",
"(",
"self",
")",
":",
"select_map",
"(",
"map",
"=",
"\"CAST(mapAdd(([toUInt8(1), 2], [1, 1]), ([toUInt8(1), 2], [1, 1])), 'Map(Int8, Int8)')\"",
",",
"output",
"=",
"\"{1:2,2:2}\"",
")"
] | [
878,
0
] | [
881,
127
] | python | en | ['en', 'en', 'en'] | True |
cast_from_mapsubstract | (self) | Check converting the result of mapSubstract function to a map data type.
| Check converting the result of mapSubstract function to a map data type.
| def cast_from_mapsubstract(self):
"""Check converting the result of mapSubstract function to a map data type.
"""
select_map(map="CAST(mapSubtract(([toUInt8(1), 2], [toInt32(1), 1]), ([toUInt8(1), 2], [toInt32(2), 1])), 'Map(Int8, Int8)')", output="{1:-1,2:0}") | [
"def",
"cast_from_mapsubstract",
"(",
"self",
")",
":",
"select_map",
"(",
"map",
"=",
"\"CAST(mapSubtract(([toUInt8(1), 2], [toInt32(1), 1]), ([toUInt8(1), 2], [toInt32(2), 1])), 'Map(Int8, Int8)')\"",
",",
"output",
"=",
"\"{1:-1,2:0}\"",
")"
] | [
887,
0
] | [
890,
151
] | python | en | ['en', 'en', 'en'] | True |
cast_from_mappopulateseries | (self) | Check converting the result of mapPopulateSeries function to a map data type.
| Check converting the result of mapPopulateSeries function to a map data type.
| def cast_from_mappopulateseries(self):
"""Check converting the result of mapPopulateSeries function to a map data type.
"""
select_map(map="CAST(mapPopulateSeries([1,2,4], [11,22,44], 5), 'Map(Int8, Int8)')", output="{1:11,2:22,3:0,4:44,5:0}") | [
"def",
"cast_from_mappopulateseries",
"(",
"self",
")",
":",
"select_map",
"(",
"map",
"=",
"\"CAST(mapPopulateSeries([1,2,4], [11,22,44], 5), 'Map(Int8, Int8)')\"",
",",
"output",
"=",
"\"{1:11,2:22,3:0,4:44,5:0}\"",
")"
] | [
896,
0
] | [
899,
123
] | python | en | ['en', 'en', 'en'] | True |
mapcontains | (self) | Check usages of mapContains function with map data type.
| Check usages of mapContains function with map data type.
| def mapcontains(self):
"""Check usages of mapContains function with map data type.
"""
node = self.context.node
with Example("key in map"):
table_map(type="Map(String, String)",
data="(map('e','f')),(map('a','b'))",
select="m",
filter="mapContains(m, 'a')",
... | [
"def",
"mapcontains",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Example",
"(",
"\"key in map\"",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('e','f')),(map('a','b'))\"",
... | [
905,
0
] | [
939,
121
] | python | en | ['en', 'en', 'en'] | True |
mapkeys | (self) | Check usages of mapKeys function with map data type.
| Check usages of mapKeys function with map data type.
| def mapkeys(self):
"""Check usages of mapKeys function with map data type.
"""
with Example("key in map"):
table_map(type="Map(String, String)",
data="(map('e','f')),(map('a','b'))",
select="m",
filter="has(mapKeys(m), 'a')",
exitcode=0, message='{"m":... | [
"def",
"mapkeys",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"key in map\"",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('e','f')),(map('a','b'))\"",
",",
"select",
"=",
"\"m\"",
",",
"filter",
"=",
"\"ha... | [
945,
0
] | [
981,
82
] | python | en | ['en', 'en', 'en'] | True |
mapvalues | (self) | Check usages of mapValues function with map data type.
| Check usages of mapValues function with map data type.
| def mapvalues(self):
"""Check usages of mapValues function with map data type.
"""
with Example("value in map"):
table_map(type="Map(String, String)",
data="(map('e','f')),(map('a','b'))",
select="m",
filter="has(mapValues(m), 'b')",
exitcode=0, messag... | [
"def",
"mapvalues",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"value in map\"",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('e','f')),(map('a','b'))\"",
",",
"select",
"=",
"\"m\"",
",",
"filter",
"=",
"... | [
987,
0
] | [
1023,
88
] | python | en | ['en', 'en', 'en'] | True |
functions_with_inline_defined_map | (self) | Check that a map defined inline inside the select statement
can be used with functions that work with maps.
| Check that a map defined inline inside the select statement
can be used with functions that work with maps.
| def functions_with_inline_defined_map(self):
"""Check that a map defined inline inside the select statement
can be used with functions that work with maps.
"""
with Example("mapKeys"):
select_map(map="map(1,2,3,4) as map, mapKeys(map) AS keys", output="{1:2,3:4}\t[1,3]")
with Example("mapVa... | [
"def",
"functions_with_inline_defined_map",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"mapKeys\"",
")",
":",
"select_map",
"(",
"map",
"=",
"\"map(1,2,3,4) as map, mapKeys(map) AS keys\"",
",",
"output",
"=",
"\"{1:2,3:4}\\t[1,3]\"",
")",
"with",
"Example",
"("... | [
1029,
0
] | [
1040,
101
] | python | en | ['en', 'en', 'en'] | True |
empty_map | (self) | Check creating of an empty map `{}` using the map() function
when inserting data into a map type table column.
| Check creating of an empty map `{}` using the map() function
when inserting data into a map type table column.
| def empty_map(self):
"""Check creating of an empty map `{}` using the map() function
when inserting data into a map type table column.
"""
table_map(type="Map(String, String)",
data="(map('e','f')),(map())",
select="m",
filter="1=1",
exitcode=0, message='{"m":{}}\n{"m":{"... | [
"def",
"empty_map",
"(",
"self",
")",
":",
"table_map",
"(",
"type",
"=",
"\"Map(String, String)\"",
",",
"data",
"=",
"\"(map('e','f')),(map())\"",
",",
"select",
"=",
"\"m\"",
",",
"filter",
"=",
"\"1=1\"",
",",
"exitcode",
"=",
"0",
",",
"message",
"=",
... | [
1043,
0
] | [
1051,
56
] | python | en | ['en', 'en', 'en'] | True |
performance_vs_two_tuple_of_arrays | (self, len=10, rows=6000000) | Check performance of using map data type vs Tuple(Array, Array).
| Check performance of using map data type vs Tuple(Array, Array).
| def performance_vs_two_tuple_of_arrays(self, len=10, rows=6000000):
"""Check performance of using map data type vs Tuple(Array, Array).
"""
uid = getuid()
node = self.context.node
with Given(f"table with Tuple(Array(Int8),Array(Int8))"):
sql = "CREATE TABLE {name} (pairs Tuple(Array(Int8),A... | [
"def",
"performance_vs_two_tuple_of_arrays",
"(",
"self",
",",
"len",
"=",
"10",
",",
"rows",
"=",
"6000000",
")",
":",
"uid",
"=",
"getuid",
"(",
")",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Given",
"(",
"f\"table with Tuple(Array(Int8),A... | [
1057,
0
] | [
1102,
83
] | python | en | ['en', 'en', 'en'] | True |
performance_vs_array_of_tuples | (self, len=10, rows=6000000) | Check performance of using map data type vs Array(Tuple(K,V)).
| Check performance of using map data type vs Array(Tuple(K,V)).
| def performance_vs_array_of_tuples(self, len=10, rows=6000000):
"""Check performance of using map data type vs Array(Tuple(K,V)).
"""
uid = getuid()
node = self.context.node
with Given(f"table with Array(Tuple(K,V))"):
sql = "CREATE TABLE {name} (pairs Array(Tuple(Int8, Int8))) ENGINE = Mer... | [
"def",
"performance_vs_array_of_tuples",
"(",
"self",
",",
"len",
"=",
"10",
",",
"rows",
"=",
"6000000",
")",
":",
"uid",
"=",
"getuid",
"(",
")",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Given",
"(",
"f\"table with Array(Tuple(K,V))\"",
... | [
1108,
0
] | [
1152,
83
] | python | en | ['en', 'no', 'en'] | True |
performance | (self, len=10, rows=6000000) | Check insert and select performance of using map data type.
| Check insert and select performance of using map data type.
| def performance(self, len=10, rows=6000000):
"""Check insert and select performance of using map data type.
"""
uid = getuid()
node = self.context.node
with Given("table with Map(Int8,Int8)"):
sql = "CREATE TABLE {name} (pairs Map(Int8,Int8)) ENGINE = MergeTree() ORDER BY pairs"
map... | [
"def",
"performance",
"(",
"self",
",",
"len",
"=",
"10",
",",
"rows",
"=",
"6000000",
")",
":",
"uid",
"=",
"getuid",
"(",
")",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Given",
"(",
"\"table with Map(Int8,Int8)\"",
")",
":",
"sql",
... | [
1155,
0
] | [
1177,
57
] | python | en | ['en', 'en', 'en'] | True |
FormsList.get | (self, request: Request) | Return a list of all forms to authenticated users. | Return a list of all forms to authenticated users. | async def get(self, request: Request) -> JSONResponse:
"""Return a list of all forms to authenticated users."""
forms = []
cursor = request.state.db.forms.find()
for form in await cursor.to_list(None):
forms.append(Form(**form)) # For converting _id to id
# Covert ... | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
":",
"Request",
")",
"->",
"JSONResponse",
":",
"forms",
"=",
"[",
"]",
"cursor",
"=",
"request",
".",
"state",
".",
"db",
".",
"forms",
".",
"find",
"(",
")",
"for",
"form",
"in",
"await",
"curso... | [
25,
4
] | [
38,
9
] | python | en | ['en', 'en', 'en'] | True |
FormsList.post | (self, request: Request) | Create a new form. | Create a new form. | async def post(self, request: Request) -> JSONResponse:
"""Create a new form."""
form_data = await request.json()
# Verify Webhook
try:
# Get url from request
url = form_data[WebHook.__name__.lower()][WebHook.URL.value]
# Validate URL
val... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
":",
"Request",
")",
"->",
"JSONResponse",
":",
"form_data",
"=",
"await",
"request",
".",
"json",
"(",
")",
"# Verify Webhook",
"try",
":",
"# Get url from request",
"url",
"=",
"form_data",
"[",
"WebHook... | [
46,
4
] | [
71,
40
] | python | en | ['en', 'en', 'en'] | True |
imshow | (image, ax=None, title=None, normalize=True) | Imshow for Tensor. | Imshow for Tensor. | def imshow(image, ax=None, title=None, normalize=True):
"""Imshow for Tensor."""
if ax is None:
fig, ax = plt.subplots()
image = image.numpy().transpose((1, 2, 0))
if normalize:
mean = np.array([0.485, 0.456, 0.406])
std = np.array([0.229, 0.224, 0.225])
image =... | [
"def",
"imshow",
"(",
"image",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"normalize",
"=",
"True",
")",
":",
"if",
"ax",
"is",
"None",
":",
"fig",
",",
"ax",
"=",
"plt",
".",
"subplots",
"(",
")",
"image",
"=",
"image",
".",
"nump... | [
30,
0
] | [
51,
13
] | python | en | ['en', 'no', 'en'] | True |
view_recon | (img, recon) | Function for displaying an image (as a PyTorch Tensor) and its
reconstruction also a PyTorch Tensor
| Function for displaying an image (as a PyTorch Tensor) and its
reconstruction also a PyTorch Tensor
| def view_recon(img, recon):
''' Function for displaying an image (as a PyTorch Tensor) and its
reconstruction also a PyTorch Tensor
'''
fig, axes = plt.subplots(ncols=2, sharex=True, sharey=True)
axes[0].imshow(img.numpy().squeeze())
axes[1].imshow(recon.data.numpy().squeeze())
... | [
"def",
"view_recon",
"(",
"img",
",",
"recon",
")",
":",
"fig",
",",
"axes",
"=",
"plt",
".",
"subplots",
"(",
"ncols",
"=",
"2",
",",
"sharex",
"=",
"True",
",",
"sharey",
"=",
"True",
")",
"axes",
"[",
"0",
"]",
".",
"imshow",
"(",
"img",
"."... | [
54,
0
] | [
64,
39
] | python | en | ['en', 'en', 'en'] | True |
view_classify | (img, ps, version="MNIST") | Function for viewing an image and it's predicted classes.
| Function for viewing an image and it's predicted classes.
| def view_classify(img, ps, version="MNIST"):
''' Function for viewing an image and it's predicted classes.
'''
ps = ps.data.numpy().squeeze()
fig, (ax1, ax2) = plt.subplots(figsize=(6,9), ncols=2)
ax1.imshow(img.resize_(1, 28, 28).numpy().squeeze())
ax1.axis('off')
ax2.barh(np.arang... | [
"def",
"view_classify",
"(",
"img",
",",
"ps",
",",
"version",
"=",
"\"MNIST\"",
")",
":",
"ps",
"=",
"ps",
".",
"data",
".",
"numpy",
"(",
")",
".",
"squeeze",
"(",
")",
"fig",
",",
"(",
"ax1",
",",
"ax2",
")",
"=",
"plt",
".",
"subplots",
"("... | [
66,
0
] | [
93,
22
] | python | en | ['en', 'en', 'en'] | True |
home | (request) | Home page.
| Home page.
| def home(request):
"""Home page.
"""
return {} | [
"def",
"home",
"(",
"request",
")",
":",
"return",
"{",
"}"
] | [
6,
0
] | [
9,
10
] | python | en | ['en', 'en', 'en'] | False |
regression | (self, local, clickhouse_binary_path, stress=None, parallel=None) | ClickHouse AES encryption functions regression module.
| ClickHouse AES encryption functions regression module.
| def regression(self, local, clickhouse_binary_path, stress=None, parallel=None):
"""ClickHouse AES encryption functions regression module.
"""
top().terminating = False
nodes = {
"clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"),
}
if stress is not None:
self.context.s... | [
"def",
"regression",
"(",
"self",
",",
"local",
",",
"clickhouse_binary_path",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"top",
"(",
")",
".",
"terminating",
"=",
"False",
"nodes",
"=",
"{",
"\"clickhouse\"",
":",
"(",
"\"clickh... | [
78,
0
] | [
104,
27
] | python | en | ['en', 'en', 'en'] | True |
ReplayBuffer.__init__ | (self, size) | Create Replay buffer.
Parameters
----------
size: int
Max number of transitions to store in the buffer. When the buffer
overflows the old memories are dropped.
| Create Replay buffer.
Parameters
----------
size: int
Max number of transitions to store in the buffer. When the buffer
overflows the old memories are dropped.
| def __init__(self, size):
"""Create Replay buffer.
Parameters
----------
size: int
Max number of transitions to store in the buffer. When the buffer
overflows the old memories are dropped.
"""
self._storage = []
self._maxsize = size
... | [
"def",
"__init__",
"(",
"self",
",",
"size",
")",
":",
"self",
".",
"_storage",
"=",
"[",
"]",
"self",
".",
"_maxsize",
"=",
"size",
"self",
".",
"_next_idx",
"=",
"998400"
] | [
7,
4
] | [
17,
31
] | python | de | ['de', 'yo', 'en'] | False |
ReplayBuffer.sample | (self, batch_size) | Sample a batch of experiences.
Parameters
----------
batch_size: int
How many transitions to sample.
Returns
-------
obs_batch: np.array
batch of observations
act_batch: np.array
batch of actions executed given obs_batch
... | Sample a batch of experiences.
Parameters
----------
batch_size: int
How many transitions to sample.
Returns
-------
obs_batch: np.array
batch of observations
act_batch: np.array
batch of actions executed given obs_batch
... | def sample(self, batch_size):
"""Sample a batch of experiences.
Parameters
----------
batch_size: int
How many transitions to sample.
Returns
-------
obs_batch: np.array
batch of observations
act_batch: np.array
batch of... | [
"def",
"sample",
"(",
"self",
",",
"batch_size",
")",
":",
"idxes",
"=",
"[",
"random",
".",
"randint",
"(",
"0",
",",
"len",
"(",
"self",
".",
"_storage",
")",
"-",
"1",
")",
"for",
"_",
"in",
"range",
"(",
"batch_size",
")",
"]",
"return",
"sel... | [
46,
4
] | [
73,
41
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.__init__ | (self, sensor_name, username, password, system_id, sunset, fetcher, metadata) | Initialize the sensor. | Initialize the sensor. | def __init__(self, sensor_name, username, password, system_id, sunset, fetcher, metadata):
"""Initialize the sensor."""
self._state = None
self._name = sensor_name
self._username = username
self._password = password
self._system_id = system_id
self._sunset = sunse... | [
"def",
"__init__",
"(",
"self",
",",
"sensor_name",
",",
"username",
",",
"password",
",",
"system_id",
",",
"sunset",
",",
"fetcher",
",",
"metadata",
")",
":",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_name",
"=",
"sensor_name",
"self",
".",
... | [
78,
4
] | [
88,
29
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
91,
4
] | [
93,
25
] | python | en | ['en', 'mi', 'en'] | True |
ApsystemsSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
96,
4
] | [
98,
26
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def state_attributes(self):
"""Return the device state attributes."""
return self._attributes | [
"def",
"state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | [
101,
4
] | [
103,
31
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return self._metadata[1] | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_metadata",
"[",
"1",
"]"
] | [
106,
4
] | [
108,
32
] | python | en | ['en', 'la', 'en'] | True |
ApsystemsSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
return self._metadata[2] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_metadata",
"[",
"2",
"]"
] | [
111,
4
] | [
113,
32
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.async_update | (self) | Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
| Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
| async def async_update(self):
"""Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
"""
if not self.available:
self._state = STATE_UNAVAILABLE
return
ap_data = await self._fetcher.data()
# ... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"available",
":",
"self",
".",
"_state",
"=",
"STATE_UNAVAILABLE",
"return",
"ap_data",
"=",
"await",
"self",
".",
"_fetcher",
".",
"data",
"(",
")",
"# state is not available",... | [
137,
4
] | [
171,
27
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.find_start_time | (self, now) | Return sunrise or start_time if given. | Return sunrise or start_time if given. | def find_start_time(self, now):
"""Return sunrise or start_time if given."""
sunrise = get_astral_event_date(self.hass, SUN_EVENT_SUNRISE, now.date())
return sunrise | [
"def",
"find_start_time",
"(",
"self",
",",
"now",
")",
":",
"sunrise",
"=",
"get_astral_event_date",
"(",
"self",
".",
"hass",
",",
"SUN_EVENT_SUNRISE",
",",
"now",
".",
"date",
"(",
")",
")",
"return",
"sunrise"
] | [
173,
4
] | [
176,
22
] | python | en | ['en', 'en', 'en'] | True |
ApsystemsSensor.find_stop_time | (self, now) | Return sunset or stop_time if given. | Return sunset or stop_time if given. | def find_stop_time(self, now):
"""Return sunset or stop_time if given."""
sunset = get_astral_event_date(self.hass, SUN_EVENT_SUNSET, now.date())
return sunset | [
"def",
"find_stop_time",
"(",
"self",
",",
"now",
")",
":",
"sunset",
"=",
"get_astral_event_date",
"(",
"self",
".",
"hass",
",",
"SUN_EVENT_SUNSET",
",",
"now",
".",
"date",
"(",
")",
")",
"return",
"sunset"
] | [
178,
4
] | [
181,
21
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (self, node=None) | Check that a role named ALL only grants privileges that it already has.
| Check that a role named ALL only grants privileges that it already has.
| def privilege_check(self, node=None):
'''Check that a role named ALL only grants privileges that it already has.
'''
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
with user(node, f"{user_name}"), role(node, "ALL"):
with When("I grant the ALL role to the... | [
"def",
"privilege_check",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{user_name}\"",
... | [
8,
0
] | [
24,
40
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of the role 'ALL'.
| Check the RBAC functionality of the role 'ALL'.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of the role 'ALL'.
"""
self.context.node = self.context.cluster.node(node)
Scenario(run=privilege_check, setup=instrument_clickhouse_server_log) | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Scenario",
"(",
"run",
"=",
"privilege_check",
",",
"setup",... | [
31,
0
] | [
36,
73
] | python | en | ['en', 'en', 'en'] | True |
show_composite | (img, channels, ax=None, figsize=(3,3), title=None, scale=True,
ctx=None, norm_min=None, norm_max=None, scale_axis=(0,1), **kwargs) | Show three channel composite so that channels correspond to R, G and B | Show three channel composite so that channels correspond to R, G and B | def show_composite(img, channels, ax=None, figsize=(3,3), title=None, scale=True,
ctx=None, norm_min=None, norm_max=None, scale_axis=(0,1), **kwargs)->plt.Axes:
"Show three channel composite so that channels correspond to R, G and B"
ax = ifnone(ax, ctx)
if ax is None: _, ax = plt.subplot... | [
"def",
"show_composite",
"(",
"img",
",",
"channels",
",",
"ax",
"=",
"None",
",",
"figsize",
"=",
"(",
"3",
",",
"3",
")",
",",
"title",
"=",
"None",
",",
"scale",
"=",
"True",
",",
"ctx",
"=",
"None",
",",
"norm_min",
"=",
"None",
",",
"norm_ma... | [
38,
0
] | [
54,
13
] | python | en | ['en', 'en', 'en'] | True |
show_normalized_spectral_index | (img, channels, ax=None, figsize=(3,3), ctx=None,
title=None, **kwargs) | Show normalized spectral index such as NDVI | Show normalized spectral index such as NDVI | def show_normalized_spectral_index(img, channels, ax=None, figsize=(3,3), ctx=None,
title=None, **kwargs) -> plt.Axes:
"Show normalized spectral index such as NDVI"
ax = ifnone(ax, ctx)
if ax is None: _, ax = plt.subplots(figsize=figsize)
b_0, b_1 = channels
tempim... | [
"def",
"show_normalized_spectral_index",
"(",
"img",
",",
"channels",
",",
"ax",
"=",
"None",
",",
"figsize",
"=",
"(",
"3",
",",
"3",
")",
",",
"ctx",
"=",
"None",
",",
"title",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"plt",
".",
"Axes",
... | [
66,
0
] | [
77,
13
] | python | en | ['en', 'en', 'en'] | True |
show_mean_spectra | (img, ax=None, figsize=(3,3), ctx=None, title=None, **kwargs) | Show average spectra graph | Show average spectra graph | def show_mean_spectra(img, ax=None, figsize=(3,3), ctx=None, title=None, **kwargs) -> plt.Axes:
"Show average spectra graph"
ax = ifnone(ax, ctx)
if ax is None: _, ax = plt.subplots(figsize=figsize)
tempim = img.data.cpu().numpy()
means = np.nanmean(tempim, axis=(-2, -1))
ax.plot(means, **kwargs... | [
"def",
"show_mean_spectra",
"(",
"img",
",",
"ax",
"=",
"None",
",",
"figsize",
"=",
"(",
"3",
",",
"3",
")",
",",
"ctx",
"=",
"None",
",",
"title",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"plt",
".",
"Axes",
":",
"ax",
"=",
"ifnone",
... | [
79,
0
] | [
88,
13
] | python | en | ['en', 'en', 'en'] | True |
norm | (vals, norm_min=None, norm_max=None, axis=(0,1)) |
For visualization purposes scale image with `(vals-norm_min)/(norm_max-norm_min),
with norm_min and norm_max either specified or within 0.01 and 0.99 quantiles of all values
|
For visualization purposes scale image with `(vals-norm_min)/(norm_max-norm_min),
with norm_min and norm_max either specified or within 0.01 and 0.99 quantiles of all values
| def norm(vals, norm_min=None, norm_max=None, axis=(0,1)):
"""
For visualization purposes scale image with `(vals-norm_min)/(norm_max-norm_min),
with norm_min and norm_max either specified or within 0.01 and 0.99 quantiles of all values
"""
norm_min = ifnone(norm_min, np.quantile(vals, 0.01, axis=axi... | [
"def",
"norm",
"(",
"vals",
",",
"norm_min",
"=",
"None",
",",
"norm_max",
"=",
"None",
",",
"axis",
"=",
"(",
"0",
",",
"1",
")",
")",
":",
"norm_min",
"=",
"ifnone",
"(",
"norm_min",
",",
"np",
".",
"quantile",
"(",
"vals",
",",
"0.01",
",",
... | [
90,
0
] | [
100,
17
] | python | en | ['en', 'error', 'th'] | False |
show_results | (x:TensorImage, y:TensorMask, samples, outs, ctxs, max_n=6,
nrows=None, ncols=3, figsize=None, show_cbar=False, **kwargs) | Patch `show_results` to show segmentation results in three columns (no-mask, ground truth, prediction) | Patch `show_results` to show segmentation results in three columns (no-mask, ground truth, prediction) | def show_results(x:TensorImage, y:TensorMask, samples, outs, ctxs, max_n=6,
nrows=None, ncols=3, figsize=None, show_cbar=False, **kwargs):
"Patch `show_results` to show segmentation results in three columns (no-mask, ground truth, prediction)"
if ctxs is None: ctxs = get_grid(min(len(samples)*... | [
"def",
"show_results",
"(",
"x",
":",
"TensorImage",
",",
"y",
":",
"TensorMask",
",",
"samples",
",",
"outs",
",",
"ctxs",
",",
"max_n",
"=",
"6",
",",
"nrows",
"=",
"None",
",",
"ncols",
"=",
"3",
",",
"figsize",
"=",
"None",
",",
"show_cbar",
"=... | [
105,
0
] | [
124,
15
] | python | en | ['en', 'en', 'en'] | True |
RegressionMaskBlock | (cls=RegressionMask, **kwargs) | Default behaviour: use all channels | Default behaviour: use all channels | def RegressionMaskBlock(cls=RegressionMask, **kwargs):
"Default behaviour: use all channels"
return TransformBlock(partial(cls.create)) | [
"def",
"RegressionMaskBlock",
"(",
"cls",
"=",
"RegressionMask",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"TransformBlock",
"(",
"partial",
"(",
"cls",
".",
"create",
")",
")"
] | [
168,
0
] | [
170,
46
] | python | en | ['en', 'fr', 'en'] | True |
MultiChannelImageBlock | (cls=MultiChannelTensorImage, chans=None, max_val=None) | Default behaviour: use all channels | Default behaviour: use all channels | def MultiChannelImageBlock(cls=MultiChannelTensorImage, chans=None, max_val=None):
"Default behaviour: use all channels"
return TransformBlock(partial(cls.create, chans=chans, maxval=max_val)) | [
"def",
"MultiChannelImageBlock",
"(",
"cls",
"=",
"MultiChannelTensorImage",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
")",
":",
"return",
"TransformBlock",
"(",
"partial",
"(",
"cls",
".",
"create",
",",
"chans",
"=",
"chans",
",",
"maxval",
... | [
206,
0
] | [
208,
75
] | python | en | ['en', 'fr', 'en'] | True |
using_attr | (f, attr) | Change function `f` to operate on `attr` | Change function `f` to operate on `attr` | def using_attr(f, attr):
"Change function `f` to operate on `attr`"
return partial(_using_attr, f, attr) | [
"def",
"using_attr",
"(",
"f",
",",
"attr",
")",
":",
"return",
"partial",
"(",
"_using_attr",
",",
"f",
",",
"attr",
")"
] | [
214,
0
] | [
216,
40
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageTupleBlock | (cls=MultiChannelTensorImageTuple, chans=None, max_val=None) | Default behaviour: use all channels | Default behaviour: use all channels | def MultiChannelImageTupleBlock(cls=MultiChannelTensorImageTuple, chans=None, max_val=None):
"Default behaviour: use all channels"
return TransformBlock(partial(cls.create, chans=chans, max_val=max_val)) | [
"def",
"MultiChannelImageTupleBlock",
"(",
"cls",
"=",
"MultiChannelTensorImageTuple",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
")",
":",
"return",
"TransformBlock",
"(",
"partial",
"(",
"cls",
".",
"create",
",",
"chans",
"=",
"chans",
",",
"... | [
246,
0
] | [
248,
76
] | python | en | ['en', 'fr', 'en'] | True |
label_with_matching_fname | (fn, path) | Utility to match image and mask that have different folder but identical filename | Utility to match image and mask that have different folder but identical filename | def label_with_matching_fname(fn, path):
"Utility to match image and mask that have different folder but identical filename"
return f'{path}/{fn.stem}{fn.suffix}' | [
"def",
"label_with_matching_fname",
"(",
"fn",
",",
"path",
")",
":",
"return",
"f'{path}/{fn.stem}{fn.suffix}'"
] | [
406,
0
] | [
408,
41
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelTensorImage.show | (self, channels=[0], ctx=None, norm_min=None, norm_max=None, **kwargs) | These need refactoring maybe | These need refactoring maybe | def show(self, channels=[0], ctx=None, norm_min=None, norm_max=None, **kwargs):
"These need refactoring maybe"
if channels == 'spectra':
return show_mean_spectra(self, ctx=ctx, **kwargs)
if len(channels) == 3:
return show_composite(self, channels=channels, ctx=ctx, norm_... | [
"def",
"show",
"(",
"self",
",",
"channels",
"=",
"[",
"0",
"]",
",",
"ctx",
"=",
"None",
",",
"norm_min",
"=",
"None",
",",
"norm_max",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"channels",
"==",
"'spectra'",
":",
"return",
"show_mean_... | [
176,
4
] | [
188,
71
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelTensorImageTuple.show | (self, channels=[0], ctx=None, norm_min=None, norm_max=None, **kwargs) | These need refactoring maybe | These need refactoring maybe | def show(self, channels=[0], ctx=None, norm_min=None, norm_max=None, **kwargs):
ims = self
"These need refactoring maybe"
if channels == 'spectra':
return show_mean_spectra(torch.cat(ims, dim=2), ctx=ctx, **kwargs)
if len(channels) == 3:
return show_composite(tor... | [
"def",
"show",
"(",
"self",
",",
"channels",
"=",
"[",
"0",
"]",
",",
"ctx",
"=",
"None",
",",
"norm_min",
"=",
"None",
",",
"norm_max",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ims",
"=",
"self",
"if",
"channels",
"==",
"'spectra'",
":",... | [
222,
4
] | [
235,
71
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_folder | (cls, path, chans=None, max_val=None, extensions=['.tif'],
train='train', valid='valid', valid_pct=None, seed=None,
vocab=None, item_tfms=None, batch_tfms=None, **kwargs) | Create from imagenet style dataset in `path` with `train`, `valid`, `test` subfolders (or provide `valid_pct`).
Optionally list the channels to use. | Create from imagenet style dataset in `path` with `train`, `valid`, `test` subfolders (or provide `valid_pct`).
Optionally list the channels to use. | def from_folder(cls, path, chans=None, max_val=None, extensions=['.tif'],
train='train', valid='valid', valid_pct=None, seed=None,
vocab=None, item_tfms=None, batch_tfms=None, **kwargs):
"""Create from imagenet style dataset in `path` with `train`, `valid`, `test` subfold... | [
"def",
"from_folder",
"(",
"cls",
",",
"path",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"extensions",
"=",
"[",
"'.tif'",
"]",
",",
"train",
"=",
"'train'",
",",
"valid",
"=",
"'valid'",
",",
"valid_pct",
"=",
"None",
",",
"seed",... | [
281,
4
] | [
293,
65
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_path_func | (cls, path, fnames, label_func,chans=None, max_val=None, extensions=['.tif'],
valid_pct=0.2, seed=None, item_tfms=None, batch_tfms=None, **kwargs) | Create from list of `fnames` in `path`s with `label_func`.
Optionally list the channels to use. | Create from list of `fnames` in `path`s with `label_func`.
Optionally list the channels to use. | def from_path_func(cls, path, fnames, label_func,chans=None, max_val=None, extensions=['.tif'],
valid_pct=0.2, seed=None, item_tfms=None, batch_tfms=None, **kwargs):
"""Create from list of `fnames` in `path`s with `label_func`.
Optionally list the channels to use."""
dblo... | [
"def",
"from_path_func",
"(",
"cls",
",",
"path",
",",
"fnames",
",",
"label_func",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"extensions",
"=",
"[",
"'.tif'",
"]",
",",
"valid_pct",
"=",
"0.2",
",",
"seed",
"=",
"None",
",",
"item... | [
297,
4
] | [
307,
65
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_name_func | (cls, path, fnames, label_func,
chans=None, max_val=None, extensions=['.tif'], **kwargs) | Create from name attrs in list of `fnames` in `path`s with `label_func`.
Optionally list the channels to use. | Create from name attrs in list of `fnames` in `path`s with `label_func`.
Optionally list the channels to use. | def from_name_func(cls, path, fnames, label_func,
chans=None, max_val=None, extensions=['.tif'], **kwargs):
"""Create from name attrs in list of `fnames` in `path`s with `label_func`.
Optionally list the channels to use."""
f = using_attr(label_func, 'name')
return... | [
"def",
"from_name_func",
"(",
"cls",
",",
"path",
",",
"fnames",
",",
"label_func",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"extensions",
"=",
"[",
"'.tif'",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"f",
"=",
"using_attr",
"(",
... | [
310,
4
] | [
315,
90
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_path_re | (cls, path, fnames, pat, chans=None, max_val=None, extensions=['.tif'], **kwargs) | Create from list of `fnames` in `path`s with re expression `pat`.
Optionally list the channels to use. | Create from list of `fnames` in `path`s with re expression `pat`.
Optionally list the channels to use. | def from_path_re(cls, path, fnames, pat, chans=None, max_val=None, extensions=['.tif'], **kwargs):
"""Create from list of `fnames` in `path`s with re expression `pat`.
Optionally list the channels to use."""
return cls.from_path_func(path, fnames, RegexLabeller(pat), chans=chans, max_val=None... | [
"def",
"from_path_re",
"(",
"cls",
",",
"path",
",",
"fnames",
",",
"pat",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"extensions",
"=",
"[",
"'.tif'",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"cls",
".",
"from_path_func",
... | [
318,
4
] | [
321,
104
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_name_re | (cls, path, fnames, pat, chans=None, max_val=None, extensions=['.tif'],**kwargs) | Create from name attrs in list of `fnames` in `path`s with re expression `pat`.
Optionally list the channels to use | Create from name attrs in list of `fnames` in `path`s with re expression `pat`.
Optionally list the channels to use | def from_name_re(cls, path, fnames, pat, chans=None, max_val=None, extensions=['.tif'],**kwargs):
"""Create from name attrs in list of `fnames` in `path`s with re expression `pat`.
Optionally list the channels to use"""
return cls.from_name_func(path, fnames, RegexLabeller(pat), chans=chans, ... | [
"def",
"from_name_re",
"(",
"cls",
",",
"path",
",",
"fnames",
",",
"pat",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"extensions",
"=",
"[",
"'.tif'",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"cls",
".",
"from_name_func",
... | [
325,
4
] | [
328,
106
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_shapefile | (cls, path, chans=None, max_val=None, shp_fname='labels.shp', **kwargs) | Create from shapefile `shp_fname` in `path` readable with geopandas (GeoJSON, ESRI Shapefile)
Optionally list the channels to use. | Create from shapefile `shp_fname` in `path` readable with geopandas (GeoJSON, ESRI Shapefile)
Optionally list the channels to use. | def from_shapefile(cls, path, chans=None, max_val=None, shp_fname='labels.shp', **kwargs):
"""Create from shapefile `shp_fname` in `path` readable with geopandas (GeoJSON, ESRI Shapefile)
Optionally list the channels to use."""
df = gpd.read_file(str(Path(path)/shp_fname))
# Shapefiles d... | [
"def",
"from_shapefile",
"(",
"cls",
",",
"path",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"shp_fname",
"=",
"'labels.shp'",
",",
"*",
"*",
"kwargs",
")",
":",
"df",
"=",
"gpd",
".",
"read_file",
"(",
"str",
"(",
"Path",
"(",
"p... | [
349,
4
] | [
355,
78
] | python | en | ['en', 'en', 'en'] | True |
MultiChannelImageDataLoaders.from_lists | (cls, path, fnames, labels, chans=None, max_val=None, valid_pct=0.2,
seed:int=None, y_block=None, item_tfms=None, batch_tfms=None,
**kwargs) | Create from list of `fnames` in `path`.
Optionally list the channels to use. | Create from list of `fnames` in `path`.
Optionally list the channels to use. | def from_lists(cls, path, fnames, labels, chans=None, max_val=None, valid_pct=0.2,
seed:int=None, y_block=None, item_tfms=None, batch_tfms=None,
**kwargs):
"""Create from list of `fnames` in `path`.
Optionally list the channels to use."""
if y_block is None:... | [
"def",
"from_lists",
"(",
"cls",
",",
"path",
",",
"fnames",
",",
"labels",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"valid_pct",
"=",
"0.2",
",",
"seed",
":",
"int",
"=",
"None",
",",
"y_block",
"=",
"None",
",",
"item_tfms",
"... | [
365,
4
] | [
377,
77
] | python | en | ['en', 'en', 'en'] | True |
TifSegmentationDataLoaders.from_label_func | (cls, path, fnames, label_func, y_block=MaskBlock, chans=None, max_val=None,
extensions=['.tif'], valid_pct=0.2, seed=None, splitter=None,
codes=None, item_tfms=None, batch_tfms=None, **kwargs) | Create from list of `fnames` in `path`s with `label_func`. | Create from list of `fnames` in `path`s with `label_func`. | def from_label_func(cls, path, fnames, label_func, y_block=MaskBlock, chans=None, max_val=None,
extensions=['.tif'], valid_pct=0.2, seed=None, splitter=None,
codes=None, item_tfms=None, batch_tfms=None, **kwargs):
"Create from list of `fnames` in `path`s with `l... | [
"def",
"from_label_func",
"(",
"cls",
",",
"path",
",",
"fnames",
",",
"label_func",
",",
"y_block",
"=",
"MaskBlock",
",",
"chans",
"=",
"None",
",",
"max_val",
"=",
"None",
",",
"extensions",
"=",
"[",
"'.tif'",
"]",
",",
"valid_pct",
"=",
"0.2",
","... | [
390,
4
] | [
402,
18
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check alter row policy query syntax.
```sql
ALTER [ROW] POLICY [IF EXISTS] name [ON CLUSTER cluster_name] ON [database.]table
[RENAME TO new_name]
[AS {PERMISSIVE | RESTRICTIVE}]
[FOR SELECT]
[USING {condition | NONE}][,...]
[TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
```
| Check alter row policy query syntax. | def feature(self, node="clickhouse1"):
"""Check alter row policy query syntax.
```sql
ALTER [ROW] POLICY [IF EXISTS] name [ON CLUSTER cluster_name] ON [database.]table
[RENAME TO new_name]
[AS {PERMISSIVE | RESTRICTIVE}]
[FOR SELECT]
[USING {condition | NONE}][,...]
[TO {role [,...] | A... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"cleanup",
"(",
"policy",
")",
":",
"try",
":",
"with",
"G... | [
10,
0
] | [
243,
59
] | python | en | ['en', 'en', 'en'] | True |
_find_scalar_parameter | (expr) | :func:`~ibis.expr.lineage.traverse` function to find all
:class:`~ibis.expr.types.ScalarParameter` instances and yield the operation
and the parent expresssion's resolved name.
Parameters
----------
expr : ibis.expr.types.Expr
Returns
-------
Tuple[bool, object]
| :func:`~ibis.expr.lineage.traverse` function to find all
:class:`~ibis.expr.types.ScalarParameter` instances and yield the operation
and the parent expresssion's resolved name. | def _find_scalar_parameter(expr):
""":func:`~ibis.expr.lineage.traverse` function to find all
:class:`~ibis.expr.types.ScalarParameter` instances and yield the operation
and the parent expresssion's resolved name.
Parameters
----------
expr : ibis.expr.types.Expr
Returns
-------
Tu... | [
"def",
"_find_scalar_parameter",
"(",
"expr",
")",
":",
"op",
"=",
"expr",
".",
"op",
"(",
")",
"if",
"isinstance",
"(",
"op",
",",
"ops",
".",
"ScalarParameter",
")",
":",
"result",
"=",
"op",
",",
"expr",
".",
"get_name",
"(",
")",
"else",
":",
"... | [
113,
0
] | [
132,
30
] | python | en | ['en', 'en', 'en'] | True |
parse_project_and_dataset | (project, dataset) | Figure out the project id under which queries will run versus the
project of where the data live as well as what dataset to use.
Parameters
----------
project : str
A project name
dataset : str
A ``<project>.<dataset>`` string or just a dataset name
Returns
-------
data... | Figure out the project id under which queries will run versus the
project of where the data live as well as what dataset to use. | def parse_project_and_dataset(project, dataset):
"""Figure out the project id under which queries will run versus the
project of where the data live as well as what dataset to use.
Parameters
----------
project : str
A project name
dataset : str
A ``<project>.<dataset>`` string ... | [
"def",
"parse_project_and_dataset",
"(",
"project",
",",
"dataset",
")",
":",
"try",
":",
"data_project",
",",
"dataset",
"=",
"dataset",
".",
"split",
"(",
"'.'",
")",
"except",
"ValueError",
":",
"billing_project",
"=",
"data_project",
"=",
"project",
"else"... | [
281,
0
] | [
325,
49
] | python | en | ['en', 'en', 'en'] | True |
BigQueryClient.__init__ | (self, project_id, dataset_id, credentials=None) |
Parameters
----------
project_id : str
A project name
dataset_id : str
A ``<project_id>.<dataset_id>`` string or just a dataset name
credentials : google.auth.credentials.Credentials, optional
|
Parameters
----------
project_id : str
A project name
dataset_id : str
A ``<project_id>.<dataset_id>`` string or just a dataset name
credentials : google.auth.credentials.Credentials, optional
| def __init__(self, project_id, dataset_id, credentials=None):
"""
Parameters
----------
project_id : str
A project name
dataset_id : str
A ``<project_id>.<dataset_id>`` string or just a dataset name
credentials : google.auth.credentials.Credentials... | [
"def",
"__init__",
"(",
"self",
",",
"project_id",
",",
"dataset_id",
",",
"credentials",
"=",
"None",
")",
":",
"(",
"self",
".",
"data_project",
",",
"self",
".",
"billing_project",
",",
"self",
".",
"dataset",
")",
"=",
"parse_project_and_dataset",
"(",
... | [
335,
4
] | [
349,
56
] | python | en | ['en', 'error', 'th'] | False |
math_int_inline | (self, func, expected_result, exitcode, int_type, min, max, node=None) | Check mathematical functions with Int128, UInt128, Int256, and UInt256 using inline tests.
| Check mathematical functions with Int128, UInt128, Int256, and UInt256 using inline tests.
| def math_int_inline(self, func, expected_result, exitcode, int_type, min, max, node=None):
"""Check mathematical functions with Int128, UInt128, Int256, and UInt256 using inline tests.
"""
if node is None:
node = self.context.node
if func in ['intExp2(', 'intExp10(', 'pow(1,', 'power(1,', 'atan... | [
"def",
"math_int_inline",
"(",
"self",
",",
"func",
",",
"expected_result",
",",
"exitcode",
",",
"int_type",
",",
"min",
",",
"max",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
44,
0
] | [
68,
20
] | python | en | ['en', 'en', 'en'] | True |
math_int_table | (self, func, expected_result, exitcode, int_type, min, max, node=None) | Check mathematical functions with Int128, UInt128, Int256, and UInt256 using table tests.
| Check mathematical functions with Int128, UInt128, Int256, and UInt256 using table tests.
| def math_int_table(self, func, expected_result, exitcode, int_type, min, max, node=None):
"""Check mathematical functions with Int128, UInt128, Int256, and UInt256 using table tests.
"""
if node is None:
node = self.context.node
table_name = f'table_{getuid()}'
with Given(f"I have a table"... | [
"def",
"math_int_table",
"(",
"self",
",",
"func",
",",
"expected_result",
",",
"exitcode",
",",
"int_type",
",",
"min",
",",
"max",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node"... | [
72,
0
] | [
101,
20
] | python | en | ['en', 'en', 'en'] | True |
math_dec_inline | (self, func, expected_result, exitcode, node=None) | Check mathematical functions with Decimal256 using inline tests.
| Check mathematical functions with Decimal256 using inline tests.
| def math_dec_inline(self, func, expected_result, exitcode, node=None):
"""Check mathematical functions with Decimal256 using inline tests.
"""
min = Decimal256_min_max[0]
max = Decimal256_min_max[1]
if node is None:
node = self.context.node
if func in ['intExp2(', 'intExp10(', 'pow(1,'... | [
"def",
"math_dec_inline",
"(",
"self",
",",
"func",
",",
"expected_result",
",",
"exitcode",
",",
"node",
"=",
"None",
")",
":",
"min",
"=",
"Decimal256_min_max",
"[",
"0",
"]",
"max",
"=",
"Decimal256_min_max",
"[",
"1",
"]",
"if",
"node",
"is",
"None",... | [
105,
0
] | [
132,
20
] | python | en | ['en', 'en', 'en'] | True |
math_dec_table | (self, func, expected_result, exitcode, node=None) | Check mathematical functions with Decimal256 using table tests.
| Check mathematical functions with Decimal256 using table tests.
| def math_dec_table(self, func, expected_result, exitcode, node=None):
"""Check mathematical functions with Decimal256 using table tests.
"""
min = Decimal256_min_max[0]
max = Decimal256_min_max[1]
if node is None:
node = self.context.node
table_name = f'table_{getuid()}'
with Give... | [
"def",
"math_dec_table",
"(",
"self",
",",
"func",
",",
"expected_result",
",",
"exitcode",
",",
"node",
"=",
"None",
")",
":",
"min",
"=",
"Decimal256_min_max",
"[",
"0",
"]",
"max",
"=",
"Decimal256_min_max",
"[",
"1",
"]",
"if",
"node",
"is",
"None",
... | [
136,
0
] | [
168,
20
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None) | Check that mathematical functions work with extended precision data types.
| Check that mathematical functions work with extended precision data types.
| def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None):
"""Check that mathematical functions work with extended precision data types.
"""
self.context.node = self.context.cluster.node(node)
self.context.mysql_node = self.context.cluster.node(mysql_node)
with allow_ex... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"mysql_node",
"=",
"\"mysql1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluste... | [
176,
0
] | [
186,
36
] | python | en | ['en', 'en', 'en'] | True |
ScanTreeForJsFiles | (root) | Scans a directory tree for JavaScript files.
Args:
root: str, Path to a root directory.
Returns:
An iterable of paths to JS files, relative to cwd.
| Scans a directory tree for JavaScript files. | def ScanTreeForJsFiles(root):
"""Scans a directory tree for JavaScript files.
Args:
root: str, Path to a root directory.
Returns:
An iterable of paths to JS files, relative to cwd.
"""
return ScanTree(root, path_filter=_JS_FILE_REGEX) | [
"def",
"ScanTreeForJsFiles",
"(",
"root",
")",
":",
"return",
"ScanTree",
"(",
"root",
",",
"path_filter",
"=",
"_JS_FILE_REGEX",
")"
] | [
30,
0
] | [
39,
51
] | python | en | ['en', 'en', 'en'] | True |
ScanTree | (root, path_filter=None, ignore_hidden=True) | Scans a directory tree for files.
Args:
root: str, Path to a root directory.
path_filter: A regular expression filter. If set, only paths matching
the path_filter are returned.
ignore_hidden: If True, do not follow or return hidden directories or files
(those starting with a '.' character).
... | Scans a directory tree for files. | def ScanTree(root, path_filter=None, ignore_hidden=True):
"""Scans a directory tree for files.
Args:
root: str, Path to a root directory.
path_filter: A regular expression filter. If set, only paths matching
the path_filter are returned.
ignore_hidden: If True, do not follow or return hidden dir... | [
"def",
"ScanTree",
"(",
"root",
",",
"path_filter",
"=",
"None",
",",
"ignore_hidden",
"=",
"True",
")",
":",
"def",
"OnError",
"(",
"os_error",
")",
":",
"raise",
"os_error",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
... | [
42,
0
] | [
77,
38
] | python | en | ['en', 'en', 'en'] | True |
_clean_bins | () |
Clean up the binary files and headers that are installed along with the bindings
|
Clean up the binary files and headers that are installed along with the bindings
| def _clean_bins():
"""
Clean up the binary files and headers that are installed along with the bindings
"""
rmtree(LIBS_DIR)
rmtree(BINS_DIR)
rmtree(HEADERS_DIR) | [
"def",
"_clean_bins",
"(",
")",
":",
"rmtree",
"(",
"LIBS_DIR",
")",
"rmtree",
"(",
"BINS_DIR",
")",
"rmtree",
"(",
"HEADERS_DIR",
")"
] | [
66,
0
] | [
72,
23
] | python | en | ['en', 'error', 'th'] | False |
_clean_native_build | () |
Clean the "build" directory in the z3 native root
|
Clean the "build" directory in the z3 native root
| def _clean_native_build():
"""
Clean the "build" directory in the z3 native root
"""
rmtree(BUILD_DIR) | [
"def",
"_clean_native_build",
"(",
")",
":",
"rmtree",
"(",
"BUILD_DIR",
")"
] | [
74,
0
] | [
78,
21
] | python | en | ['en', 'error', 'th'] | False |
_copy_bins | () |
Copy the library and header files into their final destinations
|
Copy the library and header files into their final destinations
| def _copy_bins():
"""
Copy the library and header files into their final destinations
"""
# STEP 1: If we're performing a build from a copied source tree,
# copy the generated python files into the package
_clean_bins()
python_dir = None
if RELEASE_DIR is not None:
python_dir =... | [
"def",
"_copy_bins",
"(",
")",
":",
"# STEP 1: If we're performing a build from a copied source tree,",
"# copy the generated python files into the package",
"_clean_bins",
"(",
")",
"python_dir",
"=",
"None",
"if",
"RELEASE_DIR",
"is",
"not",
"None",
":",
"python_dir",
"=",
... | [
120,
0
] | [
155,
90
] | python | en | ['en', 'error', 'th'] | False |
_copy_sources | () |
Prepare for a source distribution by assembling a minimal set of source files needed
for building
|
Prepare for a source distribution by assembling a minimal set of source files needed
for building
| def _copy_sources():
"""
Prepare for a source distribution by assembling a minimal set of source files needed
for building
"""
shutil.rmtree(SRC_DIR_LOCAL, ignore_errors=True)
os.mkdir(SRC_DIR_LOCAL)
shutil.copy(os.path.join(SRC_DIR_REPO, 'LICENSE.txt'), SRC_DIR_LOCAL)
shutil.copytree(o... | [
"def",
"_copy_sources",
"(",
")",
":",
"shutil",
".",
"rmtree",
"(",
"SRC_DIR_LOCAL",
",",
"ignore_errors",
"=",
"True",
")",
"os",
".",
"mkdir",
"(",
"SRC_DIR_LOCAL",
")",
"shutil",
".",
"copy",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SRC_DIR_REPO",
... | [
157,
0
] | [
175,
87
] | python | en | ['en', 'error', 'th'] | False |
schema_from_table | (table, schema=None) | Retrieve an ibis schema from a SQLAlchemy ``Table``.
Parameters
----------
table : sa.Table
Returns
-------
schema : ibis.expr.datatypes.Schema
An ibis schema corresponding to the types of the columns in `table`.
| Retrieve an ibis schema from a SQLAlchemy ``Table``. | def schema_from_table(table, schema=None):
"""Retrieve an ibis schema from a SQLAlchemy ``Table``.
Parameters
----------
table : sa.Table
Returns
-------
schema : ibis.expr.datatypes.Schema
An ibis schema corresponding to the types of the columns in `table`.
"""
schema = sc... | [
"def",
"schema_from_table",
"(",
"table",
",",
"schema",
"=",
"None",
")",
":",
"schema",
"=",
"schema",
"if",
"schema",
"is",
"not",
"None",
"else",
"{",
"}",
"pairs",
"=",
"[",
"]",
"for",
"name",
",",
"column",
"in",
"table",
".",
"columns",
".",
... | [
170,
0
] | [
194,
28
] | python | en | ['en', 'gd', 'en'] | True |
invalidates_reflection_cache | (f) | Invalidate the SQLAlchemy reflection cache if `f` performs an operation
that mutates database or table metadata such as ``CREATE TABLE``,
``DROP TABLE``, etc.
Parameters
----------
f : callable
A method on :class:`ibis.sql.alchemy.AlchemyClient`
| Invalidate the SQLAlchemy reflection cache if `f` performs an operation
that mutates database or table metadata such as ``CREATE TABLE``,
``DROP TABLE``, etc. | def invalidates_reflection_cache(f):
"""Invalidate the SQLAlchemy reflection cache if `f` performs an operation
that mutates database or table metadata such as ``CREATE TABLE``,
``DROP TABLE``, etc.
Parameters
----------
f : callable
A method on :class:`ibis.sql.alchemy.AlchemyClient`
... | [
"def",
"invalidates_reflection_cache",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"f",
"(",
"self",
",",
"*",
"args",
",",
... | [
892,
0
] | [
910,
18
] | python | en | ['en', 'en', 'en'] | True |
AlchemyContext.get_table | (self, expr) |
Get the memoized SQLAlchemy expression object
|
Get the memoized SQLAlchemy expression object
| def get_table(self, expr):
"""
Get the memoized SQLAlchemy expression object
"""
return self._get_table_item('_table_objects', expr) | [
"def",
"get_table",
"(",
"self",
",",
"expr",
")",
":",
"return",
"self",
".",
"_get_table_item",
"(",
"'_table_objects'",
",",
"expr",
")"
] | [
735,
4
] | [
739,
59
] | python | en | ['en', 'error', 'th'] | False |
AlchemyDatabaseSchema.__init__ | (self, name, database) |
Parameters
----------
name : str
database : AlchemyDatabase
| def __init__(self, name, database):
"""
Parameters
----------
name : str
database : AlchemyDatabase
"""
self.name = name
self.database = database
self.client = database.client | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"database",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"database",
"=",
"database",
"self",
".",
"client",
"=",
"database",
".",
"client"
] | [
783,
4
] | [
793,
37
] | python | en | ['en', 'error', 'th'] | False | |
AlchemyDatabaseSchema.drop | (self, force=False) |
Drop the schema
Parameters
----------
force : boolean, default False
Drop any objects if they exist, and do not fail if the schema does
not exist.
|
Drop the schema | def drop(self, force=False):
"""
Drop the schema
Parameters
----------
force : boolean, default False
Drop any objects if they exist, and do not fail if the schema does
not exist.
"""
raise NotImplementedError(
"Drop is not impleme... | [
"def",
"drop",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Drop is not implemented yet for sqlalchemy schemas\"",
")"
] | [
798,
4
] | [
809,
65
] | python | en | ['en', 'error', 'th'] | False |
AlchemyDatabaseSchema.table | (self, name) |
Return a table expression referencing a table in this schema
Returns
-------
table : TableExpr
|
Return a table expression referencing a table in this schema | def table(self, name):
"""
Return a table expression referencing a table in this schema
Returns
-------
table : TableExpr
"""
qualified_name = self._qualify(name)
return self.database.table(qualified_name, self.name) | [
"def",
"table",
"(",
"self",
",",
"name",
")",
":",
"qualified_name",
"=",
"self",
".",
"_qualify",
"(",
"name",
")",
"return",
"self",
".",
"database",
".",
"table",
"(",
"qualified_name",
",",
"self",
".",
"name",
")"
] | [
811,
4
] | [
820,
61
] | python | en | ['en', 'error', 'th'] | False |
AlchemyClient.list_tables | (self, like=None, database=None, schema=None) |
List tables/views in the current (or indicated) database.
Parameters
----------
like : string, default None
Checks for this string contained in name
database : string, default None
If not passed, uses the current/default database
Returns
---... |
List tables/views in the current (or indicated) database. | def list_tables(self, like=None, database=None, schema=None):
"""
List tables/views in the current (or indicated) database.
Parameters
----------
like : string, default None
Checks for this string contained in name
database : string, default None
If n... | [
"def",
"list_tables",
"(",
"self",
",",
"like",
"=",
"None",
",",
"database",
"=",
"None",
",",
"schema",
"=",
"None",
")",
":",
"inspector",
"=",
"self",
".",
"inspector",
"names",
"=",
"inspector",
".",
"get_table_names",
"(",
"schema",
"=",
"schema",
... | [
993,
4
] | [
1013,
28
] | python | en | ['en', 'error', 'th'] | False |
main | () | Calculate metrics from collected data, generate plots and tables. | Calculate metrics from collected data, generate plots and tables. | def main():
"""Calculate metrics from collected data, generate plots and tables."""
# metrics and plots for sidechannels
fr = print_sidechannel(
"reload",
start=0,
end=250,
step=5,
threshold=100,
direction="-",
clusters=[(0, 49), (150, 200), (600, 800)... | [
"def",
"main",
"(",
")",
":",
"# metrics and plots for sidechannels",
"fr",
"=",
"print_sidechannel",
"(",
"\"reload\"",
",",
"start",
"=",
"0",
",",
"end",
"=",
"250",
",",
"step",
"=",
"5",
",",
"threshold",
"=",
"100",
",",
"direction",
"=",
"\"-\"",
... | [
23,
0
] | [
59,
36
] | python | en | ['en', 'en', 'en'] | True |
print_sidechannel | (name, start, end, step, threshold, direction, clusters) | Print metrics for the given sidechannel. | Print metrics for the given sidechannel. | def print_sidechannel(name, start, end, step, threshold, direction, clusters):
"""Print metrics for the given sidechannel."""
name = f"sidechannel_{name}"
print(f"{name}:")
# read data
csv = pd.read_csv(f"data/{name}.csv")
cached = np.asarray(csv["cached"])
uncached = np.asarray(csv["uncac... | [
"def",
"print_sidechannel",
"(",
"name",
",",
"start",
",",
"end",
",",
"step",
",",
"threshold",
",",
"direction",
",",
"clusters",
")",
":",
"name",
"=",
"f\"sidechannel_{name}\"",
"print",
"(",
"f\"{name}:\"",
")",
"# read data",
"csv",
"=",
"pd",
".",
... | [
62,
0
] | [
98,
56
] | python | en | ['en', 'en', 'en'] | True |
plot_sidechannel | (fr, ff) | Plot histograms for given sidechannel data. | Plot histograms for given sidechannel data. | def plot_sidechannel(fr, ff):
"""Plot histograms for given sidechannel data."""
def plot_hist(ax, cached, uncached, start, end, step, threshold):
"""Plot a single histogram."""
bins = np.arange(start, end + 1, step)
ax.hist(cached, bins, alpha=0.7, label="im Cache", density=True, color... | [
"def",
"plot_sidechannel",
"(",
"fr",
",",
"ff",
")",
":",
"def",
"plot_hist",
"(",
"ax",
",",
"cached",
",",
"uncached",
",",
"start",
",",
"end",
",",
"step",
",",
"threshold",
")",
":",
"\"\"\"Plot a single histogram.\"\"\"",
"bins",
"=",
"np",
".",
"... | [
101,
0
] | [
132,
40
] | python | en | ['da', 'en', 'en'] | True |
calc_metrics_prefix | (prefix) | Print metrics for all data files with the given prefix. | Print metrics for all data files with the given prefix. | def calc_metrics_prefix(prefix):
"""Print metrics for all data files with the given prefix."""
for file in listdir("data"):
if file.startswith(prefix):
calc_metrics(file.rsplit(".", 1)[0])
print() | [
"def",
"calc_metrics_prefix",
"(",
"prefix",
")",
":",
"for",
"file",
"in",
"listdir",
"(",
"\"data\"",
")",
":",
"if",
"file",
".",
"startswith",
"(",
"prefix",
")",
":",
"calc_metrics",
"(",
"file",
".",
"rsplit",
"(",
"\".\"",
",",
"1",
")",
"[",
... | [
135,
0
] | [
140,
11
] | python | en | ['en', 'en', 'en'] | True |
calc_metrics | (name) | Print metrics for data file with the given name. | Print metrics for data file with the given name. | def calc_metrics(name):
"""Print metrics for data file with the given name."""
csv = pd.read_csv(f"data/{name}.csv")
print(f"{name}:")
for measure in csv:
samples = csv[measure]
# print mean and stdev for each metric
print(f" {measure:20}: {mean(samples):10.4g} ± {stdev(sampl... | [
"def",
"calc_metrics",
"(",
"name",
")",
":",
"csv",
"=",
"pd",
".",
"read_csv",
"(",
"f\"data/{name}.csv\"",
")",
"print",
"(",
"f\"{name}:\"",
")",
"for",
"measure",
"in",
"csv",
":",
"samples",
"=",
"csv",
"[",
"measure",
"]",
"# print mean and stdev for ... | [
143,
0
] | [
151,
81
] | python | en | ['en', 'en', 'en'] | True |
print_table_attack | (attack) | Print markdown table containing the metrics for the given attack's variants. | Print markdown table containing the metrics for the given attack's variants. | def print_table_attack(attack):
"""Print markdown table containing the metrics for the given attack's variants."""
variants = {
"default": "Basis",
"ff": "Flush+Flush",
"signal": "Signal",
"transient": "Transient",
"load": "Load",
"lp": "Load Port",
"kerne... | [
"def",
"print_table_attack",
"(",
"attack",
")",
":",
"variants",
"=",
"{",
"\"default\"",
":",
"\"Basis\"",
",",
"\"ff\"",
":",
"\"Flush+Flush\"",
",",
"\"signal\"",
":",
"\"Signal\"",
",",
"\"transient\"",
":",
"\"Transient\"",
",",
"\"load\"",
":",
"\"Load\""... | [
154,
0
] | [
220,
11
] | python | en | ['en', 'en', 'en'] | True |
main | () |
Trenutno gre skozi vse članke, če pride do že obstoječega, se ustavi
Za testiranje najboljše, da zamenjaš STEVILO_VSEH_STRANI z neko malo cifro,
da ne naloada vseh clankov, ker jih je ogromno
|
Trenutno gre skozi vse članke, če pride do že obstoječega, se ustavi
Za testiranje najboljše, da zamenjaš STEVILO_VSEH_STRANI z neko malo cifro,
da ne naloada vseh clankov, ker jih je ogromno
| def main():
driver = initDriver()
html = loadPage(my_url,driver,1)
i = 0
#ce se clanki niso uspesno nalozili, probaj max 10krat
while i < MAX_HTTP_RETRIES and html is NOT_FOUND:
html = loadPage(my_url,driver,1)
i+=1
NOVICE = []
STEVILO_VSEH_STRANI = getSteviloVsehStrani(my_u... | [
"def",
"main",
"(",
")",
":",
"driver",
"=",
"initDriver",
"(",
")",
"html",
"=",
"loadPage",
"(",
"my_url",
",",
"driver",
",",
"1",
")",
"i",
"=",
"0",
"#ce se clanki niso uspesno nalozili, probaj max 10krat",
"while",
"i",
"<",
"MAX_HTTP_RETRIES",
"and",
... | [
100,
0
] | [
154,
18
] | python | en | ['en', 'error', 'th'] | False |
aggregate_funcs_over_rows_frame | (self, func) | Checking aggregate funcs over rows frame.
| Checking aggregate funcs over rows frame.
| def aggregate_funcs_over_rows_frame(self, func):
"""Checking aggregate funcs over rows frame.
"""
execute_query(f"""
SELECT {func} OVER (ORDER BY salary, empno ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS func
FROM empsalary
"""
) | [
"def",
"aggregate_funcs_over_rows_frame",
"(",
"self",
",",
"func",
")",
":",
"execute_query",
"(",
"f\"\"\"\n SELECT {func} OVER (ORDER BY salary, empno ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS func\n FROM empsalary\n \"\"\"",
")"
] | [
75,
0
] | [
82,
5
] | python | en | ['en', 'en', 'en'] | True |
avg_with_nulls | (self) | Check `avg` aggregate function using a window that contains NULLs.
| Check `avg` aggregate function using a window that contains NULLs.
| def avg_with_nulls(self):
"""Check `avg` aggregate function using a window that contains NULLs.
"""
expected = convert_output("""
i | avg
---+--------------------
1 | 1.5
2 | 2
3 | \\N
4 | \\N
""")
execute_query("""
SELECT i, avg(v... | [
"def",
"avg_with_nulls",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n i | avg\n ---+--------------------\n 1 | 1.5\n 2 | 2\n 3 | \\\\N\n 4 | \\\\N\n \"\"\"",
")",
"execute_query",
"(",
"\"\"\"\n S... | [
85,
0
] | [
102,
5
] | python | en | ['en', 'en', 'en'] | True |
var_pop | (self) | Check `var_pop` aggregate function ove a window.
| Check `var_pop` aggregate function ove a window.
| def var_pop(self):
"""Check `var_pop` aggregate function ove a window.
"""
expected = convert_output("""
var_pop
-----------------------
21704
13868.75
11266.666666666666
4225
0
""")
execute_query("""
SELECT VAR_POP(n) OVER (ORDER BY i... | [
"def",
"var_pop",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n var_pop\n -----------------------\n 21704\n 13868.75\n 11266.666666666666\n 4225\n 0\n \"\"\"",
")",
"execute_query",
"(",
"\"\"\"\n SELEC... | [
105,
0
] | [
123,
5
] | python | en | ['en', 'en', 'en'] | True |
var_samp | (self) | Check `var_samp` aggregate function ove a window.
| Check `var_samp` aggregate function ove a window.
| def var_samp(self):
"""Check `var_samp` aggregate function ove a window.
"""
expected = convert_output("""
var_samp
-----------------------
27130
18491.666666666668
16900
8450
nan
""")
execute_query("""
SELECT VAR_SAMP(n) OVER (ORDER BY ... | [
"def",
"var_samp",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n var_samp\n -----------------------\n 27130\n 18491.666666666668\n 16900\n 8450\n nan\n \"\"\"",
")",
"execute_query",
"(",
"\"\"\"\n SELECT... | [
126,
0
] | [
144,
5
] | python | en | ['en', 'en', 'en'] | True |
stddevpop | (self) | Check `stddevPop` aggregate function ove a window.
| Check `stddevPop` aggregate function ove a window.
| def stddevpop(self):
"""Check `stddevPop` aggregate function ove a window.
"""
expected = convert_output("""
stddev_pop
---------------------
147.32277488562318
147.32277488562318
117.76565713313877
106.14455552060438
65
0
""")
execut... | [
"def",
"stddevpop",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n stddev_pop\n ---------------------\n 147.32277488562318\n 147.32277488562318\n 117.76565713313877\n 106.14455552060438\n 65\n 0\n \"\"\"",
")... | [
147,
0
] | [
166,
5
] | python | en | ['en', 'en', 'en'] | True |
stddevsamp | (self) | Check `stddevSamp` aggregate function ove a window.
| Check `stddevSamp` aggregate function ove a window.
| def stddevsamp(self):
"""Check `stddevSamp` aggregate function ove a window.
"""
expected = convert_output("""
stddev_samp
---------------------
164.7118696390761
164.7118696390761
135.9840676942217
130
91.92388155425118
nan
""")
execu... | [
"def",
"stddevsamp",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n stddev_samp\n ---------------------\n 164.7118696390761\n 164.7118696390761\n 135.9840676942217\n 130\n 91.92388155425118\n nan\n \"\"\"",
")... | [
169,
0
] | [
188,
5
] | python | en | ['en', 'en', 'en'] | True |
aggregate_function_recovers_from_nan | (self) | Check that aggregate function can recover from `nan` value inside a window.
| Check that aggregate function can recover from `nan` value inside a window.
| def aggregate_function_recovers_from_nan(self):
"""Check that aggregate function can recover from `nan` value inside a window.
"""
expected = convert_output("""
a | b | sum
---+-----+-----
1 | 1 | 1
2 | 2 | 3
3 | nan | nan
4 | 3 | nan
... | [
"def",
"aggregate_function_recovers_from_nan",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n a | b | sum\n ---+-----+-----\n 1 | 1 | 1\n 2 | 2 | 3\n 3 | nan | nan\n 4 | 3 | nan\n 5 | 4 | 7\n \"\"... | [
191,
0
] | [
210,
5
] | python | en | ['en', 'en', 'en'] | True |
bit_functions | (self) | Check trying to use bitwise functions over a window.
| Check trying to use bitwise functions over a window.
| def bit_functions(self):
"""Check trying to use bitwise functions over a window.
"""
expected = convert_output("""
i | b | bool_and | bool_or
---+---+----------+---------
1 | 1 | 1 | 1
2 | 1 | 0 | 1
3 | 0 | 0 | 0
4 | 0 | 0 | 1
5 | 1 | 1 | ... | [
"def",
"bit_functions",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n i | b | bool_and | bool_or\n ---+---+----------+---------\n 1 | 1 | 1 | 1\n 2 | 1 | 0 | 1\n 3 | 0 | 0 | 0\n 4 | 0 | 0 | 1\n 5 | 1 | 1 | 1... | [
213,
0
] | [
232,
5
] | python | en | ['en', 'en', 'en'] | True |
sum | (self) | Check calculation of sum over a window.
| Check calculation of sum over a window.
| def sum(self):
"""Check calculation of sum over a window.
"""
expected = convert_output("""
sum_1 | ten | four
-------+-----+------
0 | 0 | 0
0 | 0 | 0
2 | 0 | 2
3 | 1 | 3
4 | 1 | 1
5 | 1 | 1
3 | 3 | 3... | [
"def",
"sum",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum_1 | ten | four\n -------+-----+------\n 0 | 0 | 0\n 0 | 0 | 0\n 2 | 0 | 2\n 3 | 1 | 3\n 4 | 1 | 1\n 5 | 1 | 1\n ... | [
235,
0
] | [
256,
5
] | python | en | ['en', 'en', 'en'] | True |
nested_aggregates | (self) | Check using nested aggregates over a window.
| Check using nested aggregates over a window.
| def nested_aggregates(self):
"""Check using nested aggregates over a window.
"""
expected = convert_output("""
ten | two | gsum | wsum
-----+-----+-------+--------
0 | 0 | 45000 | 45000
2 | 0 | 47000 | 92000
4 | 0 | 49000 | 141000
6 | 0 | 51000 | 192000
... | [
"def",
"nested_aggregates",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n ten | two | gsum | wsum\n -----+-----+-------+--------\n 0 | 0 | 45000 | 45000\n 2 | 0 | 47000 | 92000\n 4 | 0 | 49000 | 141000\n 6 | 0 | 51000 | 192000... | [
259,
0
] | [
280,
5
] | python | en | ['en', 'en', 'en'] | True |
aggregate_and_window_function_in_the_same_window | (self) | Check using aggregate and window function in the same window.
| Check using aggregate and window function in the same window.
| def aggregate_and_window_function_in_the_same_window(self):
"""Check using aggregate and window function in the same window.
"""
expected = convert_output("""
sum | rank
-------+------
6000 | 1
16400 | 2
16400 | 2
20900 | 4
25100 | 5
3900 | 1
... | [
"def",
"aggregate_and_window_function_in_the_same_window",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | rank\n -------+------\n 6000 | 1\n 16400 | 2\n 16400 | 2\n 20900 | 4\n 25100 | 5\n 3900 | 1\n 7400 |... | [
283,
0
] | [
304,
5
] | python | en | ['en', 'en', 'en'] | True |
ungrouped_aggregate_over_empty_row_set | (self) | Check using window function with ungrouped aggregate over an empty row set.
| Check using window function with ungrouped aggregate over an empty row set.
| def ungrouped_aggregate_over_empty_row_set(self):
"""Check using window function with ungrouped aggregate over an empty row set.
"""
expected = convert_output("""
sum
-----
0
""")
execute_query(
"SELECT SUM(COUNT(number)) OVER () AS sum FROM numbers(10) WHERE number=42",
... | [
"def",
"ungrouped_aggregate_over_empty_row_set",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum\n -----\n 0\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT SUM(COUNT(number)) OVER () AS sum FROM numbers(10) WHERE number=42\"",
",",
"expect... | [
307,
0
] | [
319,
5
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check using aggregate functions over windows.
| Check using aggregate functions over windows.
| def feature(self):
"""Check using aggregate functions over windows.
"""
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",
")"
] | [
326,
0
] | [
330,
40
] | python | en | ['en', 'en', 'en'] | True |
error_more_than_one_order_by_column | (self) | Check that using more than one column in order by with range frame
returns an error.
| Check that using more than one column in order by with range frame
returns an error.
| def error_more_than_one_order_by_column(self):
"""Check that using more than one column in order by with range frame
returns an error.
"""
exitcode = 36
message = "DB::Exception: Received from localhost:9000. DB::Exception: The RANGE OFFSET window frame requires exactly one ORDER BY column, 2 given"... | [
"def",
"error_more_than_one_order_by_column",
"(",
"self",
")",
":",
"exitcode",
"=",
"36",
"message",
"=",
"\"DB::Exception: Received from localhost:9000. DB::Exception: The RANGE OFFSET window frame requires exactly one ORDER BY column, 2 given\"",
"sql",
"=",
"(",
"\"select sum(sala... | [
9,
0
] | [
20,
81
] | python | en | ['en', 'en', 'en'] | True |
error_missing_order_by | (self) | Check that using range frame with offsets without order by returns an error.
| Check that using range frame with offsets without order by returns an error.
| def error_missing_order_by(self):
"""Check that using range frame with offsets without order by returns an error.
"""
exitcode = 36
message = "DB::Exception: The RANGE OFFSET window frame requires exactly one ORDER BY column, 0 given"
sql = ("select sum(salary) over (range between 1 preceding and 2... | [
"def",
"error_missing_order_by",
"(",
"self",
")",
":",
"exitcode",
"=",
"36",
"message",
"=",
"\"DB::Exception: The RANGE OFFSET window frame requires exactly one ORDER BY column, 0 given\"",
"sql",
"=",
"(",
"\"select sum(salary) over (range between 1 preceding and 2 following) AS su... | [
23,
0
] | [
33,
81
] | python | en | ['en', 'en', 'en'] | True |
error_missing_order_by_with_partition_by_clause | (self) | Check that range frame with offsets used with partition by but
without order by returns an error.
| Check that range frame with offsets used with partition by but
without order by returns an error.
| def error_missing_order_by_with_partition_by_clause(self):
"""Check that range frame with offsets used with partition by but
without order by returns an error.
"""
exitcode = 36
message = "DB::Exception: The RANGE OFFSET window frame requires exactly one ORDER BY column, 0 given"
sql = ("select... | [
"def",
"error_missing_order_by_with_partition_by_clause",
"(",
"self",
")",
":",
"exitcode",
"=",
"36",
"message",
"=",
"\"DB::Exception: The RANGE OFFSET window frame requires exactly one ORDER BY column, 0 given\"",
"sql",
"=",
"(",
"\"select f1, sum(f1) over (partition by f1 range b... | [
36,
0
] | [
47,
81
] | python | en | ['en', 'en', 'en'] | True |
error_range_over_non_numerical_column | (self) | Check that range over non numerical column returns an error.
| Check that range over non numerical column returns an error.
| def error_range_over_non_numerical_column(self):
"""Check that range over non numerical column returns an error.
"""
exitcode = 48
message = "DB::Exception: The RANGE OFFSET frame for 'DB::ColumnLowCardinality' ORDER BY column is not implemented"
sql = ("select sum(salary) over (order by depname ra... | [
"def",
"error_range_over_non_numerical_column",
"(",
"self",
")",
":",
"exitcode",
"=",
"48",
"message",
"=",
"\"DB::Exception: The RANGE OFFSET frame for 'DB::ColumnLowCardinality' ORDER BY column is not implemented\"",
"sql",
"=",
"(",
"\"select sum(salary) over (order by depname ran... | [
50,
0
] | [
60,
81
] | python | en | ['en', 'gl', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.