Dataset Viewer
repository_name
stringlengths 7
54
| func_path_in_repository
stringlengths 5
179
| func_name
stringlengths 1
109
| whole_func_string
stringlengths 100
30.9k
| language
stringclasses 1
value | func_code_string
stringlengths 100
30.9k
| func_code_tokens
sequencelengths 20
3.12k
| func_documentation_string
stringlengths 1
29.9k
| func_documentation_tokens
sequencelengths 1
893
| split_name
stringclasses 1
value | func_code_url
stringlengths 91
272
| formatted_prompt
stringlengths 344
61k
| input_ids
sequencelengths 512
512
| attention_mask
sequencelengths 512
512
| labels
sequencelengths 512
512
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
zeromake/aiko | aiko/request.py | Request.fresh | def fresh(self) -> bool:
"""
检查请求缓存是否“新鲜”,也就是内容没有改变。
此方法用于 If-None-Match / ETag, 和 If-Modified-Since 和 Last-Modified 之间的缓存协商。
在设置一个或多个这些响应头后应该引用它。
"""
method_str = self.method
if method_str != 'GET' and method_str != 'HEAD':
return False
s = self.ctx.status
if (s >= 200 and s < 300) or s == 304:
return fresh(
self.headers,
(self.response and self.response.headers) or {},
)
return False | python | def fresh(self) -> bool:
"""
检查请求缓存是否“新鲜”,也就是内容没有改变。
此方法用于 If-None-Match / ETag, 和 If-Modified-Since 和 Last-Modified 之间的缓存协商。
在设置一个或多个这些响应头后应该引用它。
"""
method_str = self.method
if method_str != 'GET' and method_str != 'HEAD':
return False
s = self.ctx.status
if (s >= 200 and s < 300) or s == 304:
return fresh(
self.headers,
(self.response and self.response.headers) or {},
)
return False | [
"def",
"fresh",
"(",
"self",
")",
"->",
"bool",
":",
"method_str",
"=",
"self",
".",
"method",
"if",
"method_str",
"!=",
"'GET'",
"and",
"method_str",
"!=",
"'HEAD'",
":",
"return",
"False",
"s",
"=",
"self",
".",
"ctx",
".",
"status",
"if",
"(",
"s",
">=",
"200",
"and",
"s",
"<",
"300",
")",
"or",
"s",
"==",
"304",
":",
"return",
"fresh",
"(",
"self",
".",
"headers",
",",
"(",
"self",
".",
"response",
"and",
"self",
".",
"response",
".",
"headers",
")",
"or",
"{",
"}",
",",
")",
"return",
"False"
] | 检查请求缓存是否“新鲜”,也就是内容没有改变。
此方法用于 If-None-Match / ETag, 和 If-Modified-Since 和 Last-Modified 之间的缓存协商。
在设置一个或多个这些响应头后应该引用它。 | [
"检查请求缓存是否“新鲜”,也就是内容没有改变。",
"此方法用于",
"If",
"-",
"None",
"-",
"Match",
"/",
"ETag",
"和",
"If",
"-",
"Modified",
"-",
"Since",
"和",
"Last",
"-",
"Modified",
"之间的缓存协商。",
"在设置一个或多个这些响应头后应该引用它。"
] | train | https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/request.py#L567-L582 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
检查请求缓存是否“新鲜”,也就是内容没有改变。
此方法用于 If-None-Match / ETag, 和 If-Modified-Since 和 Last-Modified 之间的缓存协商。
在设置一个或多个这些响应头后应该引用它。
### Response:
def fresh(self) -> bool:
"""
检查请求缓存是否“新鲜”,也就是内容没有改变。
此方法用于 If-None-Match / ETag, 和 If-Modified-Since 和 Last-Modified 之间的缓存协商。
在设置一个或多个这些响应头后应该引用它。
"""
method_str = self.method
if method_str != 'GET' and method_str != 'HEAD':
return False
s = self.ctx.status
if (s >= 200 and s < 300) or s == 304:
return fresh(
self.headers,
(self.response and self.response.headers) or {},
)
return False
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
118686,
35959,
115536,
25359,
65571,
2118,
17039,
118882,
34690,
75863,
103179,
44915,
81543,
125992,
9174,
286,
117665,
41007,
114593,
1442,
12,
4155,
5364,
759,
611,
469,
5786,
11,
59243,
1442,
12,
19696,
6354,
1736,
59243,
8155,
12,
19696,
107215,
18363,
9554,
115536,
25359,
107047,
33122,
9174,
286,
74662,
45018,
48044,
58291,
43240,
19483,
108787,
105861,
51611,
65455,
34547,
107585,
117811,
103282,
3490,
14711,
6075,
512,
755,
7878,
1214,
8,
1492,
1845,
512,
286,
3270,
286,
111909,
222,
33976,
35959,
115536,
25359,
65571,
2118,
17039,
118882,
34690,
75863,
103179,
44915,
81543,
125992,
9174,
286,
117665,
41007,
114593,
1442,
12,
4155,
5364,
759,
611,
469,
5786,
11,
59243,
1442,
12,
19696,
6354,
1736,
59243,
8155,
12,
19696,
107215,
18363,
9554,
115536,
25359,
107047,
33122,
9174,
286,
74662,
45018,
48044,
58291,
43240,
19483,
108787,
105861,
51611,
65455,
34547,
107585,
117811,
103282,
9174,
286,
3270,
286,
1749,
2966,
284,
659,
13204,
198,
286,
422,
1749,
2966,
976,
364,
3891,
6,
323,
1749,
2966,
976,
364,
36533,
3730,
310,
471,
3641,
198,
286,
274,
284,
659,
31708,
4397,
198,
286,
422,
320,
82,
2669,
220,
1049,
323,
274,
366,
220,
3101,
8,
477,
274,
624,
220,
12166,
512,
310,
471,
7878,
1021,
394,
659,
18510,
345,
394,
320,
726,
11616,
323,
659,
11616,
18510,
8,
477,
14915,
310,
1763,
286,
471,
3641,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
118686,
35959,
115536,
25359,
65571,
2118,
17039,
118882,
34690,
75863,
103179,
44915,
81543,
125992,
9174,
286,
117665,
41007,
114593,
1442,
12,
4155,
5364,
759,
611,
469,
5786,
11,
59243,
1442,
12,
19696,
6354,
1736,
59243,
8155,
12,
19696,
107215,
18363,
9554,
115536,
25359,
107047,
33122,
9174,
286,
74662,
45018,
48044,
58291,
43240,
19483,
108787,
105861,
51611,
65455,
34547,
107585,
117811,
103282,
3490,
14711,
6075,
512,
755,
7878,
1214,
8,
1492,
1845,
512,
286,
3270,
286,
111909,
222,
33976,
35959,
115536,
25359,
65571,
2118,
17039,
118882,
34690,
75863,
103179,
44915,
81543,
125992,
9174,
286,
117665,
41007,
114593,
1442,
12,
4155,
5364,
759,
611,
469,
5786,
11,
59243,
1442,
12,
19696,
6354,
1736,
59243,
8155,
12,
19696,
107215,
18363,
9554,
115536,
25359,
107047,
33122,
9174,
286,
74662,
45018,
48044,
58291,
43240,
19483,
108787,
105861,
51611,
65455,
34547,
107585,
117811,
103282,
9174,
286,
3270,
286,
1749,
2966,
284,
659,
13204,
198,
286,
422,
1749,
2966,
976,
364,
3891,
6,
323,
1749,
2966,
976,
364,
36533,
3730,
310,
471,
3641,
198,
286,
274,
284,
659,
31708,
4397,
198,
286,
422,
320,
82,
2669,
220,
1049,
323,
274,
366,
220,
3101,
8,
477,
274,
624,
220,
12166,
512,
310,
471,
7878,
1021,
394,
659,
18510,
345,
394,
320,
726,
11616,
323,
659,
11616,
18510,
8,
477,
14915,
310,
1763,
286,
471,
3641,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
gem/oq-engine | openquake/hmtk/models.py | SeismicSource.attrib | def attrib(self):
"""
General XML element attributes for a seismic source, as a dict.
"""
return dict([
('id', str(self.id)),
('name', str(self.name)),
('tectonicRegion', str(self.trt)),
]) | python | def attrib(self):
"""
General XML element attributes for a seismic source, as a dict.
"""
return dict([
('id', str(self.id)),
('name', str(self.name)),
('tectonicRegion', str(self.trt)),
]) | [
"def",
"attrib",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"[",
"(",
"'id'",
",",
"str",
"(",
"self",
".",
"id",
")",
")",
",",
"(",
"'name'",
",",
"str",
"(",
"self",
".",
"name",
")",
")",
",",
"(",
"'tectonicRegion'",
",",
"str",
"(",
"self",
".",
"trt",
")",
")",
",",
"]",
")"
] | General XML element attributes for a seismic source, as a dict. | [
"General",
"XML",
"element",
"attributes",
"for",
"a",
"seismic",
"source",
"as",
"a",
"dict",
"."
] | train | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/models.py#L53-L61 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
General XML element attributes for a seismic source, as a dict.
### Response:
def attrib(self):
"""
General XML element attributes for a seismic source, as a dict.
"""
return dict([
('id', str(self.id)),
('name', str(self.name)),
('tectonicRegion', str(self.trt)),
])
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
15777,
12138,
2449,
8365,
369,
264,
72579,
2592,
11,
439,
264,
6587,
382,
14711,
6075,
512,
755,
17780,
1214,
997,
286,
3270,
286,
3331,
12138,
2449,
8365,
369,
264,
72579,
2592,
11,
439,
264,
6587,
627,
286,
3270,
286,
471,
6587,
9133,
310,
4417,
307,
518,
610,
1214,
1801,
7110,
310,
4417,
609,
518,
610,
1214,
2710,
7110,
310,
4417,
83,
440,
14338,
14422,
518,
610,
1214,
5543,
83,
7110,
286,
24371,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
15777,
12138,
2449,
8365,
369,
264,
72579,
2592,
11,
439,
264,
6587,
382,
14711,
6075,
512,
755,
17780,
1214,
997,
286,
3270,
286,
3331,
12138,
2449,
8365,
369,
264,
72579,
2592,
11,
439,
264,
6587,
627,
286,
3270,
286,
471,
6587,
9133,
310,
4417,
307,
518,
610,
1214,
1801,
7110,
310,
4417,
609,
518,
610,
1214,
2710,
7110,
310,
4417,
83,
440,
14338,
14422,
518,
610,
1214,
5543,
83,
7110,
286,
24371,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
nicolargo/glances | glances/plugins/glances_memswap.py | Plugin.update_views | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert and log
self.views['used']['decoration'] = self.get_alert_log(self.stats['used'], maximum=self.stats['total']) | python | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert and log
self.views['used']['decoration'] = self.get_alert_log(self.stats['used'], maximum=self.stats['total']) | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics informations",
"# Alert and log",
"self",
".",
"views",
"[",
"'used'",
"]",
"[",
"'decoration'",
"]",
"=",
"self",
".",
"get_alert_log",
"(",
"self",
".",
"stats",
"[",
"'used'",
"]",
",",
"maximum",
"=",
"self",
".",
"stats",
"[",
"'total'",
"]",
")"
] | Update stats views. | [
"Update",
"stats",
"views",
"."
] | train | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_memswap.py#L130-L137 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Update stats views.
### Response:
def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert and log
self.views['used']['decoration'] = self.get_alert_log(self.stats['used'], maximum=self.stats['total'])
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
4387,
10691,
6325,
382,
14711,
6075,
512,
755,
2713,
40598,
1214,
997,
286,
4304,
4387,
10691,
6325,
14781,
286,
674,
7290,
279,
7126,
596,
1749,
198,
286,
2307,
7,
11807,
11,
659,
570,
2443,
40598,
2892,
286,
674,
2758,
49449,
44827,
198,
286,
674,
14302,
323,
1515,
198,
286,
659,
22831,
681,
2656,
4274,
451,
27550,
663,
284,
659,
673,
36817,
5337,
1214,
30956,
681,
2656,
4181,
7340,
7822,
30956,
681,
5143,
7519,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
4387,
10691,
6325,
382,
14711,
6075,
512,
755,
2713,
40598,
1214,
997,
286,
4304,
4387,
10691,
6325,
14781,
286,
674,
7290,
279,
7126,
596,
1749,
198,
286,
2307,
7,
11807,
11,
659,
570,
2443,
40598,
2892,
286,
674,
2758,
49449,
44827,
198,
286,
674,
14302,
323,
1515,
198,
286,
659,
22831,
681,
2656,
4274,
451,
27550,
663,
284,
659,
673,
36817,
5337,
1214,
30956,
681,
2656,
4181,
7340,
7822,
30956,
681,
5143,
7519,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
SuryaSankar/flask-sqlalchemy-booster | flask_sqlalchemy_booster/model_booster/queryable_mixin.py | QueryableMixin.add | def add(cls, model, commit=True):
"""Adds a model instance to session and commits the
transaction.
Args:
model: The instance to add.
Examples:
>>> customer = Customer.new(name="hari", email="[email protected]")
>>> Customer.add(customer)
[email protected]
"""
if not isinstance(model, cls):
raise ValueError('%s is not of type %s' % (model, cls))
cls.session.add(model)
try:
if commit:
cls.session.commit()
return model
except:
cls.session.rollback()
raise | python | def add(cls, model, commit=True):
"""Adds a model instance to session and commits the
transaction.
Args:
model: The instance to add.
Examples:
>>> customer = Customer.new(name="hari", email="[email protected]")
>>> Customer.add(customer)
[email protected]
"""
if not isinstance(model, cls):
raise ValueError('%s is not of type %s' % (model, cls))
cls.session.add(model)
try:
if commit:
cls.session.commit()
return model
except:
cls.session.rollback()
raise | [
"def",
"add",
"(",
"cls",
",",
"model",
",",
"commit",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"model",
",",
"cls",
")",
":",
"raise",
"ValueError",
"(",
"'%s is not of type %s'",
"%",
"(",
"model",
",",
"cls",
")",
")",
"cls",
".",
"session",
".",
"add",
"(",
"model",
")",
"try",
":",
"if",
"commit",
":",
"cls",
".",
"session",
".",
"commit",
"(",
")",
"return",
"model",
"except",
":",
"cls",
".",
"session",
".",
"rollback",
"(",
")",
"raise"
] | Adds a model instance to session and commits the
transaction.
Args:
model: The instance to add.
Examples:
>>> customer = Customer.new(name="hari", email="[email protected]")
>>> Customer.add(customer)
[email protected] | [
"Adds",
"a",
"model",
"instance",
"to",
"session",
"and",
"commits",
"the",
"transaction",
"."
] | train | https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/model_booster/queryable_mixin.py#L389-L413 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Adds a model instance to session and commits the
transaction.
Args:
model: The instance to add.
Examples:
>>> customer = Customer.new(name="hari", email="[email protected]")
>>> Customer.add(customer)
[email protected]
### Response:
def add(cls, model, commit=True):
"""Adds a model instance to session and commits the
transaction.
Args:
model: The instance to add.
Examples:
>>> customer = Customer.new(name="hari", email="[email protected]")
>>> Customer.add(customer)
[email protected]
"""
if not isinstance(model, cls):
raise ValueError('%s is not of type %s' % (model, cls))
cls.session.add(model)
try:
if commit:
cls.session.commit()
return model
except:
cls.session.rollback()
raise
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
73211,
264,
1646,
2937,
311,
3882,
323,
42635,
279,
198,
286,
7901,
382,
286,
18161,
1473,
310,
1646,
25,
578,
2937,
311,
923,
382,
286,
26379,
1473,
310,
12382,
6130,
284,
12557,
4721,
3232,
429,
77007,
498,
2613,
429,
77007,
10591,
916,
5240,
310,
12382,
12557,
1388,
40421,
340,
310,
70796,
10591,
916,
271,
14711,
6075,
512,
755,
923,
21024,
11,
1646,
11,
5379,
3702,
997,
286,
4304,
73211,
264,
1646,
2937,
311,
3882,
323,
42635,
279,
198,
286,
7901,
382,
286,
18161,
1473,
310,
1646,
25,
578,
2937,
311,
923,
382,
286,
26379,
1473,
310,
12382,
6130,
284,
12557,
4721,
3232,
429,
77007,
498,
2613,
429,
77007,
10591,
916,
5240,
310,
12382,
12557,
1388,
40421,
340,
310,
70796,
10591,
916,
198,
286,
3270,
286,
422,
539,
11656,
7790,
11,
13082,
997,
310,
4933,
15764,
16428,
82,
374,
539,
315,
955,
1034,
82,
6,
1034,
320,
2590,
11,
13082,
1192,
286,
13082,
10387,
1388,
7790,
340,
286,
1456,
512,
310,
422,
5379,
512,
394,
13082,
10387,
16105,
746,
310,
471,
1646,
198,
286,
3734,
512,
310,
13082,
10387,
59111,
746,
310,
4933,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
73211,
264,
1646,
2937,
311,
3882,
323,
42635,
279,
198,
286,
7901,
382,
286,
18161,
1473,
310,
1646,
25,
578,
2937,
311,
923,
382,
286,
26379,
1473,
310,
12382,
6130,
284,
12557,
4721,
3232,
429,
77007,
498,
2613,
429,
77007,
10591,
916,
5240,
310,
12382,
12557,
1388,
40421,
340,
310,
70796,
10591,
916,
271,
14711,
6075,
512,
755,
923,
21024,
11,
1646,
11,
5379,
3702,
997,
286,
4304,
73211,
264,
1646,
2937,
311,
3882,
323,
42635,
279,
198,
286,
7901,
382,
286,
18161,
1473,
310,
1646,
25,
578,
2937,
311,
923,
382,
286,
26379,
1473,
310,
12382,
6130,
284,
12557,
4721,
3232,
429,
77007,
498,
2613,
429,
77007,
10591,
916,
5240,
310,
12382,
12557,
1388,
40421,
340,
310,
70796,
10591,
916,
198,
286,
3270,
286,
422,
539,
11656,
7790,
11,
13082,
997,
310,
4933,
15764,
16428,
82,
374,
539,
315,
955,
1034,
82,
6,
1034,
320,
2590,
11,
13082,
1192,
286,
13082,
10387,
1388,
7790,
340,
286,
1456,
512,
310,
422,
5379,
512,
394,
13082,
10387,
16105,
746,
310,
471,
1646,
198,
286,
3734,
512,
310,
13082,
10387,
59111,
746,
310,
4933,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
jbasko/pytest-random-order | random_order/bucket_types.py | bucket_type_key | def bucket_type_key(bucket_type):
"""
Registers a function that calculates test item key for the specified bucket type.
"""
def decorator(f):
@functools.wraps(f)
def wrapped(item, session):
key = f(item)
if session is not None:
for handler in session.random_order_bucket_type_key_handlers:
key = handler(item, key)
return key
bucket_type_keys[bucket_type] = wrapped
return wrapped
return decorator | python | def bucket_type_key(bucket_type):
"""
Registers a function that calculates test item key for the specified bucket type.
"""
def decorator(f):
@functools.wraps(f)
def wrapped(item, session):
key = f(item)
if session is not None:
for handler in session.random_order_bucket_type_key_handlers:
key = handler(item, key)
return key
bucket_type_keys[bucket_type] = wrapped
return wrapped
return decorator | [
"def",
"bucket_type_key",
"(",
"bucket_type",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapped",
"(",
"item",
",",
"session",
")",
":",
"key",
"=",
"f",
"(",
"item",
")",
"if",
"session",
"is",
"not",
"None",
":",
"for",
"handler",
"in",
"session",
".",
"random_order_bucket_type_key_handlers",
":",
"key",
"=",
"handler",
"(",
"item",
",",
"key",
")",
"return",
"key",
"bucket_type_keys",
"[",
"bucket_type",
"]",
"=",
"wrapped",
"return",
"wrapped",
"return",
"decorator"
] | Registers a function that calculates test item key for the specified bucket type. | [
"Registers",
"a",
"function",
"that",
"calculates",
"test",
"item",
"key",
"for",
"the",
"specified",
"bucket",
"type",
"."
] | train | https://github.com/jbasko/pytest-random-order/blob/e8ff95fcd097f9f330638cf58cc1b24983fdde15/random_order/bucket_types.py#L8-L28 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Registers a function that calculates test item key for the specified bucket type.
### Response:
def bucket_type_key(bucket_type):
"""
Registers a function that calculates test item key for the specified bucket type.
"""
def decorator(f):
@functools.wraps(f)
def wrapped(item, session):
key = f(item)
if session is not None:
for handler in session.random_order_bucket_type_key_handlers:
key = handler(item, key)
return key
bucket_type_keys[bucket_type] = wrapped
return wrapped
return decorator
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
93178,
264,
734,
430,
48517,
1296,
1537,
1401,
369,
279,
5300,
15994,
955,
382,
14711,
6075,
512,
755,
15994,
1857,
3173,
60034,
1857,
997,
262,
3270,
262,
55874,
264,
734,
430,
48517,
1296,
1537,
1401,
369,
279,
5300,
15994,
955,
627,
262,
12713,
262,
711,
51778,
968,
7887,
286,
571,
12158,
302,
6309,
82393,
2690,
968,
340,
286,
711,
20037,
5508,
11,
3882,
997,
310,
1401,
284,
282,
5508,
696,
310,
422,
3882,
374,
539,
2290,
512,
394,
369,
7158,
304,
3882,
7985,
8028,
39849,
1857,
3173,
58137,
512,
504,
1401,
284,
7158,
5508,
11,
1401,
696,
310,
471,
1401,
271,
286,
15994,
1857,
12919,
18990,
11400,
1857,
60,
284,
20037,
198,
286,
471,
20037,
271,
262,
471,
51778,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
93178,
264,
734,
430,
48517,
1296,
1537,
1401,
369,
279,
5300,
15994,
955,
382,
14711,
6075,
512,
755,
15994,
1857,
3173,
60034,
1857,
997,
262,
3270,
262,
55874,
264,
734,
430,
48517,
1296,
1537,
1401,
369,
279,
5300,
15994,
955,
627,
262,
12713,
262,
711,
51778,
968,
7887,
286,
571,
12158,
302,
6309,
82393,
2690,
968,
340,
286,
711,
20037,
5508,
11,
3882,
997,
310,
1401,
284,
282,
5508,
696,
310,
422,
3882,
374,
539,
2290,
512,
394,
369,
7158,
304,
3882,
7985,
8028,
39849,
1857,
3173,
58137,
512,
504,
1401,
284,
7158,
5508,
11,
1401,
696,
310,
471,
1401,
271,
286,
15994,
1857,
12919,
18990,
11400,
1857,
60,
284,
20037,
198,
286,
471,
20037,
271,
262,
471,
51778,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
python/core-workflow | cherry_picker/cherry_picker/cherry_picker.py | normalize_commit_message | def normalize_commit_message(commit_message):
"""
Return a tuple of title and body from the commit message
"""
split_commit_message = commit_message.split("\n")
title = split_commit_message[0]
body = "\n".join(split_commit_message[1:])
return title, body.lstrip("\n") | python | def normalize_commit_message(commit_message):
"""
Return a tuple of title and body from the commit message
"""
split_commit_message = commit_message.split("\n")
title = split_commit_message[0]
body = "\n".join(split_commit_message[1:])
return title, body.lstrip("\n") | [
"def",
"normalize_commit_message",
"(",
"commit_message",
")",
":",
"split_commit_message",
"=",
"commit_message",
".",
"split",
"(",
"\"\\n\"",
")",
"title",
"=",
"split_commit_message",
"[",
"0",
"]",
"body",
"=",
"\"\\n\"",
".",
"join",
"(",
"split_commit_message",
"[",
"1",
":",
"]",
")",
"return",
"title",
",",
"body",
".",
"lstrip",
"(",
"\"\\n\"",
")"
] | Return a tuple of title and body from the commit message | [
"Return",
"a",
"tuple",
"of",
"title",
"and",
"body",
"from",
"the",
"commit",
"message"
] | train | https://github.com/python/core-workflow/blob/b93c76195f6db382cfcefee334380fb4c68d4e21/cherry_picker/cherry_picker/cherry_picker.py#L713-L720 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Return a tuple of title and body from the commit message
### Response:
def normalize_commit_message(commit_message):
"""
Return a tuple of title and body from the commit message
"""
split_commit_message = commit_message.split("\n")
title = split_commit_message[0]
body = "\n".join(split_commit_message[1:])
return title, body.lstrip("\n")
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
5715,
264,
14743,
315,
2316,
323,
2547,
505,
279,
5379,
1984,
271,
14711,
6075,
512,
755,
22436,
37446,
6598,
70670,
6598,
997,
262,
3270,
262,
3494,
264,
14743,
315,
2316,
323,
2547,
505,
279,
5379,
1984,
198,
262,
3270,
262,
6859,
37446,
6598,
284,
5379,
6598,
5402,
5026,
77,
1158,
262,
2316,
284,
6859,
37446,
6598,
58,
15,
933,
262,
2547,
284,
2990,
77,
3343,
6115,
41055,
37446,
6598,
58,
16,
44157,
262,
471,
2316,
11,
2547,
929,
13406,
5026,
77,
1158,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
5715,
264,
14743,
315,
2316,
323,
2547,
505,
279,
5379,
1984,
271,
14711,
6075,
512,
755,
22436,
37446,
6598,
70670,
6598,
997,
262,
3270,
262,
3494,
264,
14743,
315,
2316,
323,
2547,
505,
279,
5379,
1984,
198,
262,
3270,
262,
6859,
37446,
6598,
284,
5379,
6598,
5402,
5026,
77,
1158,
262,
2316,
284,
6859,
37446,
6598,
58,
15,
933,
262,
2547,
284,
2990,
77,
3343,
6115,
41055,
37446,
6598,
58,
16,
44157,
262,
471,
2316,
11,
2547,
929,
13406,
5026,
77,
1158,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
clalancette/pycdlib | pycdlib/pycdlib.py | _yield_children | def _yield_children(rec):
# type: (dr.DirectoryRecord) -> Generator
'''
An internal function to gather and yield all of the children of a Directory
Record.
Parameters:
rec - The Directory Record to get all of the children from (must be a
directory)
Yields:
Children of this Directory Record.
Returns:
Nothing.
'''
if not rec.is_dir():
raise pycdlibexception.PyCdlibInvalidInput('Record is not a directory!')
last = b''
for child in rec.children:
# Check to see if the filename of this child is the same as the
# last one, and if so, skip the child. This can happen if we
# have very large files with more than one directory entry.
fi = child.file_identifier()
if fi == last:
continue
last = fi
if child.rock_ridge is not None and child.rock_ridge.child_link_record_exists() and child.rock_ridge.cl_to_moved_dr is not None and child.rock_ridge.cl_to_moved_dr.parent is not None:
# If this is the case, this is a relocated entry. We actually
# want to go find the entry this was relocated to; we do that
# by following the child_link, then going up to the parent and
# finding the entry that links to the same one as this one.
cl_parent = child.rock_ridge.cl_to_moved_dr.parent
for cl_child in cl_parent.children:
if cl_child.rock_ridge is not None and cl_child.rock_ridge.name() == child.rock_ridge.name():
child = cl_child
break
# If we ended up not finding the right one in the parent of the
# moved entry, weird, but just return the one we would have
# anyway.
yield child | python | def _yield_children(rec):
# type: (dr.DirectoryRecord) -> Generator
'''
An internal function to gather and yield all of the children of a Directory
Record.
Parameters:
rec - The Directory Record to get all of the children from (must be a
directory)
Yields:
Children of this Directory Record.
Returns:
Nothing.
'''
if not rec.is_dir():
raise pycdlibexception.PyCdlibInvalidInput('Record is not a directory!')
last = b''
for child in rec.children:
# Check to see if the filename of this child is the same as the
# last one, and if so, skip the child. This can happen if we
# have very large files with more than one directory entry.
fi = child.file_identifier()
if fi == last:
continue
last = fi
if child.rock_ridge is not None and child.rock_ridge.child_link_record_exists() and child.rock_ridge.cl_to_moved_dr is not None and child.rock_ridge.cl_to_moved_dr.parent is not None:
# If this is the case, this is a relocated entry. We actually
# want to go find the entry this was relocated to; we do that
# by following the child_link, then going up to the parent and
# finding the entry that links to the same one as this one.
cl_parent = child.rock_ridge.cl_to_moved_dr.parent
for cl_child in cl_parent.children:
if cl_child.rock_ridge is not None and cl_child.rock_ridge.name() == child.rock_ridge.name():
child = cl_child
break
# If we ended up not finding the right one in the parent of the
# moved entry, weird, but just return the one we would have
# anyway.
yield child | [
"def",
"_yield_children",
"(",
"rec",
")",
":",
"# type: (dr.DirectoryRecord) -> Generator",
"if",
"not",
"rec",
".",
"is_dir",
"(",
")",
":",
"raise",
"pycdlibexception",
".",
"PyCdlibInvalidInput",
"(",
"'Record is not a directory!'",
")",
"last",
"=",
"b''",
"for",
"child",
"in",
"rec",
".",
"children",
":",
"# Check to see if the filename of this child is the same as the",
"# last one, and if so, skip the child. This can happen if we",
"# have very large files with more than one directory entry.",
"fi",
"=",
"child",
".",
"file_identifier",
"(",
")",
"if",
"fi",
"==",
"last",
":",
"continue",
"last",
"=",
"fi",
"if",
"child",
".",
"rock_ridge",
"is",
"not",
"None",
"and",
"child",
".",
"rock_ridge",
".",
"child_link_record_exists",
"(",
")",
"and",
"child",
".",
"rock_ridge",
".",
"cl_to_moved_dr",
"is",
"not",
"None",
"and",
"child",
".",
"rock_ridge",
".",
"cl_to_moved_dr",
".",
"parent",
"is",
"not",
"None",
":",
"# If this is the case, this is a relocated entry. We actually",
"# want to go find the entry this was relocated to; we do that",
"# by following the child_link, then going up to the parent and",
"# finding the entry that links to the same one as this one.",
"cl_parent",
"=",
"child",
".",
"rock_ridge",
".",
"cl_to_moved_dr",
".",
"parent",
"for",
"cl_child",
"in",
"cl_parent",
".",
"children",
":",
"if",
"cl_child",
".",
"rock_ridge",
"is",
"not",
"None",
"and",
"cl_child",
".",
"rock_ridge",
".",
"name",
"(",
")",
"==",
"child",
".",
"rock_ridge",
".",
"name",
"(",
")",
":",
"child",
"=",
"cl_child",
"break",
"# If we ended up not finding the right one in the parent of the",
"# moved entry, weird, but just return the one we would have",
"# anyway.",
"yield",
"child"
] | An internal function to gather and yield all of the children of a Directory
Record.
Parameters:
rec - The Directory Record to get all of the children from (must be a
directory)
Yields:
Children of this Directory Record.
Returns:
Nothing. | [
"An",
"internal",
"function",
"to",
"gather",
"and",
"yield",
"all",
"of",
"the",
"children",
"of",
"a",
"Directory",
"Record",
"."
] | train | https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/pycdlib.py#L417-L458 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
An internal function to gather and yield all of the children of a Directory
Record.
Parameters:
rec - The Directory Record to get all of the children from (must be a
directory)
Yields:
Children of this Directory Record.
Returns:
Nothing.
### Response:
def _yield_children(rec):
# type: (dr.DirectoryRecord) -> Generator
'''
An internal function to gather and yield all of the children of a Directory
Record.
Parameters:
rec - The Directory Record to get all of the children from (must be a
directory)
Yields:
Children of this Directory Record.
Returns:
Nothing.
'''
if not rec.is_dir():
raise pycdlibexception.PyCdlibInvalidInput('Record is not a directory!')
last = b''
for child in rec.children:
# Check to see if the filename of this child is the same as the
# last one, and if so, skip the child. This can happen if we
# have very large files with more than one directory entry.
fi = child.file_identifier()
if fi == last:
continue
last = fi
if child.rock_ridge is not None and child.rock_ridge.child_link_record_exists() and child.rock_ridge.cl_to_moved_dr is not None and child.rock_ridge.cl_to_moved_dr.parent is not None:
# If this is the case, this is a relocated entry. We actually
# want to go find the entry this was relocated to; we do that
# by following the child_link, then going up to the parent and
# finding the entry that links to the same one as this one.
cl_parent = child.rock_ridge.cl_to_moved_dr.parent
for cl_child in cl_parent.children:
if cl_child.rock_ridge is not None and cl_child.rock_ridge.name() == child.rock_ridge.name():
child = cl_child
break
# If we ended up not finding the right one in the parent of the
# moved entry, weird, but just return the one we would have
# anyway.
yield child
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
2127,
5419,
734,
311,
9762,
323,
7692,
682,
315,
279,
2911,
315,
264,
18524,
198,
262,
13896,
382,
262,
13831,
512,
257,
1421,
482,
578,
18524,
13896,
311,
636,
682,
315,
279,
2911,
505,
320,
25849,
387,
264,
198,
1881,
6352,
340,
262,
816,
7052,
512,
257,
15394,
315,
420,
18524,
13896,
627,
262,
5295,
512,
257,
12334,
382,
14711,
6075,
512,
755,
721,
30796,
32306,
21285,
997,
262,
674,
955,
25,
320,
3696,
55207,
6607,
8,
1492,
29458,
198,
262,
11414,
262,
1556,
5419,
734,
311,
9762,
323,
7692,
682,
315,
279,
2911,
315,
264,
18524,
198,
262,
13896,
382,
262,
13831,
512,
257,
1421,
482,
578,
18524,
13896,
311,
636,
682,
315,
279,
2911,
505,
320,
25849,
387,
264,
198,
1881,
6352,
340,
262,
816,
7052,
512,
257,
15394,
315,
420,
18524,
13896,
627,
262,
5295,
512,
257,
12334,
627,
262,
11414,
262,
422,
539,
1421,
2124,
4432,
4019,
286,
4933,
281,
3418,
67,
2808,
7959,
1087,
88,
91300,
2808,
8087,
2566,
493,
6607,
374,
539,
264,
6352,
100073,
262,
1566,
284,
293,
72572,
262,
369,
1716,
304,
1421,
13664,
512,
286,
674,
4343,
311,
1518,
422,
279,
3986,
315,
420,
1716,
374,
279,
1890,
439,
279,
198,
286,
674,
1566,
832,
11,
323,
422,
779,
11,
10936,
279,
1716,
13,
220,
1115,
649,
3621,
422,
584,
198,
286,
674,
617,
1633,
3544,
3626,
449,
810,
1109,
832,
6352,
4441,
627,
286,
9314,
284,
1716,
9914,
34276,
746,
286,
422,
9314,
624,
1566,
512,
310,
3136,
271,
286,
1566,
284,
9314,
198,
286,
422,
1716,
13,
21161,
1745,
6614,
374,
539,
2290,
323,
1716,
13,
21161,
1745,
6614,
17990,
7381,
14526,
9965,
368,
323,
1716,
13,
21161,
1745,
6614,
6894,
2401,
722,
5047,
27778,
374,
539,
2290,
323,
1716,
13,
21161,
1745,
6614,
6894,
2401,
722,
5047,
27778,
8829,
374,
539,
2290,
512,
310,
674,
1442,
420,
374,
279,
1162,
11,
420,
374,
264,
70209,
4441,
13,
220,
1226,
3604,
198,
310,
674,
1390,
311,
733,
1505,
279,
4441,
420,
574,
70209,
311,
26,
584,
656,
430,
198,
310,
674,
555,
2768,
279,
1716,
7381,
11,
1243,
2133,
709,
311,
279,
2748,
323,
198,
310,
674,
9455,
279,
4441,
430,
7902,
311,
279,
1890,
832,
439,
420,
832,
627,
310,
1206,
16340,
284,
1716,
13,
21161,
1745,
6614,
6894,
2401,
722,
5047,
27778,
8829,
198,
310,
369,
1206,
17716,
304,
1206,
16340,
13664,
512,
394,
422,
1206,
17716,
13,
21161,
1745,
6614,
374,
539,
2290,
323,
1206,
17716,
13,
21161,
1745,
6614,
2710,
368,
624,
1716,
13,
21161,
1745,
6614,
2710,
4019,
504,
1716,
284,
1206,
17716,
198,
504,
1464,
198,
310,
674,
1442,
584,
9670,
709,
539,
9455,
279,
1314,
832,
304,
279,
2748,
315,
279,
198,
310,
674,
7882,
4441,
11,
16682,
11,
719,
1120,
471,
279,
832,
584,
1053,
617,
198,
310,
674,
13971,
382,
286,
7692,
1716
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
2127,
5419,
734,
311,
9762,
323,
7692,
682,
315,
279,
2911,
315,
264,
18524,
198,
262,
13896,
382,
262,
13831,
512,
257,
1421,
482,
578,
18524,
13896,
311,
636,
682,
315,
279,
2911,
505,
320,
25849,
387,
264,
198,
1881,
6352,
340,
262,
816,
7052,
512,
257,
15394,
315,
420,
18524,
13896,
627,
262,
5295,
512,
257,
12334,
382,
14711,
6075,
512,
755,
721,
30796,
32306,
21285,
997,
262,
674,
955,
25,
320,
3696,
55207,
6607,
8,
1492,
29458,
198,
262,
11414,
262,
1556,
5419,
734,
311,
9762,
323,
7692,
682,
315,
279,
2911,
315,
264,
18524,
198,
262,
13896,
382,
262,
13831,
512,
257,
1421,
482,
578,
18524,
13896,
311,
636,
682,
315,
279,
2911,
505,
320,
25849,
387,
264,
198,
1881,
6352,
340,
262,
816,
7052,
512,
257,
15394,
315,
420,
18524,
13896,
627,
262,
5295,
512,
257,
12334,
627,
262,
11414,
262,
422,
539,
1421,
2124,
4432,
4019,
286,
4933,
281,
3418,
67,
2808,
7959,
1087,
88,
91300,
2808,
8087,
2566,
493,
6607,
374,
539,
264,
6352,
100073,
262,
1566,
284,
293,
72572,
262,
369,
1716,
304,
1421,
13664,
512,
286,
674,
4343,
311,
1518,
422,
279,
3986,
315,
420,
1716,
374,
279,
1890,
439,
279,
198,
286,
674,
1566,
832,
11,
323,
422,
779,
11,
10936,
279,
1716,
13,
220,
1115,
649,
3621,
422,
584,
198,
286,
674,
617,
1633,
3544,
3626,
449,
810,
1109,
832,
6352,
4441,
627,
286,
9314,
284,
1716,
9914,
34276,
746,
286,
422,
9314,
624,
1566,
512,
310,
3136,
271,
286,
1566,
284,
9314,
198,
286,
422,
1716,
13,
21161,
1745,
6614,
374,
539,
2290,
323,
1716,
13,
21161,
1745,
6614,
17990,
7381,
14526,
9965,
368,
323,
1716,
13,
21161,
1745,
6614,
6894,
2401,
722,
5047,
27778,
374,
539,
2290,
323,
1716,
13,
21161,
1745,
6614,
6894,
2401,
722,
5047,
27778,
8829,
374,
539,
2290,
512,
310,
674,
1442,
420,
374,
279,
1162,
11,
420,
374,
264,
70209,
4441,
13,
220,
1226,
3604,
198,
310,
674,
1390,
311,
733,
1505,
279,
4441,
420,
574,
70209,
311,
26,
584,
656,
430,
198,
310,
674,
555,
2768,
279,
1716,
7381,
11,
1243,
2133,
709,
311,
279,
2748,
323,
198,
310,
674,
9455,
279,
4441,
430,
7902,
311,
279,
1890,
832,
439,
420,
832,
627,
310,
1206,
16340,
284,
1716,
13,
21161,
1745,
6614,
6894,
2401,
722,
5047,
27778,
8829,
198,
310,
369,
1206,
17716,
304,
1206,
16340,
13664,
512,
394,
422,
1206,
17716,
13,
21161,
1745,
6614,
374,
539,
2290,
323,
1206,
17716,
13,
21161,
1745,
6614,
2710,
368,
624,
1716,
13,
21161,
1745,
6614,
2710,
4019,
504,
1716,
284,
1206,
17716,
198,
504,
1464,
198,
310,
674,
1442,
584,
9670,
709,
539,
9455,
279,
1314,
832,
304,
279,
2748,
315,
279,
198,
310,
674,
7882,
4441,
11,
16682,
11,
719,
1120,
471,
279,
832,
584,
1053,
617,
198,
310,
674,
13971,
382,
286,
7692,
1716
] |
monarch-initiative/dipper | dipper/utils/GraphUtils.py | GraphUtils.get_properties_from_graph | def get_properties_from_graph(graph):
"""
Wrapper for RDFLib.graph.predicates() that returns a unique set
:param graph: RDFLib.graph
:return: set, set of properties
"""
# collapse to single list
property_set = set()
for row in graph.predicates():
property_set.add(row)
return property_set | python | def get_properties_from_graph(graph):
"""
Wrapper for RDFLib.graph.predicates() that returns a unique set
:param graph: RDFLib.graph
:return: set, set of properties
"""
# collapse to single list
property_set = set()
for row in graph.predicates():
property_set.add(row)
return property_set | [
"def",
"get_properties_from_graph",
"(",
"graph",
")",
":",
"# collapse to single list",
"property_set",
"=",
"set",
"(",
")",
"for",
"row",
"in",
"graph",
".",
"predicates",
"(",
")",
":",
"property_set",
".",
"add",
"(",
"row",
")",
"return",
"property_set"
] | Wrapper for RDFLib.graph.predicates() that returns a unique set
:param graph: RDFLib.graph
:return: set, set of properties | [
"Wrapper",
"for",
"RDFLib",
".",
"graph",
".",
"predicates",
"()",
"that",
"returns",
"a",
"unique",
"set",
":",
"param",
"graph",
":",
"RDFLib",
".",
"graph",
":",
"return",
":",
"set",
"set",
"of",
"properties"
] | train | https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/GraphUtils.py#L49-L60 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Wrapper for RDFLib.graph.predicates() that returns a unique set
:param graph: RDFLib.graph
:return: set, set of properties
### Response:
def get_properties_from_graph(graph):
"""
Wrapper for RDFLib.graph.predicates() that returns a unique set
:param graph: RDFLib.graph
:return: set, set of properties
"""
# collapse to single list
property_set = set()
for row in graph.predicates():
property_set.add(row)
return property_set
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
11803,
369,
69499,
9374,
10996,
75195,
25858,
368,
430,
4780,
264,
5016,
743,
198,
286,
551,
913,
4876,
25,
69499,
9374,
10996,
198,
286,
551,
693,
25,
743,
11,
743,
315,
6012,
271,
14711,
6075,
512,
755,
636,
26216,
5791,
15080,
25301,
997,
286,
3270,
286,
36588,
369,
69499,
9374,
10996,
75195,
25858,
368,
430,
4780,
264,
5016,
743,
198,
286,
551,
913,
4876,
25,
69499,
9374,
10996,
198,
286,
551,
693,
25,
743,
11,
743,
315,
6012,
198,
286,
3270,
286,
674,
18678,
311,
3254,
1160,
198,
286,
3424,
2667,
284,
743,
746,
286,
369,
2872,
304,
4876,
75195,
25858,
4019,
310,
3424,
2667,
1388,
7991,
696,
286,
471,
3424,
2667,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
11803,
369,
69499,
9374,
10996,
75195,
25858,
368,
430,
4780,
264,
5016,
743,
198,
286,
551,
913,
4876,
25,
69499,
9374,
10996,
198,
286,
551,
693,
25,
743,
11,
743,
315,
6012,
271,
14711,
6075,
512,
755,
636,
26216,
5791,
15080,
25301,
997,
286,
3270,
286,
36588,
369,
69499,
9374,
10996,
75195,
25858,
368,
430,
4780,
264,
5016,
743,
198,
286,
551,
913,
4876,
25,
69499,
9374,
10996,
198,
286,
551,
693,
25,
743,
11,
743,
315,
6012,
198,
286,
3270,
286,
674,
18678,
311,
3254,
1160,
198,
286,
3424,
2667,
284,
743,
746,
286,
369,
2872,
304,
4876,
75195,
25858,
4019,
310,
3424,
2667,
1388,
7991,
696,
286,
471,
3424,
2667,
198,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
NICTA/revrand | revrand/basis_functions.py | FastFoodRBF.grad | def grad(self, X, lenscale=None):
r"""
Get the gradients of this basis w.r.t.\ the length scale.
Parameters
----------
x: ndarray
(n, d) array of observations where n is the number of samples, and
d is the dimensionality of x.
lenscale: scalar or ndarray
scalar or array of shape (d,) length scales (one for each dimension
of x).If not input, this uses the value of the initial length
scale.
Returns
-------
ndarray:
shape (n, 2*nbases) where nbases is number of random rbf bases,
again to the nearest larger two power. This is
:math:`\partial \phi(\mathbf{x}) / \partial l`
"""
d = X.shape[1]
lenscale = self._check_dim(d, lenscale)
VX = self._makeVX(X / lenscale)
sinVX = - np.sin(VX)
cosVX = np.cos(VX)
dPhi = []
for i, l in enumerate(lenscale):
indlen = np.zeros(d)
indlen[i] = 1. / l**2
dVX = - self._makeVX(X * indlen) # FIXME make this more efficient?
dPhi.append(np.hstack((dVX * sinVX, dVX * cosVX)) /
np.sqrt(self.n))
return np.dstack(dPhi) if len(lenscale) != 1 else dPhi[0] | python | def grad(self, X, lenscale=None):
r"""
Get the gradients of this basis w.r.t.\ the length scale.
Parameters
----------
x: ndarray
(n, d) array of observations where n is the number of samples, and
d is the dimensionality of x.
lenscale: scalar or ndarray
scalar or array of shape (d,) length scales (one for each dimension
of x).If not input, this uses the value of the initial length
scale.
Returns
-------
ndarray:
shape (n, 2*nbases) where nbases is number of random rbf bases,
again to the nearest larger two power. This is
:math:`\partial \phi(\mathbf{x}) / \partial l`
"""
d = X.shape[1]
lenscale = self._check_dim(d, lenscale)
VX = self._makeVX(X / lenscale)
sinVX = - np.sin(VX)
cosVX = np.cos(VX)
dPhi = []
for i, l in enumerate(lenscale):
indlen = np.zeros(d)
indlen[i] = 1. / l**2
dVX = - self._makeVX(X * indlen) # FIXME make this more efficient?
dPhi.append(np.hstack((dVX * sinVX, dVX * cosVX)) /
np.sqrt(self.n))
return np.dstack(dPhi) if len(lenscale) != 1 else dPhi[0] | [
"def",
"grad",
"(",
"self",
",",
"X",
",",
"lenscale",
"=",
"None",
")",
":",
"d",
"=",
"X",
".",
"shape",
"[",
"1",
"]",
"lenscale",
"=",
"self",
".",
"_check_dim",
"(",
"d",
",",
"lenscale",
")",
"VX",
"=",
"self",
".",
"_makeVX",
"(",
"X",
"/",
"lenscale",
")",
"sinVX",
"=",
"-",
"np",
".",
"sin",
"(",
"VX",
")",
"cosVX",
"=",
"np",
".",
"cos",
"(",
"VX",
")",
"dPhi",
"=",
"[",
"]",
"for",
"i",
",",
"l",
"in",
"enumerate",
"(",
"lenscale",
")",
":",
"indlen",
"=",
"np",
".",
"zeros",
"(",
"d",
")",
"indlen",
"[",
"i",
"]",
"=",
"1.",
"/",
"l",
"**",
"2",
"dVX",
"=",
"-",
"self",
".",
"_makeVX",
"(",
"X",
"*",
"indlen",
")",
"# FIXME make this more efficient?",
"dPhi",
".",
"append",
"(",
"np",
".",
"hstack",
"(",
"(",
"dVX",
"*",
"sinVX",
",",
"dVX",
"*",
"cosVX",
")",
")",
"/",
"np",
".",
"sqrt",
"(",
"self",
".",
"n",
")",
")",
"return",
"np",
".",
"dstack",
"(",
"dPhi",
")",
"if",
"len",
"(",
"lenscale",
")",
"!=",
"1",
"else",
"dPhi",
"[",
"0",
"]"
] | r"""
Get the gradients of this basis w.r.t.\ the length scale.
Parameters
----------
x: ndarray
(n, d) array of observations where n is the number of samples, and
d is the dimensionality of x.
lenscale: scalar or ndarray
scalar or array of shape (d,) length scales (one for each dimension
of x).If not input, this uses the value of the initial length
scale.
Returns
-------
ndarray:
shape (n, 2*nbases) where nbases is number of random rbf bases,
again to the nearest larger two power. This is
:math:`\partial \phi(\mathbf{x}) / \partial l` | [
"r",
"Get",
"the",
"gradients",
"of",
"this",
"basis",
"w",
".",
"r",
".",
"t",
".",
"\\",
"the",
"length",
"scale",
"."
] | train | https://github.com/NICTA/revrand/blob/4c1881b6c1772d2b988518e49dde954f165acfb6/revrand/basis_functions.py#L1292-L1329 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
r"""
Get the gradients of this basis w.r.t.\ the length scale.
Parameters
----------
x: ndarray
(n, d) array of observations where n is the number of samples, and
d is the dimensionality of x.
lenscale: scalar or ndarray
scalar or array of shape (d,) length scales (one for each dimension
of x).If not input, this uses the value of the initial length
scale.
Returns
-------
ndarray:
shape (n, 2*nbases) where nbases is number of random rbf bases,
again to the nearest larger two power. This is
:math:`\partial \phi(\mathbf{x}) / \partial l`
### Response:
def grad(self, X, lenscale=None):
r"""
Get the gradients of this basis w.r.t.\ the length scale.
Parameters
----------
x: ndarray
(n, d) array of observations where n is the number of samples, and
d is the dimensionality of x.
lenscale: scalar or ndarray
scalar or array of shape (d,) length scales (one for each dimension
of x).If not input, this uses the value of the initial length
scale.
Returns
-------
ndarray:
shape (n, 2*nbases) where nbases is number of random rbf bases,
again to the nearest larger two power. This is
:math:`\partial \phi(\mathbf{x}) / \partial l`
"""
d = X.shape[1]
lenscale = self._check_dim(d, lenscale)
VX = self._makeVX(X / lenscale)
sinVX = - np.sin(VX)
cosVX = np.cos(VX)
dPhi = []
for i, l in enumerate(lenscale):
indlen = np.zeros(d)
indlen[i] = 1. / l**2
dVX = - self._makeVX(X * indlen) # FIXME make this more efficient?
dPhi.append(np.hstack((dVX * sinVX, dVX * cosVX)) /
np.sqrt(self.n))
return np.dstack(dPhi) if len(lenscale) != 1 else dPhi[0]
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
81,
7275,
286,
2175,
279,
53249,
315,
420,
8197,
289,
1783,
739,
7255,
279,
3160,
5569,
382,
286,
13831,
198,
286,
31423,
286,
865,
25,
67983,
198,
310,
320,
77,
11,
294,
8,
1358,
315,
24654,
1405,
308,
374,
279,
1396,
315,
10688,
11,
323,
198,
310,
294,
374,
279,
13167,
2786,
315,
865,
627,
286,
18848,
2296,
25,
17722,
477,
67983,
198,
310,
17722,
477,
1358,
315,
6211,
320,
67,
47121,
3160,
29505,
320,
606,
369,
1855,
13167,
198,
310,
315,
865,
570,
2746,
539,
1988,
11,
420,
5829,
279,
907,
315,
279,
2926,
3160,
198,
310,
5569,
4286,
286,
5295,
198,
286,
39707,
286,
67983,
512,
310,
6211,
320,
77,
11,
220,
17,
9,
18571,
2315,
8,
1405,
17062,
2315,
374,
1396,
315,
4288,
436,
13536,
23963,
345,
310,
1578,
311,
279,
24379,
8294,
1403,
2410,
13,
1115,
374,
198,
310,
551,
10590,
19258,
59,
38520,
1144,
17247,
11781,
10590,
13536,
46440,
5525,
611,
1144,
38520,
326,
19884,
14711,
6075,
512,
755,
6117,
1214,
11,
1630,
11,
18848,
2296,
5980,
997,
286,
436,
7275,
286,
2175,
279,
53249,
315,
420,
8197,
289,
1783,
739,
7255,
279,
3160,
5569,
382,
286,
13831,
198,
286,
31423,
286,
865,
25,
67983,
198,
310,
320,
77,
11,
294,
8,
1358,
315,
24654,
1405,
308,
374,
279,
1396,
315,
10688,
11,
323,
198,
310,
294,
374,
279,
13167,
2786,
315,
865,
627,
286,
18848,
2296,
25,
17722,
477,
67983,
198,
310,
17722,
477,
1358,
315,
6211,
320,
67,
47121,
3160,
29505,
320,
606,
369,
1855,
13167,
198,
310,
315,
865,
570,
2746,
539,
1988,
11,
420,
5829,
279,
907,
315,
279,
2926,
3160,
198,
310,
5569,
4286,
286,
5295,
198,
286,
39707,
286,
67983,
512,
310,
6211,
320,
77,
11,
220,
17,
9,
18571,
2315,
8,
1405,
17062,
2315,
374,
1396,
315,
4288,
436,
13536,
23963,
345,
310,
1578,
311,
279,
24379,
8294,
1403,
2410,
13,
1115,
374,
198,
310,
551,
10590,
19258,
59,
38520,
1144,
17247,
11781,
10590,
13536,
46440,
5525,
611,
1144,
38520,
326,
4077,
286,
3270,
286,
294,
284,
1630,
7201,
58,
16,
933,
286,
18848,
2296,
284,
659,
1462,
2071,
11024,
1528,
11,
18848,
2296,
696,
286,
79277,
284,
659,
1462,
7072,
53,
55,
7799,
611,
18848,
2296,
340,
286,
7589,
53,
55,
284,
482,
2660,
16719,
12692,
55,
340,
286,
8119,
53,
55,
284,
2660,
21832,
12692,
55,
696,
286,
294,
46267,
284,
4260,
286,
369,
602,
11,
326,
304,
13555,
2387,
729,
2296,
997,
310,
1280,
2963,
284,
2660,
13064,
1528,
340,
310,
1280,
2963,
1004,
60,
284,
220,
16,
13,
611,
326,
334,
17,
198,
310,
294,
53,
55,
284,
482,
659,
1462,
7072,
53,
55,
7799,
353,
1280,
2963,
8,
220,
674,
28575,
1304,
420,
810,
11297,
5380,
310,
294,
46267,
2102,
10101,
78601,
1209,
67,
53,
55,
353,
7589,
53,
55,
11,
294,
53,
55,
353,
8119
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
81,
7275,
286,
2175,
279,
53249,
315,
420,
8197,
289,
1783,
739,
7255,
279,
3160,
5569,
382,
286,
13831,
198,
286,
31423,
286,
865,
25,
67983,
198,
310,
320,
77,
11,
294,
8,
1358,
315,
24654,
1405,
308,
374,
279,
1396,
315,
10688,
11,
323,
198,
310,
294,
374,
279,
13167,
2786,
315,
865,
627,
286,
18848,
2296,
25,
17722,
477,
67983,
198,
310,
17722,
477,
1358,
315,
6211,
320,
67,
47121,
3160,
29505,
320,
606,
369,
1855,
13167,
198,
310,
315,
865,
570,
2746,
539,
1988,
11,
420,
5829,
279,
907,
315,
279,
2926,
3160,
198,
310,
5569,
4286,
286,
5295,
198,
286,
39707,
286,
67983,
512,
310,
6211,
320,
77,
11,
220,
17,
9,
18571,
2315,
8,
1405,
17062,
2315,
374,
1396,
315,
4288,
436,
13536,
23963,
345,
310,
1578,
311,
279,
24379,
8294,
1403,
2410,
13,
1115,
374,
198,
310,
551,
10590,
19258,
59,
38520,
1144,
17247,
11781,
10590,
13536,
46440,
5525,
611,
1144,
38520,
326,
19884,
14711,
6075,
512,
755,
6117,
1214,
11,
1630,
11,
18848,
2296,
5980,
997,
286,
436,
7275,
286,
2175,
279,
53249,
315,
420,
8197,
289,
1783,
739,
7255,
279,
3160,
5569,
382,
286,
13831,
198,
286,
31423,
286,
865,
25,
67983,
198,
310,
320,
77,
11,
294,
8,
1358,
315,
24654,
1405,
308,
374,
279,
1396,
315,
10688,
11,
323,
198,
310,
294,
374,
279,
13167,
2786,
315,
865,
627,
286,
18848,
2296,
25,
17722,
477,
67983,
198,
310,
17722,
477,
1358,
315,
6211,
320,
67,
47121,
3160,
29505,
320,
606,
369,
1855,
13167,
198,
310,
315,
865,
570,
2746,
539,
1988,
11,
420,
5829,
279,
907,
315,
279,
2926,
3160,
198,
310,
5569,
4286,
286,
5295,
198,
286,
39707,
286,
67983,
512,
310,
6211,
320,
77,
11,
220,
17,
9,
18571,
2315,
8,
1405,
17062,
2315,
374,
1396,
315,
4288,
436,
13536,
23963,
345,
310,
1578,
311,
279,
24379,
8294,
1403,
2410,
13,
1115,
374,
198,
310,
551,
10590,
19258,
59,
38520,
1144,
17247,
11781,
10590,
13536,
46440,
5525,
611,
1144,
38520,
326,
4077,
286,
3270,
286,
294,
284,
1630,
7201,
58,
16,
933,
286,
18848,
2296,
284,
659,
1462,
2071,
11024,
1528,
11,
18848,
2296,
696,
286,
79277,
284,
659,
1462,
7072,
53,
55,
7799,
611,
18848,
2296,
340,
286,
7589,
53,
55,
284,
482,
2660,
16719,
12692,
55,
340,
286,
8119,
53,
55,
284,
2660,
21832,
12692,
55,
696,
286,
294,
46267,
284,
4260,
286,
369,
602,
11,
326,
304,
13555,
2387,
729,
2296,
997,
310,
1280,
2963,
284,
2660,
13064,
1528,
340,
310,
1280,
2963,
1004,
60,
284,
220,
16,
13,
611,
326,
334,
17,
198,
310,
294,
53,
55,
284,
482,
659,
1462,
7072,
53,
55,
7799,
353,
1280,
2963,
8,
220,
674,
28575,
1304,
420,
810,
11297,
5380,
310,
294,
46267,
2102,
10101,
78601,
1209,
67,
53,
55,
353,
7589,
53,
55,
11,
294,
53,
55,
353,
8119
] |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.root_item_selected | def root_item_selected(self, item):
"""Root item has been selected: expanding it and collapsing others"""
if self.show_all_files:
return
for root_item in self.get_top_level_items():
if root_item is item:
self.expandItem(root_item)
else:
self.collapseItem(root_item) | python | def root_item_selected(self, item):
"""Root item has been selected: expanding it and collapsing others"""
if self.show_all_files:
return
for root_item in self.get_top_level_items():
if root_item is item:
self.expandItem(root_item)
else:
self.collapseItem(root_item) | [
"def",
"root_item_selected",
"(",
"self",
",",
"item",
")",
":",
"if",
"self",
".",
"show_all_files",
":",
"return",
"for",
"root_item",
"in",
"self",
".",
"get_top_level_items",
"(",
")",
":",
"if",
"root_item",
"is",
"item",
":",
"self",
".",
"expandItem",
"(",
"root_item",
")",
"else",
":",
"self",
".",
"collapseItem",
"(",
"root_item",
")"
] | Root item has been selected: expanding it and collapsing others | [
"Root",
"item",
"has",
"been",
"selected",
":",
"expanding",
"it",
"and",
"collapsing",
"others"
] | train | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L530-L538 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Root item has been selected: expanding it and collapsing others
### Response:
def root_item_selected(self, item):
"""Root item has been selected: expanding it and collapsing others"""
if self.show_all_files:
return
for root_item in self.get_top_level_items():
if root_item is item:
self.expandItem(root_item)
else:
self.collapseItem(root_item)
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
8605,
1537,
706,
1027,
4183,
25,
24050,
433,
323,
72618,
3885,
271,
14711,
6075,
512,
755,
3789,
5752,
24689,
1214,
11,
1537,
5903,
286,
4304,
8605,
1537,
706,
1027,
4183,
25,
24050,
433,
323,
72618,
3885,
37925,
286,
422,
659,
5577,
5823,
11171,
2904,
310,
471,
319,
286,
369,
3789,
5752,
304,
659,
673,
10643,
8438,
12408,
21812,
310,
422,
3789,
5752,
374,
1537,
2904,
394,
659,
28837,
1256,
9387,
5752,
1240,
310,
775,
2904,
394,
659,
522,
11019,
1256,
9387,
5752,
340,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
8605,
1537,
706,
1027,
4183,
25,
24050,
433,
323,
72618,
3885,
271,
14711,
6075,
512,
755,
3789,
5752,
24689,
1214,
11,
1537,
5903,
286,
4304,
8605,
1537,
706,
1027,
4183,
25,
24050,
433,
323,
72618,
3885,
37925,
286,
422,
659,
5577,
5823,
11171,
2904,
310,
471,
319,
286,
369,
3789,
5752,
304,
659,
673,
10643,
8438,
12408,
21812,
310,
422,
3789,
5752,
374,
1537,
2904,
394,
659,
28837,
1256,
9387,
5752,
1240,
310,
775,
2904,
394,
659,
522,
11019,
1256,
9387,
5752,
340,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
facelessuser/wcmatch | wcmatch/glob.py | Glob._match_excluded | def _match_excluded(self, filename, patterns):
"""Call match real directly to skip unnecessary `exists` check."""
return _wcparse._match_real(
filename, patterns._include, patterns._exclude, patterns._follow, self.symlinks
) | python | def _match_excluded(self, filename, patterns):
"""Call match real directly to skip unnecessary `exists` check."""
return _wcparse._match_real(
filename, patterns._include, patterns._exclude, patterns._follow, self.symlinks
) | [
"def",
"_match_excluded",
"(",
"self",
",",
"filename",
",",
"patterns",
")",
":",
"return",
"_wcparse",
".",
"_match_real",
"(",
"filename",
",",
"patterns",
".",
"_include",
",",
"patterns",
".",
"_exclude",
",",
"patterns",
".",
"_follow",
",",
"self",
".",
"symlinks",
")"
] | Call match real directly to skip unnecessary `exists` check. | [
"Call",
"match",
"real",
"directly",
"to",
"skip",
"unnecessary",
"exists",
"check",
"."
] | train | https://github.com/facelessuser/wcmatch/blob/d153e7007cc73b994ae1ba553dc4584039f5c212/wcmatch/glob.py#L142-L147 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Call match real directly to skip unnecessary `exists` check.
### Response:
def _match_excluded(self, filename, patterns):
"""Call match real directly to skip unnecessary `exists` check."""
return _wcparse._match_real(
filename, patterns._include, patterns._exclude, patterns._follow, self.symlinks
)
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
7368,
2489,
1972,
6089,
311,
10936,
26225,
1595,
16703,
63,
1817,
382,
14711,
6075,
512,
755,
721,
6481,
2769,
10391,
1214,
11,
3986,
11,
12912,
997,
286,
4304,
7368,
2489,
1972,
6089,
311,
10936,
26225,
1595,
16703,
63,
1817,
30284,
286,
471,
721,
24990,
6534,
1462,
6481,
15624,
1021,
310,
3986,
11,
12912,
1462,
1012,
11,
12912,
1462,
33513,
11,
12912,
1462,
19070,
11,
659,
78677,
1029,
15872,
198,
286,
1763,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
7368,
2489,
1972,
6089,
311,
10936,
26225,
1595,
16703,
63,
1817,
382,
14711,
6075,
512,
755,
721,
6481,
2769,
10391,
1214,
11,
3986,
11,
12912,
997,
286,
4304,
7368,
2489,
1972,
6089,
311,
10936,
26225,
1595,
16703,
63,
1817,
30284,
286,
471,
721,
24990,
6534,
1462,
6481,
15624,
1021,
310,
3986,
11,
12912,
1462,
1012,
11,
12912,
1462,
33513,
11,
12912,
1462,
19070,
11,
659,
78677,
1029,
15872,
198,
286,
1763,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
atztogo/phonopy | phonopy/structure/spglib.py | get_pointgroup | def get_pointgroup(rotations):
"""Return point group in international table symbol and number.
The symbols are mapped to the numbers as follows:
1 "1 "
2 "-1 "
3 "2 "
4 "m "
5 "2/m "
6 "222 "
7 "mm2 "
8 "mmm "
9 "4 "
10 "-4 "
11 "4/m "
12 "422 "
13 "4mm "
14 "-42m "
15 "4/mmm"
16 "3 "
17 "-3 "
18 "32 "
19 "3m "
20 "-3m "
21 "6 "
22 "-6 "
23 "6/m "
24 "622 "
25 "6mm "
26 "-62m "
27 "6/mmm"
28 "23 "
29 "m-3 "
30 "432 "
31 "-43m "
32 "m-3m "
"""
_set_no_error()
# (symbol, pointgroup_number, transformation_matrix)
pointgroup = spg.pointgroup(np.array(rotations, dtype='intc', order='C'))
_set_error_message()
return pointgroup | python | def get_pointgroup(rotations):
"""Return point group in international table symbol and number.
The symbols are mapped to the numbers as follows:
1 "1 "
2 "-1 "
3 "2 "
4 "m "
5 "2/m "
6 "222 "
7 "mm2 "
8 "mmm "
9 "4 "
10 "-4 "
11 "4/m "
12 "422 "
13 "4mm "
14 "-42m "
15 "4/mmm"
16 "3 "
17 "-3 "
18 "32 "
19 "3m "
20 "-3m "
21 "6 "
22 "-6 "
23 "6/m "
24 "622 "
25 "6mm "
26 "-62m "
27 "6/mmm"
28 "23 "
29 "m-3 "
30 "432 "
31 "-43m "
32 "m-3m "
"""
_set_no_error()
# (symbol, pointgroup_number, transformation_matrix)
pointgroup = spg.pointgroup(np.array(rotations, dtype='intc', order='C'))
_set_error_message()
return pointgroup | [
"def",
"get_pointgroup",
"(",
"rotations",
")",
":",
"_set_no_error",
"(",
")",
"# (symbol, pointgroup_number, transformation_matrix)",
"pointgroup",
"=",
"spg",
".",
"pointgroup",
"(",
"np",
".",
"array",
"(",
"rotations",
",",
"dtype",
"=",
"'intc'",
",",
"order",
"=",
"'C'",
")",
")",
"_set_error_message",
"(",
")",
"return",
"pointgroup"
] | Return point group in international table symbol and number.
The symbols are mapped to the numbers as follows:
1 "1 "
2 "-1 "
3 "2 "
4 "m "
5 "2/m "
6 "222 "
7 "mm2 "
8 "mmm "
9 "4 "
10 "-4 "
11 "4/m "
12 "422 "
13 "4mm "
14 "-42m "
15 "4/mmm"
16 "3 "
17 "-3 "
18 "32 "
19 "3m "
20 "-3m "
21 "6 "
22 "-6 "
23 "6/m "
24 "622 "
25 "6mm "
26 "-62m "
27 "6/mmm"
28 "23 "
29 "m-3 "
30 "432 "
31 "-43m "
32 "m-3m " | [
"Return",
"point",
"group",
"in",
"international",
"table",
"symbol",
"and",
"number",
"."
] | train | https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L301-L343 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Return point group in international table symbol and number.
The symbols are mapped to the numbers as follows:
1 "1 "
2 "-1 "
3 "2 "
4 "m "
5 "2/m "
6 "222 "
7 "mm2 "
8 "mmm "
9 "4 "
10 "-4 "
11 "4/m "
12 "422 "
13 "4mm "
14 "-42m "
15 "4/mmm"
16 "3 "
17 "-3 "
18 "32 "
19 "3m "
20 "-3m "
21 "6 "
22 "-6 "
23 "6/m "
24 "622 "
25 "6mm "
26 "-62m "
27 "6/mmm"
28 "23 "
29 "m-3 "
30 "432 "
31 "-43m "
32 "m-3m "
### Response:
def get_pointgroup(rotations):
"""Return point group in international table symbol and number.
The symbols are mapped to the numbers as follows:
1 "1 "
2 "-1 "
3 "2 "
4 "m "
5 "2/m "
6 "222 "
7 "mm2 "
8 "mmm "
9 "4 "
10 "-4 "
11 "4/m "
12 "422 "
13 "4mm "
14 "-42m "
15 "4/mmm"
16 "3 "
17 "-3 "
18 "32 "
19 "3m "
20 "-3m "
21 "6 "
22 "-6 "
23 "6/m "
24 "622 "
25 "6mm "
26 "-62m "
27 "6/mmm"
28 "23 "
29 "m-3 "
30 "432 "
31 "-43m "
32 "m-3m "
"""
_set_no_error()
# (symbol, pointgroup_number, transformation_matrix)
pointgroup = spg.pointgroup(np.array(rotations, dtype='intc', order='C'))
_set_error_message()
return pointgroup
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
5715,
1486,
1912,
304,
6625,
2007,
7891,
323,
1396,
382,
262,
578,
18210,
527,
24784,
311,
279,
5219,
439,
11263,
512,
262,
220,
16,
256,
330,
16,
262,
6360,
262,
220,
17,
256,
6660,
16,
256,
6360,
262,
220,
18,
256,
330,
17,
262,
6360,
262,
220,
19,
256,
330,
76,
262,
6360,
262,
220,
20,
256,
330,
17,
3262,
220,
6360,
262,
220,
21,
256,
330,
9716,
220,
6360,
262,
220,
22,
256,
330,
3906,
17,
220,
6360,
262,
220,
23,
256,
330,
49986,
220,
6360,
262,
220,
24,
256,
330,
19,
262,
6360,
262,
220,
605,
220,
6660,
19,
256,
6360,
262,
220,
806,
220,
330,
19,
3262,
220,
6360,
262,
220,
717,
220,
330,
16460,
220,
6360,
262,
220,
1032,
220,
330,
19,
3906,
220,
6360,
262,
220,
975,
220,
6660,
2983,
76,
6360,
262,
220,
868,
220,
330,
19,
3262,
3906,
702,
262,
220,
845,
220,
330,
18,
262,
6360,
262,
220,
1114,
220,
6660,
18,
256,
6360,
262,
220,
972,
220,
330,
843,
256,
6360,
262,
220,
777,
220,
330,
18,
76,
256,
6360,
262,
220,
508,
220,
6660,
18,
76,
220,
6360,
262,
220,
1691,
220,
330,
21,
262,
6360,
262,
220,
1313,
220,
6660,
21,
256,
6360,
262,
220,
1419,
220,
330,
21,
3262,
220,
6360,
262,
220,
1187,
220,
330,
19808,
220,
6360,
262,
220,
914,
220,
330,
21,
3906,
220,
6360,
262,
220,
1627,
220,
6660,
5538,
76,
6360,
262,
220,
1544,
220,
330,
21,
3262,
3906,
702,
262,
220,
1591,
220,
330,
1419,
256,
6360,
262,
220,
1682,
220,
330,
76,
12,
18,
220,
6360,
262,
220,
966,
220,
330,
16739,
220,
6360,
262,
220,
2148,
220,
6660,
3391,
76,
6360,
262,
220,
843,
220,
330,
76,
12,
18,
76,
23584,
14711,
6075,
512,
755,
636,
6213,
4166,
77690,
811,
997,
262,
4304,
5715,
1486,
1912,
304,
6625,
2007,
7891,
323,
1396,
382,
262,
578,
18210,
527,
24784,
311,
279,
5219,
439,
11263,
512,
262,
220,
16,
256,
330,
16,
262,
6360,
262,
220,
17,
256,
6660,
16,
256,
6360,
262,
220,
18,
256,
330,
17,
262,
6360,
262,
220,
19,
256,
330,
76,
262,
6360,
262,
220,
20,
256,
330,
17,
3262,
220,
6360,
262,
220,
21,
256,
330,
9716,
220,
6360,
262,
220,
22,
256,
330,
3906,
17,
220,
6360,
262,
220,
23,
256,
330,
49986,
220,
6360,
262,
220,
24,
256,
330,
19,
262,
6360,
262,
220,
605,
220,
6660,
19,
256,
6360,
262,
220,
806,
220,
330,
19,
3262,
220,
6360,
262,
220,
717,
220,
330,
16460,
220,
6360,
262,
220,
1032,
220,
330,
19,
3906,
220,
6360,
262,
220,
975,
220,
6660,
2983,
76,
6360,
262,
220,
868,
220,
330,
19,
3262,
3906,
702,
262,
220,
845,
220,
330,
18,
262,
6360,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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
5715,
1486,
1912,
304,
6625,
2007,
7891,
323,
1396,
382,
262,
578,
18210,
527,
24784,
311,
279,
5219,
439,
11263,
512,
262,
220,
16,
256,
330,
16,
262,
6360,
262,
220,
17,
256,
6660,
16,
256,
6360,
262,
220,
18,
256,
330,
17,
262,
6360,
262,
220,
19,
256,
330,
76,
262,
6360,
262,
220,
20,
256,
330,
17,
3262,
220,
6360,
262,
220,
21,
256,
330,
9716,
220,
6360,
262,
220,
22,
256,
330,
3906,
17,
220,
6360,
262,
220,
23,
256,
330,
49986,
220,
6360,
262,
220,
24,
256,
330,
19,
262,
6360,
262,
220,
605,
220,
6660,
19,
256,
6360,
262,
220,
806,
220,
330,
19,
3262,
220,
6360,
262,
220,
717,
220,
330,
16460,
220,
6360,
262,
220,
1032,
220,
330,
19,
3906,
220,
6360,
262,
220,
975,
220,
6660,
2983,
76,
6360,
262,
220,
868,
220,
330,
19,
3262,
3906,
702,
262,
220,
845,
220,
330,
18,
262,
6360,
262,
220,
1114,
220,
6660,
18,
256,
6360,
262,
220,
972,
220,
330,
843,
256,
6360,
262,
220,
777,
220,
330,
18,
76,
256,
6360,
262,
220,
508,
220,
6660,
18,
76,
220,
6360,
262,
220,
1691,
220,
330,
21,
262,
6360,
262,
220,
1313,
220,
6660,
21,
256,
6360,
262,
220,
1419,
220,
330,
21,
3262,
220,
6360,
262,
220,
1187,
220,
330,
19808,
220,
6360,
262,
220,
914,
220,
330,
21,
3906,
220,
6360,
262,
220,
1627,
220,
6660,
5538,
76,
6360,
262,
220,
1544,
220,
330,
21,
3262,
3906,
702,
262,
220,
1591,
220,
330,
1419,
256,
6360,
262,
220,
1682,
220,
330,
76,
12,
18,
220,
6360,
262,
220,
966,
220,
330,
16739,
220,
6360,
262,
220,
2148,
220,
6660,
3391,
76,
6360,
262,
220,
843,
220,
330,
76,
12,
18,
76,
23584,
14711,
6075,
512,
755,
636,
6213,
4166,
77690,
811,
997,
262,
4304,
5715,
1486,
1912,
304,
6625,
2007,
7891,
323,
1396,
382,
262,
578,
18210,
527,
24784,
311,
279,
5219,
439,
11263,
512,
262,
220,
16,
256,
330,
16,
262,
6360,
262,
220,
17,
256,
6660,
16,
256,
6360,
262,
220,
18,
256,
330,
17,
262,
6360,
262,
220,
19,
256,
330,
76,
262,
6360,
262,
220,
20,
256,
330,
17,
3262,
220,
6360,
262,
220,
21,
256,
330,
9716,
220,
6360,
262,
220,
22,
256,
330,
3906,
17,
220,
6360,
262,
220,
23,
256,
330,
49986,
220,
6360,
262,
220,
24,
256,
330,
19,
262,
6360,
262,
220,
605,
220,
6660,
19,
256,
6360,
262,
220,
806,
220,
330,
19,
3262,
220,
6360,
262,
220,
717,
220,
330,
16460,
220,
6360,
262,
220,
1032,
220,
330,
19,
3906,
220,
6360,
262,
220,
975,
220,
6660,
2983,
76,
6360,
262,
220,
868,
220,
330,
19,
3262,
3906,
702,
262,
220,
845,
220,
330,
18,
262,
6360,
262,
220,
1114,
220,
6660,
18,
256,
6360,
262,
220,
972,
220,
330,
843,
256,
6360
] |
automl/HpBandSter | hpbandster/core/nameserver.py | NameServer.start | def start(self):
"""
starts a Pyro4 nameserver in a separate thread
Returns
-------
tuple (str, int):
the host name and the used port
"""
if self.host is None:
if self.nic_name is None:
self.host = 'localhost'
else:
self.host = nic_name_to_host(self.nic_name)
uri, self.pyro_ns, _ = Pyro4.naming.startNS(host=self.host, port=self.port)
self.host, self.port = self.pyro_ns.locationStr.split(':')
self.port = int(self.port)
thread = threading.Thread(target=self.pyro_ns.requestLoop, name='Pyro4 nameserver started by HpBandSter')
thread.start()
if not self.dir is None:
os.makedirs(self.dir, exist_ok=True)
self.conf_fn = os.path.join(self.dir, 'HPB_run_%s_pyro.pkl'%self.run_id)
with open(self.conf_fn, 'wb') as fh:
pickle.dump((self.host, self.port), fh)
return(self.host, self.port) | python | def start(self):
"""
starts a Pyro4 nameserver in a separate thread
Returns
-------
tuple (str, int):
the host name and the used port
"""
if self.host is None:
if self.nic_name is None:
self.host = 'localhost'
else:
self.host = nic_name_to_host(self.nic_name)
uri, self.pyro_ns, _ = Pyro4.naming.startNS(host=self.host, port=self.port)
self.host, self.port = self.pyro_ns.locationStr.split(':')
self.port = int(self.port)
thread = threading.Thread(target=self.pyro_ns.requestLoop, name='Pyro4 nameserver started by HpBandSter')
thread.start()
if not self.dir is None:
os.makedirs(self.dir, exist_ok=True)
self.conf_fn = os.path.join(self.dir, 'HPB_run_%s_pyro.pkl'%self.run_id)
with open(self.conf_fn, 'wb') as fh:
pickle.dump((self.host, self.port), fh)
return(self.host, self.port) | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"host",
"is",
"None",
":",
"if",
"self",
".",
"nic_name",
"is",
"None",
":",
"self",
".",
"host",
"=",
"'localhost'",
"else",
":",
"self",
".",
"host",
"=",
"nic_name_to_host",
"(",
"self",
".",
"nic_name",
")",
"uri",
",",
"self",
".",
"pyro_ns",
",",
"_",
"=",
"Pyro4",
".",
"naming",
".",
"startNS",
"(",
"host",
"=",
"self",
".",
"host",
",",
"port",
"=",
"self",
".",
"port",
")",
"self",
".",
"host",
",",
"self",
".",
"port",
"=",
"self",
".",
"pyro_ns",
".",
"locationStr",
".",
"split",
"(",
"':'",
")",
"self",
".",
"port",
"=",
"int",
"(",
"self",
".",
"port",
")",
"thread",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"pyro_ns",
".",
"requestLoop",
",",
"name",
"=",
"'Pyro4 nameserver started by HpBandSter'",
")",
"thread",
".",
"start",
"(",
")",
"if",
"not",
"self",
".",
"dir",
"is",
"None",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"dir",
",",
"exist_ok",
"=",
"True",
")",
"self",
".",
"conf_fn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dir",
",",
"'HPB_run_%s_pyro.pkl'",
"%",
"self",
".",
"run_id",
")",
"with",
"open",
"(",
"self",
".",
"conf_fn",
",",
"'wb'",
")",
"as",
"fh",
":",
"pickle",
".",
"dump",
"(",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
",",
"fh",
")",
"return",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
")"
] | starts a Pyro4 nameserver in a separate thread
Returns
-------
tuple (str, int):
the host name and the used port | [
"starts",
"a",
"Pyro4",
"nameserver",
"in",
"a",
"separate",
"thread",
"Returns",
"-------",
"tuple",
"(",
"str",
"int",
")",
":",
"the",
"host",
"name",
"and",
"the",
"used",
"port"
] | train | https://github.com/automl/HpBandSter/blob/841db4b827f342e5eb7f725723ea6461ac52d45a/hpbandster/core/nameserver.py#L48-L79 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
starts a Pyro4 nameserver in a separate thread
Returns
-------
tuple (str, int):
the host name and the used port
### Response:
def start(self):
"""
starts a Pyro4 nameserver in a separate thread
Returns
-------
tuple (str, int):
the host name and the used port
"""
if self.host is None:
if self.nic_name is None:
self.host = 'localhost'
else:
self.host = nic_name_to_host(self.nic_name)
uri, self.pyro_ns, _ = Pyro4.naming.startNS(host=self.host, port=self.port)
self.host, self.port = self.pyro_ns.locationStr.split(':')
self.port = int(self.port)
thread = threading.Thread(target=self.pyro_ns.requestLoop, name='Pyro4 nameserver started by HpBandSter')
thread.start()
if not self.dir is None:
os.makedirs(self.dir, exist_ok=True)
self.conf_fn = os.path.join(self.dir, 'HPB_run_%s_pyro.pkl'%self.run_id)
with open(self.conf_fn, 'wb') as fh:
pickle.dump((self.host, self.port), fh)
return(self.host, self.port)
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
66976,
264,
5468,
299,
19,
5144,
2906,
304,
264,
8821,
4617,
25536,
197,
77186,
198,
197,
197,
36308,
298,
3324,
6189,
320,
496,
11,
528,
997,
573,
33188,
3552,
836,
323,
279,
1511,
2700,
271,
14711,
6075,
512,
755,
1212,
1214,
997,
197,
197,
12885,
1602,
197,
22087,
82,
264,
5468,
299,
19,
5144,
2906,
304,
264,
8821,
4617,
25536,
197,
77186,
198,
197,
197,
36308,
298,
3324,
6189,
320,
496,
11,
528,
997,
573,
33188,
3552,
836,
323,
279,
1511,
2700,
198,
197,
197,
7275,
1602,
197,
748,
659,
18320,
374,
2290,
512,
298,
748,
659,
1276,
292,
1292,
374,
2290,
512,
573,
5311,
18320,
284,
364,
8465,
1270,
298,
2525,
512,
573,
5311,
18320,
284,
17778,
1292,
2401,
13144,
1214,
1276,
292,
1292,
696,
197,
197,
6198,
11,
659,
7345,
299,
35828,
11,
721,
284,
5468,
299,
19,
1276,
6605,
5069,
2507,
20569,
7822,
18320,
11,
2700,
7822,
14940,
696,
197,
5311,
18320,
11,
659,
14940,
284,
659,
7345,
299,
35828,
8383,
2645,
5402,
16364,
1329,
197,
5311,
14940,
284,
528,
1214,
14940,
340,
2451,
197,
69314,
284,
31259,
33132,
8807,
7822,
7345,
299,
35828,
8387,
14962,
11,
836,
1151,
14149,
299,
19,
5144,
2906,
3940,
555,
88933,
34844,
81450,
1329,
197,
69314,
5069,
2892,
197,
748,
539,
659,
14732,
374,
2290,
512,
298,
26134,
38192,
1214,
14732,
11,
3073,
20404,
3702,
340,
298,
5311,
14263,
15604,
284,
2709,
3960,
5563,
1214,
14732,
11,
364,
6748,
33,
14334,
19213,
82,
41391,
299,
50578,
37265,
726,
7789,
851,
696,
298,
48048,
1825,
1214,
14263,
15604,
11,
364,
20824,
873,
439,
37175,
512,
573,
3303,
26688,
28026,
1209,
726,
18320,
11,
659,
14940,
705,
37175,
340,
2451,
197,
862,
1214,
18320,
11,
659,
14940,
340,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
66976,
264,
5468,
299,
19,
5144,
2906,
304,
264,
8821,
4617,
25536,
197,
77186,
198,
197,
197,
36308,
298,
3324,
6189,
320,
496,
11,
528,
997,
573,
33188,
3552,
836,
323,
279,
1511,
2700,
271,
14711,
6075,
512,
755,
1212,
1214,
997,
197,
197,
12885,
1602,
197,
22087,
82,
264,
5468,
299,
19,
5144,
2906,
304,
264,
8821,
4617,
25536,
197,
77186,
198,
197,
197,
36308,
298,
3324,
6189,
320,
496,
11,
528,
997,
573,
33188,
3552,
836,
323,
279,
1511,
2700,
198,
197,
197,
7275,
1602,
197,
748,
659,
18320,
374,
2290,
512,
298,
748,
659,
1276,
292,
1292,
374,
2290,
512,
573,
5311,
18320,
284,
364,
8465,
1270,
298,
2525,
512,
573,
5311,
18320,
284,
17778,
1292,
2401,
13144,
1214,
1276,
292,
1292,
696,
197,
197,
6198,
11,
659,
7345,
299,
35828,
11,
721,
284,
5468,
299,
19,
1276,
6605,
5069,
2507,
20569,
7822,
18320,
11,
2700,
7822,
14940,
696,
197,
5311,
18320,
11,
659,
14940,
284,
659,
7345,
299,
35828,
8383,
2645,
5402,
16364,
1329,
197,
5311,
14940,
284,
528,
1214,
14940,
340,
2451,
197,
69314,
284,
31259,
33132,
8807,
7822,
7345,
299,
35828,
8387,
14962,
11,
836,
1151,
14149,
299,
19,
5144,
2906,
3940,
555,
88933,
34844,
81450,
1329,
197,
69314,
5069,
2892,
197,
748,
539,
659,
14732,
374,
2290,
512,
298,
26134,
38192,
1214,
14732,
11,
3073,
20404,
3702,
340,
298,
5311,
14263,
15604,
284,
2709,
3960,
5563,
1214,
14732,
11,
364,
6748,
33,
14334,
19213,
82,
41391,
299,
50578,
37265,
726,
7789,
851,
696,
298,
48048,
1825,
1214,
14263,
15604,
11,
364,
20824,
873,
439,
37175,
512,
573,
3303,
26688,
28026,
1209,
726,
18320,
11,
659,
14940,
705,
37175,
340,
2451,
197,
862,
1214,
18320,
11,
659,
14940,
340,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
ploneintranet/ploneintranet.workspace | src/ploneintranet/workspace/utils.py | get_storage | def get_storage(clear=False):
"""helper function to get annotation storage on the portal
:param clear: If true is passed in, annotations will be cleared
:returns: portal annotations
:rtype: IAnnotations
"""
portal = getUtility(ISiteRoot)
annotations = IAnnotations(portal)
if ANNOTATION_KEY not in annotations or clear:
annotations[ANNOTATION_KEY] = OOBTree()
return annotations[ANNOTATION_KEY] | python | def get_storage(clear=False):
"""helper function to get annotation storage on the portal
:param clear: If true is passed in, annotations will be cleared
:returns: portal annotations
:rtype: IAnnotations
"""
portal = getUtility(ISiteRoot)
annotations = IAnnotations(portal)
if ANNOTATION_KEY not in annotations or clear:
annotations[ANNOTATION_KEY] = OOBTree()
return annotations[ANNOTATION_KEY] | [
"def",
"get_storage",
"(",
"clear",
"=",
"False",
")",
":",
"portal",
"=",
"getUtility",
"(",
"ISiteRoot",
")",
"annotations",
"=",
"IAnnotations",
"(",
"portal",
")",
"if",
"ANNOTATION_KEY",
"not",
"in",
"annotations",
"or",
"clear",
":",
"annotations",
"[",
"ANNOTATION_KEY",
"]",
"=",
"OOBTree",
"(",
")",
"return",
"annotations",
"[",
"ANNOTATION_KEY",
"]"
] | helper function to get annotation storage on the portal
:param clear: If true is passed in, annotations will be cleared
:returns: portal annotations
:rtype: IAnnotations | [
"helper",
"function",
"to",
"get",
"annotation",
"storage",
"on",
"the",
"portal"
] | train | https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/utils.py#L33-L45 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
helper function to get annotation storage on the portal
:param clear: If true is passed in, annotations will be cleared
:returns: portal annotations
:rtype: IAnnotations
### Response:
def get_storage(clear=False):
"""helper function to get annotation storage on the portal
:param clear: If true is passed in, annotations will be cleared
:returns: portal annotations
:rtype: IAnnotations
"""
portal = getUtility(ISiteRoot)
annotations = IAnnotations(portal)
if ANNOTATION_KEY not in annotations or clear:
annotations[ANNOTATION_KEY] = OOBTree()
return annotations[ANNOTATION_KEY]
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
19291,
734,
311,
636,
21917,
5942,
389,
279,
24007,
271,
262,
551,
913,
2867,
25,
1442,
837,
374,
5946,
304,
11,
33307,
690,
387,
23803,
198,
262,
551,
4310,
25,
24007,
33307,
198,
262,
551,
33613,
25,
358,
22133,
271,
14711,
6075,
512,
755,
636,
24192,
1361,
1576,
5725,
997,
262,
4304,
19291,
734,
311,
636,
21917,
5942,
389,
279,
24007,
271,
262,
551,
913,
2867,
25,
1442,
837,
374,
5946,
304,
11,
33307,
690,
387,
23803,
198,
262,
551,
4310,
25,
24007,
33307,
198,
262,
551,
33613,
25,
358,
22133,
271,
262,
3270,
262,
24007,
284,
636,
19750,
38196,
635,
8605,
340,
262,
33307,
284,
358,
22133,
21924,
278,
340,
262,
422,
2147,
14394,
3579,
6738,
539,
304,
33307,
477,
2867,
512,
286,
33307,
58,
47975,
3579,
6738,
60,
284,
507,
21257,
6670,
746,
262,
471,
33307,
58,
47975,
3579,
6738,
933,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
19291,
734,
311,
636,
21917,
5942,
389,
279,
24007,
271,
262,
551,
913,
2867,
25,
1442,
837,
374,
5946,
304,
11,
33307,
690,
387,
23803,
198,
262,
551,
4310,
25,
24007,
33307,
198,
262,
551,
33613,
25,
358,
22133,
271,
14711,
6075,
512,
755,
636,
24192,
1361,
1576,
5725,
997,
262,
4304,
19291,
734,
311,
636,
21917,
5942,
389,
279,
24007,
271,
262,
551,
913,
2867,
25,
1442,
837,
374,
5946,
304,
11,
33307,
690,
387,
23803,
198,
262,
551,
4310,
25,
24007,
33307,
198,
262,
551,
33613,
25,
358,
22133,
271,
262,
3270,
262,
24007,
284,
636,
19750,
38196,
635,
8605,
340,
262,
33307,
284,
358,
22133,
21924,
278,
340,
262,
422,
2147,
14394,
3579,
6738,
539,
304,
33307,
477,
2867,
512,
286,
33307,
58,
47975,
3579,
6738,
60,
284,
507,
21257,
6670,
746,
262,
471,
33307,
58,
47975,
3579,
6738,
933,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
saltstack/salt | salt/modules/osquery.py | kernel_integrity | def kernel_integrity(attrs=None, where=None):
'''
Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_integrity', attrs=attrs, where=where)
return {'result': False, 'comment': 'Only available on Red Hat or Debian based systems.'} | python | def kernel_integrity(attrs=None, where=None):
'''
Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_integrity', attrs=attrs, where=where)
return {'result': False, 'comment': 'Only available on Red Hat or Debian based systems.'} | [
"def",
"kernel_integrity",
"(",
"attrs",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"if",
"__grains__",
"[",
"'os_family'",
"]",
"in",
"[",
"'RedHat'",
",",
"'Debian'",
"]",
":",
"return",
"_osquery_cmd",
"(",
"table",
"=",
"'kernel_integrity'",
",",
"attrs",
"=",
"attrs",
",",
"where",
"=",
"where",
")",
"return",
"{",
"'result'",
":",
"False",
",",
"'comment'",
":",
"'Only available on Red Hat or Debian based systems.'",
"}"
] | Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity | [
"Return",
"kernel_integrity",
"information",
"from",
"osquery"
] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/osquery.py#L149-L161 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity
### Response:
def kernel_integrity(attrs=None, where=None):
'''
Return kernel_integrity information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.kernel_integrity
'''
if __grains__['os_family'] in ['RedHat', 'Debian']:
return _osquery_cmd(table='kernel_integrity', attrs=attrs, where=where)
return {'result': False, 'comment': 'Only available on Red Hat or Debian based systems.'}
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
5715,
10206,
4132,
68312,
2038,
505,
2709,
1663,
271,
262,
40377,
13688,
1473,
262,
5354,
2082,
9612,
487,
28121,
271,
286,
12290,
31801,
2709,
1663,
32326,
4132,
68312,
271,
14711,
6075,
512,
755,
10206,
4132,
68312,
40939,
5980,
11,
1405,
5980,
997,
262,
11414,
262,
3494,
10206,
4132,
68312,
2038,
505,
2709,
1663,
271,
262,
40377,
13688,
1473,
262,
5354,
2082,
9612,
487,
28121,
271,
286,
12290,
31801,
2709,
1663,
32326,
4132,
68312,
198,
262,
11414,
262,
422,
1328,
911,
1771,
565,
681,
437,
27921,
663,
304,
2570,
6161,
73387,
518,
364,
1951,
13464,
18888,
286,
471,
721,
437,
1663,
11946,
16138,
1151,
24127,
4132,
68312,
518,
16602,
28,
21101,
11,
1405,
28,
2940,
340,
262,
471,
5473,
1407,
1232,
3641,
11,
364,
6313,
1232,
364,
7456,
2561,
389,
3816,
22050,
477,
57707,
3196,
6067,
3238,
534,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
5715,
10206,
4132,
68312,
2038,
505,
2709,
1663,
271,
262,
40377,
13688,
1473,
262,
5354,
2082,
9612,
487,
28121,
271,
286,
12290,
31801,
2709,
1663,
32326,
4132,
68312,
271,
14711,
6075,
512,
755,
10206,
4132,
68312,
40939,
5980,
11,
1405,
5980,
997,
262,
11414,
262,
3494,
10206,
4132,
68312,
2038,
505,
2709,
1663,
271,
262,
40377,
13688,
1473,
262,
5354,
2082,
9612,
487,
28121,
271,
286,
12290,
31801,
2709,
1663,
32326,
4132,
68312,
198,
262,
11414,
262,
422,
1328,
911,
1771,
565,
681,
437,
27921,
663,
304,
2570,
6161,
73387,
518,
364,
1951,
13464,
18888,
286,
471,
721,
437,
1663,
11946,
16138,
1151,
24127,
4132,
68312,
518,
16602,
28,
21101,
11,
1405,
28,
2940,
340,
262,
471,
5473,
1407,
1232,
3641,
11,
364,
6313,
1232,
364,
7456,
2561,
389,
3816,
22050,
477,
57707,
3196,
6067,
3238,
534,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
NLeSC/scriptcwl | scriptcwl/step.py | Step._input_optional | def _input_optional(inp):
"""Returns True if a step input parameter is optional.
Args:
inp (dict): a dictionary representation of an input.
Raises:
ValueError: The inp provided is not valid.
"""
if 'default' in inp.keys():
return True
typ = inp.get('type')
if isinstance(typ, six.string_types):
return typ.endswith('?')
elif isinstance(typ, dict):
# TODO: handle case where iput type is dict
return False
elif isinstance(typ, list):
# The cwltool validation expands optional arguments to
# [u'null', <type>]
return bool(u'null' in typ)
else:
raise ValueError('Invalid input "{}"'.format(inp.get['id'])) | python | def _input_optional(inp):
"""Returns True if a step input parameter is optional.
Args:
inp (dict): a dictionary representation of an input.
Raises:
ValueError: The inp provided is not valid.
"""
if 'default' in inp.keys():
return True
typ = inp.get('type')
if isinstance(typ, six.string_types):
return typ.endswith('?')
elif isinstance(typ, dict):
# TODO: handle case where iput type is dict
return False
elif isinstance(typ, list):
# The cwltool validation expands optional arguments to
# [u'null', <type>]
return bool(u'null' in typ)
else:
raise ValueError('Invalid input "{}"'.format(inp.get['id'])) | [
"def",
"_input_optional",
"(",
"inp",
")",
":",
"if",
"'default'",
"in",
"inp",
".",
"keys",
"(",
")",
":",
"return",
"True",
"typ",
"=",
"inp",
".",
"get",
"(",
"'type'",
")",
"if",
"isinstance",
"(",
"typ",
",",
"six",
".",
"string_types",
")",
":",
"return",
"typ",
".",
"endswith",
"(",
"'?'",
")",
"elif",
"isinstance",
"(",
"typ",
",",
"dict",
")",
":",
"# TODO: handle case where iput type is dict",
"return",
"False",
"elif",
"isinstance",
"(",
"typ",
",",
"list",
")",
":",
"# The cwltool validation expands optional arguments to",
"# [u'null', <type>]",
"return",
"bool",
"(",
"u'null'",
"in",
"typ",
")",
"else",
":",
"raise",
"ValueError",
"(",
"'Invalid input \"{}\"'",
".",
"format",
"(",
"inp",
".",
"get",
"[",
"'id'",
"]",
")",
")"
] | Returns True if a step input parameter is optional.
Args:
inp (dict): a dictionary representation of an input.
Raises:
ValueError: The inp provided is not valid. | [
"Returns",
"True",
"if",
"a",
"step",
"input",
"parameter",
"is",
"optional",
"."
] | train | https://github.com/NLeSC/scriptcwl/blob/33bb847a875379da3a5702c7a98dfa585306b960/scriptcwl/step.py#L131-L154 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Returns True if a step input parameter is optional.
Args:
inp (dict): a dictionary representation of an input.
Raises:
ValueError: The inp provided is not valid.
### Response:
def _input_optional(inp):
"""Returns True if a step input parameter is optional.
Args:
inp (dict): a dictionary representation of an input.
Raises:
ValueError: The inp provided is not valid.
"""
if 'default' in inp.keys():
return True
typ = inp.get('type')
if isinstance(typ, six.string_types):
return typ.endswith('?')
elif isinstance(typ, dict):
# TODO: handle case where iput type is dict
return False
elif isinstance(typ, list):
# The cwltool validation expands optional arguments to
# [u'null', <type>]
return bool(u'null' in typ)
else:
raise ValueError('Invalid input "{}"'.format(inp.get['id']))
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
16851,
3082,
422,
264,
3094,
1988,
5852,
374,
10309,
382,
286,
18161,
512,
310,
33444,
320,
8644,
1680,
264,
11240,
13340,
315,
459,
1988,
382,
286,
61411,
512,
310,
15764,
25,
578,
33444,
3984,
374,
539,
2764,
382,
14711,
6075,
512,
755,
721,
1379,
75744,
60703,
997,
286,
4304,
16851,
3082,
422,
264,
3094,
1988,
5852,
374,
10309,
382,
286,
18161,
512,
310,
33444,
320,
8644,
1680,
264,
11240,
13340,
315,
459,
1988,
382,
286,
61411,
512,
310,
15764,
25,
578,
33444,
3984,
374,
539,
2764,
627,
286,
3270,
286,
422,
364,
2309,
6,
304,
33444,
9301,
4019,
310,
471,
3082,
271,
286,
3666,
284,
33444,
673,
493,
1337,
1329,
286,
422,
11656,
67883,
11,
4848,
4909,
9962,
997,
310,
471,
3666,
41215,
75645,
1329,
286,
4508,
11656,
67883,
11,
6587,
997,
310,
674,
5456,
25,
3790,
1162,
1405,
6125,
332,
955,
374,
6587,
198,
310,
471,
3641,
198,
286,
4508,
11656,
67883,
11,
1160,
997,
310,
674,
578,
272,
27515,
14506,
10741,
52956,
10309,
6105,
311,
198,
310,
674,
510,
84,
6,
2994,
518,
366,
1337,
29,
933,
310,
471,
1845,
8317,
6,
2994,
6,
304,
3666,
340,
286,
775,
512,
310,
4933,
15764,
493,
8087,
1988,
36603,
1,
4527,
2293,
60703,
673,
681,
307,
20084,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
16851,
3082,
422,
264,
3094,
1988,
5852,
374,
10309,
382,
286,
18161,
512,
310,
33444,
320,
8644,
1680,
264,
11240,
13340,
315,
459,
1988,
382,
286,
61411,
512,
310,
15764,
25,
578,
33444,
3984,
374,
539,
2764,
382,
14711,
6075,
512,
755,
721,
1379,
75744,
60703,
997,
286,
4304,
16851,
3082,
422,
264,
3094,
1988,
5852,
374,
10309,
382,
286,
18161,
512,
310,
33444,
320,
8644,
1680,
264,
11240,
13340,
315,
459,
1988,
382,
286,
61411,
512,
310,
15764,
25,
578,
33444,
3984,
374,
539,
2764,
627,
286,
3270,
286,
422,
364,
2309,
6,
304,
33444,
9301,
4019,
310,
471,
3082,
271,
286,
3666,
284,
33444,
673,
493,
1337,
1329,
286,
422,
11656,
67883,
11,
4848,
4909,
9962,
997,
310,
471,
3666,
41215,
75645,
1329,
286,
4508,
11656,
67883,
11,
6587,
997,
310,
674,
5456,
25,
3790,
1162,
1405,
6125,
332,
955,
374,
6587,
198,
310,
471,
3641,
198,
286,
4508,
11656,
67883,
11,
1160,
997,
310,
674,
578,
272,
27515,
14506,
10741,
52956,
10309,
6105,
311,
198,
310,
674,
510,
84,
6,
2994,
518,
366,
1337,
29,
933,
310,
471,
1845,
8317,
6,
2994,
6,
304,
3666,
340,
286,
775,
512,
310,
4933,
15764,
493,
8087,
1988,
36603,
1,
4527,
2293,
60703,
673,
681,
307,
20084,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
saltstack/salt | salt/utils/yast.py | mksls | def mksls(src, dst=None):
'''
Convert an AutoYAST file to an SLS file
'''
with salt.utils.files.fopen(src, 'r') as fh_:
ps_opts = xml.to_dict(ET.fromstring(fh_.read()))
if dst is not None:
with salt.utils.files.fopen(dst, 'w') as fh_:
salt.utils.yaml.safe_dump(ps_opts, fh_, default_flow_style=False)
else:
return salt.utils.yaml.safe_dump(ps_opts, default_flow_style=False) | python | def mksls(src, dst=None):
'''
Convert an AutoYAST file to an SLS file
'''
with salt.utils.files.fopen(src, 'r') as fh_:
ps_opts = xml.to_dict(ET.fromstring(fh_.read()))
if dst is not None:
with salt.utils.files.fopen(dst, 'w') as fh_:
salt.utils.yaml.safe_dump(ps_opts, fh_, default_flow_style=False)
else:
return salt.utils.yaml.safe_dump(ps_opts, default_flow_style=False) | [
"def",
"mksls",
"(",
"src",
",",
"dst",
"=",
"None",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"src",
",",
"'r'",
")",
"as",
"fh_",
":",
"ps_opts",
"=",
"xml",
".",
"to_dict",
"(",
"ET",
".",
"fromstring",
"(",
"fh_",
".",
"read",
"(",
")",
")",
")",
"if",
"dst",
"is",
"not",
"None",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"dst",
",",
"'w'",
")",
"as",
"fh_",
":",
"salt",
".",
"utils",
".",
"yaml",
".",
"safe_dump",
"(",
"ps_opts",
",",
"fh_",
",",
"default_flow_style",
"=",
"False",
")",
"else",
":",
"return",
"salt",
".",
"utils",
".",
"yaml",
".",
"safe_dump",
"(",
"ps_opts",
",",
"default_flow_style",
"=",
"False",
")"
] | Convert an AutoYAST file to an SLS file | [
"Convert",
"an",
"AutoYAST",
"file",
"to",
"an",
"SLS",
"file"
] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yast.py#L14-L25 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
Convert an AutoYAST file to an SLS file
### Response:
def mksls(src, dst=None):
'''
Convert an AutoYAST file to an SLS file
'''
with salt.utils.files.fopen(src, 'r') as fh_:
ps_opts = xml.to_dict(ET.fromstring(fh_.read()))
if dst is not None:
with salt.utils.files.fopen(dst, 'w') as fh_:
salt.utils.yaml.safe_dump(ps_opts, fh_, default_flow_style=False)
else:
return salt.utils.yaml.safe_dump(ps_opts, default_flow_style=False)
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
12281,
459,
9156,
56,
6483,
1052,
311,
459,
328,
7416,
1052,
271,
14711,
6075,
512,
755,
296,
2857,
4835,
15047,
11,
10875,
5980,
997,
262,
11414,
262,
7316,
459,
9156,
56,
6483,
1052,
311,
459,
328,
7416,
1052,
198,
262,
11414,
262,
449,
12290,
8576,
20881,
840,
2569,
15047,
11,
364,
81,
873,
439,
37175,
62,
512,
286,
4831,
33454,
284,
8562,
2446,
5356,
7,
1372,
6521,
928,
90248,
5056,
888,
51062,
262,
422,
10875,
374,
539,
2290,
512,
286,
449,
12290,
8576,
20881,
840,
2569,
31360,
11,
364,
86,
873,
439,
37175,
62,
512,
310,
12290,
8576,
34506,
53983,
18800,
44136,
33454,
11,
37175,
7022,
1670,
28541,
15468,
5725,
340,
262,
775,
512,
286,
471,
12290,
8576,
34506,
53983,
18800,
44136,
33454,
11,
1670,
28541,
15468,
5725,
340,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
6498,
382,
14711,
5546,
512,
12281,
459,
9156,
56,
6483,
1052,
311,
459,
328,
7416,
1052,
271,
14711,
6075,
512,
755,
296,
2857,
4835,
15047,
11,
10875,
5980,
997,
262,
11414,
262,
7316,
459,
9156,
56,
6483,
1052,
311,
459,
328,
7416,
1052,
198,
262,
11414,
262,
449,
12290,
8576,
20881,
840,
2569,
15047,
11,
364,
81,
873,
439,
37175,
62,
512,
286,
4831,
33454,
284,
8562,
2446,
5356,
7,
1372,
6521,
928,
90248,
5056,
888,
51062,
262,
422,
10875,
374,
539,
2290,
512,
286,
449,
12290,
8576,
20881,
840,
2569,
31360,
11,
364,
86,
873,
439,
37175,
62,
512,
310,
12290,
8576,
34506,
53983,
18800,
44136,
33454,
11,
37175,
7022,
1670,
28541,
15468,
5725,
340,
262,
775,
512,
286,
471,
12290,
8576,
34506,
53983,
18800,
44136,
33454,
11,
1670,
28541,
15468,
5725,
340,
27,
91,
8862,
728,
428,
91,
29,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009,
128009
] |
jwodder/doapi | doapi/doapi.py | doapi.wait_actions | def wait_actions(self, actions, wait_interval=None, wait_time=None):
r"""
Poll the server periodically until all actions in ``actions`` have
either completed or errored out, yielding each `Action`'s final value
as it ends.
If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing any
remaining in-progress actions) is raised.
If a `KeyboardInterrupt` is caught, any remaining actions are returned
immediately without waiting for completion.
.. versionchanged:: 0.2.0
Raises `WaitTimeoutError` on timeout
:param iterable actions: an iterable of `Action`\ s and/or other values
that are acceptable arguments to :meth:`fetch_action`
:param number wait_interval: how many seconds to sleep between
requests; defaults to :attr:`wait_interval` if not specified or
`None`
:param number wait_time: the total number of seconds after which the
method will raise an error if any actions have not yet completed,
or a negative number to wait indefinitely; defaults to
:attr:`wait_time` if not specified or `None`
:rtype: generator of `Action`\ s
:raises DOAPIError: if the API endpoint replies with an error
:raises WaitTimeoutError: if ``wait_time`` is exceeded
"""
return self._wait(map(self._action, actions), "done", True,
wait_interval, wait_time) | python | def wait_actions(self, actions, wait_interval=None, wait_time=None):
r"""
Poll the server periodically until all actions in ``actions`` have
either completed or errored out, yielding each `Action`'s final value
as it ends.
If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing any
remaining in-progress actions) is raised.
If a `KeyboardInterrupt` is caught, any remaining actions are returned
immediately without waiting for completion.
.. versionchanged:: 0.2.0
Raises `WaitTimeoutError` on timeout
:param iterable actions: an iterable of `Action`\ s and/or other values
that are acceptable arguments to :meth:`fetch_action`
:param number wait_interval: how many seconds to sleep between
requests; defaults to :attr:`wait_interval` if not specified or
`None`
:param number wait_time: the total number of seconds after which the
method will raise an error if any actions have not yet completed,
or a negative number to wait indefinitely; defaults to
:attr:`wait_time` if not specified or `None`
:rtype: generator of `Action`\ s
:raises DOAPIError: if the API endpoint replies with an error
:raises WaitTimeoutError: if ``wait_time`` is exceeded
"""
return self._wait(map(self._action, actions), "done", True,
wait_interval, wait_time) | [
"def",
"wait_actions",
"(",
"self",
",",
"actions",
",",
"wait_interval",
"=",
"None",
",",
"wait_time",
"=",
"None",
")",
":",
"return",
"self",
".",
"_wait",
"(",
"map",
"(",
"self",
".",
"_action",
",",
"actions",
")",
",",
"\"done\"",
",",
"True",
",",
"wait_interval",
",",
"wait_time",
")"
] | r"""
Poll the server periodically until all actions in ``actions`` have
either completed or errored out, yielding each `Action`'s final value
as it ends.
If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing any
remaining in-progress actions) is raised.
If a `KeyboardInterrupt` is caught, any remaining actions are returned
immediately without waiting for completion.
.. versionchanged:: 0.2.0
Raises `WaitTimeoutError` on timeout
:param iterable actions: an iterable of `Action`\ s and/or other values
that are acceptable arguments to :meth:`fetch_action`
:param number wait_interval: how many seconds to sleep between
requests; defaults to :attr:`wait_interval` if not specified or
`None`
:param number wait_time: the total number of seconds after which the
method will raise an error if any actions have not yet completed,
or a negative number to wait indefinitely; defaults to
:attr:`wait_time` if not specified or `None`
:rtype: generator of `Action`\ s
:raises DOAPIError: if the API endpoint replies with an error
:raises WaitTimeoutError: if ``wait_time`` is exceeded | [
"r",
"Poll",
"the",
"server",
"periodically",
"until",
"all",
"actions",
"in",
"actions",
"have",
"either",
"completed",
"or",
"errored",
"out",
"yielding",
"each",
"Action",
"s",
"final",
"value",
"as",
"it",
"ends",
"."
] | train | https://github.com/jwodder/doapi/blob/b1306de86a01d8ae7b9c1fe2699765bb82e4f310/doapi/doapi.py#L493-L522 | <|startoftext|>
### Instruction:
You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English.
### Task:
r"""
Poll the server periodically until all actions in ``actions`` have
either completed or errored out, yielding each `Action`'s final value
as it ends.
If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing any
remaining in-progress actions) is raised.
If a `KeyboardInterrupt` is caught, any remaining actions are returned
immediately without waiting for completion.
.. versionchanged:: 0.2.0
Raises `WaitTimeoutError` on timeout
:param iterable actions: an iterable of `Action`\ s and/or other values
that are acceptable arguments to :meth:`fetch_action`
:param number wait_interval: how many seconds to sleep between
requests; defaults to :attr:`wait_interval` if not specified or
`None`
:param number wait_time: the total number of seconds after which the
method will raise an error if any actions have not yet completed,
or a negative number to wait indefinitely; defaults to
:attr:`wait_time` if not specified or `None`
:rtype: generator of `Action`\ s
:raises DOAPIError: if the API endpoint replies with an error
:raises WaitTimeoutError: if ``wait_time`` is exceeded
### Response:
def wait_actions(self, actions, wait_interval=None, wait_time=None):
r"""
Poll the server periodically until all actions in ``actions`` have
either completed or errored out, yielding each `Action`'s final value
as it ends.
If ``wait_time`` is exceeded, a `WaitTimeoutError` (containing any
remaining in-progress actions) is raised.
If a `KeyboardInterrupt` is caught, any remaining actions are returned
immediately without waiting for completion.
.. versionchanged:: 0.2.0
Raises `WaitTimeoutError` on timeout
:param iterable actions: an iterable of `Action`\ s and/or other values
that are acceptable arguments to :meth:`fetch_action`
:param number wait_interval: how many seconds to sleep between
requests; defaults to :attr:`wait_interval` if not specified or
`None`
:param number wait_time: the total number of seconds after which the
method will raise an error if any actions have not yet completed,
or a negative number to wait indefinitely; defaults to
:attr:`wait_time` if not specified or `None`
:rtype: generator of `Action`\ s
:raises DOAPIError: if the API endpoint replies with an error
:raises WaitTimeoutError: if ``wait_time`` is exceeded
"""
return self._wait(map(self._action, actions), "done", True,
wait_interval, wait_time)
<|endoftext|> | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
81,
7275,
286,
25385,
279,
3622,
48582,
3156,
682,
6299,
304,
10103,
4109,
14196,
617,
198,
286,
3060,
8308,
477,
37410,
1171,
704,
11,
78504,
1855,
1595,
2573,
63,
6,
82,
1620,
907,
198,
286,
439,
433,
10548,
382,
286,
1442,
10103,
11748,
3084,
14196,
374,
34908,
11,
264,
1595,
14524,
7791,
1480,
63,
320,
778,
2101,
904,
198,
286,
9861,
304,
54391,
6299,
8,
374,
9408,
382,
286,
1442,
264,
1595,
19448,
23344,
63,
374,
10791,
11,
904,
9861,
6299,
527,
6052,
198,
286,
7214,
2085,
8748,
369,
9954,
382,
286,
5354,
2373,
17805,
487,
220,
15,
13,
17,
13,
15,
198,
310,
61411,
1595,
14524,
7791,
1480,
63,
389,
9829,
271,
286,
551,
913,
51934,
6299,
25,
459,
51934,
315,
1595,
2573,
62169,
274,
323,
5255,
1023,
2819,
198,
310,
430,
527,
22281,
6105,
311,
551,
69991,
19258,
9838,
8090,
4077,
286,
551,
913,
1396,
3868,
21183,
25,
1268,
1690,
6622,
311,
6212,
1990,
198,
310,
7540,
26,
17088,
311,
551,
3064,
19258,
11748,
21183,
63,
422,
539,
5300,
477,
198,
310,
1595,
4155,
4077,
286,
551,
913,
1396,
3868,
3084,
25,
279,
2860,
1396,
315,
6622,
1306,
902,
279,
198,
310,
1749,
690,
4933,
459,
1493,
422,
904,
6299,
617,
539,
3686,
8308,
345,
310,
477,
264,
8389,
1396,
311,
3868,
56334,
26,
17088,
311,
198,
310,
551,
3064,
19258,
11748,
3084,
63,
422,
539,
5300,
477,
1595,
4155,
4077,
286,
551,
33613,
25,
14143,
315,
1595,
2573,
62169,
274,
198,
286,
551,
33371,
9503,
7227,
1480,
25,
422,
279,
5446,
15233,
31737,
449,
459,
1493,
198,
286,
551,
33371,
14144,
7791,
1480,
25,
422,
10103,
11748,
3084,
14196,
374,
34908,
271,
14711,
6075,
512,
755,
3868,
26440,
1214,
11,
6299,
11,
3868,
21183,
5980,
11,
3868,
3084,
5980,
997,
286,
436,
7275,
286,
25385,
279,
3622,
48582,
3156,
682,
6299,
304,
10103,
4109,
14196,
617,
198,
286,
3060,
8308,
477,
37410,
1171,
704,
11,
78504,
1855,
1595,
2573,
63,
6,
82,
1620,
907,
198,
286,
439,
433,
10548,
382,
286,
1442,
10103,
11748,
3084,
14196,
374,
34908,
11,
264,
1595,
14524,
7791,
1480,
63,
320,
778,
2101,
904,
198,
286,
9861,
304,
54391,
6299,
8,
374,
9408,
382,
286,
1442,
264,
1595,
19448,
23344,
63,
374,
10791,
11,
904,
9861,
6299,
527,
6052,
198,
286,
7214,
2085,
8748,
369,
9954,
382,
286,
5354,
2373,
17805,
487,
220,
15,
13,
17,
13,
15,
198,
310,
61411,
1595,
14524,
7791,
1480,
63,
389,
9829,
271,
286,
551,
913,
51934,
6299,
25,
459,
51934,
315,
1595,
2573,
62169,
274,
323,
5255,
1023,
2819,
198,
310,
430,
527,
22281,
6105,
311,
551,
69991,
19258,
9838,
8090,
4077,
286,
551,
913,
1396,
3868,
21183,
25,
1268,
1690,
6622,
311,
6212,
1990,
198,
310,
7540,
26,
17088,
311,
551,
3064,
19258,
11748,
21183,
63,
422,
539,
5300,
477,
198,
310,
1595,
4155,
4077,
286,
551
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
128000,
27,
91,
2527,
14450,
428,
91,
397,
14711,
30151,
512,
2675,
527,
264,
19903,
4476,
25922,
323,
264,
11190,
15592,
15840,
18328,
13,
20400,
1193,
13325,
2082,
2085,
41941,
13,
40633,
1193,
304,
6498,
382,
14711,
5546,
512,
81,
7275,
286,
25385,
279,
3622,
48582,
3156,
682,
6299,
304,
10103,
4109,
14196,
617,
198,
286,
3060,
8308,
477,
37410,
1171,
704,
11,
78504,
1855,
1595,
2573,
63,
6,
82,
1620,
907,
198,
286,
439,
433,
10548,
382,
286,
1442,
10103,
11748,
3084,
14196,
374,
34908,
11,
264,
1595,
14524,
7791,
1480,
63,
320,
778,
2101,
904,
198,
286,
9861,
304,
54391,
6299,
8,
374,
9408,
382,
286,
1442,
264,
1595,
19448,
23344,
63,
374,
10791,
11,
904,
9861,
6299,
527,
6052,
198,
286,
7214,
2085,
8748,
369,
9954,
382,
286,
5354,
2373,
17805,
487,
220,
15,
13,
17,
13,
15,
198,
310,
61411,
1595,
14524,
7791,
1480,
63,
389,
9829,
271,
286,
551,
913,
51934,
6299,
25,
459,
51934,
315,
1595,
2573,
62169,
274,
323,
5255,
1023,
2819,
198,
310,
430,
527,
22281,
6105,
311,
551,
69991,
19258,
9838,
8090,
4077,
286,
551,
913,
1396,
3868,
21183,
25,
1268,
1690,
6622,
311,
6212,
1990,
198,
310,
7540,
26,
17088,
311,
551,
3064,
19258,
11748,
21183,
63,
422,
539,
5300,
477,
198,
310,
1595,
4155,
4077,
286,
551,
913,
1396,
3868,
3084,
25,
279,
2860,
1396,
315,
6622,
1306,
902,
279,
198,
310,
1749,
690,
4933,
459,
1493,
422,
904,
6299,
617,
539,
3686,
8308,
345,
310,
477,
264,
8389,
1396,
311,
3868,
56334,
26,
17088,
311,
198,
310,
551,
3064,
19258,
11748,
3084,
63,
422,
539,
5300,
477,
1595,
4155,
4077,
286,
551,
33613,
25,
14143,
315,
1595,
2573,
62169,
274,
198,
286,
551,
33371,
9503,
7227,
1480,
25,
422,
279,
5446,
15233,
31737,
449,
459,
1493,
198,
286,
551,
33371,
14144,
7791,
1480,
25,
422,
10103,
11748,
3084,
14196,
374,
34908,
271,
14711,
6075,
512,
755,
3868,
26440,
1214,
11,
6299,
11,
3868,
21183,
5980,
11,
3868,
3084,
5980,
997,
286,
436,
7275,
286,
25385,
279,
3622,
48582,
3156,
682,
6299,
304,
10103,
4109,
14196,
617,
198,
286,
3060,
8308,
477,
37410,
1171,
704,
11,
78504,
1855,
1595,
2573,
63,
6,
82,
1620,
907,
198,
286,
439,
433,
10548,
382,
286,
1442,
10103,
11748,
3084,
14196,
374,
34908,
11,
264,
1595,
14524,
7791,
1480,
63,
320,
778,
2101,
904,
198,
286,
9861,
304,
54391,
6299,
8,
374,
9408,
382,
286,
1442,
264,
1595,
19448,
23344,
63,
374,
10791,
11,
904,
9861,
6299,
527,
6052,
198,
286,
7214,
2085,
8748,
369,
9954,
382,
286,
5354,
2373,
17805,
487,
220,
15,
13,
17,
13,
15,
198,
310,
61411,
1595,
14524,
7791,
1480,
63,
389,
9829,
271,
286,
551,
913,
51934,
6299,
25,
459,
51934,
315,
1595,
2573,
62169,
274,
323,
5255,
1023,
2819,
198,
310,
430,
527,
22281,
6105,
311,
551,
69991,
19258,
9838,
8090,
4077,
286,
551,
913,
1396,
3868,
21183,
25,
1268,
1690,
6622,
311,
6212,
1990,
198,
310,
7540,
26,
17088,
311,
551,
3064,
19258,
11748,
21183,
63,
422,
539,
5300,
477,
198,
310,
1595,
4155,
4077,
286,
551
] |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 62