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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 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, 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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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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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, 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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 ]
[ 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 ]
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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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 ]
[ 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 262, 220, 1114, 220, 6660, 18, 256, 6360, 262, 220, 972, 220, 330, 843, 256, 6360 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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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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 ]
[ 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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,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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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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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 ]
[ 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 ]
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 ]
angr/angr
angr/utils/graph.py
compute_dominance_frontier
def compute_dominance_frontier(graph, domtree): """ Compute a dominance frontier based on the given post-dominator tree. This implementation is based on figure 2 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. :param graph: The graph where we want to compute the dominance frontier. :param domtree: The dominator tree :returns: A dict of dominance frontier """ df = {} # Perform a post-order search on the dominator tree for x in networkx.dfs_postorder_nodes(domtree): if x not in graph: # Skip nodes that are not in the graph continue df[x] = set() # local set for y in graph.successors(x): if x not in domtree.predecessors(y): df[x].add(y) # up set if x is None: continue for z in domtree.successors(x): if z is x: continue if z not in df: continue for y in df[z]: if x not in list(domtree.predecessors(y)): df[x].add(y) return df
python
def compute_dominance_frontier(graph, domtree): """ Compute a dominance frontier based on the given post-dominator tree. This implementation is based on figure 2 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. :param graph: The graph where we want to compute the dominance frontier. :param domtree: The dominator tree :returns: A dict of dominance frontier """ df = {} # Perform a post-order search on the dominator tree for x in networkx.dfs_postorder_nodes(domtree): if x not in graph: # Skip nodes that are not in the graph continue df[x] = set() # local set for y in graph.successors(x): if x not in domtree.predecessors(y): df[x].add(y) # up set if x is None: continue for z in domtree.successors(x): if z is x: continue if z not in df: continue for y in df[z]: if x not in list(domtree.predecessors(y)): df[x].add(y) return df
[ "def", "compute_dominance_frontier", "(", "graph", ",", "domtree", ")", ":", "df", "=", "{", "}", "# Perform a post-order search on the dominator tree", "for", "x", "in", "networkx", ".", "dfs_postorder_nodes", "(", "domtree", ")", ":", "if", "x", "not", "in", "graph", ":", "# Skip nodes that are not in the graph", "continue", "df", "[", "x", "]", "=", "set", "(", ")", "# local set", "for", "y", "in", "graph", ".", "successors", "(", "x", ")", ":", "if", "x", "not", "in", "domtree", ".", "predecessors", "(", "y", ")", ":", "df", "[", "x", "]", ".", "add", "(", "y", ")", "# up set", "if", "x", "is", "None", ":", "continue", "for", "z", "in", "domtree", ".", "successors", "(", "x", ")", ":", "if", "z", "is", "x", ":", "continue", "if", "z", "not", "in", "df", ":", "continue", "for", "y", "in", "df", "[", "z", "]", ":", "if", "x", "not", "in", "list", "(", "domtree", ".", "predecessors", "(", "y", ")", ")", ":", "df", "[", "x", "]", ".", "add", "(", "y", ")", "return", "df" ]
Compute a dominance frontier based on the given post-dominator tree. This implementation is based on figure 2 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. :param graph: The graph where we want to compute the dominance frontier. :param domtree: The dominator tree :returns: A dict of dominance frontier
[ "Compute", "a", "dominance", "frontier", "based", "on", "the", "given", "post", "-", "dominator", "tree", "." ]
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/utils/graph.py#L63-L104
<|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: Compute a dominance frontier based on the given post-dominator tree. This implementation is based on figure 2 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. :param graph: The graph where we want to compute the dominance frontier. :param domtree: The dominator tree :returns: A dict of dominance frontier ### Response: def compute_dominance_frontier(graph, domtree): """ Compute a dominance frontier based on the given post-dominator tree. This implementation is based on figure 2 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. :param graph: The graph where we want to compute the dominance frontier. :param domtree: The dominator tree :returns: A dict of dominance frontier """ df = {} # Perform a post-order search on the dominator tree for x in networkx.dfs_postorder_nodes(domtree): if x not in graph: # Skip nodes that are not in the graph continue df[x] = set() # local set for y in graph.successors(x): if x not in domtree.predecessors(y): df[x].add(y) # up set if x is None: continue for z in domtree.successors(x): if z is x: continue if z not in df: continue for y in df[z]: if x not in list(domtree.predecessors(y)): df[x].add(y) return df <|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, 47354, 264, 44592, 49100, 3196, 389, 279, 2728, 1772, 1773, 31306, 5021, 382, 262, 1115, 8292, 374, 3196, 389, 7216, 220, 17, 315, 5684, 1556, 90106, 6872, 315, 46879, 23977, 11579, 35527, 198, 262, 3459, 555, 14662, 18221, 35785, 11, 5099, 382, 262, 551, 913, 4876, 25, 256, 578, 4876, 1405, 584, 1390, 311, 12849, 279, 44592, 49100, 627, 262, 551, 913, 4824, 9528, 25, 578, 11358, 859, 5021, 198, 262, 551, 4310, 25, 996, 362, 6587, 315, 44592, 49100, 271, 14711, 6075, 512, 755, 12849, 821, 8129, 685, 23777, 1291, 25301, 11, 4824, 9528, 997, 262, 3270, 262, 23426, 264, 44592, 49100, 3196, 389, 279, 2728, 1772, 1773, 31306, 5021, 382, 262, 1115, 8292, 374, 3196, 389, 7216, 220, 17, 315, 5684, 1556, 90106, 6872, 315, 46879, 23977, 11579, 35527, 198, 262, 3459, 555, 14662, 18221, 35785, 11, 5099, 382, 262, 551, 913, 4876, 25, 256, 578, 4876, 1405, 584, 1390, 311, 12849, 279, 44592, 49100, 627, 262, 551, 913, 4824, 9528, 25, 578, 11358, 859, 5021, 198, 262, 551, 4310, 25, 996, 362, 6587, 315, 44592, 49100, 198, 262, 12713, 262, 6907, 284, 10294, 262, 674, 26050, 264, 1772, 24747, 2778, 389, 279, 11358, 859, 5021, 198, 262, 369, 865, 304, 4009, 87, 962, 3933, 6467, 1382, 15242, 61956, 9528, 7887, 286, 422, 865, 539, 304, 4876, 512, 310, 674, 26869, 7954, 430, 527, 539, 304, 279, 4876, 198, 310, 3136, 271, 286, 6907, 8487, 60, 284, 743, 2892, 286, 674, 2254, 743, 198, 286, 369, 379, 304, 4876, 15788, 1105, 2120, 997, 310, 422, 865, 539, 304, 4824, 9528, 6357, 28009, 1105, 7166, 997, 394, 6907, 8487, 948, 723, 7166, 696, 286, 674, 709, 743, 198, 286, 422, 865, 374, 2290, 512, 310, 3136, 271, 286, 369, 1167, 304, 4824, 9528, 15788, 1105, 2120, 997, 310, 422, 1167, 374, 865, 512, 394, 3136, 198, 310, 422, 1167, 539, 304, 6907, 512, 394, 3136, 198, 310, 369, 379, 304, 6907, 46375, 10556, 394, 422, 865, 539, 304, 1160, 61956, 9528, 6357, 28009, 1105, 7166, 10162, 504, 6907, 8487, 948, 723, 7166, 696, 262, 471, 6907, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 47354, 264, 44592, 49100, 3196, 389, 279, 2728, 1772, 1773, 31306, 5021, 382, 262, 1115, 8292, 374, 3196, 389, 7216, 220, 17, 315, 5684, 1556, 90106, 6872, 315, 46879, 23977, 11579, 35527, 198, 262, 3459, 555, 14662, 18221, 35785, 11, 5099, 382, 262, 551, 913, 4876, 25, 256, 578, 4876, 1405, 584, 1390, 311, 12849, 279, 44592, 49100, 627, 262, 551, 913, 4824, 9528, 25, 578, 11358, 859, 5021, 198, 262, 551, 4310, 25, 996, 362, 6587, 315, 44592, 49100, 271, 14711, 6075, 512, 755, 12849, 821, 8129, 685, 23777, 1291, 25301, 11, 4824, 9528, 997, 262, 3270, 262, 23426, 264, 44592, 49100, 3196, 389, 279, 2728, 1772, 1773, 31306, 5021, 382, 262, 1115, 8292, 374, 3196, 389, 7216, 220, 17, 315, 5684, 1556, 90106, 6872, 315, 46879, 23977, 11579, 35527, 198, 262, 3459, 555, 14662, 18221, 35785, 11, 5099, 382, 262, 551, 913, 4876, 25, 256, 578, 4876, 1405, 584, 1390, 311, 12849, 279, 44592, 49100, 627, 262, 551, 913, 4824, 9528, 25, 578, 11358, 859, 5021, 198, 262, 551, 4310, 25, 996, 362, 6587, 315, 44592, 49100, 198, 262, 12713, 262, 6907, 284, 10294, 262, 674, 26050, 264, 1772, 24747, 2778, 389, 279, 11358, 859, 5021, 198, 262, 369, 865, 304, 4009, 87, 962, 3933, 6467, 1382, 15242, 61956, 9528, 7887, 286, 422, 865, 539, 304, 4876, 512, 310, 674, 26869, 7954, 430, 527, 539, 304, 279, 4876, 198, 310, 3136, 271, 286, 6907, 8487, 60, 284, 743, 2892, 286, 674, 2254, 743, 198, 286, 369, 379, 304, 4876, 15788, 1105, 2120, 997, 310, 422, 865, 539, 304, 4824, 9528, 6357, 28009, 1105, 7166, 997, 394, 6907, 8487, 948, 723, 7166, 696, 286, 674, 709, 743, 198, 286, 422, 865, 374, 2290, 512, 310, 3136, 271, 286, 369, 1167, 304, 4824, 9528, 15788, 1105, 2120, 997, 310, 422, 1167, 374, 865, 512, 394, 3136, 198, 310, 422, 1167, 539, 304, 6907, 512, 394, 3136, 198, 310, 369, 379, 304, 6907, 46375, 10556, 394, 422, 865, 539, 304, 1160, 61956, 9528, 6357, 28009, 1105, 7166, 10162, 504, 6907, 8487, 948, 723, 7166, 696, 262, 471, 6907, 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 ]
coin-or/GiMPy
src/gimpy/graph.py
Graph.simplex_determine_leaving_arc
def simplex_determine_leaving_arc(self, t, k, l): ''' API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l: head of the entering arc. Return: Returns the tuple that represents leaving arc, capacity of the cycle and cycle. ''' # k,l are the first two elements of the cycle cycle = self.simplex_identify_cycle(t, k, l) flow_kl = self.get_edge_attr(k, l, 'flow') capacity_kl = self.get_edge_attr(k, l, 'capacity') min_capacity = capacity_kl # check if k,l is in U or L if flow_kl==capacity_kl: # l,k will be the last two elements cycle.reverse() n = len(cycle) index = 0 # determine last blocking arc t.add_edge(k, l) tel = t.get_edge_list() while index < (n-1): if (cycle[index], cycle[index+1]) in tel: flow = self.edge_attr[(cycle[index], cycle[index+1])]['flow'] capacity = \ self.edge_attr[(cycle[index],cycle[index+1])]['capacity'] if min_capacity >= (capacity-flow): candidate = (cycle[index], cycle[index+1]) min_capacity = capacity-flow else: flow = self.edge_attr[(cycle[index+1], cycle[index])]['flow'] if min_capacity >= flow: candidate = (cycle[index+1], cycle[index]) min_capacity = flow index += 1 # check arc (cycle[n-1], cycle[0]) if (cycle[n-1], cycle[0]) in tel: flow = self.edge_attr[(cycle[n-1], cycle[0])]['flow'] capacity = self.edge_attr[(cycle[n-1], cycle[0])]['capacity'] if min_capacity >= (capacity-flow): candidate = (cycle[n-1], cycle[0]) min_capacity = capacity-flow else: flow = self.edge_attr[(cycle[0], cycle[n-1])]['flow'] if min_capacity >= flow: candidate = (cycle[0], cycle[n-1]) min_capacity = flow return (candidate, min_capacity, cycle)
python
def simplex_determine_leaving_arc(self, t, k, l): ''' API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l: head of the entering arc. Return: Returns the tuple that represents leaving arc, capacity of the cycle and cycle. ''' # k,l are the first two elements of the cycle cycle = self.simplex_identify_cycle(t, k, l) flow_kl = self.get_edge_attr(k, l, 'flow') capacity_kl = self.get_edge_attr(k, l, 'capacity') min_capacity = capacity_kl # check if k,l is in U or L if flow_kl==capacity_kl: # l,k will be the last two elements cycle.reverse() n = len(cycle) index = 0 # determine last blocking arc t.add_edge(k, l) tel = t.get_edge_list() while index < (n-1): if (cycle[index], cycle[index+1]) in tel: flow = self.edge_attr[(cycle[index], cycle[index+1])]['flow'] capacity = \ self.edge_attr[(cycle[index],cycle[index+1])]['capacity'] if min_capacity >= (capacity-flow): candidate = (cycle[index], cycle[index+1]) min_capacity = capacity-flow else: flow = self.edge_attr[(cycle[index+1], cycle[index])]['flow'] if min_capacity >= flow: candidate = (cycle[index+1], cycle[index]) min_capacity = flow index += 1 # check arc (cycle[n-1], cycle[0]) if (cycle[n-1], cycle[0]) in tel: flow = self.edge_attr[(cycle[n-1], cycle[0])]['flow'] capacity = self.edge_attr[(cycle[n-1], cycle[0])]['capacity'] if min_capacity >= (capacity-flow): candidate = (cycle[n-1], cycle[0]) min_capacity = capacity-flow else: flow = self.edge_attr[(cycle[0], cycle[n-1])]['flow'] if min_capacity >= flow: candidate = (cycle[0], cycle[n-1]) min_capacity = flow return (candidate, min_capacity, cycle)
[ "def", "simplex_determine_leaving_arc", "(", "self", ",", "t", ",", "k", ",", "l", ")", ":", "# k,l are the first two elements of the cycle", "cycle", "=", "self", ".", "simplex_identify_cycle", "(", "t", ",", "k", ",", "l", ")", "flow_kl", "=", "self", ".", "get_edge_attr", "(", "k", ",", "l", ",", "'flow'", ")", "capacity_kl", "=", "self", ".", "get_edge_attr", "(", "k", ",", "l", ",", "'capacity'", ")", "min_capacity", "=", "capacity_kl", "# check if k,l is in U or L", "if", "flow_kl", "==", "capacity_kl", ":", "# l,k will be the last two elements", "cycle", ".", "reverse", "(", ")", "n", "=", "len", "(", "cycle", ")", "index", "=", "0", "# determine last blocking arc", "t", ".", "add_edge", "(", "k", ",", "l", ")", "tel", "=", "t", ".", "get_edge_list", "(", ")", "while", "index", "<", "(", "n", "-", "1", ")", ":", "if", "(", "cycle", "[", "index", "]", ",", "cycle", "[", "index", "+", "1", "]", ")", "in", "tel", ":", "flow", "=", "self", ".", "edge_attr", "[", "(", "cycle", "[", "index", "]", ",", "cycle", "[", "index", "+", "1", "]", ")", "]", "[", "'flow'", "]", "capacity", "=", "self", ".", "edge_attr", "[", "(", "cycle", "[", "index", "]", ",", "cycle", "[", "index", "+", "1", "]", ")", "]", "[", "'capacity'", "]", "if", "min_capacity", ">=", "(", "capacity", "-", "flow", ")", ":", "candidate", "=", "(", "cycle", "[", "index", "]", ",", "cycle", "[", "index", "+", "1", "]", ")", "min_capacity", "=", "capacity", "-", "flow", "else", ":", "flow", "=", "self", ".", "edge_attr", "[", "(", "cycle", "[", "index", "+", "1", "]", ",", "cycle", "[", "index", "]", ")", "]", "[", "'flow'", "]", "if", "min_capacity", ">=", "flow", ":", "candidate", "=", "(", "cycle", "[", "index", "+", "1", "]", ",", "cycle", "[", "index", "]", ")", "min_capacity", "=", "flow", "index", "+=", "1", "# check arc (cycle[n-1], cycle[0])", "if", "(", "cycle", "[", "n", "-", "1", "]", ",", "cycle", "[", "0", "]", ")", "in", "tel", ":", "flow", "=", "self", ".", "edge_attr", "[", "(", "cycle", "[", "n", "-", "1", "]", ",", "cycle", "[", "0", "]", ")", "]", "[", "'flow'", "]", "capacity", "=", "self", ".", "edge_attr", "[", "(", "cycle", "[", "n", "-", "1", "]", ",", "cycle", "[", "0", "]", ")", "]", "[", "'capacity'", "]", "if", "min_capacity", ">=", "(", "capacity", "-", "flow", ")", ":", "candidate", "=", "(", "cycle", "[", "n", "-", "1", "]", ",", "cycle", "[", "0", "]", ")", "min_capacity", "=", "capacity", "-", "flow", "else", ":", "flow", "=", "self", ".", "edge_attr", "[", "(", "cycle", "[", "0", "]", ",", "cycle", "[", "n", "-", "1", "]", ")", "]", "[", "'flow'", "]", "if", "min_capacity", ">=", "flow", ":", "candidate", "=", "(", "cycle", "[", "0", "]", ",", "cycle", "[", "n", "-", "1", "]", ")", "min_capacity", "=", "flow", "return", "(", "candidate", ",", "min_capacity", ",", "cycle", ")" ]
API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l: head of the entering arc. Return: Returns the tuple that represents leaving arc, capacity of the cycle and cycle.
[ "API", ":", "simplex_determine_leaving_arc", "(", "self", "t", "k", "l", ")", "Description", ":", "Determines", "and", "returns", "the", "leaving", "arc", ".", "Input", ":", "t", ":", "current", "spanning", "tree", "solution", ".", "k", ":", "tail", "of", "the", "entering", "arc", ".", "l", ":", "head", "of", "the", "entering", "arc", ".", "Return", ":", "Returns", "the", "tuple", "that", "represents", "leaving", "arc", "capacity", "of", "the", "cycle", "and", "cycle", "." ]
train
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L2349-L2403
<|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: API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l: head of the entering arc. Return: Returns the tuple that represents leaving arc, capacity of the cycle and cycle. ### Response: def simplex_determine_leaving_arc(self, t, k, l): ''' API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l: head of the entering arc. Return: Returns the tuple that represents leaving arc, capacity of the cycle and cycle. ''' # k,l are the first two elements of the cycle cycle = self.simplex_identify_cycle(t, k, l) flow_kl = self.get_edge_attr(k, l, 'flow') capacity_kl = self.get_edge_attr(k, l, 'capacity') min_capacity = capacity_kl # check if k,l is in U or L if flow_kl==capacity_kl: # l,k will be the last two elements cycle.reverse() n = len(cycle) index = 0 # determine last blocking arc t.add_edge(k, l) tel = t.get_edge_list() while index < (n-1): if (cycle[index], cycle[index+1]) in tel: flow = self.edge_attr[(cycle[index], cycle[index+1])]['flow'] capacity = \ self.edge_attr[(cycle[index],cycle[index+1])]['capacity'] if min_capacity >= (capacity-flow): candidate = (cycle[index], cycle[index+1]) min_capacity = capacity-flow else: flow = self.edge_attr[(cycle[index+1], cycle[index])]['flow'] if min_capacity >= flow: candidate = (cycle[index+1], cycle[index]) min_capacity = flow index += 1 # check arc (cycle[n-1], cycle[0]) if (cycle[n-1], cycle[0]) in tel: flow = self.edge_attr[(cycle[n-1], cycle[0])]['flow'] capacity = self.edge_attr[(cycle[n-1], cycle[0])]['capacity'] if min_capacity >= (capacity-flow): candidate = (cycle[n-1], cycle[0]) min_capacity = capacity-flow else: flow = self.edge_attr[(cycle[0], cycle[n-1])]['flow'] if min_capacity >= flow: candidate = (cycle[0], cycle[n-1]) min_capacity = flow return (candidate, min_capacity, cycle) <|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, 7227, 512, 310, 92751, 821, 25296, 12013, 2370, 64014, 1214, 11, 259, 11, 597, 11, 326, 340, 286, 7817, 512, 310, 53812, 323, 4780, 279, 9564, 15952, 627, 286, 5688, 512, 310, 259, 25, 1510, 56886, 5021, 6425, 627, 310, 597, 25, 9986, 315, 279, 16661, 15952, 627, 310, 326, 25, 2010, 315, 279, 16661, 15952, 627, 286, 3494, 512, 310, 5295, 279, 14743, 430, 11105, 9564, 15952, 11, 8824, 315, 279, 198, 310, 11008, 323, 11008, 382, 14711, 6075, 512, 755, 92751, 821, 25296, 12013, 2370, 64014, 1214, 11, 259, 11, 597, 11, 326, 997, 286, 11414, 286, 5446, 512, 310, 92751, 821, 25296, 12013, 2370, 64014, 1214, 11, 259, 11, 597, 11, 326, 340, 286, 7817, 512, 310, 53812, 323, 4780, 279, 9564, 15952, 627, 286, 5688, 512, 310, 259, 25, 1510, 56886, 5021, 6425, 627, 310, 597, 25, 9986, 315, 279, 16661, 15952, 627, 310, 326, 25, 2010, 315, 279, 16661, 15952, 627, 286, 3494, 512, 310, 5295, 279, 14743, 430, 11105, 9564, 15952, 11, 8824, 315, 279, 198, 310, 11008, 323, 11008, 627, 286, 11414, 286, 674, 597, 22997, 527, 279, 1176, 1403, 5540, 315, 279, 11008, 198, 286, 11008, 284, 659, 25456, 87, 39499, 1463, 40179, 1175, 11, 597, 11, 326, 340, 286, 6530, 4803, 75, 284, 659, 673, 18416, 10639, 6097, 11, 326, 11, 364, 5072, 1329, 286, 8824, 4803, 75, 284, 659, 673, 18416, 10639, 6097, 11, 326, 11, 364, 38487, 1329, 286, 1332, 36703, 284, 8824, 4803, 75, 198, 286, 674, 1817, 422, 597, 22997, 374, 304, 549, 477, 445, 198, 286, 422, 6530, 4803, 75, 419, 38487, 4803, 75, 512, 310, 674, 326, 16539, 690, 387, 279, 1566, 1403, 5540, 198, 310, 11008, 33181, 746, 286, 308, 284, 2479, 1361, 5566, 340, 286, 1963, 284, 220, 15, 198, 286, 674, 8417, 1566, 22978, 15952, 198, 286, 259, 1388, 18416, 6097, 11, 326, 340, 286, 19227, 284, 259, 673, 18416, 2062, 746, 286, 1418, 1963, 366, 320, 77, 12, 16, 997, 310, 422, 320, 22352, 6042, 1145, 11008, 6042, 10, 16, 2526, 304, 19227, 512, 394, 6530, 284, 659, 55366, 10639, 9896, 22352, 6042, 1145, 11008, 6042, 10, 16, 2526, 5465, 5072, 4532, 394, 8824, 284, 3120, 504, 659, 55366, 10639, 9896, 22352, 6042, 1145, 22352, 6042, 10, 16, 2526, 5465, 38487, 4532, 394, 422, 1332, 36703, 2669, 320, 38487, 62413, 997, 504, 9322, 284, 320, 22352, 6042, 1145, 11008, 6042, 10, 16, 2608, 504, 1332, 36703, 284, 8824, 62413, 198, 310, 775, 512, 394, 6530, 284, 659, 55366, 10639, 9896, 22352, 6042, 10, 16, 1145, 11008, 6042, 2526, 5465, 5072, 4532, 394, 422, 1332, 36703, 2669, 6530, 512, 504, 9322, 284, 320, 22352, 6042, 10, 16, 1145, 11008, 6042, 2608, 504, 1332, 36703, 284, 6530, 198, 310, 1963, 1447, 220, 16, 198, 286, 674, 1817, 15952, 320, 22352, 7824, 12, 16, 1145, 11008, 58 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 7227, 512, 310, 92751, 821, 25296, 12013, 2370, 64014, 1214, 11, 259, 11, 597, 11, 326, 340, 286, 7817, 512, 310, 53812, 323, 4780, 279, 9564, 15952, 627, 286, 5688, 512, 310, 259, 25, 1510, 56886, 5021, 6425, 627, 310, 597, 25, 9986, 315, 279, 16661, 15952, 627, 310, 326, 25, 2010, 315, 279, 16661, 15952, 627, 286, 3494, 512, 310, 5295, 279, 14743, 430, 11105, 9564, 15952, 11, 8824, 315, 279, 198, 310, 11008, 323, 11008, 382, 14711, 6075, 512, 755, 92751, 821, 25296, 12013, 2370, 64014, 1214, 11, 259, 11, 597, 11, 326, 997, 286, 11414, 286, 5446, 512, 310, 92751, 821, 25296, 12013, 2370, 64014, 1214, 11, 259, 11, 597, 11, 326, 340, 286, 7817, 512, 310, 53812, 323, 4780, 279, 9564, 15952, 627, 286, 5688, 512, 310, 259, 25, 1510, 56886, 5021, 6425, 627, 310, 597, 25, 9986, 315, 279, 16661, 15952, 627, 310, 326, 25, 2010, 315, 279, 16661, 15952, 627, 286, 3494, 512, 310, 5295, 279, 14743, 430, 11105, 9564, 15952, 11, 8824, 315, 279, 198, 310, 11008, 323, 11008, 627, 286, 11414, 286, 674, 597, 22997, 527, 279, 1176, 1403, 5540, 315, 279, 11008, 198, 286, 11008, 284, 659, 25456, 87, 39499, 1463, 40179, 1175, 11, 597, 11, 326, 340, 286, 6530, 4803, 75, 284, 659, 673, 18416, 10639, 6097, 11, 326, 11, 364, 5072, 1329, 286, 8824, 4803, 75, 284, 659, 673, 18416, 10639, 6097, 11, 326, 11, 364, 38487, 1329, 286, 1332, 36703, 284, 8824, 4803, 75, 198, 286, 674, 1817, 422, 597, 22997, 374, 304, 549, 477, 445, 198, 286, 422, 6530, 4803, 75, 419, 38487, 4803, 75, 512, 310, 674, 326, 16539, 690, 387, 279, 1566, 1403, 5540, 198, 310, 11008, 33181, 746, 286, 308, 284, 2479, 1361, 5566, 340, 286, 1963, 284, 220, 15, 198, 286, 674, 8417, 1566, 22978, 15952, 198, 286, 259, 1388, 18416, 6097, 11, 326, 340, 286, 19227, 284, 259, 673, 18416, 2062, 746, 286, 1418, 1963, 366, 320, 77, 12, 16, 997, 310, 422, 320, 22352, 6042, 1145, 11008, 6042, 10, 16, 2526, 304, 19227, 512, 394, 6530, 284, 659, 55366, 10639, 9896, 22352, 6042, 1145, 11008, 6042, 10, 16, 2526, 5465, 5072, 4532, 394, 8824, 284, 3120, 504, 659, 55366, 10639, 9896, 22352, 6042, 1145, 22352, 6042, 10, 16, 2526, 5465, 38487, 4532, 394, 422, 1332, 36703, 2669, 320, 38487, 62413, 997, 504, 9322, 284, 320, 22352, 6042, 1145, 11008, 6042, 10, 16, 2608, 504, 1332, 36703, 284, 8824, 62413, 198, 310, 775, 512, 394, 6530, 284, 659, 55366, 10639, 9896, 22352, 6042, 10, 16, 1145, 11008, 6042, 2526, 5465, 5072, 4532, 394, 422, 1332, 36703, 2669, 6530, 512, 504, 9322, 284, 320, 22352, 6042, 10, 16, 1145, 11008, 6042, 2608, 504, 1332, 36703, 284, 6530, 198, 310, 1963, 1447, 220, 16, 198, 286, 674, 1817, 15952, 320, 22352, 7824, 12, 16, 1145, 11008, 58 ]
CamDavidsonPilon/lifelines
lifelines/utils/__init__.py
survival_table_from_events
def survival_table_from_events( death_times, event_observed, birth_times=None, columns=["removed", "observed", "censored", "entrance", "at_risk"], weights=None, collapse=False, intervals=None, ): # pylint: disable=dangerous-default-value,too-many-locals """ Parameters ---------- death_times: (n,) array represent the event times event_observed: (n,) array 1 if observed event, 0 is censored event. birth_times: a (n,) array, optional representing when the subject was first observed. A subject's death event is then at [birth times + duration observed]. If None (default), birth_times are set to be the first observation or 0, which ever is smaller. columns: iterable, optional a 3-length array to call the, in order, removed individuals, observed deaths and censorships. weights: (n,1) array, optional Optional argument to use weights for individuals. Assumes weights of 1 if not provided. collapse: boolean, optional (default=False) If True, collapses survival table into lifetable to show events in interval bins intervals: iterable, optional Default None, otherwise a list/(n,1) array of interval edge measures. If left as None while collapse=True, then Freedman-Diaconis rule for histogram bins will be used to determine intervals. Returns ------- DataFrame Pandas DataFrame with index as the unique times or intervals in event_times. The columns named 'removed' refers to the number of individuals who were removed from the population by the end of the period. The column 'observed' refers to the number of removed individuals who were observed to have died (i.e. not censored.) The column 'censored' is defined as 'removed' - 'observed' (the number of individuals who left the population due to event_observed) Example ------- >>> #Uncollapsed output >>> removed observed censored entrance at_risk >>> event_at >>> 0 0 0 0 11 11 >>> 6 1 1 0 0 11 >>> 7 2 2 0 0 10 >>> 9 3 3 0 0 8 >>> 13 3 3 0 0 5 >>> 15 2 2 0 0 2 >>> #Collapsed output >>> removed observed censored at_risk >>> sum sum sum max >>> event_at >>> (0, 2] 34 33 1 312 >>> (2, 4] 84 42 42 278 >>> (4, 6] 64 17 47 194 >>> (6, 8] 63 16 47 130 >>> (8, 10] 35 12 23 67 >>> (10, 12] 24 5 19 32 See Also -------- group_survival_table_from_events """ removed, observed, censored, entrance, at_risk = columns death_times = np.asarray(death_times) if birth_times is None: birth_times = min(0, death_times.min()) * np.ones(death_times.shape[0]) else: birth_times = np.asarray(birth_times) if np.any(birth_times > death_times): raise ValueError("birth time must be less than time of death.") if weights is None: weights = 1 # deal with deaths and censorships df = pd.DataFrame(death_times, columns=["event_at"]) df[removed] = np.asarray(weights) df[observed] = np.asarray(weights) * (np.asarray(event_observed).astype(bool)) death_table = df.groupby("event_at").sum() death_table[censored] = (death_table[removed] - death_table[observed]).astype(int) # deal with late births births = pd.DataFrame(birth_times, columns=["event_at"]) births[entrance] = np.asarray(weights) births_table = births.groupby("event_at").sum() event_table = death_table.join(births_table, how="outer", sort=True).fillna(0) # http://wesmckinney.com/blog/?p=414 event_table[at_risk] = event_table[entrance].cumsum() - event_table[removed].cumsum().shift(1).fillna(0) # group by intervals if (collapse) or (intervals is not None): event_table = _group_event_table_by_intervals(event_table, intervals) if (np.asarray(weights).astype(int) != weights).any(): return event_table.astype(float) return event_table.astype(int)
python
def survival_table_from_events( death_times, event_observed, birth_times=None, columns=["removed", "observed", "censored", "entrance", "at_risk"], weights=None, collapse=False, intervals=None, ): # pylint: disable=dangerous-default-value,too-many-locals """ Parameters ---------- death_times: (n,) array represent the event times event_observed: (n,) array 1 if observed event, 0 is censored event. birth_times: a (n,) array, optional representing when the subject was first observed. A subject's death event is then at [birth times + duration observed]. If None (default), birth_times are set to be the first observation or 0, which ever is smaller. columns: iterable, optional a 3-length array to call the, in order, removed individuals, observed deaths and censorships. weights: (n,1) array, optional Optional argument to use weights for individuals. Assumes weights of 1 if not provided. collapse: boolean, optional (default=False) If True, collapses survival table into lifetable to show events in interval bins intervals: iterable, optional Default None, otherwise a list/(n,1) array of interval edge measures. If left as None while collapse=True, then Freedman-Diaconis rule for histogram bins will be used to determine intervals. Returns ------- DataFrame Pandas DataFrame with index as the unique times or intervals in event_times. The columns named 'removed' refers to the number of individuals who were removed from the population by the end of the period. The column 'observed' refers to the number of removed individuals who were observed to have died (i.e. not censored.) The column 'censored' is defined as 'removed' - 'observed' (the number of individuals who left the population due to event_observed) Example ------- >>> #Uncollapsed output >>> removed observed censored entrance at_risk >>> event_at >>> 0 0 0 0 11 11 >>> 6 1 1 0 0 11 >>> 7 2 2 0 0 10 >>> 9 3 3 0 0 8 >>> 13 3 3 0 0 5 >>> 15 2 2 0 0 2 >>> #Collapsed output >>> removed observed censored at_risk >>> sum sum sum max >>> event_at >>> (0, 2] 34 33 1 312 >>> (2, 4] 84 42 42 278 >>> (4, 6] 64 17 47 194 >>> (6, 8] 63 16 47 130 >>> (8, 10] 35 12 23 67 >>> (10, 12] 24 5 19 32 See Also -------- group_survival_table_from_events """ removed, observed, censored, entrance, at_risk = columns death_times = np.asarray(death_times) if birth_times is None: birth_times = min(0, death_times.min()) * np.ones(death_times.shape[0]) else: birth_times = np.asarray(birth_times) if np.any(birth_times > death_times): raise ValueError("birth time must be less than time of death.") if weights is None: weights = 1 # deal with deaths and censorships df = pd.DataFrame(death_times, columns=["event_at"]) df[removed] = np.asarray(weights) df[observed] = np.asarray(weights) * (np.asarray(event_observed).astype(bool)) death_table = df.groupby("event_at").sum() death_table[censored] = (death_table[removed] - death_table[observed]).astype(int) # deal with late births births = pd.DataFrame(birth_times, columns=["event_at"]) births[entrance] = np.asarray(weights) births_table = births.groupby("event_at").sum() event_table = death_table.join(births_table, how="outer", sort=True).fillna(0) # http://wesmckinney.com/blog/?p=414 event_table[at_risk] = event_table[entrance].cumsum() - event_table[removed].cumsum().shift(1).fillna(0) # group by intervals if (collapse) or (intervals is not None): event_table = _group_event_table_by_intervals(event_table, intervals) if (np.asarray(weights).astype(int) != weights).any(): return event_table.astype(float) return event_table.astype(int)
[ "def", "survival_table_from_events", "(", "death_times", ",", "event_observed", ",", "birth_times", "=", "None", ",", "columns", "=", "[", "\"removed\"", ",", "\"observed\"", ",", "\"censored\"", ",", "\"entrance\"", ",", "\"at_risk\"", "]", ",", "weights", "=", "None", ",", "collapse", "=", "False", ",", "intervals", "=", "None", ",", ")", ":", "# pylint: disable=dangerous-default-value,too-many-locals", "removed", ",", "observed", ",", "censored", ",", "entrance", ",", "at_risk", "=", "columns", "death_times", "=", "np", ".", "asarray", "(", "death_times", ")", "if", "birth_times", "is", "None", ":", "birth_times", "=", "min", "(", "0", ",", "death_times", ".", "min", "(", ")", ")", "*", "np", ".", "ones", "(", "death_times", ".", "shape", "[", "0", "]", ")", "else", ":", "birth_times", "=", "np", ".", "asarray", "(", "birth_times", ")", "if", "np", ".", "any", "(", "birth_times", ">", "death_times", ")", ":", "raise", "ValueError", "(", "\"birth time must be less than time of death.\"", ")", "if", "weights", "is", "None", ":", "weights", "=", "1", "# deal with deaths and censorships", "df", "=", "pd", ".", "DataFrame", "(", "death_times", ",", "columns", "=", "[", "\"event_at\"", "]", ")", "df", "[", "removed", "]", "=", "np", ".", "asarray", "(", "weights", ")", "df", "[", "observed", "]", "=", "np", ".", "asarray", "(", "weights", ")", "*", "(", "np", ".", "asarray", "(", "event_observed", ")", ".", "astype", "(", "bool", ")", ")", "death_table", "=", "df", ".", "groupby", "(", "\"event_at\"", ")", ".", "sum", "(", ")", "death_table", "[", "censored", "]", "=", "(", "death_table", "[", "removed", "]", "-", "death_table", "[", "observed", "]", ")", ".", "astype", "(", "int", ")", "# deal with late births", "births", "=", "pd", ".", "DataFrame", "(", "birth_times", ",", "columns", "=", "[", "\"event_at\"", "]", ")", "births", "[", "entrance", "]", "=", "np", ".", "asarray", "(", "weights", ")", "births_table", "=", "births", ".", "groupby", "(", "\"event_at\"", ")", ".", "sum", "(", ")", "event_table", "=", "death_table", ".", "join", "(", "births_table", ",", "how", "=", "\"outer\"", ",", "sort", "=", "True", ")", ".", "fillna", "(", "0", ")", "# http://wesmckinney.com/blog/?p=414", "event_table", "[", "at_risk", "]", "=", "event_table", "[", "entrance", "]", ".", "cumsum", "(", ")", "-", "event_table", "[", "removed", "]", ".", "cumsum", "(", ")", ".", "shift", "(", "1", ")", ".", "fillna", "(", "0", ")", "# group by intervals", "if", "(", "collapse", ")", "or", "(", "intervals", "is", "not", "None", ")", ":", "event_table", "=", "_group_event_table_by_intervals", "(", "event_table", ",", "intervals", ")", "if", "(", "np", ".", "asarray", "(", "weights", ")", ".", "astype", "(", "int", ")", "!=", "weights", ")", ".", "any", "(", ")", ":", "return", "event_table", ".", "astype", "(", "float", ")", "return", "event_table", ".", "astype", "(", "int", ")" ]
Parameters ---------- death_times: (n,) array represent the event times event_observed: (n,) array 1 if observed event, 0 is censored event. birth_times: a (n,) array, optional representing when the subject was first observed. A subject's death event is then at [birth times + duration observed]. If None (default), birth_times are set to be the first observation or 0, which ever is smaller. columns: iterable, optional a 3-length array to call the, in order, removed individuals, observed deaths and censorships. weights: (n,1) array, optional Optional argument to use weights for individuals. Assumes weights of 1 if not provided. collapse: boolean, optional (default=False) If True, collapses survival table into lifetable to show events in interval bins intervals: iterable, optional Default None, otherwise a list/(n,1) array of interval edge measures. If left as None while collapse=True, then Freedman-Diaconis rule for histogram bins will be used to determine intervals. Returns ------- DataFrame Pandas DataFrame with index as the unique times or intervals in event_times. The columns named 'removed' refers to the number of individuals who were removed from the population by the end of the period. The column 'observed' refers to the number of removed individuals who were observed to have died (i.e. not censored.) The column 'censored' is defined as 'removed' - 'observed' (the number of individuals who left the population due to event_observed) Example ------- >>> #Uncollapsed output >>> removed observed censored entrance at_risk >>> event_at >>> 0 0 0 0 11 11 >>> 6 1 1 0 0 11 >>> 7 2 2 0 0 10 >>> 9 3 3 0 0 8 >>> 13 3 3 0 0 5 >>> 15 2 2 0 0 2 >>> #Collapsed output >>> removed observed censored at_risk >>> sum sum sum max >>> event_at >>> (0, 2] 34 33 1 312 >>> (2, 4] 84 42 42 278 >>> (4, 6] 64 17 47 194 >>> (6, 8] 63 16 47 130 >>> (8, 10] 35 12 23 67 >>> (10, 12] 24 5 19 32 See Also -------- group_survival_table_from_events
[ "Parameters", "----------", "death_times", ":", "(", "n", ")", "array", "represent", "the", "event", "times", "event_observed", ":", "(", "n", ")", "array", "1", "if", "observed", "event", "0", "is", "censored", "event", ".", "birth_times", ":", "a", "(", "n", ")", "array", "optional", "representing", "when", "the", "subject", "was", "first", "observed", ".", "A", "subject", "s", "death", "event", "is", "then", "at", "[", "birth", "times", "+", "duration", "observed", "]", ".", "If", "None", "(", "default", ")", "birth_times", "are", "set", "to", "be", "the", "first", "observation", "or", "0", "which", "ever", "is", "smaller", ".", "columns", ":", "iterable", "optional", "a", "3", "-", "length", "array", "to", "call", "the", "in", "order", "removed", "individuals", "observed", "deaths", "and", "censorships", ".", "weights", ":", "(", "n", "1", ")", "array", "optional", "Optional", "argument", "to", "use", "weights", "for", "individuals", ".", "Assumes", "weights", "of", "1", "if", "not", "provided", ".", "collapse", ":", "boolean", "optional", "(", "default", "=", "False", ")", "If", "True", "collapses", "survival", "table", "into", "lifetable", "to", "show", "events", "in", "interval", "bins", "intervals", ":", "iterable", "optional", "Default", "None", "otherwise", "a", "list", "/", "(", "n", "1", ")", "array", "of", "interval", "edge", "measures", ".", "If", "left", "as", "None", "while", "collapse", "=", "True", "then", "Freedman", "-", "Diaconis", "rule", "for", "histogram", "bins", "will", "be", "used", "to", "determine", "intervals", "." ]
train
https://github.com/CamDavidsonPilon/lifelines/blob/bdf6be6f1d10eea4c46365ee0ee6a47d8c30edf8/lifelines/utils/__init__.py#L262-L361
<|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: Parameters ---------- death_times: (n,) array represent the event times event_observed: (n,) array 1 if observed event, 0 is censored event. birth_times: a (n,) array, optional representing when the subject was first observed. A subject's death event is then at [birth times + duration observed]. If None (default), birth_times are set to be the first observation or 0, which ever is smaller. columns: iterable, optional a 3-length array to call the, in order, removed individuals, observed deaths and censorships. weights: (n,1) array, optional Optional argument to use weights for individuals. Assumes weights of 1 if not provided. collapse: boolean, optional (default=False) If True, collapses survival table into lifetable to show events in interval bins intervals: iterable, optional Default None, otherwise a list/(n,1) array of interval edge measures. If left as None while collapse=True, then Freedman-Diaconis rule for histogram bins will be used to determine intervals. Returns ------- DataFrame Pandas DataFrame with index as the unique times or intervals in event_times. The columns named 'removed' refers to the number of individuals who were removed from the population by the end of the period. The column 'observed' refers to the number of removed individuals who were observed to have died (i.e. not censored.) The column 'censored' is defined as 'removed' - 'observed' (the number of individuals who left the population due to event_observed) Example ------- >>> #Uncollapsed output >>> removed observed censored entrance at_risk >>> event_at >>> 0 0 0 0 11 11 >>> 6 1 1 0 0 11 >>> 7 2 2 0 0 10 >>> 9 3 3 0 0 8 >>> 13 3 3 0 0 5 >>> 15 2 2 0 0 2 >>> #Collapsed output >>> removed observed censored at_risk >>> sum sum sum max >>> event_at >>> (0, 2] 34 33 1 312 >>> (2, 4] 84 42 42 278 >>> (4, 6] 64 17 47 194 >>> (6, 8] 63 16 47 130 >>> (8, 10] 35 12 23 67 >>> (10, 12] 24 5 19 32 See Also -------- group_survival_table_from_events ### Response: def survival_table_from_events( death_times, event_observed, birth_times=None, columns=["removed", "observed", "censored", "entrance", "at_risk"], weights=None, collapse=False, intervals=None, ): # pylint: disable=dangerous-default-value,too-many-locals """ Parameters ---------- death_times: (n,) array represent the event times event_observed: (n,) array 1 if observed event, 0 is censored event. birth_times: a (n,) array, optional representing when the subject was first observed. A subject's death event is then at [birth times + duration observed]. If None (default), birth_times are set to be the first observation or 0, which ever is smaller. columns: iterable, optional a 3-length array to call the, in order, removed individuals, observed deaths and censorships. weights: (n,1) array, optional Optional argument to use weights for individuals. Assumes weights of 1 if not provided. collapse: boolean, optional (default=False) If True, collapses survival table into lifetable to show events in interval bins intervals: iterable, optional Default None, otherwise a list/(n,1) array of interval edge measures. If left as None while collapse=True, then Freedman-Diaconis rule for histogram bins will be used to determine intervals. Returns ------- DataFrame Pandas DataFrame with index as the unique times or intervals in event_times. The columns named 'removed' refers to the number of individuals who were removed from the population by the end of the period. The column 'observed' refers to the number of removed individuals who were observed to have died (i.e. not censored.) The column 'censored' is defined as 'removed' - 'observed' (the number of individuals who left the population due to event_observed) Example ------- >>> #Uncollapsed output >>> removed observed censored entrance at_risk >>> event_at >>> 0 0 0 0 11 11 >>> 6 1 1 0 0 11 >>> 7 2 2 0 0 10 >>> 9 3 3 0 0 8 >>> 13 3 3 0 0 5 >>> 15 2 2 0 0 2 >>> #Collapsed output >>> removed observed censored at_risk >>> sum sum sum max >>> event_at >>> (0, 2] 34 33 1 312 >>> (2, 4] 84 42 42 278 >>> (4, 6] 64 17 47 194 >>> (6, 8] 63 16 47 130 >>> (8, 10] 35 12 23 67 >>> (10, 12] 24 5 19 32 See Also -------- group_survival_table_from_events """ removed, observed, censored, entrance, at_risk = columns death_times = np.asarray(death_times) if birth_times is None: birth_times = min(0, death_times.min()) * np.ones(death_times.shape[0]) else: birth_times = np.asarray(birth_times) if np.any(birth_times > death_times): raise ValueError("birth time must be less than time of death.") if weights is None: weights = 1 # deal with deaths and censorships df = pd.DataFrame(death_times, columns=["event_at"]) df[removed] = np.asarray(weights) df[observed] = np.asarray(weights) * (np.asarray(event_observed).astype(bool)) death_table = df.groupby("event_at").sum() death_table[censored] = (death_table[removed] - death_table[observed]).astype(int) # deal with late births births = pd.DataFrame(birth_times, columns=["event_at"]) births[entrance] = np.asarray(weights) births_table = births.groupby("event_at").sum() event_table = death_table.join(births_table, how="outer", sort=True).fillna(0) # http://wesmckinney.com/blog/?p=414 event_table[at_risk] = event_table[entrance].cumsum() - event_table[removed].cumsum().shift(1).fillna(0) # group by intervals if (collapse) or (intervals is not None): event_table = _group_event_table_by_intervals(event_table, intervals) if (np.asarray(weights).astype(int) != weights).any(): return event_table.astype(float) return event_table.astype(int) <|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, 9905, 198, 262, 31423, 262, 4648, 23155, 25, 320, 77, 47121, 1358, 198, 415, 4097, 279, 1567, 3115, 198, 262, 1567, 31505, 2841, 25, 320, 77, 47121, 1358, 198, 415, 220, 16, 422, 13468, 1567, 11, 220, 15, 374, 272, 56878, 1567, 627, 262, 7342, 23155, 25, 264, 320, 77, 47121, 1358, 11, 10309, 198, 415, 14393, 994, 279, 3917, 574, 1176, 13468, 13, 362, 3917, 596, 4648, 1567, 374, 1243, 520, 510, 28813, 3115, 489, 8250, 13468, 27218, 415, 1442, 2290, 320, 2309, 705, 7342, 23155, 527, 743, 311, 387, 279, 1176, 22695, 477, 220, 15, 11, 902, 3596, 374, 9333, 627, 262, 8310, 25, 51934, 11, 10309, 198, 415, 264, 220, 18, 30425, 1358, 311, 1650, 279, 11, 304, 2015, 11, 7108, 7931, 11, 13468, 16779, 198, 415, 323, 40065, 18143, 627, 262, 14661, 25, 320, 77, 11, 16, 8, 1358, 11, 10309, 198, 415, 12536, 5811, 311, 1005, 14661, 369, 7931, 13, 99207, 14661, 315, 220, 16, 422, 539, 3984, 627, 262, 18678, 25, 2777, 11, 10309, 320, 2309, 5725, 340, 415, 1442, 3082, 11, 87458, 20237, 2007, 1139, 10345, 36164, 311, 1501, 4455, 304, 10074, 29618, 198, 262, 28090, 25, 51934, 11, 10309, 198, 415, 8058, 2290, 11, 6062, 264, 1160, 12148, 77, 11, 16, 8, 1358, 315, 10074, 6964, 11193, 13, 1442, 2163, 439, 2290, 198, 415, 1418, 18678, 3702, 11, 1243, 87976, 1543, 9607, 689, 444, 285, 6037, 369, 31381, 29618, 690, 387, 1511, 311, 8417, 28090, 382, 262, 5295, 198, 262, 39707, 262, 46886, 198, 415, 34606, 300, 46886, 449, 1963, 439, 279, 5016, 3115, 477, 28090, 304, 1567, 23155, 13, 578, 8310, 7086, 198, 415, 364, 46856, 6, 19813, 311, 279, 1396, 315, 7931, 889, 1051, 7108, 505, 279, 7187, 198, 415, 555, 279, 842, 315, 279, 4261, 13, 578, 3330, 364, 5598, 2841, 6, 19813, 311, 279, 1396, 315, 7108, 198, 415, 7931, 889, 1051, 13468, 311, 617, 8636, 320, 72, 1770, 13, 539, 272, 56878, 6266, 578, 3330, 198, 415, 364, 66, 56878, 6, 374, 4613, 439, 364, 46856, 6, 482, 364, 5598, 2841, 6, 320, 1820, 1396, 315, 7931, 889, 198, 415, 2163, 279, 7187, 4245, 311, 1567, 31505, 2841, 696, 262, 13688, 198, 262, 11556, 45464, 262, 12382, 674, 64818, 68074, 2612, 198, 262, 12382, 1881, 7108, 220, 13468, 220, 272, 56878, 220, 20396, 256, 520, 1745, 3267, 198, 262, 12382, 1567, 3837, 198, 262, 12382, 220, 15, 2342, 220, 15, 260, 220, 15, 260, 220, 15, 286, 220, 806, 286, 220, 806, 198, 262, 12382, 220, 21, 2342, 220, 16, 260, 220, 16, 260, 220, 15, 260, 220, 15, 286, 220, 806, 198, 262, 12382, 220, 22, 2342, 220, 17, 260, 220, 17, 260, 220, 15, 260, 220, 15, 286, 220, 605, 198, 262, 12382, 220, 24, 2342, 220, 18, 260, 220, 18, 260, 220, 15, 260, 220, 15, 260 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 9905, 198, 262, 31423, 262, 4648, 23155, 25, 320, 77, 47121, 1358, 198, 415, 4097, 279, 1567, 3115, 198, 262, 1567, 31505, 2841, 25, 320, 77, 47121, 1358, 198, 415, 220, 16, 422, 13468, 1567, 11, 220, 15, 374, 272, 56878, 1567, 627, 262, 7342, 23155, 25, 264, 320, 77, 47121, 1358, 11, 10309, 198, 415, 14393, 994, 279, 3917, 574, 1176, 13468, 13, 362, 3917, 596, 4648, 1567, 374, 1243, 520, 510, 28813, 3115, 489, 8250, 13468, 27218, 415, 1442, 2290, 320, 2309, 705, 7342, 23155, 527, 743, 311, 387, 279, 1176, 22695, 477, 220, 15, 11, 902, 3596, 374, 9333, 627, 262, 8310, 25, 51934, 11, 10309, 198, 415, 264, 220, 18, 30425, 1358, 311, 1650, 279, 11, 304, 2015, 11, 7108, 7931, 11, 13468, 16779, 198, 415, 323, 40065, 18143, 627, 262, 14661, 25, 320, 77, 11, 16, 8, 1358, 11, 10309, 198, 415, 12536, 5811, 311, 1005, 14661, 369, 7931, 13, 99207, 14661, 315, 220, 16, 422, 539, 3984, 627, 262, 18678, 25, 2777, 11, 10309, 320, 2309, 5725, 340, 415, 1442, 3082, 11, 87458, 20237, 2007, 1139, 10345, 36164, 311, 1501, 4455, 304, 10074, 29618, 198, 262, 28090, 25, 51934, 11, 10309, 198, 415, 8058, 2290, 11, 6062, 264, 1160, 12148, 77, 11, 16, 8, 1358, 315, 10074, 6964, 11193, 13, 1442, 2163, 439, 2290, 198, 415, 1418, 18678, 3702, 11, 1243, 87976, 1543, 9607, 689, 444, 285, 6037, 369, 31381, 29618, 690, 387, 1511, 311, 8417, 28090, 382, 262, 5295, 198, 262, 39707, 262, 46886, 198, 415, 34606, 300, 46886, 449, 1963, 439, 279, 5016, 3115, 477, 28090, 304, 1567, 23155, 13, 578, 8310, 7086, 198, 415, 364, 46856, 6, 19813, 311, 279, 1396, 315, 7931, 889, 1051, 7108, 505, 279, 7187, 198, 415, 555, 279, 842, 315, 279, 4261, 13, 578, 3330, 364, 5598, 2841, 6, 19813, 311, 279, 1396, 315, 7108, 198, 415, 7931, 889, 1051, 13468, 311, 617, 8636, 320, 72, 1770, 13, 539, 272, 56878, 6266, 578, 3330, 198, 415, 364, 66, 56878, 6, 374, 4613, 439, 364, 46856, 6, 482, 364, 5598, 2841, 6, 320, 1820, 1396, 315, 7931, 889, 198, 415, 2163, 279, 7187, 4245, 311, 1567, 31505, 2841, 696, 262, 13688, 198, 262, 11556, 45464, 262, 12382, 674, 64818, 68074, 2612, 198, 262, 12382, 1881, 7108, 220, 13468, 220, 272, 56878, 220, 20396, 256, 520, 1745, 3267, 198, 262, 12382, 1567, 3837, 198, 262, 12382, 220, 15, 2342, 220, 15, 260, 220, 15, 260, 220, 15, 286, 220, 806, 286, 220, 806, 198, 262, 12382, 220, 21, 2342, 220, 16, 260, 220, 16, 260, 220, 15, 260, 220, 15, 286, 220, 806, 198, 262, 12382, 220, 22, 2342, 220, 17, 260, 220, 17, 260, 220, 15, 260, 220, 15, 286, 220, 605, 198, 262, 12382, 220, 24, 2342, 220, 18, 260, 220, 18, 260, 220, 15, 260, 220, 15, 260 ]
sptonkin/fuzzyhashlib
fuzzyhashlib/__init__.py
tlsh.update
def update(self, buf): """Update this hash object's state with the provided string.""" if self._final: raise InvalidOperation("Cannot update finalised tlsh") else: self._buf_len += len(buf) return self._tlsh.update(buf)
python
def update(self, buf): """Update this hash object's state with the provided string.""" if self._final: raise InvalidOperation("Cannot update finalised tlsh") else: self._buf_len += len(buf) return self._tlsh.update(buf)
[ "def", "update", "(", "self", ",", "buf", ")", ":", "if", "self", ".", "_final", ":", "raise", "InvalidOperation", "(", "\"Cannot update finalised tlsh\"", ")", "else", ":", "self", ".", "_buf_len", "+=", "len", "(", "buf", ")", "return", "self", ".", "_tlsh", ".", "update", "(", "buf", ")" ]
Update this hash object's state with the provided string.
[ "Update", "this", "hash", "object", "s", "state", "with", "the", "provided", "string", "." ]
train
https://github.com/sptonkin/fuzzyhashlib/blob/61999dcfb0893358a330f51d88e4fa494a91bce2/fuzzyhashlib/__init__.py#L291-L297
<|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 this hash object's state with the provided string. ### Response: def update(self, buf): """Update this hash object's state with the provided string.""" if self._final: raise InvalidOperation("Cannot update finalised tlsh") else: self._buf_len += len(buf) return self._tlsh.update(buf) <|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, 420, 5286, 1665, 596, 1614, 449, 279, 3984, 925, 382, 14711, 6075, 512, 755, 2713, 1214, 11, 6745, 997, 286, 4304, 4387, 420, 5286, 1665, 596, 1614, 449, 279, 3984, 925, 14781, 286, 422, 659, 1462, 12085, 512, 310, 4933, 14204, 8598, 446, 17902, 2713, 1620, 4147, 30896, 939, 1158, 286, 775, 512, 2829, 659, 1462, 6034, 6171, 1447, 2479, 10963, 340, 310, 471, 659, 1462, 11805, 939, 5430, 10963, 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,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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, 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, 420, 5286, 1665, 596, 1614, 449, 279, 3984, 925, 382, 14711, 6075, 512, 755, 2713, 1214, 11, 6745, 997, 286, 4304, 4387, 420, 5286, 1665, 596, 1614, 449, 279, 3984, 925, 14781, 286, 422, 659, 1462, 12085, 512, 310, 4933, 14204, 8598, 446, 17902, 2713, 1620, 4147, 30896, 939, 1158, 286, 775, 512, 2829, 659, 1462, 6034, 6171, 1447, 2479, 10963, 340, 310, 471, 659, 1462, 11805, 939, 5430, 10963, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
apetrynet/pyfilemail
pyfilemail/transfer.py
Transfer.is_complete
def is_complete(self): """:rtype: ``bool`` ``True`` if transfer is complete""" if 'status' in self.transfer_info: self._complete = self.transfer_info['status'] == 'STATUS_COMPLETE' return self._complete
python
def is_complete(self): """:rtype: ``bool`` ``True`` if transfer is complete""" if 'status' in self.transfer_info: self._complete = self.transfer_info['status'] == 'STATUS_COMPLETE' return self._complete
[ "def", "is_complete", "(", "self", ")", ":", "if", "'status'", "in", "self", ".", "transfer_info", ":", "self", ".", "_complete", "=", "self", ".", "transfer_info", "[", "'status'", "]", "==", "'STATUS_COMPLETE'", "return", "self", ".", "_complete" ]
:rtype: ``bool`` ``True`` if transfer is complete
[ ":", "rtype", ":", "bool", "True", "if", "transfer", "is", "complete" ]
train
https://github.com/apetrynet/pyfilemail/blob/eb81b0e69ff42f4335d5298833e4769b750bf397/pyfilemail/transfer.py#L400-L406
<|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: :rtype: ``bool`` ``True`` if transfer is complete ### Response: def is_complete(self): """:rtype: ``bool`` ``True`` if transfer is complete""" if 'status' in self.transfer_info: self._complete = self.transfer_info['status'] == 'STATUS_COMPLETE' return self._complete <|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, 25, 33613, 25, 10103, 2707, 14196, 10103, 2575, 14196, 422, 8481, 374, 4686, 271, 14711, 6075, 512, 755, 374, 28775, 1214, 997, 286, 1621, 794, 33613, 25, 10103, 2707, 14196, 10103, 2575, 14196, 422, 8481, 374, 4686, 15425, 286, 422, 364, 2899, 6, 304, 659, 50528, 3186, 512, 310, 659, 1462, 15079, 284, 659, 50528, 3186, 681, 2899, 663, 624, 364, 21255, 51765, 3961, 286, 471, 659, 1462, 15079, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 25, 33613, 25, 10103, 2707, 14196, 10103, 2575, 14196, 422, 8481, 374, 4686, 271, 14711, 6075, 512, 755, 374, 28775, 1214, 997, 286, 1621, 794, 33613, 25, 10103, 2707, 14196, 10103, 2575, 14196, 422, 8481, 374, 4686, 15425, 286, 422, 364, 2899, 6, 304, 659, 50528, 3186, 512, 310, 659, 1462, 15079, 284, 659, 50528, 3186, 681, 2899, 663, 624, 364, 21255, 51765, 3961, 286, 471, 659, 1462, 15079, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
sorgerlab/indra
indra/tools/assemble_corpus.py
standardize_names_groundings
def standardize_names_groundings(stmts): """Standardize the names of Concepts with respect to an ontology. NOTE: this function is currently optimized for Influence Statements obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield unexpected results for biology-specific Statements. """ print('Standardize names to groundings') for stmt in stmts: for concept in stmt.agent_list(): db_ns, db_id = concept.get_grounding() if db_id is not None: if isinstance(db_id, list): db_id = db_id[0][0].split('/')[-1] else: db_id = db_id.split('/')[-1] db_id = db_id.replace('|', ' ') db_id = db_id.replace('_', ' ') db_id = db_id.replace('ONT::', '') db_id = db_id.capitalize() concept.name = db_id return stmts
python
def standardize_names_groundings(stmts): """Standardize the names of Concepts with respect to an ontology. NOTE: this function is currently optimized for Influence Statements obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield unexpected results for biology-specific Statements. """ print('Standardize names to groundings') for stmt in stmts: for concept in stmt.agent_list(): db_ns, db_id = concept.get_grounding() if db_id is not None: if isinstance(db_id, list): db_id = db_id[0][0].split('/')[-1] else: db_id = db_id.split('/')[-1] db_id = db_id.replace('|', ' ') db_id = db_id.replace('_', ' ') db_id = db_id.replace('ONT::', '') db_id = db_id.capitalize() concept.name = db_id return stmts
[ "def", "standardize_names_groundings", "(", "stmts", ")", ":", "print", "(", "'Standardize names to groundings'", ")", "for", "stmt", "in", "stmts", ":", "for", "concept", "in", "stmt", ".", "agent_list", "(", ")", ":", "db_ns", ",", "db_id", "=", "concept", ".", "get_grounding", "(", ")", "if", "db_id", "is", "not", "None", ":", "if", "isinstance", "(", "db_id", ",", "list", ")", ":", "db_id", "=", "db_id", "[", "0", "]", "[", "0", "]", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "else", ":", "db_id", "=", "db_id", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "db_id", "=", "db_id", ".", "replace", "(", "'|'", ",", "' '", ")", "db_id", "=", "db_id", ".", "replace", "(", "'_'", ",", "' '", ")", "db_id", "=", "db_id", ".", "replace", "(", "'ONT::'", ",", "''", ")", "db_id", "=", "db_id", ".", "capitalize", "(", ")", "concept", ".", "name", "=", "db_id", "return", "stmts" ]
Standardize the names of Concepts with respect to an ontology. NOTE: this function is currently optimized for Influence Statements obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield unexpected results for biology-specific Statements.
[ "Standardize", "the", "names", "of", "Concepts", "with", "respect", "to", "an", "ontology", "." ]
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1741-L1762
<|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: Standardize the names of Concepts with respect to an ontology. NOTE: this function is currently optimized for Influence Statements obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield unexpected results for biology-specific Statements. ### Response: def standardize_names_groundings(stmts): """Standardize the names of Concepts with respect to an ontology. NOTE: this function is currently optimized for Influence Statements obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield unexpected results for biology-specific Statements. """ print('Standardize names to groundings') for stmt in stmts: for concept in stmt.agent_list(): db_ns, db_id = concept.get_grounding() if db_id is not None: if isinstance(db_id, list): db_id = db_id[0][0].split('/')[-1] else: db_id = db_id.split('/')[-1] db_id = db_id.replace('|', ' ') db_id = db_id.replace('_', ' ') db_id = db_id.replace('ONT::', '') db_id = db_id.capitalize() concept.name = db_id return stmts <|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, 20367, 553, 279, 5144, 315, 76872, 449, 5201, 311, 459, 84369, 382, 262, 17160, 25, 420, 734, 374, 5131, 34440, 369, 76040, 70816, 198, 262, 12457, 505, 469, 13652, 11, 473, 3972, 11, 79663, 323, 41135, 4931, 13, 1102, 690, 11000, 7692, 198, 262, 16907, 3135, 369, 34458, 19440, 70816, 382, 14711, 6075, 512, 755, 5410, 553, 9366, 73592, 826, 48995, 82, 997, 262, 4304, 20367, 553, 279, 5144, 315, 76872, 449, 5201, 311, 459, 84369, 382, 262, 17160, 25, 420, 734, 374, 5131, 34440, 369, 76040, 70816, 198, 262, 12457, 505, 469, 13652, 11, 473, 3972, 11, 79663, 323, 41135, 4931, 13, 1102, 690, 11000, 7692, 198, 262, 16907, 3135, 369, 34458, 19440, 70816, 627, 262, 3270, 262, 1194, 493, 20367, 553, 5144, 311, 5015, 826, 1329, 262, 369, 20621, 304, 20621, 82, 512, 286, 369, 7434, 304, 20621, 45249, 2062, 4019, 310, 3000, 35828, 11, 3000, 851, 284, 7434, 673, 73592, 287, 746, 310, 422, 3000, 851, 374, 539, 2290, 512, 394, 422, 11656, 9990, 851, 11, 1160, 997, 504, 3000, 851, 284, 3000, 851, 58, 15, 1483, 15, 948, 7105, 96787, 16, 933, 394, 775, 512, 504, 3000, 851, 284, 3000, 851, 5402, 96787, 16, 933, 394, 3000, 851, 284, 3000, 851, 7125, 48315, 518, 364, 22428, 394, 3000, 851, 284, 3000, 851, 7125, 77794, 364, 22428, 394, 3000, 851, 284, 3000, 851, 7125, 493, 10443, 487, 518, 23113, 394, 3000, 851, 284, 3000, 851, 79598, 746, 394, 7434, 2710, 284, 3000, 851, 198, 262, 471, 20621, 82, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 20367, 553, 279, 5144, 315, 76872, 449, 5201, 311, 459, 84369, 382, 262, 17160, 25, 420, 734, 374, 5131, 34440, 369, 76040, 70816, 198, 262, 12457, 505, 469, 13652, 11, 473, 3972, 11, 79663, 323, 41135, 4931, 13, 1102, 690, 11000, 7692, 198, 262, 16907, 3135, 369, 34458, 19440, 70816, 382, 14711, 6075, 512, 755, 5410, 553, 9366, 73592, 826, 48995, 82, 997, 262, 4304, 20367, 553, 279, 5144, 315, 76872, 449, 5201, 311, 459, 84369, 382, 262, 17160, 25, 420, 734, 374, 5131, 34440, 369, 76040, 70816, 198, 262, 12457, 505, 469, 13652, 11, 473, 3972, 11, 79663, 323, 41135, 4931, 13, 1102, 690, 11000, 7692, 198, 262, 16907, 3135, 369, 34458, 19440, 70816, 627, 262, 3270, 262, 1194, 493, 20367, 553, 5144, 311, 5015, 826, 1329, 262, 369, 20621, 304, 20621, 82, 512, 286, 369, 7434, 304, 20621, 45249, 2062, 4019, 310, 3000, 35828, 11, 3000, 851, 284, 7434, 673, 73592, 287, 746, 310, 422, 3000, 851, 374, 539, 2290, 512, 394, 422, 11656, 9990, 851, 11, 1160, 997, 504, 3000, 851, 284, 3000, 851, 58, 15, 1483, 15, 948, 7105, 96787, 16, 933, 394, 775, 512, 504, 3000, 851, 284, 3000, 851, 5402, 96787, 16, 933, 394, 3000, 851, 284, 3000, 851, 7125, 48315, 518, 364, 22428, 394, 3000, 851, 284, 3000, 851, 7125, 77794, 364, 22428, 394, 3000, 851, 284, 3000, 851, 7125, 493, 10443, 487, 518, 23113, 394, 3000, 851, 284, 3000, 851, 79598, 746, 394, 7434, 2710, 284, 3000, 851, 198, 262, 471, 20621, 82, 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 ]
ARMmbed/icetea
icetea_lib/Plugin/plugins/LocalAllocator/DutTcp.py
DutTcp.open_connection
def open_connection(self): """ Open connection over TCP socket. :return: Nothing """ self.logger.debug("Open COM %s", self.comport) self.port = socket.socket(socket.AF_INET, socket.SOCK_STREAM) (ip_addr, port) = self.comport.split(':') self.port.connect(ip_addr, num(port))
python
def open_connection(self): """ Open connection over TCP socket. :return: Nothing """ self.logger.debug("Open COM %s", self.comport) self.port = socket.socket(socket.AF_INET, socket.SOCK_STREAM) (ip_addr, port) = self.comport.split(':') self.port.connect(ip_addr, num(port))
[ "def", "open_connection", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Open COM %s\"", ",", "self", ".", "comport", ")", "self", ".", "port", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "(", "ip_addr", ",", "port", ")", "=", "self", ".", "comport", ".", "split", "(", "':'", ")", "self", ".", "port", ".", "connect", "(", "ip_addr", ",", "num", "(", "port", ")", ")" ]
Open connection over TCP socket. :return: Nothing
[ "Open", "connection", "over", "TCP", "socket", ".", ":", "return", ":", "Nothing" ]
train
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutTcp.py#L33-L41
<|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: Open connection over TCP socket. :return: Nothing ### Response: def open_connection(self): """ Open connection over TCP socket. :return: Nothing """ self.logger.debug("Open COM %s", self.comport) self.port = socket.socket(socket.AF_INET, socket.SOCK_STREAM) (ip_addr, port) = self.comport.split(':') self.port.connect(ip_addr, num(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, 5109, 3717, 927, 27754, 7728, 627, 286, 551, 693, 25, 12334, 271, 14711, 6075, 512, 755, 1825, 16245, 1214, 997, 286, 3270, 286, 5377, 3717, 927, 27754, 7728, 627, 286, 551, 693, 25, 12334, 198, 286, 3270, 286, 659, 16465, 8042, 446, 5109, 7837, 1034, 82, 498, 659, 916, 403, 340, 286, 659, 14940, 284, 7728, 27015, 28148, 71960, 27932, 11, 7728, 80022, 24500, 340, 286, 320, 575, 7539, 11, 2700, 8, 284, 659, 916, 403, 5402, 16364, 1329, 286, 659, 14940, 11034, 24338, 7539, 11, 1661, 21924, 1192, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 5109, 3717, 927, 27754, 7728, 627, 286, 551, 693, 25, 12334, 271, 14711, 6075, 512, 755, 1825, 16245, 1214, 997, 286, 3270, 286, 5377, 3717, 927, 27754, 7728, 627, 286, 551, 693, 25, 12334, 198, 286, 3270, 286, 659, 16465, 8042, 446, 5109, 7837, 1034, 82, 498, 659, 916, 403, 340, 286, 659, 14940, 284, 7728, 27015, 28148, 71960, 27932, 11, 7728, 80022, 24500, 340, 286, 320, 575, 7539, 11, 2700, 8, 284, 659, 916, 403, 5402, 16364, 1329, 286, 659, 14940, 11034, 24338, 7539, 11, 1661, 21924, 1192, 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 ]
anteater/anteater
anteater/src/patch_scan.py
scan_patch
def scan_patch(project, patch_file, binaries, ips, urls, file_audit_list, file_audit_project_list, flag_list, ignore_list, file_ignore, ignore_directories, url_ignore, ip_ignore, apikey): """ Scan actions for each commited file in patch set """ global failure split_path = patch_file.split(project + '/', 1)[-1] if not any(x in split_path for x in ignore_directories): if is_binary(patch_file) and binaries: hashlist = get_lists.GetLists() binary_hash = hashlist.binary_hash(project, split_path) with open(patch_file, 'rb') as afile: hasher = hashlib.sha256() buf = afile.read() hasher.update(buf) sha256hash = hasher.hexdigest() if sha256hash in binary_hash: logger.info('Found matching file hash for: %s', patch_file) else: logger.info('sha256hash: %s', sha256hash) logger.error('Non Whitelisted Binary file: %s', patch_file) scan_binary(patch_file, project, sha256hash, apikey) failure = True with open(reports_dir + "binaries-" + project + ".log", "a") \ as gate_report: gate_report.write('Non Whitelisted Binary file: {0}\n'. format(patch_file)) else: # Check file names / extensions if file_audit_list.search(patch_file) and not \ file_audit_project_list.search(patch_file): match = file_audit_list.search(patch_file) logger.error('Blacklisted file: %s', patch_file) logger.error('Matched String: %s', match.group()) failure = True with open(reports_dir + "file-names_" + project + ".log", "a") \ as gate_report: gate_report.write('Blacklisted file: {0}\n'. format(patch_file)) gate_report.write('Matched String: {0}'. format(match.group())) # Open file to check for blacklisted content if not is_binary(patch_file): try: fo = open(patch_file, 'r') lines = fo.readlines() file_exists = True except IOError: file_exists = False if file_exists and not patch_file.endswith(tuple(file_ignore)): for line in lines: # Find IP Addresses and send for report to Virus Total if ips: ipaddr = re.findall(r'(?:\d{1,3}\.)+(?:\d{1,3})', line) if ipaddr: ipaddr = ipaddr[0] if re.search(ip_ignore, ipaddr): logger.info('%s is in IP ignore list.', ipaddr) else: try: ipaddress.ip_address(ipaddr).is_global scan_ipaddr(ipaddr, apikey) except: pass # Ok to pass here, as this captures the odd string which is not an IP Address # Check for URLs and send for report to Virus Total if urls: url = re.search("(?P<url>https?://[^\s]+)", line) or re.search("(?P<url>www[^\s]+)", line) if url: url = url.group("url") if re.search(url_ignore, url): logger.info('%s is in URL ignore list.', url) else: scan_url(url, apikey) # Perform search within text files for key, value in flag_list.items(): regex = value['regex'] desc = value['desc'] if re.search(regex, line) and not re.search( ignore_list, line): logger.error('File contains violation: %s', patch_file) logger.error('Flagged Content: %s', line.rstrip()) logger.error('Rationale: %s', desc.rstrip()) failure = True with open(reports_dir + "contents_" + project + ".log", "a") as gate_report: gate_report.write('File contains violation: {0}\n'.format(patch_file)) gate_report.write('Flagged Content: {0}'.format(line)) gate_report.write('Matched Regular Exp: {0}\n'.format(regex)) gate_report.write('Rationale: {0}\n'.format(desc.rstrip()))
python
def scan_patch(project, patch_file, binaries, ips, urls, file_audit_list, file_audit_project_list, flag_list, ignore_list, file_ignore, ignore_directories, url_ignore, ip_ignore, apikey): """ Scan actions for each commited file in patch set """ global failure split_path = patch_file.split(project + '/', 1)[-1] if not any(x in split_path for x in ignore_directories): if is_binary(patch_file) and binaries: hashlist = get_lists.GetLists() binary_hash = hashlist.binary_hash(project, split_path) with open(patch_file, 'rb') as afile: hasher = hashlib.sha256() buf = afile.read() hasher.update(buf) sha256hash = hasher.hexdigest() if sha256hash in binary_hash: logger.info('Found matching file hash for: %s', patch_file) else: logger.info('sha256hash: %s', sha256hash) logger.error('Non Whitelisted Binary file: %s', patch_file) scan_binary(patch_file, project, sha256hash, apikey) failure = True with open(reports_dir + "binaries-" + project + ".log", "a") \ as gate_report: gate_report.write('Non Whitelisted Binary file: {0}\n'. format(patch_file)) else: # Check file names / extensions if file_audit_list.search(patch_file) and not \ file_audit_project_list.search(patch_file): match = file_audit_list.search(patch_file) logger.error('Blacklisted file: %s', patch_file) logger.error('Matched String: %s', match.group()) failure = True with open(reports_dir + "file-names_" + project + ".log", "a") \ as gate_report: gate_report.write('Blacklisted file: {0}\n'. format(patch_file)) gate_report.write('Matched String: {0}'. format(match.group())) # Open file to check for blacklisted content if not is_binary(patch_file): try: fo = open(patch_file, 'r') lines = fo.readlines() file_exists = True except IOError: file_exists = False if file_exists and not patch_file.endswith(tuple(file_ignore)): for line in lines: # Find IP Addresses and send for report to Virus Total if ips: ipaddr = re.findall(r'(?:\d{1,3}\.)+(?:\d{1,3})', line) if ipaddr: ipaddr = ipaddr[0] if re.search(ip_ignore, ipaddr): logger.info('%s is in IP ignore list.', ipaddr) else: try: ipaddress.ip_address(ipaddr).is_global scan_ipaddr(ipaddr, apikey) except: pass # Ok to pass here, as this captures the odd string which is not an IP Address # Check for URLs and send for report to Virus Total if urls: url = re.search("(?P<url>https?://[^\s]+)", line) or re.search("(?P<url>www[^\s]+)", line) if url: url = url.group("url") if re.search(url_ignore, url): logger.info('%s is in URL ignore list.', url) else: scan_url(url, apikey) # Perform search within text files for key, value in flag_list.items(): regex = value['regex'] desc = value['desc'] if re.search(regex, line) and not re.search( ignore_list, line): logger.error('File contains violation: %s', patch_file) logger.error('Flagged Content: %s', line.rstrip()) logger.error('Rationale: %s', desc.rstrip()) failure = True with open(reports_dir + "contents_" + project + ".log", "a") as gate_report: gate_report.write('File contains violation: {0}\n'.format(patch_file)) gate_report.write('Flagged Content: {0}'.format(line)) gate_report.write('Matched Regular Exp: {0}\n'.format(regex)) gate_report.write('Rationale: {0}\n'.format(desc.rstrip()))
[ "def", "scan_patch", "(", "project", ",", "patch_file", ",", "binaries", ",", "ips", ",", "urls", ",", "file_audit_list", ",", "file_audit_project_list", ",", "flag_list", ",", "ignore_list", ",", "file_ignore", ",", "ignore_directories", ",", "url_ignore", ",", "ip_ignore", ",", "apikey", ")", ":", "global", "failure", "split_path", "=", "patch_file", ".", "split", "(", "project", "+", "'/'", ",", "1", ")", "[", "-", "1", "]", "if", "not", "any", "(", "x", "in", "split_path", "for", "x", "in", "ignore_directories", ")", ":", "if", "is_binary", "(", "patch_file", ")", "and", "binaries", ":", "hashlist", "=", "get_lists", ".", "GetLists", "(", ")", "binary_hash", "=", "hashlist", ".", "binary_hash", "(", "project", ",", "split_path", ")", "with", "open", "(", "patch_file", ",", "'rb'", ")", "as", "afile", ":", "hasher", "=", "hashlib", ".", "sha256", "(", ")", "buf", "=", "afile", ".", "read", "(", ")", "hasher", ".", "update", "(", "buf", ")", "sha256hash", "=", "hasher", ".", "hexdigest", "(", ")", "if", "sha256hash", "in", "binary_hash", ":", "logger", ".", "info", "(", "'Found matching file hash for: %s'", ",", "patch_file", ")", "else", ":", "logger", ".", "info", "(", "'sha256hash: %s'", ",", "sha256hash", ")", "logger", ".", "error", "(", "'Non Whitelisted Binary file: %s'", ",", "patch_file", ")", "scan_binary", "(", "patch_file", ",", "project", ",", "sha256hash", ",", "apikey", ")", "failure", "=", "True", "with", "open", "(", "reports_dir", "+", "\"binaries-\"", "+", "project", "+", "\".log\"", ",", "\"a\"", ")", "as", "gate_report", ":", "gate_report", ".", "write", "(", "'Non Whitelisted Binary file: {0}\\n'", ".", "format", "(", "patch_file", ")", ")", "else", ":", "# Check file names / extensions", "if", "file_audit_list", ".", "search", "(", "patch_file", ")", "and", "not", "file_audit_project_list", ".", "search", "(", "patch_file", ")", ":", "match", "=", "file_audit_list", ".", "search", "(", "patch_file", ")", "logger", ".", "error", "(", "'Blacklisted file: %s'", ",", "patch_file", ")", "logger", ".", "error", "(", "'Matched String: %s'", ",", "match", ".", "group", "(", ")", ")", "failure", "=", "True", "with", "open", "(", "reports_dir", "+", "\"file-names_\"", "+", "project", "+", "\".log\"", ",", "\"a\"", ")", "as", "gate_report", ":", "gate_report", ".", "write", "(", "'Blacklisted file: {0}\\n'", ".", "format", "(", "patch_file", ")", ")", "gate_report", ".", "write", "(", "'Matched String: {0}'", ".", "format", "(", "match", ".", "group", "(", ")", ")", ")", "# Open file to check for blacklisted content", "if", "not", "is_binary", "(", "patch_file", ")", ":", "try", ":", "fo", "=", "open", "(", "patch_file", ",", "'r'", ")", "lines", "=", "fo", ".", "readlines", "(", ")", "file_exists", "=", "True", "except", "IOError", ":", "file_exists", "=", "False", "if", "file_exists", "and", "not", "patch_file", ".", "endswith", "(", "tuple", "(", "file_ignore", ")", ")", ":", "for", "line", "in", "lines", ":", "# Find IP Addresses and send for report to Virus Total", "if", "ips", ":", "ipaddr", "=", "re", ".", "findall", "(", "r'(?:\\d{1,3}\\.)+(?:\\d{1,3})'", ",", "line", ")", "if", "ipaddr", ":", "ipaddr", "=", "ipaddr", "[", "0", "]", "if", "re", ".", "search", "(", "ip_ignore", ",", "ipaddr", ")", ":", "logger", ".", "info", "(", "'%s is in IP ignore list.'", ",", "ipaddr", ")", "else", ":", "try", ":", "ipaddress", ".", "ip_address", "(", "ipaddr", ")", ".", "is_global", "scan_ipaddr", "(", "ipaddr", ",", "apikey", ")", "except", ":", "pass", "# Ok to pass here, as this captures the odd string which is not an IP Address", "# Check for URLs and send for report to Virus Total", "if", "urls", ":", "url", "=", "re", ".", "search", "(", "\"(?P<url>https?://[^\\s]+)\"", ",", "line", ")", "or", "re", ".", "search", "(", "\"(?P<url>www[^\\s]+)\"", ",", "line", ")", "if", "url", ":", "url", "=", "url", ".", "group", "(", "\"url\"", ")", "if", "re", ".", "search", "(", "url_ignore", ",", "url", ")", ":", "logger", ".", "info", "(", "'%s is in URL ignore list.'", ",", "url", ")", "else", ":", "scan_url", "(", "url", ",", "apikey", ")", "# Perform search within text files", "for", "key", ",", "value", "in", "flag_list", ".", "items", "(", ")", ":", "regex", "=", "value", "[", "'regex'", "]", "desc", "=", "value", "[", "'desc'", "]", "if", "re", ".", "search", "(", "regex", ",", "line", ")", "and", "not", "re", ".", "search", "(", "ignore_list", ",", "line", ")", ":", "logger", ".", "error", "(", "'File contains violation: %s'", ",", "patch_file", ")", "logger", ".", "error", "(", "'Flagged Content: %s'", ",", "line", ".", "rstrip", "(", ")", ")", "logger", ".", "error", "(", "'Rationale: %s'", ",", "desc", ".", "rstrip", "(", ")", ")", "failure", "=", "True", "with", "open", "(", "reports_dir", "+", "\"contents_\"", "+", "project", "+", "\".log\"", ",", "\"a\"", ")", "as", "gate_report", ":", "gate_report", ".", "write", "(", "'File contains violation: {0}\\n'", ".", "format", "(", "patch_file", ")", ")", "gate_report", ".", "write", "(", "'Flagged Content: {0}'", ".", "format", "(", "line", ")", ")", "gate_report", ".", "write", "(", "'Matched Regular Exp: {0}\\n'", ".", "format", "(", "regex", ")", ")", "gate_report", ".", "write", "(", "'Rationale: {0}\\n'", ".", "format", "(", "desc", ".", "rstrip", "(", ")", ")", ")" ]
Scan actions for each commited file in patch set
[ "Scan", "actions", "for", "each", "commited", "file", "in", "patch", "set" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/patch_scan.py#L104-L206
<|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: Scan actions for each commited file in patch set ### Response: def scan_patch(project, patch_file, binaries, ips, urls, file_audit_list, file_audit_project_list, flag_list, ignore_list, file_ignore, ignore_directories, url_ignore, ip_ignore, apikey): """ Scan actions for each commited file in patch set """ global failure split_path = patch_file.split(project + '/', 1)[-1] if not any(x in split_path for x in ignore_directories): if is_binary(patch_file) and binaries: hashlist = get_lists.GetLists() binary_hash = hashlist.binary_hash(project, split_path) with open(patch_file, 'rb') as afile: hasher = hashlib.sha256() buf = afile.read() hasher.update(buf) sha256hash = hasher.hexdigest() if sha256hash in binary_hash: logger.info('Found matching file hash for: %s', patch_file) else: logger.info('sha256hash: %s', sha256hash) logger.error('Non Whitelisted Binary file: %s', patch_file) scan_binary(patch_file, project, sha256hash, apikey) failure = True with open(reports_dir + "binaries-" + project + ".log", "a") \ as gate_report: gate_report.write('Non Whitelisted Binary file: {0}\n'. format(patch_file)) else: # Check file names / extensions if file_audit_list.search(patch_file) and not \ file_audit_project_list.search(patch_file): match = file_audit_list.search(patch_file) logger.error('Blacklisted file: %s', patch_file) logger.error('Matched String: %s', match.group()) failure = True with open(reports_dir + "file-names_" + project + ".log", "a") \ as gate_report: gate_report.write('Blacklisted file: {0}\n'. format(patch_file)) gate_report.write('Matched String: {0}'. format(match.group())) # Open file to check for blacklisted content if not is_binary(patch_file): try: fo = open(patch_file, 'r') lines = fo.readlines() file_exists = True except IOError: file_exists = False if file_exists and not patch_file.endswith(tuple(file_ignore)): for line in lines: # Find IP Addresses and send for report to Virus Total if ips: ipaddr = re.findall(r'(?:\d{1,3}\.)+(?:\d{1,3})', line) if ipaddr: ipaddr = ipaddr[0] if re.search(ip_ignore, ipaddr): logger.info('%s is in IP ignore list.', ipaddr) else: try: ipaddress.ip_address(ipaddr).is_global scan_ipaddr(ipaddr, apikey) except: pass # Ok to pass here, as this captures the odd string which is not an IP Address # Check for URLs and send for report to Virus Total if urls: url = re.search("(?P<url>https?://[^\s]+)", line) or re.search("(?P<url>www[^\s]+)", line) if url: url = url.group("url") if re.search(url_ignore, url): logger.info('%s is in URL ignore list.', url) else: scan_url(url, apikey) # Perform search within text files for key, value in flag_list.items(): regex = value['regex'] desc = value['desc'] if re.search(regex, line) and not re.search( ignore_list, line): logger.error('File contains violation: %s', patch_file) logger.error('Flagged Content: %s', line.rstrip()) logger.error('Rationale: %s', desc.rstrip()) failure = True with open(reports_dir + "contents_" + project + ".log", "a") as gate_report: gate_report.write('File contains violation: {0}\n'.format(patch_file)) gate_report.write('Flagged Content: {0}'.format(line)) gate_report.write('Matched Regular Exp: {0}\n'.format(regex)) gate_report.write('Rationale: {0}\n'.format(desc.rstrip())) <|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, 27668, 6299, 369, 1855, 1081, 1639, 1052, 304, 11140, 743, 271, 14711, 6075, 512, 755, 8737, 40743, 21855, 11, 11140, 2517, 11, 70837, 11, 60122, 11, 31084, 11, 1052, 85537, 2062, 345, 2342, 1052, 85537, 16756, 2062, 11, 5292, 2062, 11, 10240, 2062, 11, 1052, 59593, 345, 2342, 10240, 33971, 2490, 11, 2576, 59593, 11, 6125, 59593, 11, 6464, 798, 7887, 262, 3270, 262, 32208, 6299, 369, 1855, 1081, 1639, 1052, 304, 11140, 743, 198, 262, 3270, 262, 3728, 8060, 198, 262, 6859, 2703, 284, 11140, 2517, 5402, 21855, 489, 57527, 220, 16, 93478, 16, 2595, 262, 422, 539, 904, 2120, 304, 6859, 2703, 369, 865, 304, 10240, 33971, 2490, 997, 286, 422, 374, 32861, 93040, 2517, 8, 323, 70837, 512, 310, 5286, 1638, 284, 636, 38388, 2283, 38948, 746, 310, 8026, 9127, 284, 5286, 1638, 61713, 9127, 21855, 11, 6859, 2703, 696, 310, 449, 1825, 93040, 2517, 11, 364, 10910, 873, 439, 264, 1213, 512, 394, 91919, 284, 55595, 65470, 4146, 746, 394, 6745, 284, 264, 1213, 4217, 746, 394, 91919, 5430, 10963, 340, 394, 16249, 4146, 8460, 284, 91919, 46739, 37439, 2892, 310, 422, 16249, 4146, 8460, 304, 8026, 9127, 1473, 394, 6050, 5506, 493, 6788, 12864, 1052, 5286, 369, 25, 1034, 82, 756, 1014, 11140, 2517, 340, 310, 775, 512, 394, 6050, 5506, 493, 15605, 4146, 8460, 25, 1034, 82, 518, 16249, 4146, 8460, 340, 394, 6050, 4517, 493, 8284, 27484, 301, 13539, 18188, 1052, 25, 1034, 82, 756, 6663, 11140, 2517, 696, 394, 8737, 32861, 93040, 2517, 11, 2447, 11, 16249, 4146, 8460, 11, 6464, 798, 696, 394, 8060, 284, 3082, 271, 310, 449, 1825, 5921, 3476, 4432, 489, 330, 7006, 5548, 28751, 489, 2447, 489, 6058, 848, 498, 330, 64, 909, 3120, 504, 439, 18618, 15157, 512, 394, 18618, 15157, 3921, 493, 8284, 27484, 301, 13539, 18188, 1052, 25, 314, 15, 11281, 77, 24482, 6794, 3645, 93040, 2517, 1192, 286, 775, 512, 310, 674, 4343, 1052, 5144, 611, 20300, 198, 310, 422, 1052, 85537, 2062, 9472, 93040, 2517, 8, 323, 539, 3120, 504, 1052, 85537, 16756, 2062, 9472, 93040, 2517, 997, 394, 2489, 284, 1052, 85537, 2062, 9472, 93040, 2517, 340, 394, 6050, 4517, 493, 14755, 32340, 1052, 25, 1034, 82, 518, 11140, 2517, 340, 394, 6050, 4517, 493, 8495, 291, 935, 25, 1034, 82, 518, 2489, 6306, 2455, 394, 8060, 284, 3082, 198, 394, 449, 1825, 5921, 3476, 4432, 489, 330, 1213, 90144, 19298, 489, 2447, 489, 6058, 848, 498, 330, 64, 909, 3120, 667, 439, 18618, 15157, 512, 504, 18618, 15157, 3921, 493, 14755, 32340, 1052, 25, 314, 15, 11281, 77, 24482, 8497, 3645, 93040, 2517, 1192, 504, 18618, 15157, 3921, 493, 8495, 291, 935, 25, 314, 15, 11923, 627, 8497, 3645, 26473, 6306, 51062, 310, 674, 5377, 1052, 311, 1817, 369, 3776, 32340, 2262, 198, 310, 422, 539, 374, 32861, 93040, 2517, 997, 394, 1456 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 27668, 6299, 369, 1855, 1081, 1639, 1052, 304, 11140, 743, 271, 14711, 6075, 512, 755, 8737, 40743, 21855, 11, 11140, 2517, 11, 70837, 11, 60122, 11, 31084, 11, 1052, 85537, 2062, 345, 2342, 1052, 85537, 16756, 2062, 11, 5292, 2062, 11, 10240, 2062, 11, 1052, 59593, 345, 2342, 10240, 33971, 2490, 11, 2576, 59593, 11, 6125, 59593, 11, 6464, 798, 7887, 262, 3270, 262, 32208, 6299, 369, 1855, 1081, 1639, 1052, 304, 11140, 743, 198, 262, 3270, 262, 3728, 8060, 198, 262, 6859, 2703, 284, 11140, 2517, 5402, 21855, 489, 57527, 220, 16, 93478, 16, 2595, 262, 422, 539, 904, 2120, 304, 6859, 2703, 369, 865, 304, 10240, 33971, 2490, 997, 286, 422, 374, 32861, 93040, 2517, 8, 323, 70837, 512, 310, 5286, 1638, 284, 636, 38388, 2283, 38948, 746, 310, 8026, 9127, 284, 5286, 1638, 61713, 9127, 21855, 11, 6859, 2703, 696, 310, 449, 1825, 93040, 2517, 11, 364, 10910, 873, 439, 264, 1213, 512, 394, 91919, 284, 55595, 65470, 4146, 746, 394, 6745, 284, 264, 1213, 4217, 746, 394, 91919, 5430, 10963, 340, 394, 16249, 4146, 8460, 284, 91919, 46739, 37439, 2892, 310, 422, 16249, 4146, 8460, 304, 8026, 9127, 1473, 394, 6050, 5506, 493, 6788, 12864, 1052, 5286, 369, 25, 1034, 82, 756, 1014, 11140, 2517, 340, 310, 775, 512, 394, 6050, 5506, 493, 15605, 4146, 8460, 25, 1034, 82, 518, 16249, 4146, 8460, 340, 394, 6050, 4517, 493, 8284, 27484, 301, 13539, 18188, 1052, 25, 1034, 82, 756, 6663, 11140, 2517, 696, 394, 8737, 32861, 93040, 2517, 11, 2447, 11, 16249, 4146, 8460, 11, 6464, 798, 696, 394, 8060, 284, 3082, 271, 310, 449, 1825, 5921, 3476, 4432, 489, 330, 7006, 5548, 28751, 489, 2447, 489, 6058, 848, 498, 330, 64, 909, 3120, 504, 439, 18618, 15157, 512, 394, 18618, 15157, 3921, 493, 8284, 27484, 301, 13539, 18188, 1052, 25, 314, 15, 11281, 77, 24482, 6794, 3645, 93040, 2517, 1192, 286, 775, 512, 310, 674, 4343, 1052, 5144, 611, 20300, 198, 310, 422, 1052, 85537, 2062, 9472, 93040, 2517, 8, 323, 539, 3120, 504, 1052, 85537, 16756, 2062, 9472, 93040, 2517, 997, 394, 2489, 284, 1052, 85537, 2062, 9472, 93040, 2517, 340, 394, 6050, 4517, 493, 14755, 32340, 1052, 25, 1034, 82, 518, 11140, 2517, 340, 394, 6050, 4517, 493, 8495, 291, 935, 25, 1034, 82, 518, 2489, 6306, 2455, 394, 8060, 284, 3082, 198, 394, 449, 1825, 5921, 3476, 4432, 489, 330, 1213, 90144, 19298, 489, 2447, 489, 6058, 848, 498, 330, 64, 909, 3120, 667, 439, 18618, 15157, 512, 504, 18618, 15157, 3921, 493, 14755, 32340, 1052, 25, 314, 15, 11281, 77, 24482, 8497, 3645, 93040, 2517, 1192, 504, 18618, 15157, 3921, 493, 8495, 291, 935, 25, 314, 15, 11923, 627, 8497, 3645, 26473, 6306, 51062, 310, 674, 5377, 1052, 311, 1817, 369, 3776, 32340, 2262, 198, 310, 422, 539, 374, 32861, 93040, 2517, 997, 394, 1456 ]
google/grr
grr/server/grr_response_server/databases/mysql_flows.py
MySQLDBFlowMixin.CountFlowResultsByType
def CountFlowResultsByType(self, client_id, flow_id, cursor=None): """Returns counts of flow results grouped by result type.""" query = ("SELECT type, COUNT(*) FROM flow_results " "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) " "WHERE client_id = %s AND flow_id = %s " "GROUP BY type") args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)] cursor.execute(query, args) return dict(cursor.fetchall())
python
def CountFlowResultsByType(self, client_id, flow_id, cursor=None): """Returns counts of flow results grouped by result type.""" query = ("SELECT type, COUNT(*) FROM flow_results " "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) " "WHERE client_id = %s AND flow_id = %s " "GROUP BY type") args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)] cursor.execute(query, args) return dict(cursor.fetchall())
[ "def", "CountFlowResultsByType", "(", "self", ",", "client_id", ",", "flow_id", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT type, COUNT(*) FROM flow_results \"", "\"FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) \"", "\"WHERE client_id = %s AND flow_id = %s \"", "\"GROUP BY type\"", ")", "args", "=", "[", "db_utils", ".", "ClientIDToInt", "(", "client_id", ")", ",", "db_utils", ".", "FlowIDToInt", "(", "flow_id", ")", "]", "cursor", ".", "execute", "(", "query", ",", "args", ")", "return", "dict", "(", "cursor", ".", "fetchall", "(", ")", ")" ]
Returns counts of flow results grouped by result type.
[ "Returns", "counts", "of", "flow", "results", "grouped", "by", "result", "type", "." ]
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1350-L1360
<|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 counts of flow results grouped by result type. ### Response: def CountFlowResultsByType(self, client_id, flow_id, cursor=None): """Returns counts of flow results grouped by result type.""" query = ("SELECT type, COUNT(*) FROM flow_results " "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) " "WHERE client_id = %s AND flow_id = %s " "GROUP BY type") args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)] cursor.execute(query, args) return dict(cursor.fetchall()) <|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, 14921, 315, 6530, 3135, 41141, 555, 1121, 955, 382, 14711, 6075, 512, 755, 4605, 19410, 10001, 1383, 941, 1214, 11, 3016, 851, 11, 6530, 851, 11, 8291, 5980, 997, 262, 4304, 16851, 14921, 315, 6530, 3135, 41141, 555, 1121, 955, 14781, 262, 3319, 284, 3573, 4963, 955, 11, 24945, 29771, 4393, 6530, 13888, 6360, 1835, 330, 81305, 40400, 320, 5072, 13888, 3795, 8342, 851, 28541, 851, 23943, 8, 6360, 1835, 330, 27611, 3016, 851, 284, 1034, 82, 3651, 6530, 851, 284, 1034, 82, 6360, 1835, 330, 42580, 7866, 955, 1158, 262, 2897, 284, 510, 2042, 17758, 11978, 926, 39644, 13097, 851, 705, 3000, 17758, 61832, 926, 39644, 75737, 851, 28871, 262, 8291, 7925, 10974, 11, 2897, 696, 262, 471, 6587, 28776, 43230, 2455, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 14921, 315, 6530, 3135, 41141, 555, 1121, 955, 382, 14711, 6075, 512, 755, 4605, 19410, 10001, 1383, 941, 1214, 11, 3016, 851, 11, 6530, 851, 11, 8291, 5980, 997, 262, 4304, 16851, 14921, 315, 6530, 3135, 41141, 555, 1121, 955, 14781, 262, 3319, 284, 3573, 4963, 955, 11, 24945, 29771, 4393, 6530, 13888, 6360, 1835, 330, 81305, 40400, 320, 5072, 13888, 3795, 8342, 851, 28541, 851, 23943, 8, 6360, 1835, 330, 27611, 3016, 851, 284, 1034, 82, 3651, 6530, 851, 284, 1034, 82, 6360, 1835, 330, 42580, 7866, 955, 1158, 262, 2897, 284, 510, 2042, 17758, 11978, 926, 39644, 13097, 851, 705, 3000, 17758, 61832, 926, 39644, 75737, 851, 28871, 262, 8291, 7925, 10974, 11, 2897, 696, 262, 471, 6587, 28776, 43230, 2455, 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 ]
google/grr
grr/client/grr_response_client/client_actions/artifact_collector.py
ArtifactCollector._ProcessGrepSource
def _ProcessGrepSource(self, source): """Find files fulfilling regex conditions.""" attributes = source.base_source.attributes paths = artifact_utils.InterpolateListKbAttributes( attributes["paths"], self.knowledge_base, self.ignore_interpolation_errors) regex = utils.RegexListDisjunction(attributes["content_regex_list"]) condition = rdf_file_finder.FileFinderCondition.ContentsRegexMatch( regex=regex, mode="ALL_HITS") file_finder_action = rdf_file_finder.FileFinderAction.Stat() request = rdf_file_finder.FileFinderArgs( paths=paths, action=file_finder_action, conditions=[condition], follow_links=True) action = file_finder.FileFinderOSFromClient yield action, request
python
def _ProcessGrepSource(self, source): """Find files fulfilling regex conditions.""" attributes = source.base_source.attributes paths = artifact_utils.InterpolateListKbAttributes( attributes["paths"], self.knowledge_base, self.ignore_interpolation_errors) regex = utils.RegexListDisjunction(attributes["content_regex_list"]) condition = rdf_file_finder.FileFinderCondition.ContentsRegexMatch( regex=regex, mode="ALL_HITS") file_finder_action = rdf_file_finder.FileFinderAction.Stat() request = rdf_file_finder.FileFinderArgs( paths=paths, action=file_finder_action, conditions=[condition], follow_links=True) action = file_finder.FileFinderOSFromClient yield action, request
[ "def", "_ProcessGrepSource", "(", "self", ",", "source", ")", ":", "attributes", "=", "source", ".", "base_source", ".", "attributes", "paths", "=", "artifact_utils", ".", "InterpolateListKbAttributes", "(", "attributes", "[", "\"paths\"", "]", ",", "self", ".", "knowledge_base", ",", "self", ".", "ignore_interpolation_errors", ")", "regex", "=", "utils", ".", "RegexListDisjunction", "(", "attributes", "[", "\"content_regex_list\"", "]", ")", "condition", "=", "rdf_file_finder", ".", "FileFinderCondition", ".", "ContentsRegexMatch", "(", "regex", "=", "regex", ",", "mode", "=", "\"ALL_HITS\"", ")", "file_finder_action", "=", "rdf_file_finder", ".", "FileFinderAction", ".", "Stat", "(", ")", "request", "=", "rdf_file_finder", ".", "FileFinderArgs", "(", "paths", "=", "paths", ",", "action", "=", "file_finder_action", ",", "conditions", "=", "[", "condition", "]", ",", "follow_links", "=", "True", ")", "action", "=", "file_finder", ".", "FileFinderOSFromClient", "yield", "action", ",", "request" ]
Find files fulfilling regex conditions.
[ "Find", "files", "fulfilling", "regex", "conditions", "." ]
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/artifact_collector.py#L208-L225
<|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: Find files fulfilling regex conditions. ### Response: def _ProcessGrepSource(self, source): """Find files fulfilling regex conditions.""" attributes = source.base_source.attributes paths = artifact_utils.InterpolateListKbAttributes( attributes["paths"], self.knowledge_base, self.ignore_interpolation_errors) regex = utils.RegexListDisjunction(attributes["content_regex_list"]) condition = rdf_file_finder.FileFinderCondition.ContentsRegexMatch( regex=regex, mode="ALL_HITS") file_finder_action = rdf_file_finder.FileFinderAction.Stat() request = rdf_file_finder.FileFinderArgs( paths=paths, action=file_finder_action, conditions=[condition], follow_links=True) action = file_finder.FileFinderOSFromClient yield action, request <|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, 10086, 3626, 50698, 20791, 4787, 382, 14711, 6075, 512, 755, 721, 7575, 38, 10200, 3692, 1214, 11, 2592, 997, 262, 4304, 10086, 3626, 50698, 20791, 4787, 14781, 262, 8365, 284, 2592, 9105, 10561, 27232, 198, 262, 13006, 284, 37739, 17758, 15767, 46529, 861, 42, 65, 10738, 1021, 286, 8365, 1204, 22354, 8073, 659, 5314, 52286, 7806, 345, 286, 659, 49708, 15678, 45786, 20808, 340, 262, 20791, 284, 12721, 9166, 327, 861, 4944, 73528, 61681, 1204, 1834, 42932, 2062, 14440, 262, 3044, 284, 67165, 2517, 88502, 8744, 43400, 10770, 2510, 812, 33564, 8495, 1021, 286, 20791, 28, 27485, 11, 3941, 429, 4006, 2083, 14813, 1158, 262, 1052, 88502, 8090, 284, 67165, 2517, 88502, 8744, 43400, 2573, 54519, 746, 262, 1715, 284, 67165, 2517, 88502, 8744, 43400, 4209, 1021, 286, 13006, 28, 22354, 345, 286, 1957, 60345, 88502, 8090, 345, 286, 4787, 5941, 9233, 1282, 286, 1833, 26324, 3702, 340, 262, 1957, 284, 1052, 88502, 8744, 43400, 3204, 3915, 3032, 271, 262, 7692, 1957, 11, 1715, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 10086, 3626, 50698, 20791, 4787, 382, 14711, 6075, 512, 755, 721, 7575, 38, 10200, 3692, 1214, 11, 2592, 997, 262, 4304, 10086, 3626, 50698, 20791, 4787, 14781, 262, 8365, 284, 2592, 9105, 10561, 27232, 198, 262, 13006, 284, 37739, 17758, 15767, 46529, 861, 42, 65, 10738, 1021, 286, 8365, 1204, 22354, 8073, 659, 5314, 52286, 7806, 345, 286, 659, 49708, 15678, 45786, 20808, 340, 262, 20791, 284, 12721, 9166, 327, 861, 4944, 73528, 61681, 1204, 1834, 42932, 2062, 14440, 262, 3044, 284, 67165, 2517, 88502, 8744, 43400, 10770, 2510, 812, 33564, 8495, 1021, 286, 20791, 28, 27485, 11, 3941, 429, 4006, 2083, 14813, 1158, 262, 1052, 88502, 8090, 284, 67165, 2517, 88502, 8744, 43400, 2573, 54519, 746, 262, 1715, 284, 67165, 2517, 88502, 8744, 43400, 4209, 1021, 286, 13006, 28, 22354, 345, 286, 1957, 60345, 88502, 8090, 345, 286, 4787, 5941, 9233, 1282, 286, 1833, 26324, 3702, 340, 262, 1957, 284, 1052, 88502, 8744, 43400, 3204, 3915, 3032, 271, 262, 7692, 1957, 11, 1715, 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 ]
F5Networks/f5-common-python
f5/multi_device/cluster/__init__.py
ClusterManager.manage_extant
def manage_extant(self, **kwargs): '''Manage an existing cluster :param kwargs: dict -- keyword args in dict ''' self._check_device_number(kwargs['devices']) self.trust_domain = TrustDomain( devices=kwargs['devices'], partition=kwargs['device_group_partition'] ) self.device_group = DeviceGroup(**kwargs) self.cluster = Cluster(**kwargs)
python
def manage_extant(self, **kwargs): '''Manage an existing cluster :param kwargs: dict -- keyword args in dict ''' self._check_device_number(kwargs['devices']) self.trust_domain = TrustDomain( devices=kwargs['devices'], partition=kwargs['device_group_partition'] ) self.device_group = DeviceGroup(**kwargs) self.cluster = Cluster(**kwargs)
[ "def", "manage_extant", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_check_device_number", "(", "kwargs", "[", "'devices'", "]", ")", "self", ".", "trust_domain", "=", "TrustDomain", "(", "devices", "=", "kwargs", "[", "'devices'", "]", ",", "partition", "=", "kwargs", "[", "'device_group_partition'", "]", ")", "self", ".", "device_group", "=", "DeviceGroup", "(", "*", "*", "kwargs", ")", "self", ".", "cluster", "=", "Cluster", "(", "*", "*", "kwargs", ")" ]
Manage an existing cluster :param kwargs: dict -- keyword args in dict
[ "Manage", "an", "existing", "cluster" ]
train
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/cluster/__init__.py#L136-L148
<|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: Manage an existing cluster :param kwargs: dict -- keyword args in dict ### Response: def manage_extant(self, **kwargs): '''Manage an existing cluster :param kwargs: dict -- keyword args in dict ''' self._check_device_number(kwargs['devices']) self.trust_domain = TrustDomain( devices=kwargs['devices'], partition=kwargs['device_group_partition'] ) self.device_group = DeviceGroup(**kwargs) self.cluster = Cluster(**kwargs) <|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, 34176, 459, 6484, 10879, 271, 286, 551, 913, 16901, 25, 6587, 1198, 16570, 2897, 304, 6587, 271, 14711, 6075, 512, 755, 10299, 10129, 519, 1214, 11, 3146, 9872, 997, 286, 11712, 34176, 459, 6484, 10879, 271, 286, 551, 913, 16901, 25, 6587, 1198, 16570, 2897, 304, 6587, 198, 286, 45832, 286, 659, 1462, 2071, 9385, 5617, 71706, 681, 48066, 7519, 286, 659, 5543, 592, 20715, 284, 17236, 13950, 1021, 310, 7766, 28, 9872, 681, 48066, 4479, 310, 17071, 28, 9872, 681, 6239, 6422, 44940, 4532, 286, 1763, 286, 659, 18861, 6422, 284, 14227, 2878, 22551, 9872, 340, 286, 659, 41601, 284, 36480, 22551, 9872, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 34176, 459, 6484, 10879, 271, 286, 551, 913, 16901, 25, 6587, 1198, 16570, 2897, 304, 6587, 271, 14711, 6075, 512, 755, 10299, 10129, 519, 1214, 11, 3146, 9872, 997, 286, 11712, 34176, 459, 6484, 10879, 271, 286, 551, 913, 16901, 25, 6587, 1198, 16570, 2897, 304, 6587, 198, 286, 45832, 286, 659, 1462, 2071, 9385, 5617, 71706, 681, 48066, 7519, 286, 659, 5543, 592, 20715, 284, 17236, 13950, 1021, 310, 7766, 28, 9872, 681, 48066, 4479, 310, 17071, 28, 9872, 681, 6239, 6422, 44940, 4532, 286, 1763, 286, 659, 18861, 6422, 284, 14227, 2878, 22551, 9872, 340, 286, 659, 41601, 284, 36480, 22551, 9872, 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 ]
woolfson-group/isambard
isambard/ampal/interactions.py
find_covalent_bonds
def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional Allows deviation from ideal covalent bond distance to be included. For example, a value of 1.1 would allow interactions up to 10% further from the ideal distance to be included. tag : bool, optional If `True`, will add the covalent bond to the tags dictionary of each `Atom` involved in the interaction under the `covalent_bonds` key. """ sectors=gen_sectors(ampal.get_atoms(), max_range * 1.1) bonds=[] for sector in sectors.values(): atoms=itertools.combinations(sector, 2) bonds.extend(covalent_bonds(atoms, threshold=threshold)) bond_set=list(set(bonds)) if tag: for bond in bond_set: a, b=bond.a, bond.b if 'covalent_bonds' not in a.tags: a.tags['covalent_bonds']=[b] else: a.tags['covalent_bonds'].append(b) if 'covalent_bonds' not in b.tags: b.tags['covalent_bonds']=[a] else: b.tags['covalent_bonds'].append(a) return bond_set
python
def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional Allows deviation from ideal covalent bond distance to be included. For example, a value of 1.1 would allow interactions up to 10% further from the ideal distance to be included. tag : bool, optional If `True`, will add the covalent bond to the tags dictionary of each `Atom` involved in the interaction under the `covalent_bonds` key. """ sectors=gen_sectors(ampal.get_atoms(), max_range * 1.1) bonds=[] for sector in sectors.values(): atoms=itertools.combinations(sector, 2) bonds.extend(covalent_bonds(atoms, threshold=threshold)) bond_set=list(set(bonds)) if tag: for bond in bond_set: a, b=bond.a, bond.b if 'covalent_bonds' not in a.tags: a.tags['covalent_bonds']=[b] else: a.tags['covalent_bonds'].append(b) if 'covalent_bonds' not in b.tags: b.tags['covalent_bonds']=[a] else: b.tags['covalent_bonds'].append(a) return bond_set
[ "def", "find_covalent_bonds", "(", "ampal", ",", "max_range", "=", "2.2", ",", "threshold", "=", "1.1", ",", "tag", "=", "True", ")", ":", "sectors", "=", "gen_sectors", "(", "ampal", ".", "get_atoms", "(", ")", ",", "max_range", "*", "1.1", ")", "bonds", "=", "[", "]", "for", "sector", "in", "sectors", ".", "values", "(", ")", ":", "atoms", "=", "itertools", ".", "combinations", "(", "sector", ",", "2", ")", "bonds", ".", "extend", "(", "covalent_bonds", "(", "atoms", ",", "threshold", "=", "threshold", ")", ")", "bond_set", "=", "list", "(", "set", "(", "bonds", ")", ")", "if", "tag", ":", "for", "bond", "in", "bond_set", ":", "a", ",", "b", "=", "bond", ".", "a", ",", "bond", ".", "b", "if", "'covalent_bonds'", "not", "in", "a", ".", "tags", ":", "a", ".", "tags", "[", "'covalent_bonds'", "]", "=", "[", "b", "]", "else", ":", "a", ".", "tags", "[", "'covalent_bonds'", "]", ".", "append", "(", "b", ")", "if", "'covalent_bonds'", "not", "in", "b", ".", "tags", ":", "b", ".", "tags", "[", "'covalent_bonds'", "]", "=", "[", "a", "]", "else", ":", "b", ".", "tags", "[", "'covalent_bonds'", "]", ".", "append", "(", "a", ")", "return", "bond_set" ]
Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional Allows deviation from ideal covalent bond distance to be included. For example, a value of 1.1 would allow interactions up to 10% further from the ideal distance to be included. tag : bool, optional If `True`, will add the covalent bond to the tags dictionary of each `Atom` involved in the interaction under the `covalent_bonds` key.
[ "Finds", "all", "covalent", "bonds", "in", "the", "AMPAL", "object", "." ]
train
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L206-L242
<|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: Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional Allows deviation from ideal covalent bond distance to be included. For example, a value of 1.1 would allow interactions up to 10% further from the ideal distance to be included. tag : bool, optional If `True`, will add the covalent bond to the tags dictionary of each `Atom` involved in the interaction under the `covalent_bonds` key. ### Response: def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional Allows deviation from ideal covalent bond distance to be included. For example, a value of 1.1 would allow interactions up to 10% further from the ideal distance to be included. tag : bool, optional If `True`, will add the covalent bond to the tags dictionary of each `Atom` involved in the interaction under the `covalent_bonds` key. """ sectors=gen_sectors(ampal.get_atoms(), max_range * 1.1) bonds=[] for sector in sectors.values(): atoms=itertools.combinations(sector, 2) bonds.extend(covalent_bonds(atoms, threshold=threshold)) bond_set=list(set(bonds)) if tag: for bond in bond_set: a, b=bond.a, bond.b if 'covalent_bonds' not in a.tags: a.tags['covalent_bonds']=[b] else: a.tags['covalent_bonds'].append(b) if 'covalent_bonds' not in b.tags: b.tags['covalent_bonds']=[a] else: b.tags['covalent_bonds'].append(a) return bond_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, 37, 8843, 682, 1080, 838, 306, 27460, 304, 279, 64008, 984, 1665, 382, 262, 13831, 198, 262, 31423, 262, 1097, 19866, 551, 64008, 984, 3075, 198, 286, 5884, 64008, 984, 1665, 449, 264, 1595, 456, 68855, 63, 1749, 627, 262, 1973, 9897, 551, 2273, 11, 10309, 198, 286, 12477, 311, 7124, 279, 10706, 1404, 11, 779, 22639, 520, 5129, 21986, 198, 286, 690, 539, 387, 1766, 627, 262, 12447, 551, 2273, 11, 10309, 198, 286, 46871, 38664, 505, 10728, 1080, 838, 306, 11049, 6138, 311, 387, 5343, 627, 286, 1789, 3187, 11, 264, 907, 315, 220, 16, 13, 16, 1053, 2187, 22639, 709, 311, 220, 605, 4, 4726, 198, 286, 505, 279, 10728, 6138, 311, 387, 5343, 627, 262, 4877, 551, 1845, 11, 10309, 198, 286, 1442, 1595, 2575, 7964, 690, 923, 279, 1080, 838, 306, 11049, 311, 279, 9681, 11240, 315, 198, 286, 1855, 1595, 36936, 63, 6532, 304, 279, 16628, 1234, 279, 1595, 1030, 838, 306, 890, 51058, 4077, 286, 1401, 382, 14711, 6075, 512, 755, 1505, 11647, 838, 306, 890, 51058, 7, 1141, 278, 11, 1973, 9897, 28, 17, 13, 17, 11, 12447, 28, 16, 13, 16, 11, 4877, 3702, 997, 262, 4304, 37, 8843, 682, 1080, 838, 306, 27460, 304, 279, 64008, 984, 1665, 382, 262, 13831, 198, 262, 31423, 262, 1097, 19866, 551, 64008, 984, 3075, 198, 286, 5884, 64008, 984, 1665, 449, 264, 1595, 456, 68855, 63, 1749, 627, 262, 1973, 9897, 551, 2273, 11, 10309, 198, 286, 12477, 311, 7124, 279, 10706, 1404, 11, 779, 22639, 520, 5129, 21986, 198, 286, 690, 539, 387, 1766, 627, 262, 12447, 551, 2273, 11, 10309, 198, 286, 46871, 38664, 505, 10728, 1080, 838, 306, 11049, 6138, 311, 387, 5343, 627, 286, 1789, 3187, 11, 264, 907, 315, 220, 16, 13, 16, 1053, 2187, 22639, 709, 311, 220, 605, 4, 4726, 198, 286, 505, 279, 10728, 6138, 311, 387, 5343, 627, 262, 4877, 551, 1845, 11, 10309, 198, 286, 1442, 1595, 2575, 7964, 690, 923, 279, 1080, 838, 306, 11049, 311, 279, 9681, 11240, 315, 198, 286, 1855, 1595, 36936, 63, 6532, 304, 279, 16628, 1234, 279, 1595, 1030, 838, 306, 890, 51058, 4077, 286, 1401, 627, 262, 3270, 262, 26593, 28, 4469, 3537, 12816, 7, 1141, 278, 673, 68855, 1535, 1973, 9897, 353, 220, 16, 13, 16, 340, 262, 27460, 28283, 262, 369, 10706, 304, 26593, 10883, 4019, 286, 33299, 28, 275, 37416, 916, 74729, 10698, 5009, 11, 220, 17, 340, 286, 27460, 16209, 20059, 838, 306, 890, 51058, 19917, 7085, 11, 12447, 28, 30002, 1192, 262, 11049, 2667, 42072, 14505, 1921, 51058, 1192, 262, 422, 4877, 512, 286, 369, 11049, 304, 11049, 2667, 512, 310, 264, 11, 293, 22861, 2159, 5973, 11, 11049, 960, 198, 310, 422, 364, 1030, 838, 306, 890, 51058, 6, 539, 304, 264, 33608, 512, 394, 264, 33608, 681, 1030, 838, 306, 890, 51058 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 37, 8843, 682, 1080, 838, 306, 27460, 304, 279, 64008, 984, 1665, 382, 262, 13831, 198, 262, 31423, 262, 1097, 19866, 551, 64008, 984, 3075, 198, 286, 5884, 64008, 984, 1665, 449, 264, 1595, 456, 68855, 63, 1749, 627, 262, 1973, 9897, 551, 2273, 11, 10309, 198, 286, 12477, 311, 7124, 279, 10706, 1404, 11, 779, 22639, 520, 5129, 21986, 198, 286, 690, 539, 387, 1766, 627, 262, 12447, 551, 2273, 11, 10309, 198, 286, 46871, 38664, 505, 10728, 1080, 838, 306, 11049, 6138, 311, 387, 5343, 627, 286, 1789, 3187, 11, 264, 907, 315, 220, 16, 13, 16, 1053, 2187, 22639, 709, 311, 220, 605, 4, 4726, 198, 286, 505, 279, 10728, 6138, 311, 387, 5343, 627, 262, 4877, 551, 1845, 11, 10309, 198, 286, 1442, 1595, 2575, 7964, 690, 923, 279, 1080, 838, 306, 11049, 311, 279, 9681, 11240, 315, 198, 286, 1855, 1595, 36936, 63, 6532, 304, 279, 16628, 1234, 279, 1595, 1030, 838, 306, 890, 51058, 4077, 286, 1401, 382, 14711, 6075, 512, 755, 1505, 11647, 838, 306, 890, 51058, 7, 1141, 278, 11, 1973, 9897, 28, 17, 13, 17, 11, 12447, 28, 16, 13, 16, 11, 4877, 3702, 997, 262, 4304, 37, 8843, 682, 1080, 838, 306, 27460, 304, 279, 64008, 984, 1665, 382, 262, 13831, 198, 262, 31423, 262, 1097, 19866, 551, 64008, 984, 3075, 198, 286, 5884, 64008, 984, 1665, 449, 264, 1595, 456, 68855, 63, 1749, 627, 262, 1973, 9897, 551, 2273, 11, 10309, 198, 286, 12477, 311, 7124, 279, 10706, 1404, 11, 779, 22639, 520, 5129, 21986, 198, 286, 690, 539, 387, 1766, 627, 262, 12447, 551, 2273, 11, 10309, 198, 286, 46871, 38664, 505, 10728, 1080, 838, 306, 11049, 6138, 311, 387, 5343, 627, 286, 1789, 3187, 11, 264, 907, 315, 220, 16, 13, 16, 1053, 2187, 22639, 709, 311, 220, 605, 4, 4726, 198, 286, 505, 279, 10728, 6138, 311, 387, 5343, 627, 262, 4877, 551, 1845, 11, 10309, 198, 286, 1442, 1595, 2575, 7964, 690, 923, 279, 1080, 838, 306, 11049, 311, 279, 9681, 11240, 315, 198, 286, 1855, 1595, 36936, 63, 6532, 304, 279, 16628, 1234, 279, 1595, 1030, 838, 306, 890, 51058, 4077, 286, 1401, 627, 262, 3270, 262, 26593, 28, 4469, 3537, 12816, 7, 1141, 278, 673, 68855, 1535, 1973, 9897, 353, 220, 16, 13, 16, 340, 262, 27460, 28283, 262, 369, 10706, 304, 26593, 10883, 4019, 286, 33299, 28, 275, 37416, 916, 74729, 10698, 5009, 11, 220, 17, 340, 286, 27460, 16209, 20059, 838, 306, 890, 51058, 19917, 7085, 11, 12447, 28, 30002, 1192, 262, 11049, 2667, 42072, 14505, 1921, 51058, 1192, 262, 422, 4877, 512, 286, 369, 11049, 304, 11049, 2667, 512, 310, 264, 11, 293, 22861, 2159, 5973, 11, 11049, 960, 198, 310, 422, 364, 1030, 838, 306, 890, 51058, 6, 539, 304, 264, 33608, 512, 394, 264, 33608, 681, 1030, 838, 306, 890, 51058 ]
all-umass/graphs
graphs/mixins/label.py
LabelMixin.classify_nearest
def classify_nearest(self, partial_labels): '''Simple semi-supervised classification, by assigning unlabeled vertices the label of nearest labeled vertex. partial_labels: (n,) array of integer labels, -1 for unlabeled. ''' labels = np.array(partial_labels, copy=True) unlabeled = labels == -1 # compute geodesic distances from unlabeled vertices D_unlabeled = self.shortest_path(weighted=True)[unlabeled] # set distances to other unlabeled vertices to infinity D_unlabeled[:,unlabeled] = np.inf # find shortest distances to labeled vertices idx = D_unlabeled.argmin(axis=1) # apply the label of the closest vertex labels[unlabeled] = labels[idx] return labels
python
def classify_nearest(self, partial_labels): '''Simple semi-supervised classification, by assigning unlabeled vertices the label of nearest labeled vertex. partial_labels: (n,) array of integer labels, -1 for unlabeled. ''' labels = np.array(partial_labels, copy=True) unlabeled = labels == -1 # compute geodesic distances from unlabeled vertices D_unlabeled = self.shortest_path(weighted=True)[unlabeled] # set distances to other unlabeled vertices to infinity D_unlabeled[:,unlabeled] = np.inf # find shortest distances to labeled vertices idx = D_unlabeled.argmin(axis=1) # apply the label of the closest vertex labels[unlabeled] = labels[idx] return labels
[ "def", "classify_nearest", "(", "self", ",", "partial_labels", ")", ":", "labels", "=", "np", ".", "array", "(", "partial_labels", ",", "copy", "=", "True", ")", "unlabeled", "=", "labels", "==", "-", "1", "# compute geodesic distances from unlabeled vertices", "D_unlabeled", "=", "self", ".", "shortest_path", "(", "weighted", "=", "True", ")", "[", "unlabeled", "]", "# set distances to other unlabeled vertices to infinity", "D_unlabeled", "[", ":", ",", "unlabeled", "]", "=", "np", ".", "inf", "# find shortest distances to labeled vertices", "idx", "=", "D_unlabeled", ".", "argmin", "(", "axis", "=", "1", ")", "# apply the label of the closest vertex", "labels", "[", "unlabeled", "]", "=", "labels", "[", "idx", "]", "return", "labels" ]
Simple semi-supervised classification, by assigning unlabeled vertices the label of nearest labeled vertex. partial_labels: (n,) array of integer labels, -1 for unlabeled.
[ "Simple", "semi", "-", "supervised", "classification", "by", "assigning", "unlabeled", "vertices", "the", "label", "of", "nearest", "labeled", "vertex", "." ]
train
https://github.com/all-umass/graphs/blob/4fbeb025dfe33340335f34300f58dd3809228822/graphs/mixins/label.py#L42-L58
<|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: Simple semi-supervised classification, by assigning unlabeled vertices the label of nearest labeled vertex. partial_labels: (n,) array of integer labels, -1 for unlabeled. ### Response: def classify_nearest(self, partial_labels): '''Simple semi-supervised classification, by assigning unlabeled vertices the label of nearest labeled vertex. partial_labels: (n,) array of integer labels, -1 for unlabeled. ''' labels = np.array(partial_labels, copy=True) unlabeled = labels == -1 # compute geodesic distances from unlabeled vertices D_unlabeled = self.shortest_path(weighted=True)[unlabeled] # set distances to other unlabeled vertices to infinity D_unlabeled[:,unlabeled] = np.inf # find shortest distances to labeled vertices idx = D_unlabeled.argmin(axis=1) # apply the label of the closest vertex labels[unlabeled] = labels[idx] return labels <|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, 16778, 18768, 59615, 79090, 24790, 11, 555, 61853, 65985, 23121, 17672, 198, 262, 279, 2440, 315, 24379, 30929, 12202, 382, 262, 7276, 14889, 25, 320, 77, 47121, 1358, 315, 7698, 9382, 11, 482, 16, 369, 65985, 23121, 382, 14711, 6075, 512, 755, 49229, 14250, 15795, 1214, 11, 7276, 14889, 997, 262, 11712, 16778, 18768, 59615, 79090, 24790, 11, 555, 61853, 65985, 23121, 17672, 198, 262, 279, 2440, 315, 24379, 30929, 12202, 382, 262, 7276, 14889, 25, 320, 77, 47121, 1358, 315, 7698, 9382, 11, 482, 16, 369, 65985, 23121, 627, 262, 11414, 262, 9382, 284, 2660, 7382, 1319, 21564, 14889, 11, 3048, 3702, 340, 262, 65985, 23121, 284, 9382, 624, 482, 16, 198, 262, 674, 12849, 3980, 2601, 292, 27650, 505, 65985, 23121, 17672, 198, 262, 423, 5012, 75, 23121, 284, 659, 27764, 478, 2703, 57232, 291, 3702, 6758, 359, 75, 23121, 933, 262, 674, 743, 27650, 311, 1023, 65985, 23121, 17672, 311, 56010, 198, 262, 423, 5012, 75, 23121, 9821, 359, 75, 23121, 60, 284, 2660, 32057, 198, 262, 674, 1505, 40243, 27650, 311, 30929, 17672, 198, 262, 7335, 284, 423, 5012, 75, 23121, 21875, 1083, 32984, 28, 16, 340, 262, 674, 3881, 279, 2440, 315, 279, 18585, 12202, 198, 262, 9382, 58, 359, 75, 23121, 60, 284, 9382, 11858, 933, 262, 471, 9382, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 16778, 18768, 59615, 79090, 24790, 11, 555, 61853, 65985, 23121, 17672, 198, 262, 279, 2440, 315, 24379, 30929, 12202, 382, 262, 7276, 14889, 25, 320, 77, 47121, 1358, 315, 7698, 9382, 11, 482, 16, 369, 65985, 23121, 382, 14711, 6075, 512, 755, 49229, 14250, 15795, 1214, 11, 7276, 14889, 997, 262, 11712, 16778, 18768, 59615, 79090, 24790, 11, 555, 61853, 65985, 23121, 17672, 198, 262, 279, 2440, 315, 24379, 30929, 12202, 382, 262, 7276, 14889, 25, 320, 77, 47121, 1358, 315, 7698, 9382, 11, 482, 16, 369, 65985, 23121, 627, 262, 11414, 262, 9382, 284, 2660, 7382, 1319, 21564, 14889, 11, 3048, 3702, 340, 262, 65985, 23121, 284, 9382, 624, 482, 16, 198, 262, 674, 12849, 3980, 2601, 292, 27650, 505, 65985, 23121, 17672, 198, 262, 423, 5012, 75, 23121, 284, 659, 27764, 478, 2703, 57232, 291, 3702, 6758, 359, 75, 23121, 933, 262, 674, 743, 27650, 311, 1023, 65985, 23121, 17672, 311, 56010, 198, 262, 423, 5012, 75, 23121, 9821, 359, 75, 23121, 60, 284, 2660, 32057, 198, 262, 674, 1505, 40243, 27650, 311, 30929, 17672, 198, 262, 7335, 284, 423, 5012, 75, 23121, 21875, 1083, 32984, 28, 16, 340, 262, 674, 3881, 279, 2440, 315, 279, 18585, 12202, 198, 262, 9382, 58, 359, 75, 23121, 60, 284, 9382, 11858, 933, 262, 471, 9382, 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 ]
llazzaro/django-scheduler
schedule/templatetags/scheduletags.py
_cook_slots
def _cook_slots(period, increment): """ Prepare slots to be displayed on the left hand side calculate dimensions (in px) for each slot. Arguments: period - time period for the whole series increment - slot size in minutes """ tdiff = datetime.timedelta(minutes=increment) num = int((period.end - period.start).total_seconds()) // int(tdiff.total_seconds()) s = period.start slots = [] for i in range(num): sl = period.get_time_slot(s, s + tdiff) slots.append(sl) s = s + tdiff return slots
python
def _cook_slots(period, increment): """ Prepare slots to be displayed on the left hand side calculate dimensions (in px) for each slot. Arguments: period - time period for the whole series increment - slot size in minutes """ tdiff = datetime.timedelta(minutes=increment) num = int((period.end - period.start).total_seconds()) // int(tdiff.total_seconds()) s = period.start slots = [] for i in range(num): sl = period.get_time_slot(s, s + tdiff) slots.append(sl) s = s + tdiff return slots
[ "def", "_cook_slots", "(", "period", ",", "increment", ")", ":", "tdiff", "=", "datetime", ".", "timedelta", "(", "minutes", "=", "increment", ")", "num", "=", "int", "(", "(", "period", ".", "end", "-", "period", ".", "start", ")", ".", "total_seconds", "(", ")", ")", "//", "int", "(", "tdiff", ".", "total_seconds", "(", ")", ")", "s", "=", "period", ".", "start", "slots", "=", "[", "]", "for", "i", "in", "range", "(", "num", ")", ":", "sl", "=", "period", ".", "get_time_slot", "(", "s", ",", "s", "+", "tdiff", ")", "slots", ".", "append", "(", "sl", ")", "s", "=", "s", "+", "tdiff", "return", "slots" ]
Prepare slots to be displayed on the left hand side calculate dimensions (in px) for each slot. Arguments: period - time period for the whole series increment - slot size in minutes
[ "Prepare", "slots", "to", "be", "displayed", "on", "the", "left", "hand", "side", "calculate", "dimensions", "(", "in", "px", ")", "for", "each", "slot", ".", "Arguments", ":", "period", "-", "time", "period", "for", "the", "whole", "series", "increment", "-", "slot", "size", "in", "minutes" ]
train
https://github.com/llazzaro/django-scheduler/blob/0530b74a5fc0b1125645002deaa4da2337ed0f17/schedule/templatetags/scheduletags.py#L245-L261
<|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: Prepare slots to be displayed on the left hand side calculate dimensions (in px) for each slot. Arguments: period - time period for the whole series increment - slot size in minutes ### Response: def _cook_slots(period, increment): """ Prepare slots to be displayed on the left hand side calculate dimensions (in px) for each slot. Arguments: period - time period for the whole series increment - slot size in minutes """ tdiff = datetime.timedelta(minutes=increment) num = int((period.end - period.start).total_seconds()) // int(tdiff.total_seconds()) s = period.start slots = [] for i in range(num): sl = period.get_time_slot(s, s + tdiff) slots.append(sl) s = s + tdiff return slots <|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, 51690, 16087, 311, 387, 12882, 389, 279, 2163, 1450, 3185, 198, 286, 11294, 15696, 320, 258, 17585, 8, 369, 1855, 9633, 627, 286, 28802, 512, 286, 4261, 482, 892, 4261, 369, 279, 4459, 4101, 198, 286, 16650, 482, 9633, 1404, 304, 4520, 271, 14711, 6075, 512, 755, 721, 87895, 55261, 75882, 11, 16650, 997, 262, 3270, 286, 32266, 16087, 311, 387, 12882, 389, 279, 2163, 1450, 3185, 198, 286, 11294, 15696, 320, 258, 17585, 8, 369, 1855, 9633, 627, 286, 28802, 512, 286, 4261, 482, 892, 4261, 369, 279, 4459, 4101, 198, 286, 16650, 482, 9633, 1404, 304, 4520, 198, 262, 3270, 262, 259, 13798, 284, 9050, 58939, 77759, 28, 36844, 340, 262, 1661, 284, 528, 1209, 19862, 5183, 482, 4261, 5069, 570, 5143, 35925, 2189, 443, 528, 1175, 13798, 14032, 35925, 2455, 262, 274, 284, 4261, 5069, 198, 262, 16087, 284, 4260, 262, 369, 602, 304, 2134, 8228, 997, 286, 1776, 284, 4261, 673, 3084, 28663, 1161, 11, 274, 489, 259, 13798, 340, 286, 16087, 2102, 56791, 340, 286, 274, 284, 274, 489, 259, 13798, 198, 262, 471, 16087, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 51690, 16087, 311, 387, 12882, 389, 279, 2163, 1450, 3185, 198, 286, 11294, 15696, 320, 258, 17585, 8, 369, 1855, 9633, 627, 286, 28802, 512, 286, 4261, 482, 892, 4261, 369, 279, 4459, 4101, 198, 286, 16650, 482, 9633, 1404, 304, 4520, 271, 14711, 6075, 512, 755, 721, 87895, 55261, 75882, 11, 16650, 997, 262, 3270, 286, 32266, 16087, 311, 387, 12882, 389, 279, 2163, 1450, 3185, 198, 286, 11294, 15696, 320, 258, 17585, 8, 369, 1855, 9633, 627, 286, 28802, 512, 286, 4261, 482, 892, 4261, 369, 279, 4459, 4101, 198, 286, 16650, 482, 9633, 1404, 304, 4520, 198, 262, 3270, 262, 259, 13798, 284, 9050, 58939, 77759, 28, 36844, 340, 262, 1661, 284, 528, 1209, 19862, 5183, 482, 4261, 5069, 570, 5143, 35925, 2189, 443, 528, 1175, 13798, 14032, 35925, 2455, 262, 274, 284, 4261, 5069, 198, 262, 16087, 284, 4260, 262, 369, 602, 304, 2134, 8228, 997, 286, 1776, 284, 4261, 673, 3084, 28663, 1161, 11, 274, 489, 259, 13798, 340, 286, 16087, 2102, 56791, 340, 286, 274, 284, 274, 489, 259, 13798, 198, 262, 471, 16087, 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 ]
pyviz/param
param/parameterized.py
Parameters.get_value_generator
def get_value_generator(self_,name): # pylint: disable-msg=E0213 """ Return the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned. """ cls_or_slf = self_.self_or_cls param_obj = cls_or_slf.param.objects('existing').get(name) if not param_obj: value = getattr(cls_or_slf,name) # CompositeParameter detected by being a Parameter and having 'attribs' elif hasattr(param_obj,'attribs'): value = [cls_or_slf.param.get_value_generator(a) for a in param_obj.attribs] # not a Dynamic Parameter elif not hasattr(param_obj,'_value_is_dynamic'): value = getattr(cls_or_slf,name) # Dynamic Parameter... else: internal_name = "_%s_param_value"%name if hasattr(cls_or_slf,internal_name): # dealing with object and it's been set on this object value = getattr(cls_or_slf,internal_name) else: # dealing with class or isn't set on the object value = param_obj.default return value
python
def get_value_generator(self_,name): # pylint: disable-msg=E0213 """ Return the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned. """ cls_or_slf = self_.self_or_cls param_obj = cls_or_slf.param.objects('existing').get(name) if not param_obj: value = getattr(cls_or_slf,name) # CompositeParameter detected by being a Parameter and having 'attribs' elif hasattr(param_obj,'attribs'): value = [cls_or_slf.param.get_value_generator(a) for a in param_obj.attribs] # not a Dynamic Parameter elif not hasattr(param_obj,'_value_is_dynamic'): value = getattr(cls_or_slf,name) # Dynamic Parameter... else: internal_name = "_%s_param_value"%name if hasattr(cls_or_slf,internal_name): # dealing with object and it's been set on this object value = getattr(cls_or_slf,internal_name) else: # dealing with class or isn't set on the object value = param_obj.default return value
[ "def", "get_value_generator", "(", "self_", ",", "name", ")", ":", "# pylint: disable-msg=E0213", "cls_or_slf", "=", "self_", ".", "self_or_cls", "param_obj", "=", "cls_or_slf", ".", "param", ".", "objects", "(", "'existing'", ")", ".", "get", "(", "name", ")", "if", "not", "param_obj", ":", "value", "=", "getattr", "(", "cls_or_slf", ",", "name", ")", "# CompositeParameter detected by being a Parameter and having 'attribs'", "elif", "hasattr", "(", "param_obj", ",", "'attribs'", ")", ":", "value", "=", "[", "cls_or_slf", ".", "param", ".", "get_value_generator", "(", "a", ")", "for", "a", "in", "param_obj", ".", "attribs", "]", "# not a Dynamic Parameter", "elif", "not", "hasattr", "(", "param_obj", ",", "'_value_is_dynamic'", ")", ":", "value", "=", "getattr", "(", "cls_or_slf", ",", "name", ")", "# Dynamic Parameter...", "else", ":", "internal_name", "=", "\"_%s_param_value\"", "%", "name", "if", "hasattr", "(", "cls_or_slf", ",", "internal_name", ")", ":", "# dealing with object and it's been set on this object", "value", "=", "getattr", "(", "cls_or_slf", ",", "internal_name", ")", "else", ":", "# dealing with class or isn't set on the object", "value", "=", "param_obj", ".", "default", "return", "value" ]
Return the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned.
[ "Return", "the", "value", "or", "value", "-", "generating", "object", "of", "the", "named", "attribute", "." ]
train
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1504-L1537
<|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 the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned. ### Response: def get_value_generator(self_,name): # pylint: disable-msg=E0213 """ Return the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned. """ cls_or_slf = self_.self_or_cls param_obj = cls_or_slf.param.objects('existing').get(name) if not param_obj: value = getattr(cls_or_slf,name) # CompositeParameter detected by being a Parameter and having 'attribs' elif hasattr(param_obj,'attribs'): value = [cls_or_slf.param.get_value_generator(a) for a in param_obj.attribs] # not a Dynamic Parameter elif not hasattr(param_obj,'_value_is_dynamic'): value = getattr(cls_or_slf,name) # Dynamic Parameter... else: internal_name = "_%s_param_value"%name if hasattr(cls_or_slf,internal_name): # dealing with object and it's been set on this object value = getattr(cls_or_slf,internal_name) else: # dealing with class or isn't set on the object value = param_obj.default return value <|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, 279, 907, 477, 907, 2427, 94207, 1665, 315, 279, 7086, 198, 286, 7180, 382, 286, 1789, 1455, 5137, 11, 420, 374, 5042, 279, 5852, 596, 907, 198, 286, 320, 72, 1770, 13, 279, 1890, 439, 31097, 12122, 719, 22648, 5137, 617, 198, 286, 872, 907, 2427, 94207, 1665, 6052, 382, 14711, 6075, 512, 755, 636, 3220, 26898, 1214, 7022, 609, 1680, 674, 51471, 25, 11404, 58562, 86334, 11592, 18, 198, 286, 3270, 286, 3494, 279, 907, 477, 907, 2427, 94207, 1665, 315, 279, 7086, 198, 286, 7180, 382, 286, 1789, 1455, 5137, 11, 420, 374, 5042, 279, 5852, 596, 907, 198, 286, 320, 72, 1770, 13, 279, 1890, 439, 31097, 12122, 719, 22648, 5137, 617, 198, 286, 872, 907, 2427, 94207, 1665, 6052, 627, 286, 3270, 286, 13082, 8908, 646, 11253, 284, 659, 5056, 726, 8908, 39756, 198, 286, 1719, 7478, 284, 13082, 8908, 646, 11253, 6772, 8549, 493, 37995, 1861, 456, 3232, 696, 286, 422, 539, 1719, 7478, 512, 310, 907, 284, 31097, 21024, 8908, 646, 11253, 22779, 696, 286, 674, 41739, 5078, 16914, 555, 1694, 264, 15521, 323, 3515, 364, 45213, 82, 1270, 286, 4508, 32156, 9942, 7478, 2965, 45213, 82, 11290, 310, 907, 284, 510, 18565, 8908, 646, 11253, 6772, 673, 3220, 26898, 2948, 8, 369, 264, 304, 1719, 7478, 49542, 82, 2595, 286, 674, 539, 264, 22648, 15521, 198, 286, 4508, 539, 32156, 9942, 7478, 2965, 62, 970, 7037, 47092, 11290, 310, 907, 284, 31097, 21024, 8908, 646, 11253, 22779, 696, 286, 674, 22648, 15521, 9522, 286, 775, 512, 310, 5419, 1292, 284, 9177, 4, 82, 4182, 3220, 32491, 609, 198, 310, 422, 32156, 21024, 8908, 646, 11253, 10072, 3051, 1292, 997, 394, 674, 14892, 449, 1665, 323, 433, 596, 1027, 743, 389, 420, 1665, 198, 394, 907, 284, 31097, 21024, 8908, 646, 11253, 10072, 3051, 1292, 340, 310, 775, 512, 394, 674, 14892, 449, 538, 477, 4536, 956, 743, 389, 279, 1665, 198, 394, 907, 284, 1719, 7478, 8939, 271, 286, 471, 907, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 279, 907, 477, 907, 2427, 94207, 1665, 315, 279, 7086, 198, 286, 7180, 382, 286, 1789, 1455, 5137, 11, 420, 374, 5042, 279, 5852, 596, 907, 198, 286, 320, 72, 1770, 13, 279, 1890, 439, 31097, 12122, 719, 22648, 5137, 617, 198, 286, 872, 907, 2427, 94207, 1665, 6052, 382, 14711, 6075, 512, 755, 636, 3220, 26898, 1214, 7022, 609, 1680, 674, 51471, 25, 11404, 58562, 86334, 11592, 18, 198, 286, 3270, 286, 3494, 279, 907, 477, 907, 2427, 94207, 1665, 315, 279, 7086, 198, 286, 7180, 382, 286, 1789, 1455, 5137, 11, 420, 374, 5042, 279, 5852, 596, 907, 198, 286, 320, 72, 1770, 13, 279, 1890, 439, 31097, 12122, 719, 22648, 5137, 617, 198, 286, 872, 907, 2427, 94207, 1665, 6052, 627, 286, 3270, 286, 13082, 8908, 646, 11253, 284, 659, 5056, 726, 8908, 39756, 198, 286, 1719, 7478, 284, 13082, 8908, 646, 11253, 6772, 8549, 493, 37995, 1861, 456, 3232, 696, 286, 422, 539, 1719, 7478, 512, 310, 907, 284, 31097, 21024, 8908, 646, 11253, 22779, 696, 286, 674, 41739, 5078, 16914, 555, 1694, 264, 15521, 323, 3515, 364, 45213, 82, 1270, 286, 4508, 32156, 9942, 7478, 2965, 45213, 82, 11290, 310, 907, 284, 510, 18565, 8908, 646, 11253, 6772, 673, 3220, 26898, 2948, 8, 369, 264, 304, 1719, 7478, 49542, 82, 2595, 286, 674, 539, 264, 22648, 15521, 198, 286, 4508, 539, 32156, 9942, 7478, 2965, 62, 970, 7037, 47092, 11290, 310, 907, 284, 31097, 21024, 8908, 646, 11253, 22779, 696, 286, 674, 22648, 15521, 9522, 286, 775, 512, 310, 5419, 1292, 284, 9177, 4, 82, 4182, 3220, 32491, 609, 198, 310, 422, 32156, 21024, 8908, 646, 11253, 10072, 3051, 1292, 997, 394, 674, 14892, 449, 1665, 323, 433, 596, 1027, 743, 389, 420, 1665, 198, 394, 907, 284, 31097, 21024, 8908, 646, 11253, 10072, 3051, 1292, 340, 310, 775, 512, 394, 674, 14892, 449, 538, 477, 4536, 956, 743, 389, 279, 1665, 198, 394, 907, 284, 1719, 7478, 8939, 271, 286, 471, 907, 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 ]
mitsei/dlkit
dlkit/json_/proxy/sessions.py
ProxySession.get_proxy
def get_proxy(self, input_): """Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsupported - ``input`` is not of this service *compliance: mandatory -- This method is must be implemented.* """ if input_._http_request is not None: authentication = Authentication() authentication.set_django_user(input_._http_request.user) else: authentication = None effective_agent_id = input_._effective_agent_id # Also need to deal with effective dates and Local return rules.Proxy(authentication=authentication, effective_agent_id=effective_agent_id)
python
def get_proxy(self, input_): """Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsupported - ``input`` is not of this service *compliance: mandatory -- This method is must be implemented.* """ if input_._http_request is not None: authentication = Authentication() authentication.set_django_user(input_._http_request.user) else: authentication = None effective_agent_id = input_._effective_agent_id # Also need to deal with effective dates and Local return rules.Proxy(authentication=authentication, effective_agent_id=effective_agent_id)
[ "def", "get_proxy", "(", "self", ",", "input_", ")", ":", "if", "input_", ".", "_http_request", "is", "not", "None", ":", "authentication", "=", "Authentication", "(", ")", "authentication", ".", "set_django_user", "(", "input_", ".", "_http_request", ".", "user", ")", "else", ":", "authentication", "=", "None", "effective_agent_id", "=", "input_", ".", "_effective_agent_id", "# Also need to deal with effective dates and Local", "return", "rules", ".", "Proxy", "(", "authentication", "=", "authentication", ",", "effective_agent_id", "=", "effective_agent_id", ")" ]
Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsupported - ``input`` is not of this service *compliance: mandatory -- This method is must be implemented.*
[ "Gets", "a", "proxy", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/proxy/sessions.py#L45-L65
<|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: Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsupported - ``input`` is not of this service *compliance: mandatory -- This method is must be implemented.* ### Response: def get_proxy(self, input_): """Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsupported - ``input`` is not of this service *compliance: mandatory -- This method is must be implemented.* """ if input_._http_request is not None: authentication = Authentication() authentication.set_django_user(input_._http_request.user) else: authentication = None effective_agent_id = input_._effective_agent_id # Also need to deal with effective dates and Local return rules.Proxy(authentication=authentication, effective_agent_id=effective_agent_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, 50458, 264, 13594, 382, 286, 1417, 25, 262, 1988, 320, 437, 307, 42203, 76300, 10770, 1680, 264, 13594, 3044, 198, 286, 471, 25, 320, 437, 307, 42203, 76300, 8, 482, 264, 13594, 198, 286, 4933, 25, 220, 18576, 9350, 482, 10103, 1379, 14196, 374, 10103, 2994, 85374, 286, 4933, 25, 220, 17145, 9595, 482, 12153, 311, 4686, 1715, 198, 286, 4933, 25, 220, 18628, 55581, 482, 24645, 8060, 198, 286, 4933, 25, 220, 34181, 482, 10103, 1379, 14196, 374, 539, 315, 420, 2532, 198, 286, 353, 884, 32712, 25, 23911, 1198, 1115, 1749, 374, 2011, 387, 11798, 43115, 14711, 6075, 512, 755, 636, 30812, 1214, 11, 1988, 62, 997, 286, 4304, 50458, 264, 13594, 382, 286, 1417, 25, 262, 1988, 320, 437, 307, 42203, 76300, 10770, 1680, 264, 13594, 3044, 198, 286, 471, 25, 320, 437, 307, 42203, 76300, 8, 482, 264, 13594, 198, 286, 4933, 25, 220, 18576, 9350, 482, 10103, 1379, 14196, 374, 10103, 2994, 85374, 286, 4933, 25, 220, 17145, 9595, 482, 12153, 311, 4686, 1715, 198, 286, 4933, 25, 220, 18628, 55581, 482, 24645, 8060, 198, 286, 4933, 25, 220, 34181, 482, 10103, 1379, 14196, 374, 539, 315, 420, 2532, 198, 286, 353, 884, 32712, 25, 23911, 1198, 1115, 1749, 374, 2011, 387, 11798, 43115, 286, 3270, 286, 422, 1988, 62, 1462, 1277, 8052, 374, 539, 2290, 512, 310, 17066, 284, 24446, 746, 310, 17066, 995, 821, 5970, 3398, 5498, 62, 1462, 1277, 8052, 3405, 340, 286, 775, 512, 310, 17066, 284, 2290, 198, 286, 7524, 26814, 851, 284, 1988, 62, 1462, 78995, 26814, 851, 198, 286, 674, 7429, 1205, 311, 3568, 449, 7524, 13003, 323, 8949, 198, 286, 471, 5718, 76300, 28535, 7311, 28, 46990, 345, 6096, 7524, 26814, 851, 28, 78995, 26814, 851, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 50458, 264, 13594, 382, 286, 1417, 25, 262, 1988, 320, 437, 307, 42203, 76300, 10770, 1680, 264, 13594, 3044, 198, 286, 471, 25, 320, 437, 307, 42203, 76300, 8, 482, 264, 13594, 198, 286, 4933, 25, 220, 18576, 9350, 482, 10103, 1379, 14196, 374, 10103, 2994, 85374, 286, 4933, 25, 220, 17145, 9595, 482, 12153, 311, 4686, 1715, 198, 286, 4933, 25, 220, 18628, 55581, 482, 24645, 8060, 198, 286, 4933, 25, 220, 34181, 482, 10103, 1379, 14196, 374, 539, 315, 420, 2532, 198, 286, 353, 884, 32712, 25, 23911, 1198, 1115, 1749, 374, 2011, 387, 11798, 43115, 14711, 6075, 512, 755, 636, 30812, 1214, 11, 1988, 62, 997, 286, 4304, 50458, 264, 13594, 382, 286, 1417, 25, 262, 1988, 320, 437, 307, 42203, 76300, 10770, 1680, 264, 13594, 3044, 198, 286, 471, 25, 320, 437, 307, 42203, 76300, 8, 482, 264, 13594, 198, 286, 4933, 25, 220, 18576, 9350, 482, 10103, 1379, 14196, 374, 10103, 2994, 85374, 286, 4933, 25, 220, 17145, 9595, 482, 12153, 311, 4686, 1715, 198, 286, 4933, 25, 220, 18628, 55581, 482, 24645, 8060, 198, 286, 4933, 25, 220, 34181, 482, 10103, 1379, 14196, 374, 539, 315, 420, 2532, 198, 286, 353, 884, 32712, 25, 23911, 1198, 1115, 1749, 374, 2011, 387, 11798, 43115, 286, 3270, 286, 422, 1988, 62, 1462, 1277, 8052, 374, 539, 2290, 512, 310, 17066, 284, 24446, 746, 310, 17066, 995, 821, 5970, 3398, 5498, 62, 1462, 1277, 8052, 3405, 340, 286, 775, 512, 310, 17066, 284, 2290, 198, 286, 7524, 26814, 851, 284, 1988, 62, 1462, 78995, 26814, 851, 198, 286, 674, 7429, 1205, 311, 3568, 449, 7524, 13003, 323, 8949, 198, 286, 471, 5718, 76300, 28535, 7311, 28, 46990, 345, 6096, 7524, 26814, 851, 28, 78995, 26814, 851, 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 ]
DataDog/integrations-core
openstack/datadog_checks/openstack/openstack.py
KeystoneCatalog.get_neutron_endpoint
def get_neutron_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog """ catalog = json_resp.get('token', {}).get('catalog', []) match = 'neutron' neutron_endpoint = None for entry in catalog: if entry['name'] == match or 'Networking' in entry['name']: valid_endpoints = {} for ep in entry['endpoints']: interface = ep.get('interface', '') if interface in ['public', 'internal']: valid_endpoints[interface] = ep['url'] if valid_endpoints: # Favor public endpoints over internal neutron_endpoint = valid_endpoints.get("public", valid_endpoints.get("internal")) break else: raise MissingNeutronEndpoint() return neutron_endpoint
python
def get_neutron_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog """ catalog = json_resp.get('token', {}).get('catalog', []) match = 'neutron' neutron_endpoint = None for entry in catalog: if entry['name'] == match or 'Networking' in entry['name']: valid_endpoints = {} for ep in entry['endpoints']: interface = ep.get('interface', '') if interface in ['public', 'internal']: valid_endpoints[interface] = ep['url'] if valid_endpoints: # Favor public endpoints over internal neutron_endpoint = valid_endpoints.get("public", valid_endpoints.get("internal")) break else: raise MissingNeutronEndpoint() return neutron_endpoint
[ "def", "get_neutron_endpoint", "(", "cls", ",", "json_resp", ")", ":", "catalog", "=", "json_resp", ".", "get", "(", "'token'", ",", "{", "}", ")", ".", "get", "(", "'catalog'", ",", "[", "]", ")", "match", "=", "'neutron'", "neutron_endpoint", "=", "None", "for", "entry", "in", "catalog", ":", "if", "entry", "[", "'name'", "]", "==", "match", "or", "'Networking'", "in", "entry", "[", "'name'", "]", ":", "valid_endpoints", "=", "{", "}", "for", "ep", "in", "entry", "[", "'endpoints'", "]", ":", "interface", "=", "ep", ".", "get", "(", "'interface'", ",", "''", ")", "if", "interface", "in", "[", "'public'", ",", "'internal'", "]", ":", "valid_endpoints", "[", "interface", "]", "=", "ep", "[", "'url'", "]", "if", "valid_endpoints", ":", "# Favor public endpoints over internal", "neutron_endpoint", "=", "valid_endpoints", ".", "get", "(", "\"public\"", ",", "valid_endpoints", ".", "get", "(", "\"internal\"", ")", ")", "break", "else", ":", "raise", "MissingNeutronEndpoint", "(", ")", "return", "neutron_endpoint" ]
Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog
[ "Parse", "the", "service", "catalog", "returned", "by", "the", "Identity", "API", "for", "an", "endpoint", "matching", "the", "Neutron", "service", "Sends", "a", "CRITICAL", "service", "check", "when", "none", "are", "found", "registered", "in", "the", "Catalog" ]
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack/datadog_checks/openstack/openstack.py#L455-L479
<|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: Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog ### Response: def get_neutron_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog """ catalog = json_resp.get('token', {}).get('catalog', []) match = 'neutron' neutron_endpoint = None for entry in catalog: if entry['name'] == match or 'Networking' in entry['name']: valid_endpoints = {} for ep in entry['endpoints']: interface = ep.get('interface', '') if interface in ['public', 'internal']: valid_endpoints[interface] = ep['url'] if valid_endpoints: # Favor public endpoints over internal neutron_endpoint = valid_endpoints.get("public", valid_endpoints.get("internal")) break else: raise MissingNeutronEndpoint() return neutron_endpoint <|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, 14802, 279, 2532, 16808, 6052, 555, 279, 27638, 5446, 369, 459, 15233, 12864, 279, 4275, 75248, 2532, 198, 286, 65502, 264, 12904, 47917, 2532, 1817, 994, 7000, 527, 1766, 9879, 304, 279, 32321, 271, 14711, 6075, 512, 755, 636, 14250, 75248, 37799, 21024, 11, 3024, 36260, 997, 286, 3270, 286, 15118, 279, 2532, 16808, 6052, 555, 279, 27638, 5446, 369, 459, 15233, 12864, 279, 4275, 75248, 2532, 198, 286, 65502, 264, 12904, 47917, 2532, 1817, 994, 7000, 527, 1766, 9879, 304, 279, 32321, 198, 286, 3270, 286, 16808, 284, 3024, 36260, 673, 493, 5963, 518, 73827, 456, 493, 27637, 518, 28714, 286, 2489, 284, 364, 818, 75248, 3961, 286, 73404, 37799, 284, 2290, 198, 286, 369, 4441, 304, 16808, 512, 310, 422, 4441, 681, 609, 663, 624, 2489, 477, 364, 79107, 6, 304, 4441, 681, 609, 18888, 394, 2764, 6345, 7862, 284, 5731, 394, 369, 4248, 304, 4441, 681, 408, 7862, 18888, 504, 3834, 284, 4248, 673, 493, 5077, 518, 23113, 504, 422, 3834, 304, 2570, 898, 518, 364, 10701, 18888, 667, 2764, 6345, 7862, 58, 5077, 60, 284, 4248, 681, 1103, 16049, 394, 422, 2764, 6345, 7862, 512, 504, 674, 74887, 586, 37442, 927, 5419, 198, 504, 73404, 37799, 284, 2764, 6345, 7862, 673, 446, 898, 498, 2764, 6345, 7862, 673, 446, 10701, 5572, 504, 1464, 198, 286, 775, 512, 310, 4933, 36364, 8989, 75248, 28480, 2892, 286, 471, 73404, 37799, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 14802, 279, 2532, 16808, 6052, 555, 279, 27638, 5446, 369, 459, 15233, 12864, 279, 4275, 75248, 2532, 198, 286, 65502, 264, 12904, 47917, 2532, 1817, 994, 7000, 527, 1766, 9879, 304, 279, 32321, 271, 14711, 6075, 512, 755, 636, 14250, 75248, 37799, 21024, 11, 3024, 36260, 997, 286, 3270, 286, 15118, 279, 2532, 16808, 6052, 555, 279, 27638, 5446, 369, 459, 15233, 12864, 279, 4275, 75248, 2532, 198, 286, 65502, 264, 12904, 47917, 2532, 1817, 994, 7000, 527, 1766, 9879, 304, 279, 32321, 198, 286, 3270, 286, 16808, 284, 3024, 36260, 673, 493, 5963, 518, 73827, 456, 493, 27637, 518, 28714, 286, 2489, 284, 364, 818, 75248, 3961, 286, 73404, 37799, 284, 2290, 198, 286, 369, 4441, 304, 16808, 512, 310, 422, 4441, 681, 609, 663, 624, 2489, 477, 364, 79107, 6, 304, 4441, 681, 609, 18888, 394, 2764, 6345, 7862, 284, 5731, 394, 369, 4248, 304, 4441, 681, 408, 7862, 18888, 504, 3834, 284, 4248, 673, 493, 5077, 518, 23113, 504, 422, 3834, 304, 2570, 898, 518, 364, 10701, 18888, 667, 2764, 6345, 7862, 58, 5077, 60, 284, 4248, 681, 1103, 16049, 394, 422, 2764, 6345, 7862, 512, 504, 674, 74887, 586, 37442, 927, 5419, 198, 504, 73404, 37799, 284, 2764, 6345, 7862, 673, 446, 898, 498, 2764, 6345, 7862, 673, 446, 10701, 5572, 504, 1464, 198, 286, 775, 512, 310, 4933, 36364, 8989, 75248, 28480, 2892, 286, 471, 73404, 37799, 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 ]
materialsproject/pymatgen
pymatgen/io/abinit/flows.py
Flow.validate_json_schema
def validate_json_schema(self): """Validate the JSON schema. Return list of errors.""" errors = [] for work in self: for task in work: if not task.get_results().validate_json_schema(): errors.append(task) if not work.get_results().validate_json_schema(): errors.append(work) if not self.get_results().validate_json_schema(): errors.append(self) return errors
python
def validate_json_schema(self): """Validate the JSON schema. Return list of errors.""" errors = [] for work in self: for task in work: if not task.get_results().validate_json_schema(): errors.append(task) if not work.get_results().validate_json_schema(): errors.append(work) if not self.get_results().validate_json_schema(): errors.append(self) return errors
[ "def", "validate_json_schema", "(", "self", ")", ":", "errors", "=", "[", "]", "for", "work", "in", "self", ":", "for", "task", "in", "work", ":", "if", "not", "task", ".", "get_results", "(", ")", ".", "validate_json_schema", "(", ")", ":", "errors", ".", "append", "(", "task", ")", "if", "not", "work", ".", "get_results", "(", ")", ".", "validate_json_schema", "(", ")", ":", "errors", ".", "append", "(", "work", ")", "if", "not", "self", ".", "get_results", "(", ")", ".", "validate_json_schema", "(", ")", ":", "errors", ".", "append", "(", "self", ")", "return", "errors" ]
Validate the JSON schema. Return list of errors.
[ "Validate", "the", "JSON", "schema", ".", "Return", "list", "of", "errors", "." ]
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L426-L439
<|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: Validate the JSON schema. Return list of errors. ### Response: def validate_json_schema(self): """Validate the JSON schema. Return list of errors.""" errors = [] for work in self: for task in work: if not task.get_results().validate_json_schema(): errors.append(task) if not work.get_results().validate_json_schema(): errors.append(work) if not self.get_results().validate_json_schema(): errors.append(self) return errors <|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, 18409, 279, 4823, 11036, 13, 3494, 1160, 315, 6103, 382, 14711, 6075, 512, 755, 9788, 9643, 26443, 1214, 997, 286, 4304, 18409, 279, 4823, 11036, 13, 3494, 1160, 315, 6103, 14781, 286, 6103, 284, 14941, 286, 369, 990, 304, 659, 512, 310, 369, 3465, 304, 990, 512, 394, 422, 539, 3465, 673, 13888, 1020, 7212, 9643, 26443, 4019, 504, 6103, 2102, 17941, 340, 310, 422, 539, 990, 673, 13888, 1020, 7212, 9643, 26443, 4019, 394, 6103, 2102, 32570, 340, 286, 422, 539, 659, 673, 13888, 1020, 7212, 9643, 26443, 4019, 310, 6103, 2102, 1214, 696, 286, 471, 6103, 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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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, 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, 18409, 279, 4823, 11036, 13, 3494, 1160, 315, 6103, 382, 14711, 6075, 512, 755, 9788, 9643, 26443, 1214, 997, 286, 4304, 18409, 279, 4823, 11036, 13, 3494, 1160, 315, 6103, 14781, 286, 6103, 284, 14941, 286, 369, 990, 304, 659, 512, 310, 369, 3465, 304, 990, 512, 394, 422, 539, 3465, 673, 13888, 1020, 7212, 9643, 26443, 4019, 504, 6103, 2102, 17941, 340, 310, 422, 539, 990, 673, 13888, 1020, 7212, 9643, 26443, 4019, 394, 6103, 2102, 32570, 340, 286, 422, 539, 659, 673, 13888, 1020, 7212, 9643, 26443, 4019, 310, 6103, 2102, 1214, 696, 286, 471, 6103, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
juju/python-libjuju
juju/client/overrides.py
ResourcesFacade.AddPendingResources
async def AddPendingResources(self, application_tag, charm_url, resources): """Fix the calling signature of AddPendingResources. The ResourcesFacade doesn't conform to the standard facade pattern in the Juju source, which leads to the schemagened code not matching up properly with the actual calling convention in the API. There is work planned to fix this in Juju, but we have to work around it for now. application_tag : str charm_url : str resources : typing.Sequence<+T_co>[~CharmResource]<~CharmResource> Returns -> typing.Union[_ForwardRef('ErrorResult'), typing.Sequence<+T_co>[str]] """ # map input types to rpc msg _params = dict() msg = dict(type='Resources', request='AddPendingResources', version=1, params=_params) _params['tag'] = application_tag _params['url'] = charm_url _params['resources'] = resources reply = await self.rpc(msg) return reply
python
async def AddPendingResources(self, application_tag, charm_url, resources): """Fix the calling signature of AddPendingResources. The ResourcesFacade doesn't conform to the standard facade pattern in the Juju source, which leads to the schemagened code not matching up properly with the actual calling convention in the API. There is work planned to fix this in Juju, but we have to work around it for now. application_tag : str charm_url : str resources : typing.Sequence<+T_co>[~CharmResource]<~CharmResource> Returns -> typing.Union[_ForwardRef('ErrorResult'), typing.Sequence<+T_co>[str]] """ # map input types to rpc msg _params = dict() msg = dict(type='Resources', request='AddPendingResources', version=1, params=_params) _params['tag'] = application_tag _params['url'] = charm_url _params['resources'] = resources reply = await self.rpc(msg) return reply
[ "async", "def", "AddPendingResources", "(", "self", ",", "application_tag", ",", "charm_url", ",", "resources", ")", ":", "# map input types to rpc msg", "_params", "=", "dict", "(", ")", "msg", "=", "dict", "(", "type", "=", "'Resources'", ",", "request", "=", "'AddPendingResources'", ",", "version", "=", "1", ",", "params", "=", "_params", ")", "_params", "[", "'tag'", "]", "=", "application_tag", "_params", "[", "'url'", "]", "=", "charm_url", "_params", "[", "'resources'", "]", "=", "resources", "reply", "=", "await", "self", ".", "rpc", "(", "msg", ")", "return", "reply" ]
Fix the calling signature of AddPendingResources. The ResourcesFacade doesn't conform to the standard facade pattern in the Juju source, which leads to the schemagened code not matching up properly with the actual calling convention in the API. There is work planned to fix this in Juju, but we have to work around it for now. application_tag : str charm_url : str resources : typing.Sequence<+T_co>[~CharmResource]<~CharmResource> Returns -> typing.Union[_ForwardRef('ErrorResult'), typing.Sequence<+T_co>[str]]
[ "Fix", "the", "calling", "signature", "of", "AddPendingResources", "." ]
train
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/overrides.py#L65-L89
<|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: Fix the calling signature of AddPendingResources. The ResourcesFacade doesn't conform to the standard facade pattern in the Juju source, which leads to the schemagened code not matching up properly with the actual calling convention in the API. There is work planned to fix this in Juju, but we have to work around it for now. application_tag : str charm_url : str resources : typing.Sequence<+T_co>[~CharmResource]<~CharmResource> Returns -> typing.Union[_ForwardRef('ErrorResult'), typing.Sequence<+T_co>[str]] ### Response: async def AddPendingResources(self, application_tag, charm_url, resources): """Fix the calling signature of AddPendingResources. The ResourcesFacade doesn't conform to the standard facade pattern in the Juju source, which leads to the schemagened code not matching up properly with the actual calling convention in the API. There is work planned to fix this in Juju, but we have to work around it for now. application_tag : str charm_url : str resources : typing.Sequence<+T_co>[~CharmResource]<~CharmResource> Returns -> typing.Union[_ForwardRef('ErrorResult'), typing.Sequence<+T_co>[str]] """ # map input types to rpc msg _params = dict() msg = dict(type='Resources', request='AddPendingResources', version=1, params=_params) _params['tag'] = application_tag _params['url'] = charm_url _params['resources'] = resources reply = await self.rpc(msg) return reply <|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, 27048, 279, 8260, 12223, 315, 2758, 33127, 11528, 382, 286, 578, 16607, 56431, 3250, 956, 26965, 311, 279, 5410, 62716, 5497, 304, 198, 286, 279, 22410, 8783, 2592, 11, 902, 11767, 311, 279, 20225, 351, 6901, 2082, 539, 12864, 709, 198, 286, 10489, 449, 279, 5150, 8260, 21977, 304, 279, 5446, 13, 220, 2684, 374, 990, 198, 286, 13205, 311, 5155, 420, 304, 22410, 8783, 11, 719, 584, 617, 311, 990, 2212, 433, 369, 1457, 382, 286, 3851, 9556, 551, 610, 198, 286, 32353, 2975, 551, 610, 198, 286, 5070, 551, 20061, 64637, 27, 10, 51, 11647, 31868, 93, 1163, 2227, 4888, 35239, 93, 1163, 2227, 4888, 397, 286, 5295, 1492, 20061, 10840, 290, 13804, 27014, 4032, 493, 1480, 2122, 3379, 1408, 20061, 64637, 27, 10, 51, 11647, 31868, 496, 43550, 14711, 6075, 512, 7847, 711, 2758, 33127, 11528, 1214, 11, 3851, 9556, 11, 32353, 2975, 11, 5070, 997, 286, 4304, 27048, 279, 8260, 12223, 315, 2758, 33127, 11528, 382, 286, 578, 16607, 56431, 3250, 956, 26965, 311, 279, 5410, 62716, 5497, 304, 198, 286, 279, 22410, 8783, 2592, 11, 902, 11767, 311, 279, 20225, 351, 6901, 2082, 539, 12864, 709, 198, 286, 10489, 449, 279, 5150, 8260, 21977, 304, 279, 5446, 13, 220, 2684, 374, 990, 198, 286, 13205, 311, 5155, 420, 304, 22410, 8783, 11, 719, 584, 617, 311, 990, 2212, 433, 369, 1457, 382, 286, 3851, 9556, 551, 610, 198, 286, 32353, 2975, 551, 610, 198, 286, 5070, 551, 20061, 64637, 27, 10, 51, 11647, 31868, 93, 1163, 2227, 4888, 35239, 93, 1163, 2227, 4888, 397, 286, 5295, 1492, 20061, 10840, 290, 13804, 27014, 4032, 493, 1480, 2122, 3379, 1408, 20061, 64637, 27, 10, 51, 11647, 31868, 496, 14623, 286, 3270, 286, 674, 2472, 1988, 4595, 311, 36696, 3835, 198, 286, 721, 3603, 284, 6587, 746, 286, 3835, 284, 6587, 5930, 1151, 11528, 756, 4391, 1715, 1151, 2261, 33127, 11528, 756, 4391, 2373, 28, 16, 345, 4391, 3712, 21574, 3603, 340, 286, 721, 3603, 681, 4681, 663, 284, 3851, 9556, 198, 286, 721, 3603, 681, 1103, 663, 284, 32353, 2975, 198, 286, 721, 3603, 681, 13035, 663, 284, 5070, 198, 286, 10052, 284, 2597, 659, 56277, 8282, 340, 286, 471, 10052, 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, 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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 27048, 279, 8260, 12223, 315, 2758, 33127, 11528, 382, 286, 578, 16607, 56431, 3250, 956, 26965, 311, 279, 5410, 62716, 5497, 304, 198, 286, 279, 22410, 8783, 2592, 11, 902, 11767, 311, 279, 20225, 351, 6901, 2082, 539, 12864, 709, 198, 286, 10489, 449, 279, 5150, 8260, 21977, 304, 279, 5446, 13, 220, 2684, 374, 990, 198, 286, 13205, 311, 5155, 420, 304, 22410, 8783, 11, 719, 584, 617, 311, 990, 2212, 433, 369, 1457, 382, 286, 3851, 9556, 551, 610, 198, 286, 32353, 2975, 551, 610, 198, 286, 5070, 551, 20061, 64637, 27, 10, 51, 11647, 31868, 93, 1163, 2227, 4888, 35239, 93, 1163, 2227, 4888, 397, 286, 5295, 1492, 20061, 10840, 290, 13804, 27014, 4032, 493, 1480, 2122, 3379, 1408, 20061, 64637, 27, 10, 51, 11647, 31868, 496, 43550, 14711, 6075, 512, 7847, 711, 2758, 33127, 11528, 1214, 11, 3851, 9556, 11, 32353, 2975, 11, 5070, 997, 286, 4304, 27048, 279, 8260, 12223, 315, 2758, 33127, 11528, 382, 286, 578, 16607, 56431, 3250, 956, 26965, 311, 279, 5410, 62716, 5497, 304, 198, 286, 279, 22410, 8783, 2592, 11, 902, 11767, 311, 279, 20225, 351, 6901, 2082, 539, 12864, 709, 198, 286, 10489, 449, 279, 5150, 8260, 21977, 304, 279, 5446, 13, 220, 2684, 374, 990, 198, 286, 13205, 311, 5155, 420, 304, 22410, 8783, 11, 719, 584, 617, 311, 990, 2212, 433, 369, 1457, 382, 286, 3851, 9556, 551, 610, 198, 286, 32353, 2975, 551, 610, 198, 286, 5070, 551, 20061, 64637, 27, 10, 51, 11647, 31868, 93, 1163, 2227, 4888, 35239, 93, 1163, 2227, 4888, 397, 286, 5295, 1492, 20061, 10840, 290, 13804, 27014, 4032, 493, 1480, 2122, 3379, 1408, 20061, 64637, 27, 10, 51, 11647, 31868, 496, 14623, 286, 3270, 286, 674, 2472, 1988, 4595, 311, 36696, 3835, 198, 286, 721, 3603, 284, 6587, 746, 286, 3835, 284, 6587, 5930, 1151, 11528, 756, 4391, 1715, 1151, 2261, 33127, 11528, 756, 4391, 2373, 28, 16, 345, 4391, 3712, 21574, 3603, 340, 286, 721, 3603, 681, 4681, 663, 284, 3851, 9556, 198, 286, 721, 3603, 681, 1103, 663, 284, 32353, 2975, 198, 286, 721, 3603, 681, 13035, 663, 284, 5070, 198, 286, 10052, 284, 2597, 659, 56277, 8282, 340, 286, 471, 10052, 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 ]
inveniosoftware-contrib/invenio-classifier
invenio_classifier/find.py
get_reference_section_beginning
def get_reference_section_beginning(fulltext): """Get start of reference section.""" sect_start = { 'start_line': None, 'end_line': None, 'title_string': None, 'marker_pattern': None, 'marker': None, 'how_found_start': None, } # Find start of refs section: sect_start = find_reference_section(fulltext) if sect_start is not None: sect_start['how_found_start'] = 1 else: # No references found - try with no title option sect_start = find_reference_section_no_title_via_brackets(fulltext) if sect_start is not None: sect_start['how_found_start'] = 2 # Try weaker set of patterns if needed if sect_start is None: # No references found - try with no title option (with weaker # patterns..) sect_start = find_reference_section_no_title_via_dots(fulltext) if sect_start is not None: sect_start['how_found_start'] = 3 if sect_start is None: # No references found - try with no title option (with even # weaker patterns..) sect_start = find_reference_section_no_title_via_numbers( fulltext) if sect_start is not None: sect_start['how_found_start'] = 4 if sect_start: current_app.logger.debug('* title %r' % sect_start['title_string']) current_app.logger.debug('* marker %r' % sect_start['marker']) current_app.logger.debug('* title_marker_same_line %s' % sect_start['title_marker_same_line']) else: current_app.logger.debug('* could not find references section') return sect_start
python
def get_reference_section_beginning(fulltext): """Get start of reference section.""" sect_start = { 'start_line': None, 'end_line': None, 'title_string': None, 'marker_pattern': None, 'marker': None, 'how_found_start': None, } # Find start of refs section: sect_start = find_reference_section(fulltext) if sect_start is not None: sect_start['how_found_start'] = 1 else: # No references found - try with no title option sect_start = find_reference_section_no_title_via_brackets(fulltext) if sect_start is not None: sect_start['how_found_start'] = 2 # Try weaker set of patterns if needed if sect_start is None: # No references found - try with no title option (with weaker # patterns..) sect_start = find_reference_section_no_title_via_dots(fulltext) if sect_start is not None: sect_start['how_found_start'] = 3 if sect_start is None: # No references found - try with no title option (with even # weaker patterns..) sect_start = find_reference_section_no_title_via_numbers( fulltext) if sect_start is not None: sect_start['how_found_start'] = 4 if sect_start: current_app.logger.debug('* title %r' % sect_start['title_string']) current_app.logger.debug('* marker %r' % sect_start['marker']) current_app.logger.debug('* title_marker_same_line %s' % sect_start['title_marker_same_line']) else: current_app.logger.debug('* could not find references section') return sect_start
[ "def", "get_reference_section_beginning", "(", "fulltext", ")", ":", "sect_start", "=", "{", "'start_line'", ":", "None", ",", "'end_line'", ":", "None", ",", "'title_string'", ":", "None", ",", "'marker_pattern'", ":", "None", ",", "'marker'", ":", "None", ",", "'how_found_start'", ":", "None", ",", "}", "# Find start of refs section:", "sect_start", "=", "find_reference_section", "(", "fulltext", ")", "if", "sect_start", "is", "not", "None", ":", "sect_start", "[", "'how_found_start'", "]", "=", "1", "else", ":", "# No references found - try with no title option", "sect_start", "=", "find_reference_section_no_title_via_brackets", "(", "fulltext", ")", "if", "sect_start", "is", "not", "None", ":", "sect_start", "[", "'how_found_start'", "]", "=", "2", "# Try weaker set of patterns if needed", "if", "sect_start", "is", "None", ":", "# No references found - try with no title option (with weaker", "# patterns..)", "sect_start", "=", "find_reference_section_no_title_via_dots", "(", "fulltext", ")", "if", "sect_start", "is", "not", "None", ":", "sect_start", "[", "'how_found_start'", "]", "=", "3", "if", "sect_start", "is", "None", ":", "# No references found - try with no title option (with even", "# weaker patterns..)", "sect_start", "=", "find_reference_section_no_title_via_numbers", "(", "fulltext", ")", "if", "sect_start", "is", "not", "None", ":", "sect_start", "[", "'how_found_start'", "]", "=", "4", "if", "sect_start", ":", "current_app", ".", "logger", ".", "debug", "(", "'* title %r'", "%", "sect_start", "[", "'title_string'", "]", ")", "current_app", ".", "logger", ".", "debug", "(", "'* marker %r'", "%", "sect_start", "[", "'marker'", "]", ")", "current_app", ".", "logger", ".", "debug", "(", "'* title_marker_same_line %s'", "%", "sect_start", "[", "'title_marker_same_line'", "]", ")", "else", ":", "current_app", ".", "logger", ".", "debug", "(", "'* could not find references section'", ")", "return", "sect_start" ]
Get start of reference section.
[ "Get", "start", "of", "reference", "section", "." ]
train
https://github.com/inveniosoftware-contrib/invenio-classifier/blob/3c758cf34dca6bf0548e7da5de34e5f72e3b255e/invenio_classifier/find.py#L476-L518
<|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: Get start of reference section. ### Response: def get_reference_section_beginning(fulltext): """Get start of reference section.""" sect_start = { 'start_line': None, 'end_line': None, 'title_string': None, 'marker_pattern': None, 'marker': None, 'how_found_start': None, } # Find start of refs section: sect_start = find_reference_section(fulltext) if sect_start is not None: sect_start['how_found_start'] = 1 else: # No references found - try with no title option sect_start = find_reference_section_no_title_via_brackets(fulltext) if sect_start is not None: sect_start['how_found_start'] = 2 # Try weaker set of patterns if needed if sect_start is None: # No references found - try with no title option (with weaker # patterns..) sect_start = find_reference_section_no_title_via_dots(fulltext) if sect_start is not None: sect_start['how_found_start'] = 3 if sect_start is None: # No references found - try with no title option (with even # weaker patterns..) sect_start = find_reference_section_no_title_via_numbers( fulltext) if sect_start is not None: sect_start['how_found_start'] = 4 if sect_start: current_app.logger.debug('* title %r' % sect_start['title_string']) current_app.logger.debug('* marker %r' % sect_start['marker']) current_app.logger.debug('* title_marker_same_line %s' % sect_start['title_marker_same_line']) else: current_app.logger.debug('* could not find references section') return sect_start <|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, 1991, 1212, 315, 5905, 3857, 382, 14711, 6075, 512, 755, 636, 26508, 16619, 24223, 1251, 30007, 1342, 997, 262, 4304, 1991, 1212, 315, 5905, 3857, 14781, 262, 31237, 5011, 284, 341, 286, 364, 2527, 6665, 1232, 2290, 345, 286, 364, 408, 6665, 1232, 2290, 345, 286, 364, 2150, 3991, 1232, 2290, 345, 286, 364, 28842, 21957, 1232, 2290, 345, 286, 364, 28842, 1232, 2290, 345, 286, 364, 5269, 22200, 5011, 1232, 2290, 345, 262, 557, 262, 674, 7531, 1212, 315, 44243, 3857, 512, 262, 31237, 5011, 284, 1505, 26508, 16619, 30007, 1342, 340, 262, 422, 31237, 5011, 374, 539, 2290, 512, 286, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 16, 198, 262, 775, 512, 286, 674, 2360, 15407, 1766, 482, 1456, 449, 912, 2316, 3072, 198, 286, 31237, 5011, 284, 1505, 26508, 16619, 6673, 6240, 81810, 18150, 18889, 30007, 1342, 340, 286, 422, 31237, 5011, 374, 539, 2290, 512, 310, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 17, 198, 286, 674, 9934, 43383, 743, 315, 12912, 422, 4460, 198, 286, 422, 31237, 5011, 374, 2290, 512, 310, 674, 2360, 15407, 1766, 482, 1456, 449, 912, 2316, 3072, 320, 4291, 43383, 198, 310, 674, 12912, 497, 340, 310, 31237, 5011, 284, 1505, 26508, 16619, 6673, 6240, 81810, 821, 2469, 30007, 1342, 340, 310, 422, 31237, 5011, 374, 539, 2290, 512, 394, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 18, 198, 310, 422, 31237, 5011, 374, 2290, 512, 394, 674, 2360, 15407, 1766, 482, 1456, 449, 912, 2316, 3072, 320, 4291, 1524, 198, 394, 674, 43383, 12912, 497, 340, 394, 31237, 5011, 284, 1505, 26508, 16619, 6673, 6240, 81810, 34064, 1021, 504, 2539, 1342, 340, 394, 422, 31237, 5011, 374, 539, 2290, 512, 504, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 19, 271, 262, 422, 31237, 5011, 512, 286, 1510, 8354, 16465, 8042, 33114, 2316, 1034, 81, 6, 1034, 31237, 5011, 681, 2150, 3991, 7519, 286, 1510, 8354, 16465, 8042, 33114, 11381, 1034, 81, 6, 1034, 31237, 5011, 681, 28842, 7519, 286, 1510, 8354, 16465, 8042, 33114, 2316, 27363, 34674, 6665, 1034, 82, 1270, 792, 1034, 31237, 5011, 681, 2150, 27363, 34674, 6665, 7519, 262, 775, 512, 286, 1510, 8354, 16465, 8042, 33114, 1436, 539, 1505, 15407, 3857, 1329, 262, 471, 31237, 5011, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1991, 1212, 315, 5905, 3857, 382, 14711, 6075, 512, 755, 636, 26508, 16619, 24223, 1251, 30007, 1342, 997, 262, 4304, 1991, 1212, 315, 5905, 3857, 14781, 262, 31237, 5011, 284, 341, 286, 364, 2527, 6665, 1232, 2290, 345, 286, 364, 408, 6665, 1232, 2290, 345, 286, 364, 2150, 3991, 1232, 2290, 345, 286, 364, 28842, 21957, 1232, 2290, 345, 286, 364, 28842, 1232, 2290, 345, 286, 364, 5269, 22200, 5011, 1232, 2290, 345, 262, 557, 262, 674, 7531, 1212, 315, 44243, 3857, 512, 262, 31237, 5011, 284, 1505, 26508, 16619, 30007, 1342, 340, 262, 422, 31237, 5011, 374, 539, 2290, 512, 286, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 16, 198, 262, 775, 512, 286, 674, 2360, 15407, 1766, 482, 1456, 449, 912, 2316, 3072, 198, 286, 31237, 5011, 284, 1505, 26508, 16619, 6673, 6240, 81810, 18150, 18889, 30007, 1342, 340, 286, 422, 31237, 5011, 374, 539, 2290, 512, 310, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 17, 198, 286, 674, 9934, 43383, 743, 315, 12912, 422, 4460, 198, 286, 422, 31237, 5011, 374, 2290, 512, 310, 674, 2360, 15407, 1766, 482, 1456, 449, 912, 2316, 3072, 320, 4291, 43383, 198, 310, 674, 12912, 497, 340, 310, 31237, 5011, 284, 1505, 26508, 16619, 6673, 6240, 81810, 821, 2469, 30007, 1342, 340, 310, 422, 31237, 5011, 374, 539, 2290, 512, 394, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 18, 198, 310, 422, 31237, 5011, 374, 2290, 512, 394, 674, 2360, 15407, 1766, 482, 1456, 449, 912, 2316, 3072, 320, 4291, 1524, 198, 394, 674, 43383, 12912, 497, 340, 394, 31237, 5011, 284, 1505, 26508, 16619, 6673, 6240, 81810, 34064, 1021, 504, 2539, 1342, 340, 394, 422, 31237, 5011, 374, 539, 2290, 512, 504, 31237, 5011, 681, 5269, 22200, 5011, 663, 284, 220, 19, 271, 262, 422, 31237, 5011, 512, 286, 1510, 8354, 16465, 8042, 33114, 2316, 1034, 81, 6, 1034, 31237, 5011, 681, 2150, 3991, 7519, 286, 1510, 8354, 16465, 8042, 33114, 11381, 1034, 81, 6, 1034, 31237, 5011, 681, 28842, 7519, 286, 1510, 8354, 16465, 8042, 33114, 2316, 27363, 34674, 6665, 1034, 82, 1270, 792, 1034, 31237, 5011, 681, 2150, 27363, 34674, 6665, 7519, 262, 775, 512, 286, 1510, 8354, 16465, 8042, 33114, 1436, 539, 1505, 15407, 3857, 1329, 262, 471, 31237, 5011, 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 ]
ixc/python-edtf
edtf/convert.py
struct_time_to_jd
def struct_time_to_jd(st): """ Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored. """ year, month, day = st[:3] hours, minutes, seconds = st[3:6] # Convert time of day to fraction of day day += jdutil.hmsm_to_days(hours, minutes, seconds) return jdutil.date_to_jd(year, month, day)
python
def struct_time_to_jd(st): """ Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored. """ year, month, day = st[:3] hours, minutes, seconds = st[3:6] # Convert time of day to fraction of day day += jdutil.hmsm_to_days(hours, minutes, seconds) return jdutil.date_to_jd(year, month, day)
[ "def", "struct_time_to_jd", "(", "st", ")", ":", "year", ",", "month", ",", "day", "=", "st", "[", ":", "3", "]", "hours", ",", "minutes", ",", "seconds", "=", "st", "[", "3", ":", "6", "]", "# Convert time of day to fraction of day", "day", "+=", "jdutil", ".", "hmsm_to_days", "(", "hours", ",", "minutes", ",", "seconds", ")", "return", "jdutil", ".", "date_to_jd", "(", "year", ",", "month", ",", "day", ")" ]
Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored.
[ "Return", "a", "float", "number", "representing", "the", "Julian", "Date", "for", "the", "given", "struct_time", "." ]
train
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/convert.py#L66-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: Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored. ### Response: def struct_time_to_jd(st): """ Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored. """ year, month, day = st[:3] hours, minutes, seconds = st[3:6] # Convert time of day to fraction of day day += jdutil.hmsm_to_days(hours, minutes, seconds) return jdutil.date_to_jd(year, month, day) <|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, 2273, 1396, 14393, 279, 38897, 2696, 369, 279, 2728, 198, 262, 1595, 1257, 3084, 63438, 262, 17160, 25, 5066, 5151, 1595, 14046, 1704, 1316, 7964, 1595, 14046, 4271, 1316, 7964, 323, 1595, 14046, 7037, 16032, 63, 527, 12305, 382, 14711, 6075, 512, 755, 2080, 3084, 2401, 5487, 67, 6019, 997, 262, 3270, 262, 3494, 264, 2273, 1396, 14393, 279, 38897, 2696, 369, 279, 2728, 198, 262, 1595, 1257, 3084, 63438, 262, 17160, 25, 5066, 5151, 1595, 14046, 1704, 1316, 7964, 1595, 14046, 4271, 1316, 7964, 323, 1595, 14046, 7037, 16032, 63, 527, 12305, 627, 262, 3270, 262, 1060, 11, 2305, 11, 1938, 284, 357, 3530, 18, 933, 262, 4207, 11, 4520, 11, 6622, 284, 357, 58, 18, 25, 21, 2595, 262, 674, 7316, 892, 315, 1938, 311, 19983, 315, 1938, 198, 262, 1938, 1447, 74476, 1338, 870, 1026, 76, 2401, 29453, 70697, 11, 4520, 11, 6622, 696, 262, 471, 74476, 1338, 10108, 2401, 5487, 67, 29381, 11, 2305, 11, 1938, 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, 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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, 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, 2273, 1396, 14393, 279, 38897, 2696, 369, 279, 2728, 198, 262, 1595, 1257, 3084, 63438, 262, 17160, 25, 5066, 5151, 1595, 14046, 1704, 1316, 7964, 1595, 14046, 4271, 1316, 7964, 323, 1595, 14046, 7037, 16032, 63, 527, 12305, 382, 14711, 6075, 512, 755, 2080, 3084, 2401, 5487, 67, 6019, 997, 262, 3270, 262, 3494, 264, 2273, 1396, 14393, 279, 38897, 2696, 369, 279, 2728, 198, 262, 1595, 1257, 3084, 63438, 262, 17160, 25, 5066, 5151, 1595, 14046, 1704, 1316, 7964, 1595, 14046, 4271, 1316, 7964, 323, 1595, 14046, 7037, 16032, 63, 527, 12305, 627, 262, 3270, 262, 1060, 11, 2305, 11, 1938, 284, 357, 3530, 18, 933, 262, 4207, 11, 4520, 11, 6622, 284, 357, 58, 18, 25, 21, 2595, 262, 674, 7316, 892, 315, 1938, 311, 19983, 315, 1938, 198, 262, 1938, 1447, 74476, 1338, 870, 1026, 76, 2401, 29453, 70697, 11, 4520, 11, 6622, 696, 262, 471, 74476, 1338, 10108, 2401, 5487, 67, 29381, 11, 2305, 11, 1938, 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 ]
saltstack/salt
salt/modules/debian_ip.py
_parse_current_network_settings
def _parse_current_network_settings(): ''' Parse /etc/default/networking and return current configuration ''' opts = salt.utils.odict.OrderedDict() opts['networking'] = '' if os.path.isfile(_DEB_NETWORKING_FILE): with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents: for line in contents: salt.utils.stringutils.to_unicode(line) if line.startswith('#'): continue elif line.startswith('CONFIGURE_INTERFACES'): opts['networking'] = line.split('=', 1)[1].strip() hostname = _parse_hostname() domainname = _parse_domainname() searchdomain = _parse_searchdomain() opts['hostname'] = hostname opts['domainname'] = domainname opts['searchdomain'] = searchdomain return opts
python
def _parse_current_network_settings(): ''' Parse /etc/default/networking and return current configuration ''' opts = salt.utils.odict.OrderedDict() opts['networking'] = '' if os.path.isfile(_DEB_NETWORKING_FILE): with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents: for line in contents: salt.utils.stringutils.to_unicode(line) if line.startswith('#'): continue elif line.startswith('CONFIGURE_INTERFACES'): opts['networking'] = line.split('=', 1)[1].strip() hostname = _parse_hostname() domainname = _parse_domainname() searchdomain = _parse_searchdomain() opts['hostname'] = hostname opts['domainname'] = domainname opts['searchdomain'] = searchdomain return opts
[ "def", "_parse_current_network_settings", "(", ")", ":", "opts", "=", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", "(", ")", "opts", "[", "'networking'", "]", "=", "''", "if", "os", ".", "path", ".", "isfile", "(", "_DEB_NETWORKING_FILE", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "_DEB_NETWORKING_FILE", ")", "as", "contents", ":", "for", "line", "in", "contents", ":", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "line", ")", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "continue", "elif", "line", ".", "startswith", "(", "'CONFIGURE_INTERFACES'", ")", ":", "opts", "[", "'networking'", "]", "=", "line", ".", "split", "(", "'='", ",", "1", ")", "[", "1", "]", ".", "strip", "(", ")", "hostname", "=", "_parse_hostname", "(", ")", "domainname", "=", "_parse_domainname", "(", ")", "searchdomain", "=", "_parse_searchdomain", "(", ")", "opts", "[", "'hostname'", "]", "=", "hostname", "opts", "[", "'domainname'", "]", "=", "domainname", "opts", "[", "'searchdomain'", "]", "=", "searchdomain", "return", "opts" ]
Parse /etc/default/networking and return current configuration
[ "Parse", "/", "etc", "/", "default", "/", "networking", "and", "return", "current", "configuration" ]
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L263-L286
<|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: Parse /etc/default/networking and return current configuration ### Response: def _parse_current_network_settings(): ''' Parse /etc/default/networking and return current configuration ''' opts = salt.utils.odict.OrderedDict() opts['networking'] = '' if os.path.isfile(_DEB_NETWORKING_FILE): with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents: for line in contents: salt.utils.stringutils.to_unicode(line) if line.startswith('#'): continue elif line.startswith('CONFIGURE_INTERFACES'): opts['networking'] = line.split('=', 1)[1].strip() hostname = _parse_hostname() domainname = _parse_domainname() searchdomain = _parse_searchdomain() opts['hostname'] = hostname opts['domainname'] = domainname opts['searchdomain'] = searchdomain return opts <|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, 14802, 611, 12380, 30089, 48758, 287, 323, 471, 1510, 6683, 271, 14711, 6075, 512, 755, 721, 6534, 11327, 21640, 11090, 4019, 262, 11414, 262, 15118, 611, 12380, 30089, 48758, 287, 323, 471, 1510, 6683, 198, 262, 11414, 262, 12462, 284, 12290, 8576, 72699, 858, 20240, 291, 13755, 746, 262, 12462, 681, 17969, 287, 663, 284, 46420, 262, 422, 2709, 3960, 40047, 2551, 1170, 33, 49219, 1753, 8247, 997, 286, 449, 12290, 8576, 20881, 840, 2569, 2551, 1170, 33, 49219, 1753, 8247, 8, 439, 8970, 512, 310, 369, 1584, 304, 8970, 512, 394, 12290, 8576, 4909, 6159, 2446, 55762, 8973, 340, 394, 422, 1584, 27249, 3599, 11290, 504, 3136, 198, 394, 4508, 1584, 27249, 493, 25677, 4622, 17148, 37, 53181, 11290, 504, 12462, 681, 17969, 287, 663, 284, 1584, 5402, 493, 18123, 220, 16, 6758, 16, 948, 13406, 2892, 262, 29215, 284, 721, 6534, 64940, 746, 262, 8106, 609, 284, 721, 6534, 20715, 609, 746, 262, 2778, 12482, 284, 721, 6534, 10947, 12482, 2892, 262, 12462, 681, 28906, 663, 284, 29215, 198, 262, 12462, 681, 12482, 609, 663, 284, 8106, 609, 198, 262, 12462, 681, 1874, 12482, 663, 284, 2778, 12482, 198, 262, 471, 12462, 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, 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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 ]
[ 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, 14802, 611, 12380, 30089, 48758, 287, 323, 471, 1510, 6683, 271, 14711, 6075, 512, 755, 721, 6534, 11327, 21640, 11090, 4019, 262, 11414, 262, 15118, 611, 12380, 30089, 48758, 287, 323, 471, 1510, 6683, 198, 262, 11414, 262, 12462, 284, 12290, 8576, 72699, 858, 20240, 291, 13755, 746, 262, 12462, 681, 17969, 287, 663, 284, 46420, 262, 422, 2709, 3960, 40047, 2551, 1170, 33, 49219, 1753, 8247, 997, 286, 449, 12290, 8576, 20881, 840, 2569, 2551, 1170, 33, 49219, 1753, 8247, 8, 439, 8970, 512, 310, 369, 1584, 304, 8970, 512, 394, 12290, 8576, 4909, 6159, 2446, 55762, 8973, 340, 394, 422, 1584, 27249, 3599, 11290, 504, 3136, 198, 394, 4508, 1584, 27249, 493, 25677, 4622, 17148, 37, 53181, 11290, 504, 12462, 681, 17969, 287, 663, 284, 1584, 5402, 493, 18123, 220, 16, 6758, 16, 948, 13406, 2892, 262, 29215, 284, 721, 6534, 64940, 746, 262, 8106, 609, 284, 721, 6534, 20715, 609, 746, 262, 2778, 12482, 284, 721, 6534, 10947, 12482, 2892, 262, 12462, 681, 28906, 663, 284, 29215, 198, 262, 12462, 681, 12482, 609, 663, 284, 8106, 609, 198, 262, 12462, 681, 1874, 12482, 663, 284, 2778, 12482, 198, 262, 471, 12462, 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 ]
wandb/client
wandb/__init__.py
log
def log(row=None, commit=True, *args, **kargs): """Log a dict to the global run's history. If commit is false, enables multiple calls before commiting. Eg. wandb.log({'train-loss': 0.5, 'accuracy': 0.9}) """ if run is None: raise ValueError( "You must call `wandb.init` in the same process before calling log") if row is None: row = {} if commit: run.history.add(row, *args, **kargs) else: run.history.update(row, *args, **kargs)
python
def log(row=None, commit=True, *args, **kargs): """Log a dict to the global run's history. If commit is false, enables multiple calls before commiting. Eg. wandb.log({'train-loss': 0.5, 'accuracy': 0.9}) """ if run is None: raise ValueError( "You must call `wandb.init` in the same process before calling log") if row is None: row = {} if commit: run.history.add(row, *args, **kargs) else: run.history.update(row, *args, **kargs)
[ "def", "log", "(", "row", "=", "None", ",", "commit", "=", "True", ",", "*", "args", ",", "*", "*", "kargs", ")", ":", "if", "run", "is", "None", ":", "raise", "ValueError", "(", "\"You must call `wandb.init` in the same process before calling log\"", ")", "if", "row", "is", "None", ":", "row", "=", "{", "}", "if", "commit", ":", "run", ".", "history", ".", "add", "(", "row", ",", "*", "args", ",", "*", "*", "kargs", ")", "else", ":", "run", ".", "history", ".", "update", "(", "row", ",", "*", "args", ",", "*", "*", "kargs", ")" ]
Log a dict to the global run's history. If commit is false, enables multiple calls before commiting. Eg. wandb.log({'train-loss': 0.5, 'accuracy': 0.9})
[ "Log", "a", "dict", "to", "the", "global", "run", "s", "history", ".", "If", "commit", "is", "false", "enables", "multiple", "calls", "before", "commiting", "." ]
train
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/__init__.py#L465-L481
<|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: Log a dict to the global run's history. If commit is false, enables multiple calls before commiting. Eg. wandb.log({'train-loss': 0.5, 'accuracy': 0.9}) ### Response: def log(row=None, commit=True, *args, **kargs): """Log a dict to the global run's history. If commit is false, enables multiple calls before commiting. Eg. wandb.log({'train-loss': 0.5, 'accuracy': 0.9}) """ if run is None: raise ValueError( "You must call `wandb.init` in the same process before calling log") if row is None: row = {} if commit: run.history.add(row, *args, **kargs) else: run.history.update(row, *args, **kargs) <|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, 2250, 264, 6587, 311, 279, 3728, 1629, 596, 3925, 13, 220, 1442, 5379, 374, 905, 11, 20682, 5361, 6880, 1603, 5379, 287, 382, 262, 39175, 382, 262, 29810, 65, 1699, 15597, 10613, 77401, 1232, 220, 15, 13, 20, 11, 364, 33829, 1232, 220, 15, 13, 24, 9000, 14711, 6075, 512, 755, 1515, 7991, 5980, 11, 5379, 3702, 11, 353, 2164, 11, 3146, 74, 2164, 997, 262, 4304, 2250, 264, 6587, 311, 279, 3728, 1629, 596, 3925, 13, 220, 1442, 5379, 374, 905, 11, 20682, 5361, 6880, 1603, 5379, 287, 382, 262, 39175, 382, 262, 29810, 65, 1699, 15597, 10613, 77401, 1232, 220, 15, 13, 20, 11, 364, 33829, 1232, 220, 15, 13, 24, 3602, 262, 3270, 262, 422, 1629, 374, 2290, 512, 286, 4933, 15764, 1021, 310, 330, 2675, 2011, 1650, 1595, 80910, 65, 8435, 63, 304, 279, 1890, 1920, 1603, 8260, 1515, 5240, 262, 422, 2872, 374, 2290, 512, 286, 2872, 284, 5731, 262, 422, 5379, 512, 286, 1629, 24323, 1388, 7991, 11, 353, 2164, 11, 3146, 74, 2164, 340, 262, 775, 512, 286, 1629, 24323, 5430, 7991, 11, 353, 2164, 11, 3146, 74, 2164, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2250, 264, 6587, 311, 279, 3728, 1629, 596, 3925, 13, 220, 1442, 5379, 374, 905, 11, 20682, 5361, 6880, 1603, 5379, 287, 382, 262, 39175, 382, 262, 29810, 65, 1699, 15597, 10613, 77401, 1232, 220, 15, 13, 20, 11, 364, 33829, 1232, 220, 15, 13, 24, 9000, 14711, 6075, 512, 755, 1515, 7991, 5980, 11, 5379, 3702, 11, 353, 2164, 11, 3146, 74, 2164, 997, 262, 4304, 2250, 264, 6587, 311, 279, 3728, 1629, 596, 3925, 13, 220, 1442, 5379, 374, 905, 11, 20682, 5361, 6880, 1603, 5379, 287, 382, 262, 39175, 382, 262, 29810, 65, 1699, 15597, 10613, 77401, 1232, 220, 15, 13, 20, 11, 364, 33829, 1232, 220, 15, 13, 24, 3602, 262, 3270, 262, 422, 1629, 374, 2290, 512, 286, 4933, 15764, 1021, 310, 330, 2675, 2011, 1650, 1595, 80910, 65, 8435, 63, 304, 279, 1890, 1920, 1603, 8260, 1515, 5240, 262, 422, 2872, 374, 2290, 512, 286, 2872, 284, 5731, 262, 422, 5379, 512, 286, 1629, 24323, 1388, 7991, 11, 353, 2164, 11, 3146, 74, 2164, 340, 262, 775, 512, 286, 1629, 24323, 5430, 7991, 11, 353, 2164, 11, 3146, 74, 2164, 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 ]
omederos/pyspinner
spinning/spinning.py
override_params
def override_params(opening_char='{', closing_char='}', separator_char='|'): """ Override some character settings @type opening_char: str @param opening_char: Opening character. Default: '{' @type closing_char: str @param closing_char: Closing character. Default: '}' @type separator_char: str @param separator_char: Separator char. Default: '|' """ global char_separator, char_opening, char_closing char_separator = separator_char char_opening = opening_char char_closing = closing_char
python
def override_params(opening_char='{', closing_char='}', separator_char='|'): """ Override some character settings @type opening_char: str @param opening_char: Opening character. Default: '{' @type closing_char: str @param closing_char: Closing character. Default: '}' @type separator_char: str @param separator_char: Separator char. Default: '|' """ global char_separator, char_opening, char_closing char_separator = separator_char char_opening = opening_char char_closing = closing_char
[ "def", "override_params", "(", "opening_char", "=", "'{'", ",", "closing_char", "=", "'}'", ",", "separator_char", "=", "'|'", ")", ":", "global", "char_separator", ",", "char_opening", ",", "char_closing", "char_separator", "=", "separator_char", "char_opening", "=", "opening_char", "char_closing", "=", "closing_char" ]
Override some character settings @type opening_char: str @param opening_char: Opening character. Default: '{' @type closing_char: str @param closing_char: Closing character. Default: '}' @type separator_char: str @param separator_char: Separator char. Default: '|'
[ "Override", "some", "character", "settings" ]
train
https://github.com/omederos/pyspinner/blob/4615d92e669942c48d5542a23ddf6d40b206d9d5/spinning/spinning.py#L10-L24
<|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: Override some character settings @type opening_char: str @param opening_char: Opening character. Default: '{' @type closing_char: str @param closing_char: Closing character. Default: '}' @type separator_char: str @param separator_char: Separator char. Default: '|' ### Response: def override_params(opening_char='{', closing_char='}', separator_char='|'): """ Override some character settings @type opening_char: str @param opening_char: Opening character. Default: '{' @type closing_char: str @param closing_char: Closing character. Default: '}' @type separator_char: str @param separator_char: Separator char. Default: '|' """ global char_separator, char_opening, char_closing char_separator = separator_char char_opening = opening_char char_closing = closing_char <|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, 2226, 1063, 3752, 5110, 271, 262, 571, 1337, 8736, 9415, 25, 610, 198, 262, 571, 913, 8736, 9415, 25, 41137, 3752, 13, 8058, 25, 11834, 1270, 262, 571, 1337, 15676, 9415, 25, 610, 198, 262, 571, 913, 15676, 9415, 25, 62213, 3752, 13, 8058, 25, 41174, 1270, 262, 571, 1337, 25829, 9415, 25, 610, 198, 262, 571, 913, 25829, 9415, 25, 79389, 1181, 13, 8058, 25, 37457, 3961, 14711, 6075, 512, 755, 2882, 6887, 32081, 287, 9415, 56073, 518, 15676, 9415, 1151, 17266, 25829, 9415, 1151, 91, 11290, 262, 3270, 262, 39358, 1063, 3752, 5110, 271, 262, 571, 1337, 8736, 9415, 25, 610, 198, 262, 571, 913, 8736, 9415, 25, 41137, 3752, 13, 8058, 25, 11834, 1270, 262, 571, 1337, 15676, 9415, 25, 610, 198, 262, 571, 913, 15676, 9415, 25, 62213, 3752, 13, 8058, 25, 41174, 1270, 262, 571, 1337, 25829, 9415, 25, 610, 198, 262, 571, 913, 25829, 9415, 25, 79389, 1181, 13, 8058, 25, 37457, 1270, 262, 3270, 262, 3728, 1181, 59304, 11, 1181, 11563, 287, 11, 1181, 669, 18310, 198, 262, 1181, 59304, 284, 25829, 9415, 198, 262, 1181, 11563, 287, 284, 8736, 9415, 198, 262, 1181, 669, 18310, 284, 15676, 9415, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2226, 1063, 3752, 5110, 271, 262, 571, 1337, 8736, 9415, 25, 610, 198, 262, 571, 913, 8736, 9415, 25, 41137, 3752, 13, 8058, 25, 11834, 1270, 262, 571, 1337, 15676, 9415, 25, 610, 198, 262, 571, 913, 15676, 9415, 25, 62213, 3752, 13, 8058, 25, 41174, 1270, 262, 571, 1337, 25829, 9415, 25, 610, 198, 262, 571, 913, 25829, 9415, 25, 79389, 1181, 13, 8058, 25, 37457, 3961, 14711, 6075, 512, 755, 2882, 6887, 32081, 287, 9415, 56073, 518, 15676, 9415, 1151, 17266, 25829, 9415, 1151, 91, 11290, 262, 3270, 262, 39358, 1063, 3752, 5110, 271, 262, 571, 1337, 8736, 9415, 25, 610, 198, 262, 571, 913, 8736, 9415, 25, 41137, 3752, 13, 8058, 25, 11834, 1270, 262, 571, 1337, 15676, 9415, 25, 610, 198, 262, 571, 913, 15676, 9415, 25, 62213, 3752, 13, 8058, 25, 41174, 1270, 262, 571, 1337, 25829, 9415, 25, 610, 198, 262, 571, 913, 25829, 9415, 25, 79389, 1181, 13, 8058, 25, 37457, 1270, 262, 3270, 262, 3728, 1181, 59304, 11, 1181, 11563, 287, 11, 1181, 669, 18310, 198, 262, 1181, 59304, 284, 25829, 9415, 198, 262, 1181, 11563, 287, 284, 8736, 9415, 198, 262, 1181, 669, 18310, 284, 15676, 9415, 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 ]
saltstack/salt
salt/states/zone.py
detached
def detached(name): ''' Ensure zone is detached name : string name of the zone ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} zones = __salt__['zoneadm.list'](installed=True, configured=True) if name in zones: if zones[name]['state'] != 'configured': if __opts__['test']: res_detach = {'status': True} else: res_detach = __salt__['zoneadm.detach'](name) ret['result'] = res_detach['status'] if ret['result']: ret['changes'][name] = 'detached' ret['comment'] = 'The zone {0} was detached.'.format(name) else: ret['comment'] = [] ret['comment'].append('Failed to detach zone {0}!'.format(name)) if 'message' in res_detach: ret['comment'].append(res_detach['message']) ret['comment'] = "\n".join(ret['comment']) else: ret['result'] = True ret['comment'] = 'zone {0} already detached.'.format(name) else: ## note: a non existing zone is not attached, we do not consider this a failure ret['result'] = True ret['comment'] = 'zone {0} is not configured!'.format(name) return ret
python
def detached(name): ''' Ensure zone is detached name : string name of the zone ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} zones = __salt__['zoneadm.list'](installed=True, configured=True) if name in zones: if zones[name]['state'] != 'configured': if __opts__['test']: res_detach = {'status': True} else: res_detach = __salt__['zoneadm.detach'](name) ret['result'] = res_detach['status'] if ret['result']: ret['changes'][name] = 'detached' ret['comment'] = 'The zone {0} was detached.'.format(name) else: ret['comment'] = [] ret['comment'].append('Failed to detach zone {0}!'.format(name)) if 'message' in res_detach: ret['comment'].append(res_detach['message']) ret['comment'] = "\n".join(ret['comment']) else: ret['result'] = True ret['comment'] = 'zone {0} already detached.'.format(name) else: ## note: a non existing zone is not attached, we do not consider this a failure ret['result'] = True ret['comment'] = 'zone {0} is not configured!'.format(name) return ret
[ "def", "detached", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "zones", "=", "__salt__", "[", "'zoneadm.list'", "]", "(", "installed", "=", "True", ",", "configured", "=", "True", ")", "if", "name", "in", "zones", ":", "if", "zones", "[", "name", "]", "[", "'state'", "]", "!=", "'configured'", ":", "if", "__opts__", "[", "'test'", "]", ":", "res_detach", "=", "{", "'status'", ":", "True", "}", "else", ":", "res_detach", "=", "__salt__", "[", "'zoneadm.detach'", "]", "(", "name", ")", "ret", "[", "'result'", "]", "=", "res_detach", "[", "'status'", "]", "if", "ret", "[", "'result'", "]", ":", "ret", "[", "'changes'", "]", "[", "name", "]", "=", "'detached'", "ret", "[", "'comment'", "]", "=", "'The zone {0} was detached.'", ".", "format", "(", "name", ")", "else", ":", "ret", "[", "'comment'", "]", "=", "[", "]", "ret", "[", "'comment'", "]", ".", "append", "(", "'Failed to detach zone {0}!'", ".", "format", "(", "name", ")", ")", "if", "'message'", "in", "res_detach", ":", "ret", "[", "'comment'", "]", ".", "append", "(", "res_detach", "[", "'message'", "]", ")", "ret", "[", "'comment'", "]", "=", "\"\\n\"", ".", "join", "(", "ret", "[", "'comment'", "]", ")", "else", ":", "ret", "[", "'result'", "]", "=", "True", "ret", "[", "'comment'", "]", "=", "'zone {0} already detached.'", ".", "format", "(", "name", ")", "else", ":", "## note: a non existing zone is not attached, we do not consider this a failure", "ret", "[", "'result'", "]", "=", "True", "ret", "[", "'comment'", "]", "=", "'zone {0} is not configured!'", ".", "format", "(", "name", ")", "return", "ret" ]
Ensure zone is detached name : string name of the zone
[ "Ensure", "zone", "is", "detached" ]
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zone.py#L1100-L1138
<|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: Ensure zone is detached name : string name of the zone ### Response: def detached(name): ''' Ensure zone is detached name : string name of the zone ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} zones = __salt__['zoneadm.list'](installed=True, configured=True) if name in zones: if zones[name]['state'] != 'configured': if __opts__['test']: res_detach = {'status': True} else: res_detach = __salt__['zoneadm.detach'](name) ret['result'] = res_detach['status'] if ret['result']: ret['changes'][name] = 'detached' ret['comment'] = 'The zone {0} was detached.'.format(name) else: ret['comment'] = [] ret['comment'].append('Failed to detach zone {0}!'.format(name)) if 'message' in res_detach: ret['comment'].append(res_detach['message']) ret['comment'] = "\n".join(ret['comment']) else: ret['result'] = True ret['comment'] = 'zone {0} already detached.'.format(name) else: ## note: a non existing zone is not attached, we do not consider this a failure ret['result'] = True ret['comment'] = 'zone {0} is not configured!'.format(name) return ret <|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, 65539, 10353, 374, 45017, 271, 262, 836, 551, 925, 198, 286, 836, 315, 279, 10353, 271, 14711, 6075, 512, 755, 45017, 3232, 997, 262, 11414, 262, 30379, 10353, 374, 45017, 271, 262, 836, 551, 925, 198, 286, 836, 315, 279, 10353, 271, 262, 11414, 262, 2160, 284, 5473, 609, 1232, 836, 345, 1881, 364, 19926, 1232, 14915, 1881, 364, 1407, 1232, 2290, 345, 1881, 364, 6313, 1232, 3436, 633, 262, 26467, 284, 1328, 43326, 565, 681, 8855, 48029, 6556, 85433, 50673, 3702, 11, 20336, 3702, 340, 262, 422, 836, 304, 26467, 512, 286, 422, 26467, 11174, 5465, 2513, 663, 976, 364, 82543, 3730, 310, 422, 1328, 10740, 565, 681, 1985, 18888, 394, 594, 94167, 284, 5473, 2899, 1232, 3082, 534, 310, 775, 512, 394, 594, 94167, 284, 1328, 43326, 565, 681, 8855, 48029, 61486, 85433, 609, 340, 310, 2160, 681, 1407, 663, 284, 594, 94167, 681, 2899, 4532, 310, 422, 2160, 681, 1407, 18888, 394, 2160, 681, 19926, 10136, 609, 60, 284, 364, 19842, 3939, 1270, 394, 2160, 681, 6313, 663, 284, 364, 791, 10353, 314, 15, 92, 574, 45017, 37049, 2293, 3232, 340, 310, 775, 512, 394, 2160, 681, 6313, 663, 284, 4260, 394, 2160, 681, 6313, 7352, 5200, 493, 9595, 311, 47881, 10353, 314, 15, 92, 0, 4527, 2293, 3232, 1192, 394, 422, 364, 2037, 6, 304, 594, 94167, 512, 504, 2160, 681, 6313, 7352, 5200, 4693, 94167, 681, 2037, 7519, 394, 2160, 681, 6313, 663, 284, 2990, 77, 3343, 6115, 16442, 681, 6313, 7519, 286, 775, 512, 310, 2160, 681, 1407, 663, 284, 3082, 198, 310, 2160, 681, 6313, 663, 284, 364, 8855, 314, 15, 92, 2736, 45017, 37049, 2293, 3232, 340, 262, 775, 512, 286, 7860, 5296, 25, 264, 2536, 6484, 10353, 374, 539, 12673, 11, 584, 656, 539, 2980, 420, 264, 8060, 198, 286, 2160, 681, 1407, 663, 284, 3082, 198, 286, 2160, 681, 6313, 663, 284, 364, 8855, 314, 15, 92, 374, 539, 20336, 0, 4527, 2293, 3232, 696, 262, 471, 2160, 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, 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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 65539, 10353, 374, 45017, 271, 262, 836, 551, 925, 198, 286, 836, 315, 279, 10353, 271, 14711, 6075, 512, 755, 45017, 3232, 997, 262, 11414, 262, 30379, 10353, 374, 45017, 271, 262, 836, 551, 925, 198, 286, 836, 315, 279, 10353, 271, 262, 11414, 262, 2160, 284, 5473, 609, 1232, 836, 345, 1881, 364, 19926, 1232, 14915, 1881, 364, 1407, 1232, 2290, 345, 1881, 364, 6313, 1232, 3436, 633, 262, 26467, 284, 1328, 43326, 565, 681, 8855, 48029, 6556, 85433, 50673, 3702, 11, 20336, 3702, 340, 262, 422, 836, 304, 26467, 512, 286, 422, 26467, 11174, 5465, 2513, 663, 976, 364, 82543, 3730, 310, 422, 1328, 10740, 565, 681, 1985, 18888, 394, 594, 94167, 284, 5473, 2899, 1232, 3082, 534, 310, 775, 512, 394, 594, 94167, 284, 1328, 43326, 565, 681, 8855, 48029, 61486, 85433, 609, 340, 310, 2160, 681, 1407, 663, 284, 594, 94167, 681, 2899, 4532, 310, 422, 2160, 681, 1407, 18888, 394, 2160, 681, 19926, 10136, 609, 60, 284, 364, 19842, 3939, 1270, 394, 2160, 681, 6313, 663, 284, 364, 791, 10353, 314, 15, 92, 574, 45017, 37049, 2293, 3232, 340, 310, 775, 512, 394, 2160, 681, 6313, 663, 284, 4260, 394, 2160, 681, 6313, 7352, 5200, 493, 9595, 311, 47881, 10353, 314, 15, 92, 0, 4527, 2293, 3232, 1192, 394, 422, 364, 2037, 6, 304, 594, 94167, 512, 504, 2160, 681, 6313, 7352, 5200, 4693, 94167, 681, 2037, 7519, 394, 2160, 681, 6313, 663, 284, 2990, 77, 3343, 6115, 16442, 681, 6313, 7519, 286, 775, 512, 310, 2160, 681, 1407, 663, 284, 3082, 198, 310, 2160, 681, 6313, 663, 284, 364, 8855, 314, 15, 92, 2736, 45017, 37049, 2293, 3232, 340, 262, 775, 512, 286, 7860, 5296, 25, 264, 2536, 6484, 10353, 374, 539, 12673, 11, 584, 656, 539, 2980, 420, 264, 8060, 198, 286, 2160, 681, 1407, 663, 284, 3082, 198, 286, 2160, 681, 6313, 663, 284, 364, 8855, 314, 15, 92, 374, 539, 20336, 0, 4527, 2293, 3232, 696, 262, 471, 2160, 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 ]
onelogin/python3-saml
src/onelogin/saml2/response.py
OneLogin_Saml2_Response.__query
def __query(self, query, tagid=None): """ Extracts nodes that match the query from the Response :param query: Xpath Expresion :type query: String :param tagid: Tag ID :type query: String :returns: The queried nodes :rtype: list """ if self.encrypted: document = self.decrypted_document else: document = self.document return OneLogin_Saml2_XML.query(document, query, None, tagid)
python
def __query(self, query, tagid=None): """ Extracts nodes that match the query from the Response :param query: Xpath Expresion :type query: String :param tagid: Tag ID :type query: String :returns: The queried nodes :rtype: list """ if self.encrypted: document = self.decrypted_document else: document = self.document return OneLogin_Saml2_XML.query(document, query, None, tagid)
[ "def", "__query", "(", "self", ",", "query", ",", "tagid", "=", "None", ")", ":", "if", "self", ".", "encrypted", ":", "document", "=", "self", ".", "decrypted_document", "else", ":", "document", "=", "self", ".", "document", "return", "OneLogin_Saml2_XML", ".", "query", "(", "document", ",", "query", ",", "None", ",", "tagid", ")" ]
Extracts nodes that match the query from the Response :param query: Xpath Expresion :type query: String :param tagid: Tag ID :type query: String :returns: The queried nodes :rtype: list
[ "Extracts", "nodes", "that", "match", "the", "query", "from", "the", "Response" ]
train
https://github.com/onelogin/python3-saml/blob/064b7275fba1e5f39a9116ba1cdcc5d01fc34daa/src/onelogin/saml2/response.py#L760-L777
<|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: Extracts nodes that match the query from the Response :param query: Xpath Expresion :type query: String :param tagid: Tag ID :type query: String :returns: The queried nodes :rtype: list ### Response: def __query(self, query, tagid=None): """ Extracts nodes that match the query from the Response :param query: Xpath Expresion :type query: String :param tagid: Tag ID :type query: String :returns: The queried nodes :rtype: list """ if self.encrypted: document = self.decrypted_document else: document = self.document return OneLogin_Saml2_XML.query(document, query, None, tagid) <|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, 30059, 82, 7954, 430, 2489, 279, 3319, 505, 279, 6075, 271, 286, 551, 913, 3319, 25, 1630, 2398, 7943, 417, 290, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 913, 4877, 307, 25, 12633, 3110, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 4310, 25, 578, 79002, 7954, 198, 286, 551, 33613, 25, 1160, 271, 14711, 6075, 512, 755, 1328, 1663, 1214, 11, 3319, 11, 4877, 307, 5980, 997, 286, 3270, 286, 23673, 82, 7954, 430, 2489, 279, 3319, 505, 279, 6075, 271, 286, 551, 913, 3319, 25, 1630, 2398, 7943, 417, 290, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 913, 4877, 307, 25, 12633, 3110, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 4310, 25, 578, 79002, 7954, 198, 286, 551, 33613, 25, 1160, 198, 286, 3270, 286, 422, 659, 13, 37544, 512, 310, 2246, 284, 659, 29120, 14353, 27326, 198, 286, 775, 512, 310, 2246, 284, 659, 17926, 198, 286, 471, 3861, 6363, 1117, 9655, 17, 46717, 4891, 15649, 11, 3319, 11, 2290, 11, 4877, 307, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 30059, 82, 7954, 430, 2489, 279, 3319, 505, 279, 6075, 271, 286, 551, 913, 3319, 25, 1630, 2398, 7943, 417, 290, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 913, 4877, 307, 25, 12633, 3110, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 4310, 25, 578, 79002, 7954, 198, 286, 551, 33613, 25, 1160, 271, 14711, 6075, 512, 755, 1328, 1663, 1214, 11, 3319, 11, 4877, 307, 5980, 997, 286, 3270, 286, 23673, 82, 7954, 430, 2489, 279, 3319, 505, 279, 6075, 271, 286, 551, 913, 3319, 25, 1630, 2398, 7943, 417, 290, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 913, 4877, 307, 25, 12633, 3110, 198, 286, 551, 1337, 3319, 25, 935, 271, 286, 551, 4310, 25, 578, 79002, 7954, 198, 286, 551, 33613, 25, 1160, 198, 286, 3270, 286, 422, 659, 13, 37544, 512, 310, 2246, 284, 659, 29120, 14353, 27326, 198, 286, 775, 512, 310, 2246, 284, 659, 17926, 198, 286, 471, 3861, 6363, 1117, 9655, 17, 46717, 4891, 15649, 11, 3319, 11, 2290, 11, 4877, 307, 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 ]
HiPERCAM/hcam_widgets
hcam_widgets/widgets.py
Windows.enable
def enable(self): """ Enables all settings """ nwin = self.nwin.value() for label, xs, ys, nx, ny in \ zip(self.label[:nwin], self.xs[:nwin], self.ys[:nwin], self.nx[:nwin], self.ny[:nwin]): label.config(state='normal') xs.enable() ys.enable() nx.enable() ny.enable() for label, xs, ys, nx, ny in \ zip(self.label[nwin:], self.xs[nwin:], self.ys[nwin:], self.nx[nwin:], self.ny[nwin:]): label.config(state='disable') xs.disable() ys.disable() nx.disable() ny.disable() self.nwin.enable() self.xbin.enable() self.ybin.enable() self.sbutt.enable()
python
def enable(self): """ Enables all settings """ nwin = self.nwin.value() for label, xs, ys, nx, ny in \ zip(self.label[:nwin], self.xs[:nwin], self.ys[:nwin], self.nx[:nwin], self.ny[:nwin]): label.config(state='normal') xs.enable() ys.enable() nx.enable() ny.enable() for label, xs, ys, nx, ny in \ zip(self.label[nwin:], self.xs[nwin:], self.ys[nwin:], self.nx[nwin:], self.ny[nwin:]): label.config(state='disable') xs.disable() ys.disable() nx.disable() ny.disable() self.nwin.enable() self.xbin.enable() self.ybin.enable() self.sbutt.enable()
[ "def", "enable", "(", "self", ")", ":", "nwin", "=", "self", ".", "nwin", ".", "value", "(", ")", "for", "label", ",", "xs", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "label", "[", ":", "nwin", "]", ",", "self", ".", "xs", "[", ":", "nwin", "]", ",", "self", ".", "ys", "[", ":", "nwin", "]", ",", "self", ".", "nx", "[", ":", "nwin", "]", ",", "self", ".", "ny", "[", ":", "nwin", "]", ")", ":", "label", ".", "config", "(", "state", "=", "'normal'", ")", "xs", ".", "enable", "(", ")", "ys", ".", "enable", "(", ")", "nx", ".", "enable", "(", ")", "ny", ".", "enable", "(", ")", "for", "label", ",", "xs", ",", "ys", ",", "nx", ",", "ny", "in", "zip", "(", "self", ".", "label", "[", "nwin", ":", "]", ",", "self", ".", "xs", "[", "nwin", ":", "]", ",", "self", ".", "ys", "[", "nwin", ":", "]", ",", "self", ".", "nx", "[", "nwin", ":", "]", ",", "self", ".", "ny", "[", "nwin", ":", "]", ")", ":", "label", ".", "config", "(", "state", "=", "'disable'", ")", "xs", ".", "disable", "(", ")", "ys", ".", "disable", "(", ")", "nx", ".", "disable", "(", ")", "ny", ".", "disable", "(", ")", "self", ".", "nwin", ".", "enable", "(", ")", "self", ".", "xbin", ".", "enable", "(", ")", "self", ".", "ybin", ".", "enable", "(", ")", "self", ".", "sbutt", ".", "enable", "(", ")" ]
Enables all settings
[ "Enables", "all", "settings" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/widgets.py#L4229-L4255
<|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: Enables all settings ### Response: def enable(self): """ Enables all settings """ nwin = self.nwin.value() for label, xs, ys, nx, ny in \ zip(self.label[:nwin], self.xs[:nwin], self.ys[:nwin], self.nx[:nwin], self.ny[:nwin]): label.config(state='normal') xs.enable() ys.enable() nx.enable() ny.enable() for label, xs, ys, nx, ny in \ zip(self.label[nwin:], self.xs[nwin:], self.ys[nwin:], self.nx[nwin:], self.ny[nwin:]): label.config(state='disable') xs.disable() ys.disable() nx.disable() ny.disable() self.nwin.enable() self.xbin.enable() self.ybin.enable() self.sbutt.enable() <|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, 1737, 4893, 682, 5110, 271, 14711, 6075, 512, 755, 7431, 1214, 997, 286, 3270, 286, 77416, 682, 5110, 198, 286, 3270, 286, 308, 7678, 284, 659, 1276, 7678, 2894, 746, 286, 369, 2440, 11, 12209, 11, 32910, 11, 25508, 11, 19541, 304, 3120, 394, 10521, 1214, 2981, 3530, 77, 7678, 1145, 659, 2036, 82, 3530, 77, 7678, 1145, 659, 13, 1065, 3530, 77, 7678, 1282, 504, 659, 1276, 87, 3530, 77, 7678, 1145, 659, 83914, 3530, 77, 7678, 22953, 310, 2440, 5539, 8556, 1151, 8416, 1329, 310, 12209, 29797, 746, 310, 32910, 29797, 746, 310, 25508, 29797, 746, 310, 19541, 29797, 2892, 286, 369, 2440, 11, 12209, 11, 32910, 11, 25508, 11, 19541, 304, 3120, 394, 10521, 1214, 2981, 7824, 7678, 46599, 659, 2036, 82, 7824, 7678, 46599, 659, 13, 1065, 7824, 7678, 25, 1282, 504, 659, 1276, 87, 7824, 7678, 46599, 659, 83914, 7824, 7678, 25, 22953, 310, 2440, 5539, 8556, 1151, 18502, 1329, 310, 12209, 43728, 746, 310, 32910, 43728, 746, 310, 25508, 43728, 746, 310, 19541, 43728, 2892, 286, 659, 1276, 7678, 29797, 746, 286, 659, 2036, 7006, 29797, 746, 286, 659, 2441, 7006, 29797, 746, 286, 659, 516, 93896, 29797, 746, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1737, 4893, 682, 5110, 271, 14711, 6075, 512, 755, 7431, 1214, 997, 286, 3270, 286, 77416, 682, 5110, 198, 286, 3270, 286, 308, 7678, 284, 659, 1276, 7678, 2894, 746, 286, 369, 2440, 11, 12209, 11, 32910, 11, 25508, 11, 19541, 304, 3120, 394, 10521, 1214, 2981, 3530, 77, 7678, 1145, 659, 2036, 82, 3530, 77, 7678, 1145, 659, 13, 1065, 3530, 77, 7678, 1282, 504, 659, 1276, 87, 3530, 77, 7678, 1145, 659, 83914, 3530, 77, 7678, 22953, 310, 2440, 5539, 8556, 1151, 8416, 1329, 310, 12209, 29797, 746, 310, 32910, 29797, 746, 310, 25508, 29797, 746, 310, 19541, 29797, 2892, 286, 369, 2440, 11, 12209, 11, 32910, 11, 25508, 11, 19541, 304, 3120, 394, 10521, 1214, 2981, 7824, 7678, 46599, 659, 2036, 82, 7824, 7678, 46599, 659, 13, 1065, 7824, 7678, 25, 1282, 504, 659, 1276, 87, 7824, 7678, 46599, 659, 83914, 7824, 7678, 25, 22953, 310, 2440, 5539, 8556, 1151, 18502, 1329, 310, 12209, 43728, 746, 310, 32910, 43728, 746, 310, 25508, 43728, 746, 310, 19541, 43728, 2892, 286, 659, 1276, 7678, 29797, 746, 286, 659, 2036, 7006, 29797, 746, 286, 659, 2441, 7006, 29797, 746, 286, 659, 516, 93896, 29797, 746, 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 ]
klen/peewee_migrate
peewee_migrate/migrator.py
Migrator.add_default
def add_default(self, model, name, default): """Add default.""" field = model._meta.fields[name] model._meta.defaults[field] = field.default = default self.ops.append(self.migrator.apply_default(model._meta.table_name, name, field)) return model
python
def add_default(self, model, name, default): """Add default.""" field = model._meta.fields[name] model._meta.defaults[field] = field.default = default self.ops.append(self.migrator.apply_default(model._meta.table_name, name, field)) return model
[ "def", "add_default", "(", "self", ",", "model", ",", "name", ",", "default", ")", ":", "field", "=", "model", ".", "_meta", ".", "fields", "[", "name", "]", "model", ".", "_meta", ".", "defaults", "[", "field", "]", "=", "field", ".", "default", "=", "default", "self", ".", "ops", ".", "append", "(", "self", ".", "migrator", ".", "apply_default", "(", "model", ".", "_meta", ".", "table_name", ",", "name", ",", "field", ")", ")", "return", "model" ]
Add default.
[ "Add", "default", "." ]
train
https://github.com/klen/peewee_migrate/blob/b77895ab1c9be3121bc127e0c2dfb047eed8b24c/peewee_migrate/migrator.py#L341-L346
<|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: Add default. ### Response: def add_default(self, model, name, default): """Add default.""" field = model._meta.fields[name] model._meta.defaults[field] = field.default = default self.ops.append(self.migrator.apply_default(model._meta.table_name, name, field)) return model <|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, 2261, 1670, 382, 14711, 6075, 512, 755, 923, 10198, 1214, 11, 1646, 11, 836, 11, 1670, 997, 286, 4304, 2261, 1670, 14781, 286, 2115, 284, 1646, 1462, 5607, 13216, 11174, 933, 286, 1646, 1462, 5607, 45044, 39740, 60, 284, 2115, 8939, 284, 1670, 198, 286, 659, 47878, 2102, 1214, 749, 5346, 859, 13344, 10198, 7790, 1462, 5607, 10549, 1292, 11, 836, 11, 2115, 1192, 286, 471, 1646, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2261, 1670, 382, 14711, 6075, 512, 755, 923, 10198, 1214, 11, 1646, 11, 836, 11, 1670, 997, 286, 4304, 2261, 1670, 14781, 286, 2115, 284, 1646, 1462, 5607, 13216, 11174, 933, 286, 1646, 1462, 5607, 45044, 39740, 60, 284, 2115, 8939, 284, 1670, 198, 286, 659, 47878, 2102, 1214, 749, 5346, 859, 13344, 10198, 7790, 1462, 5607, 10549, 1292, 11, 836, 11, 2115, 1192, 286, 471, 1646, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
MartinThoma/mpu
mpu/pd.py
describe
def describe(df, dtype=None): """ Print a description of a Pandas dataframe. Parameters ---------- df : Pandas.DataFrame dtype : dict Maps column names to types """ if dtype is None: dtype = {} print('Number of datapoints: {datapoints}'.format(datapoints=len(df))) column_info, column_info_meta = _get_column_info(df, dtype) if len(column_info['int']) > 0: _describe_int(df, column_info) if len(column_info['float']) > 0: _describe_float(df, column_info) if len(column_info['category']) > 0: _describe_category(df, column_info, column_info_meta) if len(column_info['time']) > 0: _describe_time(df, column_info, column_info_meta) if len(column_info['other']) > 0: _describe_other(df, column_info, column_info_meta) column_types = {} for column_type, columns in column_info.items(): for column_name in columns: if column_type == 'other': column_type = 'str' column_types[column_name] = column_type return column_types
python
def describe(df, dtype=None): """ Print a description of a Pandas dataframe. Parameters ---------- df : Pandas.DataFrame dtype : dict Maps column names to types """ if dtype is None: dtype = {} print('Number of datapoints: {datapoints}'.format(datapoints=len(df))) column_info, column_info_meta = _get_column_info(df, dtype) if len(column_info['int']) > 0: _describe_int(df, column_info) if len(column_info['float']) > 0: _describe_float(df, column_info) if len(column_info['category']) > 0: _describe_category(df, column_info, column_info_meta) if len(column_info['time']) > 0: _describe_time(df, column_info, column_info_meta) if len(column_info['other']) > 0: _describe_other(df, column_info, column_info_meta) column_types = {} for column_type, columns in column_info.items(): for column_name in columns: if column_type == 'other': column_type = 'str' column_types[column_name] = column_type return column_types
[ "def", "describe", "(", "df", ",", "dtype", "=", "None", ")", ":", "if", "dtype", "is", "None", ":", "dtype", "=", "{", "}", "print", "(", "'Number of datapoints: {datapoints}'", ".", "format", "(", "datapoints", "=", "len", "(", "df", ")", ")", ")", "column_info", ",", "column_info_meta", "=", "_get_column_info", "(", "df", ",", "dtype", ")", "if", "len", "(", "column_info", "[", "'int'", "]", ")", ">", "0", ":", "_describe_int", "(", "df", ",", "column_info", ")", "if", "len", "(", "column_info", "[", "'float'", "]", ")", ">", "0", ":", "_describe_float", "(", "df", ",", "column_info", ")", "if", "len", "(", "column_info", "[", "'category'", "]", ")", ">", "0", ":", "_describe_category", "(", "df", ",", "column_info", ",", "column_info_meta", ")", "if", "len", "(", "column_info", "[", "'time'", "]", ")", ">", "0", ":", "_describe_time", "(", "df", ",", "column_info", ",", "column_info_meta", ")", "if", "len", "(", "column_info", "[", "'other'", "]", ")", ">", "0", ":", "_describe_other", "(", "df", ",", "column_info", ",", "column_info_meta", ")", "column_types", "=", "{", "}", "for", "column_type", ",", "columns", "in", "column_info", ".", "items", "(", ")", ":", "for", "column_name", "in", "columns", ":", "if", "column_type", "==", "'other'", ":", "column_type", "=", "'str'", "column_types", "[", "column_name", "]", "=", "column_type", "return", "column_types" ]
Print a description of a Pandas dataframe. Parameters ---------- df : Pandas.DataFrame dtype : dict Maps column names to types
[ "Print", "a", "description", "of", "a", "Pandas", "dataframe", "." ]
train
https://github.com/MartinThoma/mpu/blob/61bc36d0192ca90c0bcf9b8a5d7d0d8520e20ff6/mpu/pd.py#L49-L85
<|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: Print a description of a Pandas dataframe. Parameters ---------- df : Pandas.DataFrame dtype : dict Maps column names to types ### Response: def describe(df, dtype=None): """ Print a description of a Pandas dataframe. Parameters ---------- df : Pandas.DataFrame dtype : dict Maps column names to types """ if dtype is None: dtype = {} print('Number of datapoints: {datapoints}'.format(datapoints=len(df))) column_info, column_info_meta = _get_column_info(df, dtype) if len(column_info['int']) > 0: _describe_int(df, column_info) if len(column_info['float']) > 0: _describe_float(df, column_info) if len(column_info['category']) > 0: _describe_category(df, column_info, column_info_meta) if len(column_info['time']) > 0: _describe_time(df, column_info, column_info_meta) if len(column_info['other']) > 0: _describe_other(df, column_info, column_info_meta) column_types = {} for column_type, columns in column_info.items(): for column_name in columns: if column_type == 'other': column_type = 'str' column_types[column_name] = column_type return column_types <|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, 9171, 264, 4096, 315, 264, 34606, 300, 39328, 382, 262, 13831, 198, 262, 31423, 262, 6907, 551, 34606, 300, 21756, 198, 262, 13534, 551, 6587, 198, 286, 28508, 3330, 5144, 311, 4595, 271, 14711, 6075, 512, 755, 7664, 16446, 11, 13534, 5980, 997, 262, 3270, 262, 8377, 264, 4096, 315, 264, 34606, 300, 39328, 382, 262, 13831, 198, 262, 31423, 262, 6907, 551, 34606, 300, 21756, 198, 262, 13534, 551, 6587, 198, 286, 28508, 3330, 5144, 311, 4595, 198, 262, 3270, 262, 422, 13534, 374, 2290, 512, 286, 13534, 284, 5731, 262, 1194, 493, 2903, 315, 62823, 14737, 25, 314, 94353, 14737, 24398, 2293, 45941, 391, 14737, 46919, 16446, 6054, 262, 3330, 3186, 11, 3330, 3186, 13686, 284, 721, 456, 8918, 3186, 16446, 11, 13534, 696, 262, 422, 2479, 17725, 3186, 681, 396, 5188, 871, 220, 15, 512, 286, 721, 12612, 4132, 16446, 11, 3330, 3186, 696, 262, 422, 2479, 17725, 3186, 681, 3733, 5188, 871, 220, 15, 512, 286, 721, 12612, 18047, 16446, 11, 3330, 3186, 696, 262, 422, 2479, 17725, 3186, 681, 5588, 5188, 871, 220, 15, 512, 286, 721, 12612, 12110, 16446, 11, 3330, 3186, 11, 3330, 3186, 13686, 696, 262, 422, 2479, 17725, 3186, 681, 1712, 5188, 871, 220, 15, 512, 286, 721, 12612, 3084, 16446, 11, 3330, 3186, 11, 3330, 3186, 13686, 696, 262, 422, 2479, 17725, 3186, 681, 1605, 5188, 871, 220, 15, 512, 286, 721, 12612, 31556, 16446, 11, 3330, 3186, 11, 3330, 3186, 13686, 696, 262, 3330, 9962, 284, 5731, 262, 369, 3330, 1857, 11, 8310, 304, 3330, 3186, 9812, 4019, 286, 369, 3330, 1292, 304, 8310, 512, 310, 422, 3330, 1857, 624, 364, 1605, 3730, 394, 3330, 1857, 284, 364, 496, 1270, 310, 3330, 9962, 53585, 1292, 60, 284, 3330, 1857, 198, 262, 471, 3330, 9962, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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193, 304, 6498, 382, 14711, 5546, 512, 9171, 264, 4096, 315, 264, 34606, 300, 39328, 382, 262, 13831, 198, 262, 31423, 262, 6907, 551, 34606, 300, 21756, 198, 262, 13534, 551, 6587, 198, 286, 28508, 3330, 5144, 311, 4595, 271, 14711, 6075, 512, 755, 7664, 16446, 11, 13534, 5980, 997, 262, 3270, 262, 8377, 264, 4096, 315, 264, 34606, 300, 39328, 382, 262, 13831, 198, 262, 31423, 262, 6907, 551, 34606, 300, 21756, 198, 262, 13534, 551, 6587, 198, 286, 28508, 3330, 5144, 311, 4595, 198, 262, 3270, 262, 422, 13534, 374, 2290, 512, 286, 13534, 284, 5731, 262, 1194, 493, 2903, 315, 62823, 14737, 25, 314, 94353, 14737, 24398, 2293, 45941, 391, 14737, 46919, 16446, 6054, 262, 3330, 3186, 11, 3330, 3186, 13686, 284, 721, 456, 8918, 3186, 16446, 11, 13534, 696, 262, 422, 2479, 17725, 3186, 681, 396, 5188, 871, 220, 15, 512, 286, 721, 12612, 4132, 16446, 11, 3330, 3186, 696, 262, 422, 2479, 17725, 3186, 681, 3733, 5188, 871, 220, 15, 512, 286, 721, 12612, 18047, 16446, 11, 3330, 3186, 696, 262, 422, 2479, 17725, 3186, 681, 5588, 5188, 871, 220, 15, 512, 286, 721, 12612, 12110, 16446, 11, 3330, 3186, 11, 3330, 3186, 13686, 696, 262, 422, 2479, 17725, 3186, 681, 1712, 5188, 871, 220, 15, 512, 286, 721, 12612, 3084, 16446, 11, 3330, 3186, 11, 3330, 3186, 13686, 696, 262, 422, 2479, 17725, 3186, 681, 1605, 5188, 871, 220, 15, 512, 286, 721, 12612, 31556, 16446, 11, 3330, 3186, 11, 3330, 3186, 13686, 696, 262, 3330, 9962, 284, 5731, 262, 369, 3330, 1857, 11, 8310, 304, 3330, 3186, 9812, 4019, 286, 369, 3330, 1292, 304, 8310, 512, 310, 422, 3330, 1857, 624, 364, 1605, 3730, 394, 3330, 1857, 284, 364, 496, 1270, 310, 3330, 9962, 53585, 1292, 60, 284, 3330, 1857, 198, 262, 471, 3330, 9962, 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 ]
wummel/linkchecker
linkcheck/checker/__init__.py
get_url_from
def get_url_from (base_url, recursion_level, aggregate, parent_url=None, base_ref=None, line=0, column=0, page=0, name=u"", parent_content_type=None, extern=None): """ Get url data from given base data. @param base_url: base url from a link tag @type base_url: string or None @param recursion_level: current recursion level @type recursion_level: number @param aggregate: aggregate object @type aggregate: aggregate.Consumer @param parent_url: parent url @type parent_url: string or None @param base_ref: base url from <base> tag @type base_ref string or None @param line: line number @type line: number @param column: column number @type column: number @param page: page number @type page: number @param name: link name @type name: string @param extern: (is_extern, is_strict) or None @type extern: tuple(int, int) or None """ if base_url is not None: base_url = strformat.unicode_safe(base_url) # left strip for detection of URL scheme base_url_stripped = base_url.lstrip() else: base_url_stripped = base_url if parent_url is not None: parent_url = strformat.unicode_safe(parent_url) if base_ref is not None: base_ref = strformat.unicode_safe(base_ref) name = strformat.unicode_safe(name) url = absolute_url(base_url_stripped, base_ref, parent_url).lower() if ":" in url: scheme = url.split(":", 1)[0].lower() else: scheme = None if not (url or name): # use filename as base url, with slash as path seperator name = base_url.replace("\\", "/") allowed_schemes = aggregate.config["allowedschemes"] # ignore local PHP files with execution directives local_php = (parent_content_type == 'application/x-httpd-php' and '<?' in base_url and '?>' in base_url and scheme == 'file') if local_php or (allowed_schemes and scheme not in allowed_schemes): klass = ignoreurl.IgnoreUrl else: assume_local_file = (recursion_level == 0) klass = get_urlclass_from(scheme, assume_local_file=assume_local_file) log.debug(LOG_CHECK, "%s handles url %s", klass.__name__, base_url) return klass(base_url, recursion_level, aggregate, parent_url=parent_url, base_ref=base_ref, line=line, column=column, page=page, name=name, extern=extern)
python
def get_url_from (base_url, recursion_level, aggregate, parent_url=None, base_ref=None, line=0, column=0, page=0, name=u"", parent_content_type=None, extern=None): """ Get url data from given base data. @param base_url: base url from a link tag @type base_url: string or None @param recursion_level: current recursion level @type recursion_level: number @param aggregate: aggregate object @type aggregate: aggregate.Consumer @param parent_url: parent url @type parent_url: string or None @param base_ref: base url from <base> tag @type base_ref string or None @param line: line number @type line: number @param column: column number @type column: number @param page: page number @type page: number @param name: link name @type name: string @param extern: (is_extern, is_strict) or None @type extern: tuple(int, int) or None """ if base_url is not None: base_url = strformat.unicode_safe(base_url) # left strip for detection of URL scheme base_url_stripped = base_url.lstrip() else: base_url_stripped = base_url if parent_url is not None: parent_url = strformat.unicode_safe(parent_url) if base_ref is not None: base_ref = strformat.unicode_safe(base_ref) name = strformat.unicode_safe(name) url = absolute_url(base_url_stripped, base_ref, parent_url).lower() if ":" in url: scheme = url.split(":", 1)[0].lower() else: scheme = None if not (url or name): # use filename as base url, with slash as path seperator name = base_url.replace("\\", "/") allowed_schemes = aggregate.config["allowedschemes"] # ignore local PHP files with execution directives local_php = (parent_content_type == 'application/x-httpd-php' and '<?' in base_url and '?>' in base_url and scheme == 'file') if local_php or (allowed_schemes and scheme not in allowed_schemes): klass = ignoreurl.IgnoreUrl else: assume_local_file = (recursion_level == 0) klass = get_urlclass_from(scheme, assume_local_file=assume_local_file) log.debug(LOG_CHECK, "%s handles url %s", klass.__name__, base_url) return klass(base_url, recursion_level, aggregate, parent_url=parent_url, base_ref=base_ref, line=line, column=column, page=page, name=name, extern=extern)
[ "def", "get_url_from", "(", "base_url", ",", "recursion_level", ",", "aggregate", ",", "parent_url", "=", "None", ",", "base_ref", "=", "None", ",", "line", "=", "0", ",", "column", "=", "0", ",", "page", "=", "0", ",", "name", "=", "u\"\"", ",", "parent_content_type", "=", "None", ",", "extern", "=", "None", ")", ":", "if", "base_url", "is", "not", "None", ":", "base_url", "=", "strformat", ".", "unicode_safe", "(", "base_url", ")", "# left strip for detection of URL scheme", "base_url_stripped", "=", "base_url", ".", "lstrip", "(", ")", "else", ":", "base_url_stripped", "=", "base_url", "if", "parent_url", "is", "not", "None", ":", "parent_url", "=", "strformat", ".", "unicode_safe", "(", "parent_url", ")", "if", "base_ref", "is", "not", "None", ":", "base_ref", "=", "strformat", ".", "unicode_safe", "(", "base_ref", ")", "name", "=", "strformat", ".", "unicode_safe", "(", "name", ")", "url", "=", "absolute_url", "(", "base_url_stripped", ",", "base_ref", ",", "parent_url", ")", ".", "lower", "(", ")", "if", "\":\"", "in", "url", ":", "scheme", "=", "url", ".", "split", "(", "\":\"", ",", "1", ")", "[", "0", "]", ".", "lower", "(", ")", "else", ":", "scheme", "=", "None", "if", "not", "(", "url", "or", "name", ")", ":", "# use filename as base url, with slash as path seperator", "name", "=", "base_url", ".", "replace", "(", "\"\\\\\"", ",", "\"/\"", ")", "allowed_schemes", "=", "aggregate", ".", "config", "[", "\"allowedschemes\"", "]", "# ignore local PHP files with execution directives", "local_php", "=", "(", "parent_content_type", "==", "'application/x-httpd-php'", "and", "'<?'", "in", "base_url", "and", "'?>'", "in", "base_url", "and", "scheme", "==", "'file'", ")", "if", "local_php", "or", "(", "allowed_schemes", "and", "scheme", "not", "in", "allowed_schemes", ")", ":", "klass", "=", "ignoreurl", ".", "IgnoreUrl", "else", ":", "assume_local_file", "=", "(", "recursion_level", "==", "0", ")", "klass", "=", "get_urlclass_from", "(", "scheme", ",", "assume_local_file", "=", "assume_local_file", ")", "log", ".", "debug", "(", "LOG_CHECK", ",", "\"%s handles url %s\"", ",", "klass", ".", "__name__", ",", "base_url", ")", "return", "klass", "(", "base_url", ",", "recursion_level", ",", "aggregate", ",", "parent_url", "=", "parent_url", ",", "base_ref", "=", "base_ref", ",", "line", "=", "line", ",", "column", "=", "column", ",", "page", "=", "page", ",", "name", "=", "name", ",", "extern", "=", "extern", ")" ]
Get url data from given base data. @param base_url: base url from a link tag @type base_url: string or None @param recursion_level: current recursion level @type recursion_level: number @param aggregate: aggregate object @type aggregate: aggregate.Consumer @param parent_url: parent url @type parent_url: string or None @param base_ref: base url from <base> tag @type base_ref string or None @param line: line number @type line: number @param column: column number @type column: number @param page: page number @type page: number @param name: link name @type name: string @param extern: (is_extern, is_strict) or None @type extern: tuple(int, int) or None
[ "Get", "url", "data", "from", "given", "base", "data", "." ]
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/__init__.py#L67-L125
<|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: Get url data from given base data. @param base_url: base url from a link tag @type base_url: string or None @param recursion_level: current recursion level @type recursion_level: number @param aggregate: aggregate object @type aggregate: aggregate.Consumer @param parent_url: parent url @type parent_url: string or None @param base_ref: base url from <base> tag @type base_ref string or None @param line: line number @type line: number @param column: column number @type column: number @param page: page number @type page: number @param name: link name @type name: string @param extern: (is_extern, is_strict) or None @type extern: tuple(int, int) or None ### Response: def get_url_from (base_url, recursion_level, aggregate, parent_url=None, base_ref=None, line=0, column=0, page=0, name=u"", parent_content_type=None, extern=None): """ Get url data from given base data. @param base_url: base url from a link tag @type base_url: string or None @param recursion_level: current recursion level @type recursion_level: number @param aggregate: aggregate object @type aggregate: aggregate.Consumer @param parent_url: parent url @type parent_url: string or None @param base_ref: base url from <base> tag @type base_ref string or None @param line: line number @type line: number @param column: column number @type column: number @param page: page number @type page: number @param name: link name @type name: string @param extern: (is_extern, is_strict) or None @type extern: tuple(int, int) or None """ if base_url is not None: base_url = strformat.unicode_safe(base_url) # left strip for detection of URL scheme base_url_stripped = base_url.lstrip() else: base_url_stripped = base_url if parent_url is not None: parent_url = strformat.unicode_safe(parent_url) if base_ref is not None: base_ref = strformat.unicode_safe(base_ref) name = strformat.unicode_safe(name) url = absolute_url(base_url_stripped, base_ref, parent_url).lower() if ":" in url: scheme = url.split(":", 1)[0].lower() else: scheme = None if not (url or name): # use filename as base url, with slash as path seperator name = base_url.replace("\\", "/") allowed_schemes = aggregate.config["allowedschemes"] # ignore local PHP files with execution directives local_php = (parent_content_type == 'application/x-httpd-php' and '<?' in base_url and '?>' in base_url and scheme == 'file') if local_php or (allowed_schemes and scheme not in allowed_schemes): klass = ignoreurl.IgnoreUrl else: assume_local_file = (recursion_level == 0) klass = get_urlclass_from(scheme, assume_local_file=assume_local_file) log.debug(LOG_CHECK, "%s handles url %s", klass.__name__, base_url) return klass(base_url, recursion_level, aggregate, parent_url=parent_url, base_ref=base_ref, line=line, column=column, page=page, name=name, extern=extern) <|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, 1991, 2576, 828, 505, 2728, 2385, 828, 382, 262, 571, 913, 2385, 2975, 25, 2385, 2576, 505, 264, 2723, 4877, 198, 262, 571, 1337, 2385, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 51362, 8438, 25, 1510, 51362, 2237, 198, 262, 571, 1337, 51362, 8438, 25, 1396, 198, 262, 571, 913, 24069, 25, 24069, 1665, 198, 262, 571, 1337, 24069, 25, 24069, 71571, 198, 262, 571, 913, 2748, 2975, 25, 2748, 2576, 198, 262, 571, 1337, 2748, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 2385, 7949, 25, 2385, 2576, 505, 366, 3231, 29, 4877, 198, 262, 571, 1337, 2385, 7949, 925, 477, 2290, 198, 262, 571, 913, 1584, 25, 1584, 1396, 198, 262, 571, 1337, 1584, 25, 1396, 198, 262, 571, 913, 3330, 25, 3330, 1396, 198, 262, 571, 1337, 3330, 25, 1396, 198, 262, 571, 913, 2199, 25, 2199, 1396, 198, 262, 571, 1337, 2199, 25, 1396, 198, 262, 571, 913, 836, 25, 2723, 836, 198, 262, 571, 1337, 836, 25, 925, 198, 262, 571, 913, 16011, 25, 320, 285, 62, 4399, 11, 374, 2966, 858, 8, 477, 2290, 198, 262, 571, 1337, 16011, 25, 14743, 1577, 11, 528, 8, 477, 2290, 271, 14711, 6075, 512, 755, 636, 2975, 5791, 320, 3231, 2975, 11, 51362, 8438, 11, 24069, 345, 1733, 2748, 2975, 5980, 11, 2385, 7949, 5980, 11, 1584, 28, 15, 11, 3330, 28, 15, 11, 2199, 28, 15, 345, 1733, 836, 39733, 57423, 2748, 7647, 1857, 5980, 11, 16011, 5980, 997, 262, 3270, 262, 2175, 2576, 828, 505, 2728, 2385, 828, 382, 262, 571, 913, 2385, 2975, 25, 2385, 2576, 505, 264, 2723, 4877, 198, 262, 571, 1337, 2385, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 51362, 8438, 25, 1510, 51362, 2237, 198, 262, 571, 1337, 51362, 8438, 25, 1396, 198, 262, 571, 913, 24069, 25, 24069, 1665, 198, 262, 571, 1337, 24069, 25, 24069, 71571, 198, 262, 571, 913, 2748, 2975, 25, 2748, 2576, 198, 262, 571, 1337, 2748, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 2385, 7949, 25, 2385, 2576, 505, 366, 3231, 29, 4877, 198, 262, 571, 1337, 2385, 7949, 925, 477, 2290, 198, 262, 571, 913, 1584, 25, 1584, 1396, 198, 262, 571, 1337, 1584, 25, 1396, 198, 262, 571, 913, 3330, 25, 3330, 1396, 198, 262, 571, 1337, 3330, 25, 1396, 198, 262, 571, 913, 2199, 25, 2199, 1396, 198, 262, 571, 1337, 2199, 25, 1396, 198, 262, 571, 913, 836, 25, 2723, 836, 198, 262, 571, 1337, 836, 25, 925, 198, 262, 571, 913, 16011, 25, 320, 285, 62, 4399, 11, 374, 2966, 858, 8, 477, 2290, 198, 262, 571, 1337, 16011, 25, 14743, 1577, 11, 528, 8, 477, 2290, 198, 262, 3270, 262, 422, 2385, 2975, 374, 539, 2290, 512, 286, 2385, 2975, 284, 610, 2293, 13, 25535, 35167, 12952, 2975, 340, 286, 674, 2163, 13619, 369 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 1991, 2576, 828, 505, 2728, 2385, 828, 382, 262, 571, 913, 2385, 2975, 25, 2385, 2576, 505, 264, 2723, 4877, 198, 262, 571, 1337, 2385, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 51362, 8438, 25, 1510, 51362, 2237, 198, 262, 571, 1337, 51362, 8438, 25, 1396, 198, 262, 571, 913, 24069, 25, 24069, 1665, 198, 262, 571, 1337, 24069, 25, 24069, 71571, 198, 262, 571, 913, 2748, 2975, 25, 2748, 2576, 198, 262, 571, 1337, 2748, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 2385, 7949, 25, 2385, 2576, 505, 366, 3231, 29, 4877, 198, 262, 571, 1337, 2385, 7949, 925, 477, 2290, 198, 262, 571, 913, 1584, 25, 1584, 1396, 198, 262, 571, 1337, 1584, 25, 1396, 198, 262, 571, 913, 3330, 25, 3330, 1396, 198, 262, 571, 1337, 3330, 25, 1396, 198, 262, 571, 913, 2199, 25, 2199, 1396, 198, 262, 571, 1337, 2199, 25, 1396, 198, 262, 571, 913, 836, 25, 2723, 836, 198, 262, 571, 1337, 836, 25, 925, 198, 262, 571, 913, 16011, 25, 320, 285, 62, 4399, 11, 374, 2966, 858, 8, 477, 2290, 198, 262, 571, 1337, 16011, 25, 14743, 1577, 11, 528, 8, 477, 2290, 271, 14711, 6075, 512, 755, 636, 2975, 5791, 320, 3231, 2975, 11, 51362, 8438, 11, 24069, 345, 1733, 2748, 2975, 5980, 11, 2385, 7949, 5980, 11, 1584, 28, 15, 11, 3330, 28, 15, 11, 2199, 28, 15, 345, 1733, 836, 39733, 57423, 2748, 7647, 1857, 5980, 11, 16011, 5980, 997, 262, 3270, 262, 2175, 2576, 828, 505, 2728, 2385, 828, 382, 262, 571, 913, 2385, 2975, 25, 2385, 2576, 505, 264, 2723, 4877, 198, 262, 571, 1337, 2385, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 51362, 8438, 25, 1510, 51362, 2237, 198, 262, 571, 1337, 51362, 8438, 25, 1396, 198, 262, 571, 913, 24069, 25, 24069, 1665, 198, 262, 571, 1337, 24069, 25, 24069, 71571, 198, 262, 571, 913, 2748, 2975, 25, 2748, 2576, 198, 262, 571, 1337, 2748, 2975, 25, 925, 477, 2290, 198, 262, 571, 913, 2385, 7949, 25, 2385, 2576, 505, 366, 3231, 29, 4877, 198, 262, 571, 1337, 2385, 7949, 925, 477, 2290, 198, 262, 571, 913, 1584, 25, 1584, 1396, 198, 262, 571, 1337, 1584, 25, 1396, 198, 262, 571, 913, 3330, 25, 3330, 1396, 198, 262, 571, 1337, 3330, 25, 1396, 198, 262, 571, 913, 2199, 25, 2199, 1396, 198, 262, 571, 1337, 2199, 25, 1396, 198, 262, 571, 913, 836, 25, 2723, 836, 198, 262, 571, 1337, 836, 25, 925, 198, 262, 571, 913, 16011, 25, 320, 285, 62, 4399, 11, 374, 2966, 858, 8, 477, 2290, 198, 262, 571, 1337, 16011, 25, 14743, 1577, 11, 528, 8, 477, 2290, 198, 262, 3270, 262, 422, 2385, 2975, 374, 539, 2290, 512, 286, 2385, 2975, 284, 610, 2293, 13, 25535, 35167, 12952, 2975, 340, 286, 674, 2163, 13619, 369 ]
yyuu/botornado
boto/gs/bucket.py
Bucket.set_def_acl
def set_def_acl(self, acl_or_str, key_name='', headers=None): """sets or changes a bucket's default object acl""" if isinstance(acl_or_str, Policy): raise InvalidAclError('Attempt to set S3 Policy on GS ACL') elif isinstance(acl_or_str, ACL): self.set_def_xml_acl(acl_or_str.to_xml(), key_name, headers=headers) else: self.set_def_canned_acl(acl_or_str, key_name, headers=headers)
python
def set_def_acl(self, acl_or_str, key_name='', headers=None): """sets or changes a bucket's default object acl""" if isinstance(acl_or_str, Policy): raise InvalidAclError('Attempt to set S3 Policy on GS ACL') elif isinstance(acl_or_str, ACL): self.set_def_xml_acl(acl_or_str.to_xml(), key_name, headers=headers) else: self.set_def_canned_acl(acl_or_str, key_name, headers=headers)
[ "def", "set_def_acl", "(", "self", ",", "acl_or_str", ",", "key_name", "=", "''", ",", "headers", "=", "None", ")", ":", "if", "isinstance", "(", "acl_or_str", ",", "Policy", ")", ":", "raise", "InvalidAclError", "(", "'Attempt to set S3 Policy on GS ACL'", ")", "elif", "isinstance", "(", "acl_or_str", ",", "ACL", ")", ":", "self", ".", "set_def_xml_acl", "(", "acl_or_str", ".", "to_xml", "(", ")", ",", "key_name", ",", "headers", "=", "headers", ")", "else", ":", "self", ".", "set_def_canned_acl", "(", "acl_or_str", ",", "key_name", ",", "headers", "=", "headers", ")" ]
sets or changes a bucket's default object acl
[ "sets", "or", "changes", "a", "bucket", "s", "default", "object", "acl" ]
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/gs/bucket.py#L53-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: sets or changes a bucket's default object acl ### Response: def set_def_acl(self, acl_or_str, key_name='', headers=None): """sets or changes a bucket's default object acl""" if isinstance(acl_or_str, Policy): raise InvalidAclError('Attempt to set S3 Policy on GS ACL') elif isinstance(acl_or_str, ACL): self.set_def_xml_acl(acl_or_str.to_xml(), key_name, headers=headers) else: self.set_def_canned_acl(acl_or_str, key_name, headers=headers) <|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, 5022, 477, 4442, 264, 15994, 596, 1670, 1665, 58220, 271, 14711, 6075, 512, 755, 743, 8001, 64792, 1214, 11, 58220, 8908, 2966, 11, 1401, 1292, 41662, 7247, 5980, 997, 286, 4304, 5022, 477, 4442, 264, 15994, 596, 1670, 1665, 58220, 7275, 286, 422, 11656, 2948, 566, 8908, 2966, 11, 11216, 997, 310, 4933, 14204, 32, 566, 1480, 493, 48152, 311, 743, 328, 18, 11216, 389, 36370, 44561, 1329, 286, 4508, 11656, 2948, 566, 8908, 2966, 11, 44561, 997, 310, 659, 995, 8001, 24796, 64792, 2948, 566, 8908, 2966, 2446, 24796, 1535, 1401, 1292, 11, 7247, 55185, 340, 286, 775, 512, 310, 659, 995, 8001, 669, 7443, 64792, 2948, 566, 8908, 2966, 11, 1401, 1292, 11, 7247, 55185, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 5022, 477, 4442, 264, 15994, 596, 1670, 1665, 58220, 271, 14711, 6075, 512, 755, 743, 8001, 64792, 1214, 11, 58220, 8908, 2966, 11, 1401, 1292, 41662, 7247, 5980, 997, 286, 4304, 5022, 477, 4442, 264, 15994, 596, 1670, 1665, 58220, 7275, 286, 422, 11656, 2948, 566, 8908, 2966, 11, 11216, 997, 310, 4933, 14204, 32, 566, 1480, 493, 48152, 311, 743, 328, 18, 11216, 389, 36370, 44561, 1329, 286, 4508, 11656, 2948, 566, 8908, 2966, 11, 44561, 997, 310, 659, 995, 8001, 24796, 64792, 2948, 566, 8908, 2966, 2446, 24796, 1535, 1401, 1292, 11, 7247, 55185, 340, 286, 775, 512, 310, 659, 995, 8001, 669, 7443, 64792, 2948, 566, 8908, 2966, 11, 1401, 1292, 11, 7247, 55185, 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 ]
BD2KGenomics/toil-scripts
src/toil_scripts/spladder_pipeline/spladder_pipeline.py
star
def star(job, inputs, r1_cutadapt, r2_cutadapt): """ Performs alignment of fastqs to BAM via STAR :param JobFunctionWrappingJob job: passed by Toil automatically :param Namespace inputs: Stores input arguments (see main) :param str r1_cutadapt: FileStore ID of read 1 fastq :param str r2_cutadapt: FileStore ID of read 2 fastq """ job.fileStore.logToMaster('Aligning with STAR: {}'.format(inputs.uuid)) work_dir = job.fileStore.getLocalTempDir() cores = min(inputs.cores, 16) # Retrieve files job.fileStore.readGlobalFile(r1_cutadapt, os.path.join(work_dir, 'R1_cutadapt.fastq')) job.fileStore.readGlobalFile(r2_cutadapt, os.path.join(work_dir, 'R2_cutadapt.fastq')) # Get starIndex download_url(job=job, url=inputs.star_index, work_dir=work_dir, name='starIndex.tar.gz') subprocess.check_call(['tar', '-xvf', os.path.join(work_dir, 'starIndex.tar.gz'), '-C', work_dir]) # Parameters parameters = ['--runThreadN', str(cores), '--genomeDir', '/data/starIndex', '--outFileNamePrefix', 'rna', '--outSAMtype', 'BAM', 'SortedByCoordinate', '--outSAMunmapped', 'Within', '--quantMode', 'TranscriptomeSAM', '--outSAMattributes', 'NH', 'HI', 'AS', 'NM', 'MD', '--outFilterType', 'BySJout', '--outFilterMultimapNmax', '20', '--outFilterMismatchNmax', '999', '--outFilterMismatchNoverReadLmax', '0.04', '--alignIntronMin', '20', '--alignIntronMax', '1000000', '--alignMatesGapMax', '1000000', '--alignSJoverhangMin', '8', '--alignSJDBoverhangMin', '1', '--sjdbScore', '1', '--readFilesIn', '/data/R1_cutadapt.fastq', '/data/R2_cutadapt.fastq'] # Call: STAR Map docker_call(job=job, tool='quay.io/ucsc_cgl/star:2.4.2a--bcbd5122b69ff6ac4ef61958e47bde94001cfe80', work_dir=work_dir, parameters=parameters) # Call Samtools Index index_command = ['index', '/data/rnaAligned.sortedByCoord.out.bam'] docker_call(job=job, work_dir=work_dir, parameters=index_command, tool='quay.io/ucsc_cgl/samtools:1.3--256539928ea162949d8a65ca5c79a72ef557ce7c') # fileStore bam_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, 'rnaAligned.sortedByCoord.out.bam')) bai_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, 'rnaAligned.sortedByCoord.out.bam.bai')) job.fileStore.deleteGlobalFile(r1_cutadapt) job.fileStore.deleteGlobalFile(r2_cutadapt) # Launch children and follow-on vcqc_id = job.addChildJobFn(variant_calling_and_qc, inputs, bam_id, bai_id, cores=2, disk='30G').rv() spladder_id = job.addChildJobFn(spladder, inputs, bam_id, bai_id, disk='30G').rv() job.addFollowOnJobFn(consolidate_output_tarballs, inputs, vcqc_id, spladder_id, disk='30G')
python
def star(job, inputs, r1_cutadapt, r2_cutadapt): """ Performs alignment of fastqs to BAM via STAR :param JobFunctionWrappingJob job: passed by Toil automatically :param Namespace inputs: Stores input arguments (see main) :param str r1_cutadapt: FileStore ID of read 1 fastq :param str r2_cutadapt: FileStore ID of read 2 fastq """ job.fileStore.logToMaster('Aligning with STAR: {}'.format(inputs.uuid)) work_dir = job.fileStore.getLocalTempDir() cores = min(inputs.cores, 16) # Retrieve files job.fileStore.readGlobalFile(r1_cutadapt, os.path.join(work_dir, 'R1_cutadapt.fastq')) job.fileStore.readGlobalFile(r2_cutadapt, os.path.join(work_dir, 'R2_cutadapt.fastq')) # Get starIndex download_url(job=job, url=inputs.star_index, work_dir=work_dir, name='starIndex.tar.gz') subprocess.check_call(['tar', '-xvf', os.path.join(work_dir, 'starIndex.tar.gz'), '-C', work_dir]) # Parameters parameters = ['--runThreadN', str(cores), '--genomeDir', '/data/starIndex', '--outFileNamePrefix', 'rna', '--outSAMtype', 'BAM', 'SortedByCoordinate', '--outSAMunmapped', 'Within', '--quantMode', 'TranscriptomeSAM', '--outSAMattributes', 'NH', 'HI', 'AS', 'NM', 'MD', '--outFilterType', 'BySJout', '--outFilterMultimapNmax', '20', '--outFilterMismatchNmax', '999', '--outFilterMismatchNoverReadLmax', '0.04', '--alignIntronMin', '20', '--alignIntronMax', '1000000', '--alignMatesGapMax', '1000000', '--alignSJoverhangMin', '8', '--alignSJDBoverhangMin', '1', '--sjdbScore', '1', '--readFilesIn', '/data/R1_cutadapt.fastq', '/data/R2_cutadapt.fastq'] # Call: STAR Map docker_call(job=job, tool='quay.io/ucsc_cgl/star:2.4.2a--bcbd5122b69ff6ac4ef61958e47bde94001cfe80', work_dir=work_dir, parameters=parameters) # Call Samtools Index index_command = ['index', '/data/rnaAligned.sortedByCoord.out.bam'] docker_call(job=job, work_dir=work_dir, parameters=index_command, tool='quay.io/ucsc_cgl/samtools:1.3--256539928ea162949d8a65ca5c79a72ef557ce7c') # fileStore bam_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, 'rnaAligned.sortedByCoord.out.bam')) bai_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, 'rnaAligned.sortedByCoord.out.bam.bai')) job.fileStore.deleteGlobalFile(r1_cutadapt) job.fileStore.deleteGlobalFile(r2_cutadapt) # Launch children and follow-on vcqc_id = job.addChildJobFn(variant_calling_and_qc, inputs, bam_id, bai_id, cores=2, disk='30G').rv() spladder_id = job.addChildJobFn(spladder, inputs, bam_id, bai_id, disk='30G').rv() job.addFollowOnJobFn(consolidate_output_tarballs, inputs, vcqc_id, spladder_id, disk='30G')
[ "def", "star", "(", "job", ",", "inputs", ",", "r1_cutadapt", ",", "r2_cutadapt", ")", ":", "job", ".", "fileStore", ".", "logToMaster", "(", "'Aligning with STAR: {}'", ".", "format", "(", "inputs", ".", "uuid", ")", ")", "work_dir", "=", "job", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "cores", "=", "min", "(", "inputs", ".", "cores", ",", "16", ")", "# Retrieve files", "job", ".", "fileStore", ".", "readGlobalFile", "(", "r1_cutadapt", ",", "os", ".", "path", ".", "join", "(", "work_dir", ",", "'R1_cutadapt.fastq'", ")", ")", "job", ".", "fileStore", ".", "readGlobalFile", "(", "r2_cutadapt", ",", "os", ".", "path", ".", "join", "(", "work_dir", ",", "'R2_cutadapt.fastq'", ")", ")", "# Get starIndex", "download_url", "(", "job", "=", "job", ",", "url", "=", "inputs", ".", "star_index", ",", "work_dir", "=", "work_dir", ",", "name", "=", "'starIndex.tar.gz'", ")", "subprocess", ".", "check_call", "(", "[", "'tar'", ",", "'-xvf'", ",", "os", ".", "path", ".", "join", "(", "work_dir", ",", "'starIndex.tar.gz'", ")", ",", "'-C'", ",", "work_dir", "]", ")", "# Parameters", "parameters", "=", "[", "'--runThreadN'", ",", "str", "(", "cores", ")", ",", "'--genomeDir'", ",", "'/data/starIndex'", ",", "'--outFileNamePrefix'", ",", "'rna'", ",", "'--outSAMtype'", ",", "'BAM'", ",", "'SortedByCoordinate'", ",", "'--outSAMunmapped'", ",", "'Within'", ",", "'--quantMode'", ",", "'TranscriptomeSAM'", ",", "'--outSAMattributes'", ",", "'NH'", ",", "'HI'", ",", "'AS'", ",", "'NM'", ",", "'MD'", ",", "'--outFilterType'", ",", "'BySJout'", ",", "'--outFilterMultimapNmax'", ",", "'20'", ",", "'--outFilterMismatchNmax'", ",", "'999'", ",", "'--outFilterMismatchNoverReadLmax'", ",", "'0.04'", ",", "'--alignIntronMin'", ",", "'20'", ",", "'--alignIntronMax'", ",", "'1000000'", ",", "'--alignMatesGapMax'", ",", "'1000000'", ",", "'--alignSJoverhangMin'", ",", "'8'", ",", "'--alignSJDBoverhangMin'", ",", "'1'", ",", "'--sjdbScore'", ",", "'1'", ",", "'--readFilesIn'", ",", "'/data/R1_cutadapt.fastq'", ",", "'/data/R2_cutadapt.fastq'", "]", "# Call: STAR Map", "docker_call", "(", "job", "=", "job", ",", "tool", "=", "'quay.io/ucsc_cgl/star:2.4.2a--bcbd5122b69ff6ac4ef61958e47bde94001cfe80'", ",", "work_dir", "=", "work_dir", ",", "parameters", "=", "parameters", ")", "# Call Samtools Index", "index_command", "=", "[", "'index'", ",", "'/data/rnaAligned.sortedByCoord.out.bam'", "]", "docker_call", "(", "job", "=", "job", ",", "work_dir", "=", "work_dir", ",", "parameters", "=", "index_command", ",", "tool", "=", "'quay.io/ucsc_cgl/samtools:1.3--256539928ea162949d8a65ca5c79a72ef557ce7c'", ")", "# fileStore", "bam_id", "=", "job", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "'rnaAligned.sortedByCoord.out.bam'", ")", ")", "bai_id", "=", "job", ".", "fileStore", ".", "writeGlobalFile", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "'rnaAligned.sortedByCoord.out.bam.bai'", ")", ")", "job", ".", "fileStore", ".", "deleteGlobalFile", "(", "r1_cutadapt", ")", "job", ".", "fileStore", ".", "deleteGlobalFile", "(", "r2_cutadapt", ")", "# Launch children and follow-on", "vcqc_id", "=", "job", ".", "addChildJobFn", "(", "variant_calling_and_qc", ",", "inputs", ",", "bam_id", ",", "bai_id", ",", "cores", "=", "2", ",", "disk", "=", "'30G'", ")", ".", "rv", "(", ")", "spladder_id", "=", "job", ".", "addChildJobFn", "(", "spladder", ",", "inputs", ",", "bam_id", ",", "bai_id", ",", "disk", "=", "'30G'", ")", ".", "rv", "(", ")", "job", ".", "addFollowOnJobFn", "(", "consolidate_output_tarballs", ",", "inputs", ",", "vcqc_id", ",", "spladder_id", ",", "disk", "=", "'30G'", ")" ]
Performs alignment of fastqs to BAM via STAR :param JobFunctionWrappingJob job: passed by Toil automatically :param Namespace inputs: Stores input arguments (see main) :param str r1_cutadapt: FileStore ID of read 1 fastq :param str r2_cutadapt: FileStore ID of read 2 fastq
[ "Performs", "alignment", "of", "fastqs", "to", "BAM", "via", "STAR" ]
train
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L180-L232
<|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: Performs alignment of fastqs to BAM via STAR :param JobFunctionWrappingJob job: passed by Toil automatically :param Namespace inputs: Stores input arguments (see main) :param str r1_cutadapt: FileStore ID of read 1 fastq :param str r2_cutadapt: FileStore ID of read 2 fastq ### Response: def star(job, inputs, r1_cutadapt, r2_cutadapt): """ Performs alignment of fastqs to BAM via STAR :param JobFunctionWrappingJob job: passed by Toil automatically :param Namespace inputs: Stores input arguments (see main) :param str r1_cutadapt: FileStore ID of read 1 fastq :param str r2_cutadapt: FileStore ID of read 2 fastq """ job.fileStore.logToMaster('Aligning with STAR: {}'.format(inputs.uuid)) work_dir = job.fileStore.getLocalTempDir() cores = min(inputs.cores, 16) # Retrieve files job.fileStore.readGlobalFile(r1_cutadapt, os.path.join(work_dir, 'R1_cutadapt.fastq')) job.fileStore.readGlobalFile(r2_cutadapt, os.path.join(work_dir, 'R2_cutadapt.fastq')) # Get starIndex download_url(job=job, url=inputs.star_index, work_dir=work_dir, name='starIndex.tar.gz') subprocess.check_call(['tar', '-xvf', os.path.join(work_dir, 'starIndex.tar.gz'), '-C', work_dir]) # Parameters parameters = ['--runThreadN', str(cores), '--genomeDir', '/data/starIndex', '--outFileNamePrefix', 'rna', '--outSAMtype', 'BAM', 'SortedByCoordinate', '--outSAMunmapped', 'Within', '--quantMode', 'TranscriptomeSAM', '--outSAMattributes', 'NH', 'HI', 'AS', 'NM', 'MD', '--outFilterType', 'BySJout', '--outFilterMultimapNmax', '20', '--outFilterMismatchNmax', '999', '--outFilterMismatchNoverReadLmax', '0.04', '--alignIntronMin', '20', '--alignIntronMax', '1000000', '--alignMatesGapMax', '1000000', '--alignSJoverhangMin', '8', '--alignSJDBoverhangMin', '1', '--sjdbScore', '1', '--readFilesIn', '/data/R1_cutadapt.fastq', '/data/R2_cutadapt.fastq'] # Call: STAR Map docker_call(job=job, tool='quay.io/ucsc_cgl/star:2.4.2a--bcbd5122b69ff6ac4ef61958e47bde94001cfe80', work_dir=work_dir, parameters=parameters) # Call Samtools Index index_command = ['index', '/data/rnaAligned.sortedByCoord.out.bam'] docker_call(job=job, work_dir=work_dir, parameters=index_command, tool='quay.io/ucsc_cgl/samtools:1.3--256539928ea162949d8a65ca5c79a72ef557ce7c') # fileStore bam_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, 'rnaAligned.sortedByCoord.out.bam')) bai_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, 'rnaAligned.sortedByCoord.out.bam.bai')) job.fileStore.deleteGlobalFile(r1_cutadapt) job.fileStore.deleteGlobalFile(r2_cutadapt) # Launch children and follow-on vcqc_id = job.addChildJobFn(variant_calling_and_qc, inputs, bam_id, bai_id, cores=2, disk='30G').rv() spladder_id = job.addChildJobFn(spladder, inputs, bam_id, bai_id, disk='30G').rv() job.addFollowOnJobFn(consolidate_output_tarballs, inputs, vcqc_id, spladder_id, disk='30G') <|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, 3976, 10008, 17632, 315, 5043, 27455, 311, 93227, 4669, 57845, 271, 262, 551, 913, 12280, 5263, 36314, 3713, 12524, 2683, 25, 5946, 555, 2057, 321, 9651, 198, 262, 551, 913, 43062, 11374, 25, 39402, 1988, 6105, 320, 4151, 1925, 340, 262, 551, 913, 610, 436, 16, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 16, 5043, 80, 198, 262, 551, 913, 610, 436, 17, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 17, 5043, 80, 271, 14711, 6075, 512, 755, 6917, 29429, 11, 11374, 11, 436, 16, 42417, 89171, 11, 436, 17, 42417, 89171, 997, 262, 3270, 262, 58816, 17632, 315, 5043, 27455, 311, 93227, 4669, 57845, 271, 262, 551, 913, 12280, 5263, 36314, 3713, 12524, 2683, 25, 5946, 555, 2057, 321, 9651, 198, 262, 551, 913, 43062, 11374, 25, 39402, 1988, 6105, 320, 4151, 1925, 340, 262, 551, 913, 610, 436, 16, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 16, 5043, 80, 198, 262, 551, 913, 610, 436, 17, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 17, 5043, 80, 198, 262, 3270, 262, 2683, 9914, 6221, 1699, 1271, 18532, 493, 10275, 287, 449, 57845, 25, 26307, 2293, 35099, 32247, 1192, 262, 990, 4432, 284, 2683, 9914, 6221, 67041, 12427, 6315, 746, 262, 36804, 284, 1332, 35099, 522, 4692, 11, 220, 845, 340, 262, 674, 32662, 3626, 198, 262, 2683, 9914, 6221, 4217, 11907, 1738, 2666, 16, 42417, 89171, 11, 2709, 3960, 5563, 32570, 4432, 11, 364, 49, 16, 42417, 89171, 40670, 80, 7132, 262, 2683, 9914, 6221, 4217, 11907, 1738, 2666, 17, 42417, 89171, 11, 2709, 3960, 5563, 32570, 4432, 11, 364, 49, 17, 42417, 89171, 40670, 80, 7132, 262, 674, 2175, 6917, 1581, 198, 262, 4232, 2975, 29429, 28, 8975, 11, 2576, 28, 25986, 53682, 3644, 11, 990, 4432, 28, 1816, 4432, 11, 836, 1151, 12134, 1581, 29148, 21637, 1329, 262, 24418, 9271, 13735, 6561, 27835, 518, 7944, 87, 46341, 518, 2709, 3960, 5563, 32570, 4432, 11, 364, 12134, 1581, 29148, 21637, 4670, 7944, 34, 518, 990, 4432, 2608, 262, 674, 13831, 198, 262, 5137, 284, 2570, 313, 6236, 6998, 45, 518, 610, 7, 7857, 1350, 1733, 17753, 89045, 6315, 518, 3434, 695, 80364, 1581, 756, 1733, 17753, 412, 11143, 14672, 518, 364, 90331, 756, 1733, 17753, 412, 87434, 1337, 518, 364, 33, 1428, 518, 364, 52151, 1383, 29689, 756, 1733, 17753, 412, 87434, 359, 66471, 518, 364, 43061, 756, 1733, 17753, 31548, 3720, 518, 364, 3246, 1250, 638, 87434, 756, 1733, 17753, 412, 87434, 12620, 518, 364, 52371, 518, 364, 24860, 518, 364, 1950, 518, 364, 38425, 518, 364, 6204, 756, 1733, 17753, 412, 5750, 941, 518, 364, 1383, 98589, 412, 756, 1733, 17753, 412, 5750, 41504, 41042, 45, 2880, 518, 364, 508, 756, 1733, 17753, 412, 5750, 83672, 45, 2880, 518, 364, 5500, 756, 1733, 17753, 412, 5750, 83672, 45, 2017, 4518, 43 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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5043, 27455, 311, 93227, 4669, 57845, 271, 262, 551, 913, 12280, 5263, 36314, 3713, 12524, 2683, 25, 5946, 555, 2057, 321, 9651, 198, 262, 551, 913, 43062, 11374, 25, 39402, 1988, 6105, 320, 4151, 1925, 340, 262, 551, 913, 610, 436, 16, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 16, 5043, 80, 198, 262, 551, 913, 610, 436, 17, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 17, 5043, 80, 271, 14711, 6075, 512, 755, 6917, 29429, 11, 11374, 11, 436, 16, 42417, 89171, 11, 436, 17, 42417, 89171, 997, 262, 3270, 262, 58816, 17632, 315, 5043, 27455, 311, 93227, 4669, 57845, 271, 262, 551, 913, 12280, 5263, 36314, 3713, 12524, 2683, 25, 5946, 555, 2057, 321, 9651, 198, 262, 551, 913, 43062, 11374, 25, 39402, 1988, 6105, 320, 4151, 1925, 340, 262, 551, 913, 610, 436, 16, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 16, 5043, 80, 198, 262, 551, 913, 610, 436, 17, 42417, 89171, 25, 2958, 6221, 3110, 315, 1373, 220, 17, 5043, 80, 198, 262, 3270, 262, 2683, 9914, 6221, 1699, 1271, 18532, 493, 10275, 287, 449, 57845, 25, 26307, 2293, 35099, 32247, 1192, 262, 990, 4432, 284, 2683, 9914, 6221, 67041, 12427, 6315, 746, 262, 36804, 284, 1332, 35099, 522, 4692, 11, 220, 845, 340, 262, 674, 32662, 3626, 198, 262, 2683, 9914, 6221, 4217, 11907, 1738, 2666, 16, 42417, 89171, 11, 2709, 3960, 5563, 32570, 4432, 11, 364, 49, 16, 42417, 89171, 40670, 80, 7132, 262, 2683, 9914, 6221, 4217, 11907, 1738, 2666, 17, 42417, 89171, 11, 2709, 3960, 5563, 32570, 4432, 11, 364, 49, 17, 42417, 89171, 40670, 80, 7132, 262, 674, 2175, 6917, 1581, 198, 262, 4232, 2975, 29429, 28, 8975, 11, 2576, 28, 25986, 53682, 3644, 11, 990, 4432, 28, 1816, 4432, 11, 836, 1151, 12134, 1581, 29148, 21637, 1329, 262, 24418, 9271, 13735, 6561, 27835, 518, 7944, 87, 46341, 518, 2709, 3960, 5563, 32570, 4432, 11, 364, 12134, 1581, 29148, 21637, 4670, 7944, 34, 518, 990, 4432, 2608, 262, 674, 13831, 198, 262, 5137, 284, 2570, 313, 6236, 6998, 45, 518, 610, 7, 7857, 1350, 1733, 17753, 89045, 6315, 518, 3434, 695, 80364, 1581, 756, 1733, 17753, 412, 11143, 14672, 518, 364, 90331, 756, 1733, 17753, 412, 87434, 1337, 518, 364, 33, 1428, 518, 364, 52151, 1383, 29689, 756, 1733, 17753, 412, 87434, 359, 66471, 518, 364, 43061, 756, 1733, 17753, 31548, 3720, 518, 364, 3246, 1250, 638, 87434, 756, 1733, 17753, 412, 87434, 12620, 518, 364, 52371, 518, 364, 24860, 518, 364, 1950, 518, 364, 38425, 518, 364, 6204, 756, 1733, 17753, 412, 5750, 941, 518, 364, 1383, 98589, 412, 756, 1733, 17753, 412, 5750, 41504, 41042, 45, 2880, 518, 364, 508, 756, 1733, 17753, 412, 5750, 83672, 45, 2880, 518, 364, 5500, 756, 1733, 17753, 412, 5750, 83672, 45, 2017, 4518, 43 ]
f3at/feat
src/feat/common/manhole.py
Parser.split
def split(self, text): ''' Splits the text with function arguments into the array with first class citizens separated. See the unit tests for clarificatin. ''' # nesting character -> count counters = {"'": False, '(': 0} def reverse(char): def wrapped(): counters[char] = not counters[char] return wrapped def increase(char): def wrapped(): counters[char] += 1 return wrapped def decrease(char): def wrapped(): counters[char] -= 1 return wrapped def is_top_level(): return all([not x for x in counters.values()]) def fail(): raise BadSyntax('Syntax error processing line: %s' %\ self._last_line) temp = "" # end of field flag indicates that we expect next character to be # either whitespace of split eof_flag = False def append_char(temp, char): if eof_flag: fail() temp += char return temp # dictionary char -> handler nesters = {"'": reverse("'"), "(": increase('('), ")": decrease('(')} # chars to split on split = (',', ) # chars to swallow consume = (' ', '\n') result = list() self.log("spliting: %s", text) for char in text: if char in nesters: nesters[char]() temp = append_char(temp, char) elif not is_top_level(): temp = append_char(temp, char) elif char in consume: if len(temp) > 0: eof_flag = True continue elif char in split: result.append(temp) temp = "" eof_flag = False else: temp = append_char(temp, char) if len(temp) > 0: result.append(temp) if not is_top_level(): fail() self.log('Split returns %r', result) return result
python
def split(self, text): ''' Splits the text with function arguments into the array with first class citizens separated. See the unit tests for clarificatin. ''' # nesting character -> count counters = {"'": False, '(': 0} def reverse(char): def wrapped(): counters[char] = not counters[char] return wrapped def increase(char): def wrapped(): counters[char] += 1 return wrapped def decrease(char): def wrapped(): counters[char] -= 1 return wrapped def is_top_level(): return all([not x for x in counters.values()]) def fail(): raise BadSyntax('Syntax error processing line: %s' %\ self._last_line) temp = "" # end of field flag indicates that we expect next character to be # either whitespace of split eof_flag = False def append_char(temp, char): if eof_flag: fail() temp += char return temp # dictionary char -> handler nesters = {"'": reverse("'"), "(": increase('('), ")": decrease('(')} # chars to split on split = (',', ) # chars to swallow consume = (' ', '\n') result = list() self.log("spliting: %s", text) for char in text: if char in nesters: nesters[char]() temp = append_char(temp, char) elif not is_top_level(): temp = append_char(temp, char) elif char in consume: if len(temp) > 0: eof_flag = True continue elif char in split: result.append(temp) temp = "" eof_flag = False else: temp = append_char(temp, char) if len(temp) > 0: result.append(temp) if not is_top_level(): fail() self.log('Split returns %r', result) return result
[ "def", "split", "(", "self", ",", "text", ")", ":", "# nesting character -> count", "counters", "=", "{", "\"'\"", ":", "False", ",", "'('", ":", "0", "}", "def", "reverse", "(", "char", ")", ":", "def", "wrapped", "(", ")", ":", "counters", "[", "char", "]", "=", "not", "counters", "[", "char", "]", "return", "wrapped", "def", "increase", "(", "char", ")", ":", "def", "wrapped", "(", ")", ":", "counters", "[", "char", "]", "+=", "1", "return", "wrapped", "def", "decrease", "(", "char", ")", ":", "def", "wrapped", "(", ")", ":", "counters", "[", "char", "]", "-=", "1", "return", "wrapped", "def", "is_top_level", "(", ")", ":", "return", "all", "(", "[", "not", "x", "for", "x", "in", "counters", ".", "values", "(", ")", "]", ")", "def", "fail", "(", ")", ":", "raise", "BadSyntax", "(", "'Syntax error processing line: %s'", "%", "self", ".", "_last_line", ")", "temp", "=", "\"\"", "# end of field flag indicates that we expect next character to be", "# either whitespace of split", "eof_flag", "=", "False", "def", "append_char", "(", "temp", ",", "char", ")", ":", "if", "eof_flag", ":", "fail", "(", ")", "temp", "+=", "char", "return", "temp", "# dictionary char -> handler", "nesters", "=", "{", "\"'\"", ":", "reverse", "(", "\"'\"", ")", ",", "\"(\"", ":", "increase", "(", "'('", ")", ",", "\")\"", ":", "decrease", "(", "'('", ")", "}", "# chars to split on", "split", "=", "(", "','", ",", ")", "# chars to swallow", "consume", "=", "(", "' '", ",", "'\\n'", ")", "result", "=", "list", "(", ")", "self", ".", "log", "(", "\"spliting: %s\"", ",", "text", ")", "for", "char", "in", "text", ":", "if", "char", "in", "nesters", ":", "nesters", "[", "char", "]", "(", ")", "temp", "=", "append_char", "(", "temp", ",", "char", ")", "elif", "not", "is_top_level", "(", ")", ":", "temp", "=", "append_char", "(", "temp", ",", "char", ")", "elif", "char", "in", "consume", ":", "if", "len", "(", "temp", ")", ">", "0", ":", "eof_flag", "=", "True", "continue", "elif", "char", "in", "split", ":", "result", ".", "append", "(", "temp", ")", "temp", "=", "\"\"", "eof_flag", "=", "False", "else", ":", "temp", "=", "append_char", "(", "temp", ",", "char", ")", "if", "len", "(", "temp", ")", ">", "0", ":", "result", ".", "append", "(", "temp", ")", "if", "not", "is_top_level", "(", ")", ":", "fail", "(", ")", "self", ".", "log", "(", "'Split returns %r'", ",", "result", ")", "return", "result" ]
Splits the text with function arguments into the array with first class citizens separated. See the unit tests for clarificatin.
[ "Splits", "the", "text", "with", "function", "arguments", "into", "the", "array", "with", "first", "class", "citizens", "separated", ".", "See", "the", "unit", "tests", "for", "clarificatin", "." ]
train
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/common/manhole.py#L155-L233
<|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: Splits the text with function arguments into the array with first class citizens separated. See the unit tests for clarificatin. ### Response: def split(self, text): ''' Splits the text with function arguments into the array with first class citizens separated. See the unit tests for clarificatin. ''' # nesting character -> count counters = {"'": False, '(': 0} def reverse(char): def wrapped(): counters[char] = not counters[char] return wrapped def increase(char): def wrapped(): counters[char] += 1 return wrapped def decrease(char): def wrapped(): counters[char] -= 1 return wrapped def is_top_level(): return all([not x for x in counters.values()]) def fail(): raise BadSyntax('Syntax error processing line: %s' %\ self._last_line) temp = "" # end of field flag indicates that we expect next character to be # either whitespace of split eof_flag = False def append_char(temp, char): if eof_flag: fail() temp += char return temp # dictionary char -> handler nesters = {"'": reverse("'"), "(": increase('('), ")": decrease('(')} # chars to split on split = (',', ) # chars to swallow consume = (' ', '\n') result = list() self.log("spliting: %s", text) for char in text: if char in nesters: nesters[char]() temp = append_char(temp, char) elif not is_top_level(): temp = append_char(temp, char) elif char in consume: if len(temp) > 0: eof_flag = True continue elif char in split: result.append(temp) temp = "" eof_flag = False else: temp = append_char(temp, char) if len(temp) > 0: result.append(temp) if not is_top_level(): fail() self.log('Split returns %r', result) return result <|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, 50, 40133, 279, 1495, 449, 734, 6105, 1139, 279, 1358, 449, 1176, 198, 286, 538, 10495, 19180, 13, 3580, 279, 5089, 7177, 369, 20064, 1104, 15111, 382, 14711, 6075, 512, 755, 6859, 1214, 11, 1495, 997, 286, 11414, 286, 328, 40133, 279, 1495, 449, 734, 6105, 1139, 279, 1358, 449, 1176, 198, 286, 538, 10495, 19180, 13, 3580, 279, 5089, 7177, 369, 20064, 1104, 15111, 627, 286, 11414, 286, 674, 67810, 3752, 1492, 1797, 198, 286, 32632, 284, 5324, 6, 794, 3641, 11, 364, 16364, 220, 15, 633, 286, 711, 10134, 7078, 7887, 310, 711, 20037, 4019, 394, 32632, 93800, 60, 284, 539, 32632, 93800, 933, 310, 471, 20037, 271, 286, 711, 5376, 7078, 7887, 310, 711, 20037, 4019, 394, 32632, 93800, 60, 1447, 220, 16, 198, 310, 471, 20037, 271, 286, 711, 18979, 7078, 7887, 310, 711, 20037, 4019, 394, 32632, 93800, 60, 6110, 220, 16, 198, 310, 471, 20037, 271, 286, 711, 374, 10643, 8438, 4019, 310, 471, 682, 2625, 1962, 865, 369, 865, 304, 32632, 10883, 368, 9801, 286, 711, 3775, 4019, 310, 4933, 11717, 34990, 493, 34990, 1493, 8863, 1584, 25, 1034, 82, 6, 1034, 5779, 1014, 659, 1462, 4354, 6665, 3707, 286, 2798, 284, 8555, 286, 674, 842, 315, 2115, 5292, 15151, 430, 584, 1755, 1828, 3752, 311, 387, 198, 286, 674, 3060, 37472, 315, 6859, 198, 286, 77860, 11173, 284, 3641, 271, 286, 711, 8911, 9415, 9957, 11, 1181, 997, 310, 422, 77860, 11173, 512, 394, 3775, 746, 310, 2798, 1447, 1181, 198, 310, 471, 2798, 271, 286, 674, 11240, 1181, 1492, 7158, 198, 286, 23634, 388, 284, 5324, 6, 794, 10134, 46556, 4063, 330, 19427, 5376, 90956, 705, 12590, 794, 18979, 90956, 10792, 286, 674, 23861, 311, 6859, 389, 198, 286, 6859, 284, 320, 518, 518, 1763, 286, 674, 23861, 311, 42276, 198, 286, 25024, 284, 4417, 6752, 5307, 77, 4713, 286, 1121, 284, 1160, 2892, 286, 659, 1699, 446, 7105, 287, 25, 1034, 82, 498, 1495, 696, 286, 369, 1181, 304, 1495, 512, 310, 422, 1181, 304, 23634, 388, 512, 394, 23634, 388, 93800, 37722, 394, 2798, 284, 8911, 9415, 9957, 11, 1181, 340, 310, 4508, 539, 374, 10643, 8438, 4019, 394, 2798, 284, 8911, 9415, 9957, 11, 1181, 340, 310, 4508, 1181, 304, 25024, 512, 394, 422, 2479, 9957, 8, 871, 220, 15, 512, 504, 77860, 11173, 284, 3082, 198, 394, 3136, 198, 310, 4508, 1181, 304, 6859, 512, 394, 1121, 2102, 9957, 340, 394, 2798, 284, 8555, 394, 77860, 11173, 284, 3641, 198, 310, 775, 512, 394, 2798, 284, 8911, 9415, 9957, 11, 1181, 340, 286, 422, 2479, 9957, 8, 871, 220, 15, 512, 310, 1121, 2102, 9957, 696, 286, 422, 539, 374, 10643, 8438, 4019, 310, 3775, 746, 286, 659, 1699, 493, 20805, 4780, 1034, 81, 518, 1121, 340, 286, 471, 1121, 198, 27, 91, 8862, 728, 428, 91, 29, 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,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 1193, 304, 6498, 382, 14711, 5546, 512, 50, 40133, 279, 1495, 449, 734, 6105, 1139, 279, 1358, 449, 1176, 198, 286, 538, 10495, 19180, 13, 3580, 279, 5089, 7177, 369, 20064, 1104, 15111, 382, 14711, 6075, 512, 755, 6859, 1214, 11, 1495, 997, 286, 11414, 286, 328, 40133, 279, 1495, 449, 734, 6105, 1139, 279, 1358, 449, 1176, 198, 286, 538, 10495, 19180, 13, 3580, 279, 5089, 7177, 369, 20064, 1104, 15111, 627, 286, 11414, 286, 674, 67810, 3752, 1492, 1797, 198, 286, 32632, 284, 5324, 6, 794, 3641, 11, 364, 16364, 220, 15, 633, 286, 711, 10134, 7078, 7887, 310, 711, 20037, 4019, 394, 32632, 93800, 60, 284, 539, 32632, 93800, 933, 310, 471, 20037, 271, 286, 711, 5376, 7078, 7887, 310, 711, 20037, 4019, 394, 32632, 93800, 60, 1447, 220, 16, 198, 310, 471, 20037, 271, 286, 711, 18979, 7078, 7887, 310, 711, 20037, 4019, 394, 32632, 93800, 60, 6110, 220, 16, 198, 310, 471, 20037, 271, 286, 711, 374, 10643, 8438, 4019, 310, 471, 682, 2625, 1962, 865, 369, 865, 304, 32632, 10883, 368, 9801, 286, 711, 3775, 4019, 310, 4933, 11717, 34990, 493, 34990, 1493, 8863, 1584, 25, 1034, 82, 6, 1034, 5779, 1014, 659, 1462, 4354, 6665, 3707, 286, 2798, 284, 8555, 286, 674, 842, 315, 2115, 5292, 15151, 430, 584, 1755, 1828, 3752, 311, 387, 198, 286, 674, 3060, 37472, 315, 6859, 198, 286, 77860, 11173, 284, 3641, 271, 286, 711, 8911, 9415, 9957, 11, 1181, 997, 310, 422, 77860, 11173, 512, 394, 3775, 746, 310, 2798, 1447, 1181, 198, 310, 471, 2798, 271, 286, 674, 11240, 1181, 1492, 7158, 198, 286, 23634, 388, 284, 5324, 6, 794, 10134, 46556, 4063, 330, 19427, 5376, 90956, 705, 12590, 794, 18979, 90956, 10792, 286, 674, 23861, 311, 6859, 389, 198, 286, 6859, 284, 320, 518, 518, 1763, 286, 674, 23861, 311, 42276, 198, 286, 25024, 284, 4417, 6752, 5307, 77, 4713, 286, 1121, 284, 1160, 2892, 286, 659, 1699, 446, 7105, 287, 25, 1034, 82, 498, 1495, 696, 286, 369, 1181, 304, 1495, 512, 310, 422, 1181, 304, 23634, 388, 512, 394, 23634, 388, 93800, 37722, 394, 2798, 284, 8911, 9415, 9957, 11, 1181, 340, 310, 4508, 539, 374, 10643, 8438, 4019, 394, 2798, 284, 8911, 9415, 9957, 11, 1181, 340, 310, 4508, 1181, 304, 25024, 512, 394, 422, 2479, 9957, 8, 871, 220, 15, 512, 504, 77860, 11173, 284, 3082, 198, 394, 3136, 198, 310, 4508, 1181, 304, 6859, 512, 394, 1121, 2102, 9957, 340, 394, 2798, 284, 8555, 394, 77860, 11173, 284, 3641, 198, 310, 775, 512, 394, 2798, 284, 8911, 9415, 9957, 11, 1181, 340, 286, 422, 2479, 9957, 8, 871, 220, 15, 512, 310, 1121, 2102, 9957, 696, 286, 422, 539, 374, 10643, 8438, 4019, 310, 3775, 746, 286, 659, 1699, 493, 20805, 4780, 1034, 81, 518, 1121, 340, 286, 471, 1121, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009 ]
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.get_available_ip6
def get_available_ip6(self, id_network6): """ Get a available IP in Network ipv6 :param id_network6: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip6': {'ip6': < available_ip6 >}} :raise IpNotAvailableError: Network dont have available IP. :raise NetworkIPv4NotFoundError: Network was not found. :raise UserNotAuthorizedError: User dont have permission to get a available IP. :raise InvalidParameterError: Network ipv6 identifier is none or invalid. :raise XMLError: Networkapi failed to generate the XML response. :raise DataBaseError: Networkapi failed to access the database. """ if not is_valid_int_param(id_network6): raise InvalidParameterError( u'Network ipv6 identifier is invalid or was not informed.') url = 'ip/availableip6/' + str(id_network6) + "/" code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def get_available_ip6(self, id_network6): """ Get a available IP in Network ipv6 :param id_network6: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip6': {'ip6': < available_ip6 >}} :raise IpNotAvailableError: Network dont have available IP. :raise NetworkIPv4NotFoundError: Network was not found. :raise UserNotAuthorizedError: User dont have permission to get a available IP. :raise InvalidParameterError: Network ipv6 identifier is none or invalid. :raise XMLError: Networkapi failed to generate the XML response. :raise DataBaseError: Networkapi failed to access the database. """ if not is_valid_int_param(id_network6): raise InvalidParameterError( u'Network ipv6 identifier is invalid or was not informed.') url = 'ip/availableip6/' + str(id_network6) + "/" code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "get_available_ip6", "(", "self", ",", "id_network6", ")", ":", "if", "not", "is_valid_int_param", "(", "id_network6", ")", ":", "raise", "InvalidParameterError", "(", "u'Network ipv6 identifier is invalid or was not informed.'", ")", "url", "=", "'ip/availableip6/'", "+", "str", "(", "id_network6", ")", "+", "\"/\"", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Get a available IP in Network ipv6 :param id_network6: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip6': {'ip6': < available_ip6 >}} :raise IpNotAvailableError: Network dont have available IP. :raise NetworkIPv4NotFoundError: Network was not found. :raise UserNotAuthorizedError: User dont have permission to get a available IP. :raise InvalidParameterError: Network ipv6 identifier is none or invalid. :raise XMLError: Networkapi failed to generate the XML response. :raise DataBaseError: Networkapi failed to access the database.
[ "Get", "a", "available", "IP", "in", "Network", "ipv6" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L275-L304
<|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: Get a available IP in Network ipv6 :param id_network6: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip6': {'ip6': < available_ip6 >}} :raise IpNotAvailableError: Network dont have available IP. :raise NetworkIPv4NotFoundError: Network was not found. :raise UserNotAuthorizedError: User dont have permission to get a available IP. :raise InvalidParameterError: Network ipv6 identifier is none or invalid. :raise XMLError: Networkapi failed to generate the XML response. :raise DataBaseError: Networkapi failed to access the database. ### Response: def get_available_ip6(self, id_network6): """ Get a available IP in Network ipv6 :param id_network6: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip6': {'ip6': < available_ip6 >}} :raise IpNotAvailableError: Network dont have available IP. :raise NetworkIPv4NotFoundError: Network was not found. :raise UserNotAuthorizedError: User dont have permission to get a available IP. :raise InvalidParameterError: Network ipv6 identifier is none or invalid. :raise XMLError: Networkapi failed to generate the XML response. :raise DataBaseError: Networkapi failed to access the database. """ if not is_valid_int_param(id_network6): raise InvalidParameterError( u'Network ipv6 identifier is invalid or was not informed.') url = 'ip/availableip6/' + str(id_network6) + "/" code, xml = self.submit(None, 'GET', url) return self.response(code, xml) <|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, 1991, 264, 2561, 6933, 304, 8304, 46575, 21, 271, 286, 551, 913, 887, 21640, 21, 25, 8304, 46575, 21, 13110, 13, 4540, 907, 323, 7191, 1109, 7315, 382, 286, 551, 693, 25, 10685, 449, 279, 2768, 6070, 1473, 286, 3588, 271, 310, 5473, 575, 21, 1232, 5473, 575, 21, 1232, 366, 2561, 10601, 21, 871, 48549, 286, 551, 19223, 36133, 2688, 16892, 1480, 25, 8304, 15890, 617, 2561, 6933, 627, 286, 551, 19223, 8304, 59156, 19, 69008, 25, 8304, 574, 539, 1766, 627, 286, 551, 19223, 2724, 2688, 61554, 1480, 25, 2724, 15890, 617, 8041, 311, 636, 264, 2561, 6933, 627, 286, 551, 19223, 14204, 5078, 1480, 25, 8304, 46575, 21, 13110, 374, 7000, 477, 8482, 627, 286, 551, 19223, 1630, 26100, 1298, 25, 8304, 2113, 4745, 311, 7068, 279, 12138, 2077, 627, 286, 551, 19223, 68030, 1480, 25, 8304, 2113, 4745, 311, 2680, 279, 4729, 382, 14711, 6075, 512, 755, 636, 28060, 10601, 21, 1214, 11, 887, 21640, 21, 997, 286, 3270, 286, 2175, 264, 2561, 6933, 304, 8304, 46575, 21, 271, 286, 551, 913, 887, 21640, 21, 25, 8304, 46575, 21, 13110, 13, 4540, 907, 323, 7191, 1109, 7315, 382, 286, 551, 693, 25, 10685, 449, 279, 2768, 6070, 1473, 286, 3588, 271, 310, 5473, 575, 21, 1232, 5473, 575, 21, 1232, 366, 2561, 10601, 21, 871, 48549, 286, 551, 19223, 36133, 2688, 16892, 1480, 25, 8304, 15890, 617, 2561, 6933, 627, 286, 551, 19223, 8304, 59156, 19, 69008, 25, 8304, 574, 539, 1766, 627, 286, 551, 19223, 2724, 2688, 61554, 1480, 25, 2724, 15890, 617, 8041, 311, 636, 264, 2561, 6933, 627, 286, 551, 19223, 14204, 5078, 1480, 25, 8304, 46575, 21, 13110, 374, 7000, 477, 8482, 627, 286, 551, 19223, 1630, 26100, 1298, 25, 8304, 2113, 4745, 311, 7068, 279, 12138, 2077, 627, 286, 551, 19223, 68030, 1480, 25, 8304, 2113, 4745, 311, 2680, 279, 4729, 382, 286, 12713, 286, 422, 539, 374, 8501, 4132, 4182, 3809, 21640, 21, 997, 310, 4933, 14204, 5078, 1480, 1021, 394, 577, 6, 12600, 46575, 21, 13110, 374, 8482, 477, 574, 539, 16369, 49420, 286, 2576, 284, 364, 575, 14, 10547, 575, 21, 11576, 489, 610, 3809, 21640, 21, 8, 489, 3605, 1875, 286, 2082, 11, 8562, 284, 659, 28021, 27815, 11, 364, 3891, 518, 2576, 696, 286, 471, 659, 11616, 16221, 11, 8562, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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14711, 5546, 512, 1991, 264, 2561, 6933, 304, 8304, 46575, 21, 271, 286, 551, 913, 887, 21640, 21, 25, 8304, 46575, 21, 13110, 13, 4540, 907, 323, 7191, 1109, 7315, 382, 286, 551, 693, 25, 10685, 449, 279, 2768, 6070, 1473, 286, 3588, 271, 310, 5473, 575, 21, 1232, 5473, 575, 21, 1232, 366, 2561, 10601, 21, 871, 48549, 286, 551, 19223, 36133, 2688, 16892, 1480, 25, 8304, 15890, 617, 2561, 6933, 627, 286, 551, 19223, 8304, 59156, 19, 69008, 25, 8304, 574, 539, 1766, 627, 286, 551, 19223, 2724, 2688, 61554, 1480, 25, 2724, 15890, 617, 8041, 311, 636, 264, 2561, 6933, 627, 286, 551, 19223, 14204, 5078, 1480, 25, 8304, 46575, 21, 13110, 374, 7000, 477, 8482, 627, 286, 551, 19223, 1630, 26100, 1298, 25, 8304, 2113, 4745, 311, 7068, 279, 12138, 2077, 627, 286, 551, 19223, 68030, 1480, 25, 8304, 2113, 4745, 311, 2680, 279, 4729, 382, 14711, 6075, 512, 755, 636, 28060, 10601, 21, 1214, 11, 887, 21640, 21, 997, 286, 3270, 286, 2175, 264, 2561, 6933, 304, 8304, 46575, 21, 271, 286, 551, 913, 887, 21640, 21, 25, 8304, 46575, 21, 13110, 13, 4540, 907, 323, 7191, 1109, 7315, 382, 286, 551, 693, 25, 10685, 449, 279, 2768, 6070, 1473, 286, 3588, 271, 310, 5473, 575, 21, 1232, 5473, 575, 21, 1232, 366, 2561, 10601, 21, 871, 48549, 286, 551, 19223, 36133, 2688, 16892, 1480, 25, 8304, 15890, 617, 2561, 6933, 627, 286, 551, 19223, 8304, 59156, 19, 69008, 25, 8304, 574, 539, 1766, 627, 286, 551, 19223, 2724, 2688, 61554, 1480, 25, 2724, 15890, 617, 8041, 311, 636, 264, 2561, 6933, 627, 286, 551, 19223, 14204, 5078, 1480, 25, 8304, 46575, 21, 13110, 374, 7000, 477, 8482, 627, 286, 551, 19223, 1630, 26100, 1298, 25, 8304, 2113, 4745, 311, 7068, 279, 12138, 2077, 627, 286, 551, 19223, 68030, 1480, 25, 8304, 2113, 4745, 311, 2680, 279, 4729, 382, 286, 12713, 286, 422, 539, 374, 8501, 4132, 4182, 3809, 21640, 21, 997, 310, 4933, 14204, 5078, 1480, 1021, 394, 577, 6, 12600, 46575, 21, 13110, 374, 8482, 477, 574, 539, 16369, 49420, 286, 2576, 284, 364, 575, 14, 10547, 575, 21, 11576, 489, 610, 3809, 21640, 21, 8, 489, 3605, 1875, 286, 2082, 11, 8562, 284, 659, 28021, 27815, 11, 364, 3891, 518, 2576, 696, 286, 471, 659, 11616, 16221, 11, 8562, 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 ]
jrigden/pyPodcastParser
pyPodcastParser/Podcast.py
Podcast.set_extended_elements
def set_extended_elements(self): """Parses and sets non required elements""" self.set_creative_commons() self.set_owner() self.set_subtitle() self.set_summary()
python
def set_extended_elements(self): """Parses and sets non required elements""" self.set_creative_commons() self.set_owner() self.set_subtitle() self.set_summary()
[ "def", "set_extended_elements", "(", "self", ")", ":", "self", ".", "set_creative_commons", "(", ")", "self", ".", "set_owner", "(", ")", "self", ".", "set_subtitle", "(", ")", "self", ".", "set_summary", "(", ")" ]
Parses and sets non required elements
[ "Parses", "and", "sets", "non", "required", "elements" ]
train
https://github.com/jrigden/pyPodcastParser/blob/b21e027bb56ec77986d76fc1990f4e420c6de869/pyPodcastParser/Podcast.py#L160-L165
<|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: Parses and sets non required elements ### Response: def set_extended_elements(self): """Parses and sets non required elements""" self.set_creative_commons() self.set_owner() self.set_subtitle() self.set_summary() <|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, 47, 1590, 288, 323, 7437, 2536, 2631, 5540, 271, 14711, 6075, 512, 755, 743, 62778, 23646, 1214, 997, 286, 4304, 47, 1590, 288, 323, 7437, 2536, 2631, 5540, 7275, 286, 659, 995, 669, 87466, 21790, 82, 746, 286, 659, 995, 30127, 746, 286, 659, 995, 96027, 746, 286, 659, 995, 28350, 746, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 47, 1590, 288, 323, 7437, 2536, 2631, 5540, 271, 14711, 6075, 512, 755, 743, 62778, 23646, 1214, 997, 286, 4304, 47, 1590, 288, 323, 7437, 2536, 2631, 5540, 7275, 286, 659, 995, 669, 87466, 21790, 82, 746, 286, 659, 995, 30127, 746, 286, 659, 995, 96027, 746, 286, 659, 995, 28350, 746, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
nameko/nameko
nameko/cli/shell.py
make_nameko_helper
def make_nameko_helper(config): """Create a fake module that provides some convenient access to nameko standalone functionality for interactive shell usage. """ module = ModuleType('nameko') module.__doc__ = """Nameko shell helper for making rpc calls and dispatching events. Usage: >>> n.rpc.service.method() "reply" >>> n.dispatch_event('service', 'event_type', 'event_data') """ proxy = ClusterRpcProxy(config) module.rpc = proxy.start() module.dispatch_event = event_dispatcher(config) module.config = config module.disconnect = proxy.stop return module
python
def make_nameko_helper(config): """Create a fake module that provides some convenient access to nameko standalone functionality for interactive shell usage. """ module = ModuleType('nameko') module.__doc__ = """Nameko shell helper for making rpc calls and dispatching events. Usage: >>> n.rpc.service.method() "reply" >>> n.dispatch_event('service', 'event_type', 'event_data') """ proxy = ClusterRpcProxy(config) module.rpc = proxy.start() module.dispatch_event = event_dispatcher(config) module.config = config module.disconnect = proxy.stop return module
[ "def", "make_nameko_helper", "(", "config", ")", ":", "module", "=", "ModuleType", "(", "'nameko'", ")", "module", ".", "__doc__", "=", "\"\"\"Nameko shell helper for making rpc calls and dispatching\nevents.\n\nUsage:\n >>> n.rpc.service.method()\n \"reply\"\n\n >>> n.dispatch_event('service', 'event_type', 'event_data')\n\"\"\"", "proxy", "=", "ClusterRpcProxy", "(", "config", ")", "module", ".", "rpc", "=", "proxy", ".", "start", "(", ")", "module", ".", "dispatch_event", "=", "event_dispatcher", "(", "config", ")", "module", ".", "config", "=", "config", "module", ".", "disconnect", "=", "proxy", ".", "stop", "return", "module" ]
Create a fake module that provides some convenient access to nameko standalone functionality for interactive shell usage.
[ "Create", "a", "fake", "module", "that", "provides", "some", "convenient", "access", "to", "nameko", "standalone", "functionality", "for", "interactive", "shell", "usage", "." ]
train
https://github.com/nameko/nameko/blob/88d7e5211de4fcc1c34cd7f84d7c77f0619c5f5d/nameko/cli/shell.py#L58-L77
<|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: Create a fake module that provides some convenient access to nameko standalone functionality for interactive shell usage. ### Response: def make_nameko_helper(config): """Create a fake module that provides some convenient access to nameko standalone functionality for interactive shell usage. """ module = ModuleType('nameko') module.__doc__ = """Nameko shell helper for making rpc calls and dispatching events. Usage: >>> n.rpc.service.method() "reply" >>> n.dispatch_event('service', 'event_type', 'event_data') """ proxy = ClusterRpcProxy(config) module.rpc = proxy.start() module.dispatch_event = event_dispatcher(config) module.config = config module.disconnect = proxy.stop return module <|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, 4110, 264, 12700, 4793, 430, 5825, 1063, 17125, 2680, 311, 836, 9509, 198, 262, 44488, 15293, 369, 21416, 12811, 10648, 382, 14711, 6075, 512, 755, 1304, 1292, 9509, 10635, 8928, 997, 262, 4304, 4110, 264, 12700, 4793, 430, 5825, 1063, 17125, 2680, 311, 836, 9509, 198, 262, 44488, 15293, 369, 21416, 12811, 10648, 627, 262, 3270, 262, 4793, 284, 14026, 941, 493, 609, 9509, 1329, 262, 4793, 4952, 5349, 565, 284, 4304, 678, 9509, 12811, 13438, 369, 3339, 36696, 6880, 323, 6988, 287, 198, 12670, 382, 15126, 512, 262, 12382, 308, 56277, 5855, 13204, 746, 262, 330, 21710, 1875, 262, 12382, 308, 20527, 6891, 493, 8095, 518, 364, 3163, 1857, 518, 364, 3163, 1807, 1329, 7275, 262, 13594, 284, 36480, 61348, 16617, 8928, 340, 262, 4793, 56277, 284, 13594, 5069, 746, 262, 4793, 20527, 6891, 284, 1567, 93289, 8928, 340, 262, 4793, 5539, 284, 2242, 198, 262, 4793, 48324, 284, 13594, 13530, 198, 262, 471, 4793, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 4110, 264, 12700, 4793, 430, 5825, 1063, 17125, 2680, 311, 836, 9509, 198, 262, 44488, 15293, 369, 21416, 12811, 10648, 382, 14711, 6075, 512, 755, 1304, 1292, 9509, 10635, 8928, 997, 262, 4304, 4110, 264, 12700, 4793, 430, 5825, 1063, 17125, 2680, 311, 836, 9509, 198, 262, 44488, 15293, 369, 21416, 12811, 10648, 627, 262, 3270, 262, 4793, 284, 14026, 941, 493, 609, 9509, 1329, 262, 4793, 4952, 5349, 565, 284, 4304, 678, 9509, 12811, 13438, 369, 3339, 36696, 6880, 323, 6988, 287, 198, 12670, 382, 15126, 512, 262, 12382, 308, 56277, 5855, 13204, 746, 262, 330, 21710, 1875, 262, 12382, 308, 20527, 6891, 493, 8095, 518, 364, 3163, 1857, 518, 364, 3163, 1807, 1329, 7275, 262, 13594, 284, 36480, 61348, 16617, 8928, 340, 262, 4793, 56277, 284, 13594, 5069, 746, 262, 4793, 20527, 6891, 284, 1567, 93289, 8928, 340, 262, 4793, 5539, 284, 2242, 198, 262, 4793, 48324, 284, 13594, 13530, 198, 262, 471, 4793, 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 ]
pytroll/satpy
satpy/scene.py
Scene.all_same_proj
def all_same_proj(self): """All contained data array are in the same projection.""" all_areas = [x.attrs.get('area', None) for x in self.values()] all_areas = [x for x in all_areas if x is not None] return all(all_areas[0].proj_str == x.proj_str for x in all_areas[1:])
python
def all_same_proj(self): """All contained data array are in the same projection.""" all_areas = [x.attrs.get('area', None) for x in self.values()] all_areas = [x for x in all_areas if x is not None] return all(all_areas[0].proj_str == x.proj_str for x in all_areas[1:])
[ "def", "all_same_proj", "(", "self", ")", ":", "all_areas", "=", "[", "x", ".", "attrs", ".", "get", "(", "'area'", ",", "None", ")", "for", "x", "in", "self", ".", "values", "(", ")", "]", "all_areas", "=", "[", "x", "for", "x", "in", "all_areas", "if", "x", "is", "not", "None", "]", "return", "all", "(", "all_areas", "[", "0", "]", ".", "proj_str", "==", "x", ".", "proj_str", "for", "x", "in", "all_areas", "[", "1", ":", "]", ")" ]
All contained data array are in the same projection.
[ "All", "contained", "data", "array", "are", "in", "the", "same", "projection", "." ]
train
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/scene.py#L459-L463
<|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: All contained data array are in the same projection. ### Response: def all_same_proj(self): """All contained data array are in the same projection.""" all_areas = [x.attrs.get('area', None) for x in self.values()] all_areas = [x for x in all_areas if x is not None] return all(all_areas[0].proj_str == x.proj_str for x in all_areas[1:]) <|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, 2460, 13282, 828, 1358, 527, 304, 279, 1890, 22343, 382, 14711, 6075, 512, 755, 682, 34674, 50553, 1214, 997, 286, 4304, 2460, 13282, 828, 1358, 527, 304, 279, 1890, 22343, 14781, 286, 682, 79672, 284, 510, 87, 46596, 673, 493, 4903, 518, 2290, 8, 369, 865, 304, 659, 10883, 28866, 286, 682, 79672, 284, 510, 87, 369, 865, 304, 682, 79672, 422, 865, 374, 539, 2290, 933, 286, 471, 682, 21013, 79672, 58, 15, 948, 31486, 2966, 624, 865, 83277, 2966, 369, 865, 304, 682, 79672, 58, 16, 44157, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 2460, 13282, 828, 1358, 527, 304, 279, 1890, 22343, 382, 14711, 6075, 512, 755, 682, 34674, 50553, 1214, 997, 286, 4304, 2460, 13282, 828, 1358, 527, 304, 279, 1890, 22343, 14781, 286, 682, 79672, 284, 510, 87, 46596, 673, 493, 4903, 518, 2290, 8, 369, 865, 304, 659, 10883, 28866, 286, 682, 79672, 284, 510, 87, 369, 865, 304, 682, 79672, 422, 865, 374, 539, 2290, 933, 286, 471, 682, 21013, 79672, 58, 15, 948, 31486, 2966, 624, 865, 83277, 2966, 369, 865, 304, 682, 79672, 58, 16, 44157, 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 ]
jermnelson/flask-fedora-commons
flask_fedora_commons/__init__.py
copy_graph
def copy_graph(subject, existing_graph): """Function takes a subject and an existing graph, returns a new graph with all predicate and objects of the existing graph copied to the new_graph with subject as the new subject Args: subject(rdflib.URIRef): A URIRef subject existing_graph(rdflib.Graph): A rdflib.Graph Returns: rdflib.Graph """ new_graph = rdflib.Graph() for predicate, object_ in existing_graph.predicate_objects(): new_graph.add((subject, predicate, object_)) return new_graph
python
def copy_graph(subject, existing_graph): """Function takes a subject and an existing graph, returns a new graph with all predicate and objects of the existing graph copied to the new_graph with subject as the new subject Args: subject(rdflib.URIRef): A URIRef subject existing_graph(rdflib.Graph): A rdflib.Graph Returns: rdflib.Graph """ new_graph = rdflib.Graph() for predicate, object_ in existing_graph.predicate_objects(): new_graph.add((subject, predicate, object_)) return new_graph
[ "def", "copy_graph", "(", "subject", ",", "existing_graph", ")", ":", "new_graph", "=", "rdflib", ".", "Graph", "(", ")", "for", "predicate", ",", "object_", "in", "existing_graph", ".", "predicate_objects", "(", ")", ":", "new_graph", ".", "add", "(", "(", "subject", ",", "predicate", ",", "object_", ")", ")", "return", "new_graph" ]
Function takes a subject and an existing graph, returns a new graph with all predicate and objects of the existing graph copied to the new_graph with subject as the new subject Args: subject(rdflib.URIRef): A URIRef subject existing_graph(rdflib.Graph): A rdflib.Graph Returns: rdflib.Graph
[ "Function", "takes", "a", "subject", "and", "an", "existing", "graph", "returns", "a", "new", "graph", "with", "all", "predicate", "and", "objects", "of", "the", "existing", "graph", "copied", "to", "the", "new_graph", "with", "subject", "as", "the", "new", "subject" ]
train
https://github.com/jermnelson/flask-fedora-commons/blob/81cee0d8c9e79fa2bdd1a101facb9e8c0f307af4/flask_fedora_commons/__init__.py#L81-L96
<|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: Function takes a subject and an existing graph, returns a new graph with all predicate and objects of the existing graph copied to the new_graph with subject as the new subject Args: subject(rdflib.URIRef): A URIRef subject existing_graph(rdflib.Graph): A rdflib.Graph Returns: rdflib.Graph ### Response: def copy_graph(subject, existing_graph): """Function takes a subject and an existing graph, returns a new graph with all predicate and objects of the existing graph copied to the new_graph with subject as the new subject Args: subject(rdflib.URIRef): A URIRef subject existing_graph(rdflib.Graph): A rdflib.Graph Returns: rdflib.Graph """ new_graph = rdflib.Graph() for predicate, object_ in existing_graph.predicate_objects(): new_graph.add((subject, predicate, object_)) return new_graph <|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, 5263, 5097, 264, 3917, 323, 459, 6484, 4876, 11, 4780, 264, 502, 4876, 449, 198, 262, 682, 25269, 323, 6302, 315, 279, 6484, 4876, 22523, 311, 279, 502, 15080, 449, 198, 262, 3917, 439, 279, 502, 3917, 271, 262, 18161, 512, 286, 3917, 76346, 1517, 581, 71074, 4032, 1680, 362, 16403, 4032, 3917, 198, 286, 6484, 15080, 76346, 1517, 581, 41337, 1680, 362, 23527, 1517, 581, 41337, 271, 262, 5295, 512, 286, 23527, 1517, 581, 41337, 271, 14711, 6075, 512, 755, 3048, 15080, 30228, 11, 6484, 15080, 997, 262, 4304, 5263, 5097, 264, 3917, 323, 459, 6484, 4876, 11, 4780, 264, 502, 4876, 449, 198, 262, 682, 25269, 323, 6302, 315, 279, 6484, 4876, 22523, 311, 279, 502, 15080, 449, 198, 262, 3917, 439, 279, 502, 3917, 271, 262, 18161, 512, 286, 3917, 76346, 1517, 581, 71074, 4032, 1680, 362, 16403, 4032, 3917, 198, 286, 6484, 15080, 76346, 1517, 581, 41337, 1680, 362, 23527, 1517, 581, 41337, 271, 262, 5295, 512, 286, 23527, 1517, 581, 41337, 198, 262, 3270, 262, 502, 15080, 284, 23527, 1517, 581, 41337, 746, 262, 369, 25269, 11, 1665, 62, 304, 6484, 15080, 95691, 25915, 4019, 286, 502, 15080, 1388, 1209, 11760, 11, 25269, 11, 1665, 62, 1192, 262, 471, 502, 15080, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 5263, 5097, 264, 3917, 323, 459, 6484, 4876, 11, 4780, 264, 502, 4876, 449, 198, 262, 682, 25269, 323, 6302, 315, 279, 6484, 4876, 22523, 311, 279, 502, 15080, 449, 198, 262, 3917, 439, 279, 502, 3917, 271, 262, 18161, 512, 286, 3917, 76346, 1517, 581, 71074, 4032, 1680, 362, 16403, 4032, 3917, 198, 286, 6484, 15080, 76346, 1517, 581, 41337, 1680, 362, 23527, 1517, 581, 41337, 271, 262, 5295, 512, 286, 23527, 1517, 581, 41337, 271, 14711, 6075, 512, 755, 3048, 15080, 30228, 11, 6484, 15080, 997, 262, 4304, 5263, 5097, 264, 3917, 323, 459, 6484, 4876, 11, 4780, 264, 502, 4876, 449, 198, 262, 682, 25269, 323, 6302, 315, 279, 6484, 4876, 22523, 311, 279, 502, 15080, 449, 198, 262, 3917, 439, 279, 502, 3917, 271, 262, 18161, 512, 286, 3917, 76346, 1517, 581, 71074, 4032, 1680, 362, 16403, 4032, 3917, 198, 286, 6484, 15080, 76346, 1517, 581, 41337, 1680, 362, 23527, 1517, 581, 41337, 271, 262, 5295, 512, 286, 23527, 1517, 581, 41337, 198, 262, 3270, 262, 502, 15080, 284, 23527, 1517, 581, 41337, 746, 262, 369, 25269, 11, 1665, 62, 304, 6484, 15080, 95691, 25915, 4019, 286, 502, 15080, 1388, 1209, 11760, 11, 25269, 11, 1665, 62, 1192, 262, 471, 502, 15080, 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 ]
rduplain/jeni-python
jeni.py
Injector.eager_partial_regardless
def eager_partial_regardless(self, fn, *a, **kw): """Like `eager_partial`, but applies if callable is not annotated.""" if self.has_annotations(fn): return self.eager_partial(fn, *a, **kw) return functools.partial(fn, *a, **kw)
python
def eager_partial_regardless(self, fn, *a, **kw): """Like `eager_partial`, but applies if callable is not annotated.""" if self.has_annotations(fn): return self.eager_partial(fn, *a, **kw) return functools.partial(fn, *a, **kw)
[ "def", "eager_partial_regardless", "(", "self", ",", "fn", ",", "*", "a", ",", "*", "*", "kw", ")", ":", "if", "self", ".", "has_annotations", "(", "fn", ")", ":", "return", "self", ".", "eager_partial", "(", "fn", ",", "*", "a", ",", "*", "*", "kw", ")", "return", "functools", ".", "partial", "(", "fn", ",", "*", "a", ",", "*", "*", "kw", ")" ]
Like `eager_partial`, but applies if callable is not annotated.
[ "Like", "eager_partial", "but", "applies", "if", "callable", "is", "not", "annotated", "." ]
train
https://github.com/rduplain/jeni-python/blob/feca12ce5e4f0438ae5d7bec59d61826063594f1/jeni.py#L594-L598
<|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: Like `eager_partial`, but applies if callable is not annotated. ### Response: def eager_partial_regardless(self, fn, *a, **kw): """Like `eager_partial`, but applies if callable is not annotated.""" if self.has_annotations(fn): return self.eager_partial(fn, *a, **kw) return functools.partial(fn, *a, **kw) <|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, 13246, 1595, 68, 1435, 53168, 7964, 719, 17208, 422, 42022, 374, 539, 63951, 382, 14711, 6075, 512, 755, 24450, 53168, 5025, 30920, 1214, 11, 5279, 11, 353, 64, 11, 3146, 29700, 997, 286, 4304, 13246, 1595, 68, 1435, 53168, 7964, 719, 17208, 422, 42022, 374, 539, 63951, 14781, 286, 422, 659, 7001, 79996, 24968, 997, 310, 471, 659, 1770, 1435, 53168, 24968, 11, 353, 64, 11, 3146, 29700, 340, 286, 471, 57566, 83999, 24968, 11, 353, 64, 11, 3146, 29700, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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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, 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, 13246, 1595, 68, 1435, 53168, 7964, 719, 17208, 422, 42022, 374, 539, 63951, 382, 14711, 6075, 512, 755, 24450, 53168, 5025, 30920, 1214, 11, 5279, 11, 353, 64, 11, 3146, 29700, 997, 286, 4304, 13246, 1595, 68, 1435, 53168, 7964, 719, 17208, 422, 42022, 374, 539, 63951, 14781, 286, 422, 659, 7001, 79996, 24968, 997, 310, 471, 659, 1770, 1435, 53168, 24968, 11, 353, 64, 11, 3146, 29700, 340, 286, 471, 57566, 83999, 24968, 11, 353, 64, 11, 3146, 29700, 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, 128009, 128009 ]
krukas/Trionyx
trionyx/navigation.py
TabRegister.get_tabs
def get_tabs(self, model_alias, object): """ Get all active tabs for given model :param model_alias: :param object: Object used to filter tabs :return: """ model_alias = self.get_model_alias(model_alias) for item in self.tabs[model_alias]: if item.display_filter(object): yield item
python
def get_tabs(self, model_alias, object): """ Get all active tabs for given model :param model_alias: :param object: Object used to filter tabs :return: """ model_alias = self.get_model_alias(model_alias) for item in self.tabs[model_alias]: if item.display_filter(object): yield item
[ "def", "get_tabs", "(", "self", ",", "model_alias", ",", "object", ")", ":", "model_alias", "=", "self", ".", "get_model_alias", "(", "model_alias", ")", "for", "item", "in", "self", ".", "tabs", "[", "model_alias", "]", ":", "if", "item", ".", "display_filter", "(", "object", ")", ":", "yield", "item" ]
Get all active tabs for given model :param model_alias: :param object: Object used to filter tabs :return:
[ "Get", "all", "active", "tabs", "for", "given", "model" ]
train
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/navigation.py#L210-L221
<|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: Get all active tabs for given model :param model_alias: :param object: Object used to filter tabs :return: ### Response: def get_tabs(self, model_alias, object): """ Get all active tabs for given model :param model_alias: :param object: Object used to filter tabs :return: """ model_alias = self.get_model_alias(model_alias) for item in self.tabs[model_alias]: if item.display_filter(object): yield 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, 1991, 682, 4642, 23204, 369, 2728, 1646, 271, 286, 551, 913, 1646, 37047, 512, 286, 551, 913, 1665, 25, 3075, 1511, 311, 4141, 23204, 198, 286, 551, 693, 1473, 14711, 6075, 512, 755, 636, 59053, 1214, 11, 1646, 37047, 11, 1665, 997, 286, 3270, 286, 2175, 682, 4642, 23204, 369, 2728, 1646, 271, 286, 551, 913, 1646, 37047, 512, 286, 551, 913, 1665, 25, 3075, 1511, 311, 4141, 23204, 198, 286, 551, 693, 512, 286, 3270, 286, 1646, 37047, 284, 659, 673, 5156, 37047, 7790, 37047, 340, 286, 369, 1537, 304, 659, 49486, 81038, 37047, 10556, 310, 422, 1537, 8344, 8901, 4496, 997, 394, 7692, 1537, 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, 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, 0, 0, 0, 0, 0, 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, 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, 1991, 682, 4642, 23204, 369, 2728, 1646, 271, 286, 551, 913, 1646, 37047, 512, 286, 551, 913, 1665, 25, 3075, 1511, 311, 4141, 23204, 198, 286, 551, 693, 1473, 14711, 6075, 512, 755, 636, 59053, 1214, 11, 1646, 37047, 11, 1665, 997, 286, 3270, 286, 2175, 682, 4642, 23204, 369, 2728, 1646, 271, 286, 551, 913, 1646, 37047, 512, 286, 551, 913, 1665, 25, 3075, 1511, 311, 4141, 23204, 198, 286, 551, 693, 512, 286, 3270, 286, 1646, 37047, 284, 659, 673, 5156, 37047, 7790, 37047, 340, 286, 369, 1537, 304, 659, 49486, 81038, 37047, 10556, 310, 422, 1537, 8344, 8901, 4496, 997, 394, 7692, 1537, 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, 128009, 128009, 128009, 128009, 128009, 128009 ]
pantsbuild/pants
pants-plugins/src/python/internal_backend/sitegen/tasks/sitegen.py
load_soups
def load_soups(config): """Generate BeautifulSoup AST for each page listed in config.""" soups = {} for page, path in config['sources'].items(): with open(path, 'r') as orig_file: soups[page] = beautiful_soup(orig_file.read(), features='html.parser') return soups
python
def load_soups(config): """Generate BeautifulSoup AST for each page listed in config.""" soups = {} for page, path in config['sources'].items(): with open(path, 'r') as orig_file: soups[page] = beautiful_soup(orig_file.read(), features='html.parser') return soups
[ "def", "load_soups", "(", "config", ")", ":", "soups", "=", "{", "}", "for", "page", ",", "path", "in", "config", "[", "'sources'", "]", ".", "items", "(", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "orig_file", ":", "soups", "[", "page", "]", "=", "beautiful_soup", "(", "orig_file", ".", "read", "(", ")", ",", "features", "=", "'html.parser'", ")", "return", "soups" ]
Generate BeautifulSoup AST for each page listed in config.
[ "Generate", "BeautifulSoup", "AST", "for", "each", "page", "listed", "in", "config", "." ]
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/pants-plugins/src/python/internal_backend/sitegen/tasks/sitegen.py#L79-L85
<|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: Generate BeautifulSoup AST for each page listed in config. ### Response: def load_soups(config): """Generate BeautifulSoup AST for each page listed in config.""" soups = {} for page, path in config['sources'].items(): with open(path, 'r') as orig_file: soups[page] = beautiful_soup(orig_file.read(), features='html.parser') return soups <|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, 32215, 37010, 23276, 369, 1855, 2199, 10212, 304, 2242, 382, 14711, 6075, 512, 755, 2865, 646, 283, 1725, 8928, 997, 220, 4304, 32215, 37010, 23276, 369, 1855, 2199, 10212, 304, 2242, 14781, 220, 5945, 1725, 284, 5731, 220, 369, 2199, 11, 1853, 304, 2242, 681, 40751, 7352, 3699, 4019, 262, 449, 1825, 5698, 11, 364, 81, 873, 439, 2780, 2517, 512, 415, 5945, 1725, 58, 2964, 60, 284, 6366, 98452, 55937, 2517, 4217, 1535, 4519, 1151, 1580, 26699, 1329, 220, 471, 5945, 1725, 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, 128009, 128009, 128009, 128009, 128009, 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,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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 ]
[ 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, 32215, 37010, 23276, 369, 1855, 2199, 10212, 304, 2242, 382, 14711, 6075, 512, 755, 2865, 646, 283, 1725, 8928, 997, 220, 4304, 32215, 37010, 23276, 369, 1855, 2199, 10212, 304, 2242, 14781, 220, 5945, 1725, 284, 5731, 220, 369, 2199, 11, 1853, 304, 2242, 681, 40751, 7352, 3699, 4019, 262, 449, 1825, 5698, 11, 364, 81, 873, 439, 2780, 2517, 512, 415, 5945, 1725, 58, 2964, 60, 284, 6366, 98452, 55937, 2517, 4217, 1535, 4519, 1151, 1580, 26699, 1329, 220, 471, 5945, 1725, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
aws/sagemaker-python-sdk
src/sagemaker/predictor.py
RealTimePredictor.delete_model
def delete_model(self): """Deletes the Amazon SageMaker models backing this predictor. """ request_failed = False failed_models = [] for model_name in self._model_names: try: self.sagemaker_session.delete_model(model_name) except Exception: # pylint: disable=broad-except request_failed = True failed_models.append(model_name) if request_failed: raise Exception('One or more models cannot be deleted, please retry. \n' 'Failed models: {}'.format(', '.join(failed_models)))
python
def delete_model(self): """Deletes the Amazon SageMaker models backing this predictor. """ request_failed = False failed_models = [] for model_name in self._model_names: try: self.sagemaker_session.delete_model(model_name) except Exception: # pylint: disable=broad-except request_failed = True failed_models.append(model_name) if request_failed: raise Exception('One or more models cannot be deleted, please retry. \n' 'Failed models: {}'.format(', '.join(failed_models)))
[ "def", "delete_model", "(", "self", ")", ":", "request_failed", "=", "False", "failed_models", "=", "[", "]", "for", "model_name", "in", "self", ".", "_model_names", ":", "try", ":", "self", ".", "sagemaker_session", ".", "delete_model", "(", "model_name", ")", "except", "Exception", ":", "# pylint: disable=broad-except", "request_failed", "=", "True", "failed_models", ".", "append", "(", "model_name", ")", "if", "request_failed", ":", "raise", "Exception", "(", "'One or more models cannot be deleted, please retry. \\n'", "'Failed models: {}'", ".", "format", "(", "', '", ".", "join", "(", "failed_models", ")", ")", ")" ]
Deletes the Amazon SageMaker models backing this predictor.
[ "Deletes", "the", "Amazon", "SageMaker", "models", "backing", "this", "predictor", "." ]
train
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/predictor.py#L131-L146
<|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: Deletes the Amazon SageMaker models backing this predictor. ### Response: def delete_model(self): """Deletes the Amazon SageMaker models backing this predictor. """ request_failed = False failed_models = [] for model_name in self._model_names: try: self.sagemaker_session.delete_model(model_name) except Exception: # pylint: disable=broad-except request_failed = True failed_models.append(model_name) if request_failed: raise Exception('One or more models cannot be deleted, please retry. \n' 'Failed models: {}'.format(', '.join(failed_models))) <|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, 62417, 279, 8339, 54384, 34359, 4211, 25695, 420, 62254, 382, 14711, 6075, 512, 755, 3783, 5156, 1214, 997, 286, 4304, 62417, 279, 8339, 54384, 34359, 4211, 25695, 420, 62254, 382, 286, 3270, 286, 1715, 36160, 284, 3641, 198, 286, 4745, 31892, 284, 4260, 286, 369, 1646, 1292, 304, 659, 1462, 2590, 9366, 512, 310, 1456, 512, 394, 659, 516, 15003, 4506, 12596, 7592, 5156, 7790, 1292, 340, 310, 3734, 4204, 25, 220, 674, 51471, 25, 11404, 22861, 8714, 10397, 1512, 198, 394, 1715, 36160, 284, 3082, 198, 394, 4745, 31892, 2102, 7790, 1292, 696, 286, 422, 1715, 36160, 512, 310, 4933, 4204, 493, 4054, 477, 810, 4211, 4250, 387, 11309, 11, 4587, 23515, 13, 1144, 77, 1270, 1014, 364, 9595, 4211, 25, 26307, 2293, 14067, 6389, 6115, 968, 5805, 31892, 6054, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 62417, 279, 8339, 54384, 34359, 4211, 25695, 420, 62254, 382, 14711, 6075, 512, 755, 3783, 5156, 1214, 997, 286, 4304, 62417, 279, 8339, 54384, 34359, 4211, 25695, 420, 62254, 382, 286, 3270, 286, 1715, 36160, 284, 3641, 198, 286, 4745, 31892, 284, 4260, 286, 369, 1646, 1292, 304, 659, 1462, 2590, 9366, 512, 310, 1456, 512, 394, 659, 516, 15003, 4506, 12596, 7592, 5156, 7790, 1292, 340, 310, 3734, 4204, 25, 220, 674, 51471, 25, 11404, 22861, 8714, 10397, 1512, 198, 394, 1715, 36160, 284, 3082, 198, 394, 4745, 31892, 2102, 7790, 1292, 696, 286, 422, 1715, 36160, 512, 310, 4933, 4204, 493, 4054, 477, 810, 4211, 4250, 387, 11309, 11, 4587, 23515, 13, 1144, 77, 1270, 1014, 364, 9595, 4211, 25, 26307, 2293, 14067, 6389, 6115, 968, 5805, 31892, 6054, 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 ]
google/mobly
mobly/asserts.py
assert_raises
def assert_raises(expected_exception, extras=None, *args, **kwargs): """Assert that an exception is raised when a function is called. If no exception is raised, test fail. If an exception is raised but not of the expected type, the exception is let through. This should only be used as a context manager: with assert_raises(Exception): func() Args: expected_exception: An exception class that is expected to be raised. extras: An optional field for extra information to be included in test result. """ context = _AssertRaisesContext(expected_exception, extras=extras) return context
python
def assert_raises(expected_exception, extras=None, *args, **kwargs): """Assert that an exception is raised when a function is called. If no exception is raised, test fail. If an exception is raised but not of the expected type, the exception is let through. This should only be used as a context manager: with assert_raises(Exception): func() Args: expected_exception: An exception class that is expected to be raised. extras: An optional field for extra information to be included in test result. """ context = _AssertRaisesContext(expected_exception, extras=extras) return context
[ "def", "assert_raises", "(", "expected_exception", ",", "extras", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "context", "=", "_AssertRaisesContext", "(", "expected_exception", ",", "extras", "=", "extras", ")", "return", "context" ]
Assert that an exception is raised when a function is called. If no exception is raised, test fail. If an exception is raised but not of the expected type, the exception is let through. This should only be used as a context manager: with assert_raises(Exception): func() Args: expected_exception: An exception class that is expected to be raised. extras: An optional field for extra information to be included in test result.
[ "Assert", "that", "an", "exception", "is", "raised", "when", "a", "function", "is", "called", "." ]
train
https://github.com/google/mobly/blob/38ba2cf7d29a20e6a2fca1718eecb337df38db26/mobly/asserts.py#L60-L77
<|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: Assert that an exception is raised when a function is called. If no exception is raised, test fail. If an exception is raised but not of the expected type, the exception is let through. This should only be used as a context manager: with assert_raises(Exception): func() Args: expected_exception: An exception class that is expected to be raised. extras: An optional field for extra information to be included in test result. ### Response: def assert_raises(expected_exception, extras=None, *args, **kwargs): """Assert that an exception is raised when a function is called. If no exception is raised, test fail. If an exception is raised but not of the expected type, the exception is let through. This should only be used as a context manager: with assert_raises(Exception): func() Args: expected_exception: An exception class that is expected to be raised. extras: An optional field for extra information to be included in test result. """ context = _AssertRaisesContext(expected_exception, extras=extras) return context <|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, 8702, 430, 459, 4788, 374, 9408, 994, 264, 734, 374, 2663, 382, 262, 1442, 912, 4788, 374, 9408, 11, 1296, 3775, 13, 1442, 459, 4788, 374, 9408, 719, 539, 198, 262, 315, 279, 3685, 955, 11, 279, 4788, 374, 1095, 1555, 382, 262, 1115, 1288, 1193, 387, 1511, 439, 264, 2317, 6783, 512, 286, 449, 2105, 89940, 17233, 997, 310, 2988, 2892, 262, 18161, 512, 286, 3685, 17957, 25, 1556, 4788, 538, 430, 374, 3685, 311, 387, 198, 310, 9408, 627, 286, 37375, 25, 1556, 10309, 2115, 369, 5066, 2038, 311, 387, 5343, 304, 198, 310, 1296, 1121, 382, 14711, 6075, 512, 755, 2105, 89940, 15611, 17957, 11, 37375, 5980, 11, 353, 2164, 11, 3146, 9872, 997, 262, 4304, 8702, 430, 459, 4788, 374, 9408, 994, 264, 734, 374, 2663, 382, 262, 1442, 912, 4788, 374, 9408, 11, 1296, 3775, 13, 1442, 459, 4788, 374, 9408, 719, 539, 198, 262, 315, 279, 3685, 955, 11, 279, 4788, 374, 1095, 1555, 382, 262, 1115, 1288, 1193, 387, 1511, 439, 264, 2317, 6783, 512, 286, 449, 2105, 89940, 17233, 997, 310, 2988, 2892, 262, 18161, 512, 286, 3685, 17957, 25, 1556, 4788, 538, 430, 374, 3685, 311, 387, 198, 310, 9408, 627, 286, 37375, 25, 1556, 10309, 2115, 369, 5066, 2038, 311, 387, 5343, 304, 198, 310, 1296, 1121, 627, 262, 3270, 262, 2317, 284, 721, 8702, 36120, 2014, 15611, 17957, 11, 37375, 28, 73675, 340, 262, 471, 2317, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 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, 8702, 430, 459, 4788, 374, 9408, 994, 264, 734, 374, 2663, 382, 262, 1442, 912, 4788, 374, 9408, 11, 1296, 3775, 13, 1442, 459, 4788, 374, 9408, 719, 539, 198, 262, 315, 279, 3685, 955, 11, 279, 4788, 374, 1095, 1555, 382, 262, 1115, 1288, 1193, 387, 1511, 439, 264, 2317, 6783, 512, 286, 449, 2105, 89940, 17233, 997, 310, 2988, 2892, 262, 18161, 512, 286, 3685, 17957, 25, 1556, 4788, 538, 430, 374, 3685, 311, 387, 198, 310, 9408, 627, 286, 37375, 25, 1556, 10309, 2115, 369, 5066, 2038, 311, 387, 5343, 304, 198, 310, 1296, 1121, 382, 14711, 6075, 512, 755, 2105, 89940, 15611, 17957, 11, 37375, 5980, 11, 353, 2164, 11, 3146, 9872, 997, 262, 4304, 8702, 430, 459, 4788, 374, 9408, 994, 264, 734, 374, 2663, 382, 262, 1442, 912, 4788, 374, 9408, 11, 1296, 3775, 13, 1442, 459, 4788, 374, 9408, 719, 539, 198, 262, 315, 279, 3685, 955, 11, 279, 4788, 374, 1095, 1555, 382, 262, 1115, 1288, 1193, 387, 1511, 439, 264, 2317, 6783, 512, 286, 449, 2105, 89940, 17233, 997, 310, 2988, 2892, 262, 18161, 512, 286, 3685, 17957, 25, 1556, 4788, 538, 430, 374, 3685, 311, 387, 198, 310, 9408, 627, 286, 37375, 25, 1556, 10309, 2115, 369, 5066, 2038, 311, 387, 5343, 304, 198, 310, 1296, 1121, 627, 262, 3270, 262, 2317, 284, 721, 8702, 36120, 2014, 15611, 17957, 11, 37375, 28, 73675, 340, 262, 471, 2317, 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 ]
titilambert/pyhydroquebec
pyhydroquebec/client.py
HydroQuebecClient._get_monthly_data
def _get_monthly_data(self, p_p_id): """Get monthly data.""" params = {"p_p_id": p_p_id, "p_p_lifecycle": 2, "p_p_resource_id": ("resourceObtenirDonnees" "PeriodesConsommation")} try: raw_res = yield from self._session.get(PROFILE_URL, params=params, timeout=self._timeout) except OSError: raise PyHydroQuebecError("Can not get monthly data") try: json_output = yield from raw_res.json(content_type='text/json') except (OSError, json.decoder.JSONDecodeError): raise PyHydroQuebecError("Could not get monthly data") if not json_output.get('success'): raise PyHydroQuebecError("Could not get monthly data") return json_output.get('results')
python
def _get_monthly_data(self, p_p_id): """Get monthly data.""" params = {"p_p_id": p_p_id, "p_p_lifecycle": 2, "p_p_resource_id": ("resourceObtenirDonnees" "PeriodesConsommation")} try: raw_res = yield from self._session.get(PROFILE_URL, params=params, timeout=self._timeout) except OSError: raise PyHydroQuebecError("Can not get monthly data") try: json_output = yield from raw_res.json(content_type='text/json') except (OSError, json.decoder.JSONDecodeError): raise PyHydroQuebecError("Could not get monthly data") if not json_output.get('success'): raise PyHydroQuebecError("Could not get monthly data") return json_output.get('results')
[ "def", "_get_monthly_data", "(", "self", ",", "p_p_id", ")", ":", "params", "=", "{", "\"p_p_id\"", ":", "p_p_id", ",", "\"p_p_lifecycle\"", ":", "2", ",", "\"p_p_resource_id\"", ":", "(", "\"resourceObtenirDonnees\"", "\"PeriodesConsommation\"", ")", "}", "try", ":", "raw_res", "=", "yield", "from", "self", ".", "_session", ".", "get", "(", "PROFILE_URL", ",", "params", "=", "params", ",", "timeout", "=", "self", ".", "_timeout", ")", "except", "OSError", ":", "raise", "PyHydroQuebecError", "(", "\"Can not get monthly data\"", ")", "try", ":", "json_output", "=", "yield", "from", "raw_res", ".", "json", "(", "content_type", "=", "'text/json'", ")", "except", "(", "OSError", ",", "json", ".", "decoder", ".", "JSONDecodeError", ")", ":", "raise", "PyHydroQuebecError", "(", "\"Could not get monthly data\"", ")", "if", "not", "json_output", ".", "get", "(", "'success'", ")", ":", "raise", "PyHydroQuebecError", "(", "\"Could not get monthly data\"", ")", "return", "json_output", ".", "get", "(", "'results'", ")" ]
Get monthly data.
[ "Get", "monthly", "data", "." ]
train
https://github.com/titilambert/pyhydroquebec/blob/4ea1374a63944413889c147d91961eda0605d4fd/pyhydroquebec/client.py#L242-L262
<|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: Get monthly data. ### Response: def _get_monthly_data(self, p_p_id): """Get monthly data.""" params = {"p_p_id": p_p_id, "p_p_lifecycle": 2, "p_p_resource_id": ("resourceObtenirDonnees" "PeriodesConsommation")} try: raw_res = yield from self._session.get(PROFILE_URL, params=params, timeout=self._timeout) except OSError: raise PyHydroQuebecError("Can not get monthly data") try: json_output = yield from raw_res.json(content_type='text/json') except (OSError, json.decoder.JSONDecodeError): raise PyHydroQuebecError("Could not get monthly data") if not json_output.get('success'): raise PyHydroQuebecError("Could not get monthly data") return json_output.get('results') <|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, 1991, 15438, 828, 382, 14711, 6075, 512, 755, 721, 456, 19469, 398, 1807, 1214, 11, 281, 623, 851, 997, 286, 4304, 1991, 15438, 828, 14781, 286, 3712, 284, 5324, 79, 623, 851, 794, 281, 623, 851, 345, 1733, 330, 79, 623, 918, 20087, 794, 220, 17, 345, 1733, 330, 79, 623, 18446, 851, 794, 3573, 9416, 4213, 2002, 404, 8161, 69819, 702, 8497, 330, 3976, 72, 2601, 15577, 20372, 367, 43232, 286, 1456, 512, 310, 7257, 5023, 284, 7692, 505, 659, 1462, 6045, 673, 56781, 6169, 8159, 345, 22232, 3712, 58743, 345, 22232, 9829, 7822, 1462, 14482, 340, 286, 3734, 75342, 512, 310, 4933, 5468, 31916, 11513, 26860, 17106, 1480, 446, 6854, 539, 636, 15438, 828, 1158, 286, 1456, 512, 310, 3024, 7800, 284, 7692, 505, 7257, 5023, 4421, 15413, 1857, 1151, 1342, 9108, 1329, 286, 3734, 320, 46, 19778, 11, 3024, 75147, 18494, 33664, 1480, 997, 310, 4933, 5468, 31916, 11513, 26860, 17106, 1480, 446, 13191, 539, 636, 15438, 828, 5240, 286, 422, 539, 3024, 7800, 673, 493, 5748, 11290, 310, 4933, 5468, 31916, 11513, 26860, 17106, 1480, 446, 13191, 539, 636, 15438, 828, 5240, 286, 471, 3024, 7800, 673, 493, 8234, 1329, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1991, 15438, 828, 382, 14711, 6075, 512, 755, 721, 456, 19469, 398, 1807, 1214, 11, 281, 623, 851, 997, 286, 4304, 1991, 15438, 828, 14781, 286, 3712, 284, 5324, 79, 623, 851, 794, 281, 623, 851, 345, 1733, 330, 79, 623, 918, 20087, 794, 220, 17, 345, 1733, 330, 79, 623, 18446, 851, 794, 3573, 9416, 4213, 2002, 404, 8161, 69819, 702, 8497, 330, 3976, 72, 2601, 15577, 20372, 367, 43232, 286, 1456, 512, 310, 7257, 5023, 284, 7692, 505, 659, 1462, 6045, 673, 56781, 6169, 8159, 345, 22232, 3712, 58743, 345, 22232, 9829, 7822, 1462, 14482, 340, 286, 3734, 75342, 512, 310, 4933, 5468, 31916, 11513, 26860, 17106, 1480, 446, 6854, 539, 636, 15438, 828, 1158, 286, 1456, 512, 310, 3024, 7800, 284, 7692, 505, 7257, 5023, 4421, 15413, 1857, 1151, 1342, 9108, 1329, 286, 3734, 320, 46, 19778, 11, 3024, 75147, 18494, 33664, 1480, 997, 310, 4933, 5468, 31916, 11513, 26860, 17106, 1480, 446, 13191, 539, 636, 15438, 828, 5240, 286, 422, 539, 3024, 7800, 673, 493, 5748, 11290, 310, 4933, 5468, 31916, 11513, 26860, 17106, 1480, 446, 13191, 539, 636, 15438, 828, 5240, 286, 471, 3024, 7800, 673, 493, 8234, 1329, 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 ]
smarie/python-valid8
valid8/composition.py
failure_raiser
def failure_raiser(*validation_func, # type: ValidationFuncs **kwargs ): # type: (...) -> Callable """ This function is automatically used if you provide a tuple `(<function>, <msg>_or_<Failure_type>)`, to any of the methods in this page or to one of the `valid8` decorators. It transforms the provided `<function>` into a failure raiser, raising a subclass of `Failure` in case of failure (either not returning `True` or raising an exception) :param validation_func: the base validation function or list of base validation functions to use. A callable, a tuple(callable, help_msg_str), a tuple(callable, failure_type), or a list of several such elements. Nested lists are supported and indicate an implicit `and_` (such as the main list). Tuples indicate an implicit `_failure_raiser`. [mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead of callables, they will be transformed to functions automatically. :param failure_type: a subclass of `WrappingFailure` that should be raised in case of failure :param help_msg: a string help message for the raised `WrappingFailure`. Optional (default = WrappingFailure with no help message). :param kw_context_args :return: """ failure_type, help_msg = pop_kwargs(kwargs, [('failure_type', None), ('help_msg', None)], allow_others=True) # the rest of keyword arguments is used as context. kw_context_args = kwargs main_func = _process_validation_function_s(list(validation_func)) return _failure_raiser(main_func, failure_type=failure_type, help_msg=help_msg, **kw_context_args)
python
def failure_raiser(*validation_func, # type: ValidationFuncs **kwargs ): # type: (...) -> Callable """ This function is automatically used if you provide a tuple `(<function>, <msg>_or_<Failure_type>)`, to any of the methods in this page or to one of the `valid8` decorators. It transforms the provided `<function>` into a failure raiser, raising a subclass of `Failure` in case of failure (either not returning `True` or raising an exception) :param validation_func: the base validation function or list of base validation functions to use. A callable, a tuple(callable, help_msg_str), a tuple(callable, failure_type), or a list of several such elements. Nested lists are supported and indicate an implicit `and_` (such as the main list). Tuples indicate an implicit `_failure_raiser`. [mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead of callables, they will be transformed to functions automatically. :param failure_type: a subclass of `WrappingFailure` that should be raised in case of failure :param help_msg: a string help message for the raised `WrappingFailure`. Optional (default = WrappingFailure with no help message). :param kw_context_args :return: """ failure_type, help_msg = pop_kwargs(kwargs, [('failure_type', None), ('help_msg', None)], allow_others=True) # the rest of keyword arguments is used as context. kw_context_args = kwargs main_func = _process_validation_function_s(list(validation_func)) return _failure_raiser(main_func, failure_type=failure_type, help_msg=help_msg, **kw_context_args)
[ "def", "failure_raiser", "(", "*", "validation_func", ",", "# type: ValidationFuncs", "*", "*", "kwargs", ")", ":", "# type: (...) -> Callable", "failure_type", ",", "help_msg", "=", "pop_kwargs", "(", "kwargs", ",", "[", "(", "'failure_type'", ",", "None", ")", ",", "(", "'help_msg'", ",", "None", ")", "]", ",", "allow_others", "=", "True", ")", "# the rest of keyword arguments is used as context.", "kw_context_args", "=", "kwargs", "main_func", "=", "_process_validation_function_s", "(", "list", "(", "validation_func", ")", ")", "return", "_failure_raiser", "(", "main_func", ",", "failure_type", "=", "failure_type", ",", "help_msg", "=", "help_msg", ",", "*", "*", "kw_context_args", ")" ]
This function is automatically used if you provide a tuple `(<function>, <msg>_or_<Failure_type>)`, to any of the methods in this page or to one of the `valid8` decorators. It transforms the provided `<function>` into a failure raiser, raising a subclass of `Failure` in case of failure (either not returning `True` or raising an exception) :param validation_func: the base validation function or list of base validation functions to use. A callable, a tuple(callable, help_msg_str), a tuple(callable, failure_type), or a list of several such elements. Nested lists are supported and indicate an implicit `and_` (such as the main list). Tuples indicate an implicit `_failure_raiser`. [mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead of callables, they will be transformed to functions automatically. :param failure_type: a subclass of `WrappingFailure` that should be raised in case of failure :param help_msg: a string help message for the raised `WrappingFailure`. Optional (default = WrappingFailure with no help message). :param kw_context_args :return:
[ "This", "function", "is", "automatically", "used", "if", "you", "provide", "a", "tuple", "(", "<function", ">", "<msg", ">", "_or_<Failure_type", ">", ")", "to", "any", "of", "the", "methods", "in", "this", "page", "or", "to", "one", "of", "the", "valid8", "decorators", ".", "It", "transforms", "the", "provided", "<function", ">", "into", "a", "failure", "raiser", "raising", "a", "subclass", "of", "Failure", "in", "case", "of", "failure", "(", "either", "not", "returning", "True", "or", "raising", "an", "exception", ")" ]
train
https://github.com/smarie/python-valid8/blob/5e15d1de11602933c5114eb9f73277ad91d97800/valid8/composition.py#L473-L498
<|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: This function is automatically used if you provide a tuple `(<function>, <msg>_or_<Failure_type>)`, to any of the methods in this page or to one of the `valid8` decorators. It transforms the provided `<function>` into a failure raiser, raising a subclass of `Failure` in case of failure (either not returning `True` or raising an exception) :param validation_func: the base validation function or list of base validation functions to use. A callable, a tuple(callable, help_msg_str), a tuple(callable, failure_type), or a list of several such elements. Nested lists are supported and indicate an implicit `and_` (such as the main list). Tuples indicate an implicit `_failure_raiser`. [mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead of callables, they will be transformed to functions automatically. :param failure_type: a subclass of `WrappingFailure` that should be raised in case of failure :param help_msg: a string help message for the raised `WrappingFailure`. Optional (default = WrappingFailure with no help message). :param kw_context_args :return: ### Response: def failure_raiser(*validation_func, # type: ValidationFuncs **kwargs ): # type: (...) -> Callable """ This function is automatically used if you provide a tuple `(<function>, <msg>_or_<Failure_type>)`, to any of the methods in this page or to one of the `valid8` decorators. It transforms the provided `<function>` into a failure raiser, raising a subclass of `Failure` in case of failure (either not returning `True` or raising an exception) :param validation_func: the base validation function or list of base validation functions to use. A callable, a tuple(callable, help_msg_str), a tuple(callable, failure_type), or a list of several such elements. Nested lists are supported and indicate an implicit `and_` (such as the main list). Tuples indicate an implicit `_failure_raiser`. [mini_lambda](https://smarie.github.io/python-mini-lambda/) expressions can be used instead of callables, they will be transformed to functions automatically. :param failure_type: a subclass of `WrappingFailure` that should be raised in case of failure :param help_msg: a string help message for the raised `WrappingFailure`. Optional (default = WrappingFailure with no help message). :param kw_context_args :return: """ failure_type, help_msg = pop_kwargs(kwargs, [('failure_type', None), ('help_msg', None)], allow_others=True) # the rest of keyword arguments is used as context. kw_context_args = kwargs main_func = _process_validation_function_s(list(validation_func)) return _failure_raiser(main_func, failure_type=failure_type, help_msg=help_msg, **kw_context_args) <|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, 2028, 734, 374, 9651, 1511, 422, 499, 3493, 264, 14743, 1595, 23561, 1723, 8226, 366, 3316, 69011, 269, 42843, 17965, 1857, 9414, 7964, 311, 904, 315, 279, 198, 262, 5528, 304, 420, 2199, 477, 311, 832, 315, 279, 1595, 1930, 23, 63, 63778, 13, 1102, 29575, 279, 3984, 31686, 1723, 44726, 1139, 264, 8060, 198, 262, 6503, 261, 11, 19054, 264, 38290, 315, 1595, 17965, 63, 304, 1162, 315, 8060, 320, 50998, 539, 13758, 1595, 2575, 63, 477, 19054, 459, 4788, 696, 262, 551, 913, 10741, 9791, 25, 279, 2385, 10741, 734, 477, 1160, 315, 2385, 10741, 5865, 311, 1005, 13, 362, 42022, 11, 264, 198, 262, 14743, 33791, 481, 11, 1520, 6619, 2966, 705, 264, 14743, 33791, 481, 11, 8060, 1857, 705, 477, 264, 1160, 315, 3892, 1778, 5540, 13, 72842, 11725, 198, 262, 527, 7396, 323, 13519, 459, 18479, 1595, 438, 62, 63, 320, 21470, 439, 279, 1925, 1160, 570, 350, 29423, 13519, 459, 18479, 198, 262, 92721, 30039, 61069, 12329, 29687, 510, 37511, 52984, 9725, 2485, 1129, 3647, 67545, 11267, 4340, 24147, 68454, 2922, 5816, 51907, 24282, 649, 387, 1511, 4619, 198, 262, 315, 1650, 4893, 11, 814, 690, 387, 24411, 311, 5865, 9651, 627, 262, 551, 913, 8060, 1857, 25, 264, 38290, 315, 1595, 36314, 3713, 17965, 63, 430, 1288, 387, 9408, 304, 1162, 315, 8060, 198, 262, 551, 913, 1520, 6619, 25, 264, 925, 1520, 1984, 369, 279, 9408, 1595, 36314, 3713, 17965, 29687, 12536, 320, 2309, 284, 32730, 3713, 17965, 449, 198, 262, 912, 1520, 1984, 4390, 262, 551, 913, 30625, 8634, 8550, 198, 262, 551, 693, 1473, 14711, 6075, 512, 755, 8060, 61069, 12329, 4163, 12564, 9791, 11, 256, 674, 955, 25, 19490, 9823, 82, 198, 4391, 3146, 9872, 198, 4391, 21711, 262, 674, 955, 25, 66877, 1492, 54223, 198, 262, 3270, 262, 1115, 734, 374, 9651, 1511, 422, 499, 3493, 264, 14743, 1595, 23561, 1723, 8226, 366, 3316, 69011, 269, 42843, 17965, 1857, 9414, 7964, 311, 904, 315, 279, 198, 262, 5528, 304, 420, 2199, 477, 311, 832, 315, 279, 1595, 1930, 23, 63, 63778, 13, 1102, 29575, 279, 3984, 31686, 1723, 44726, 1139, 264, 8060, 198, 262, 6503, 261, 11, 19054, 264, 38290, 315, 1595, 17965, 63, 304, 1162, 315, 8060, 320, 50998, 539, 13758, 1595, 2575, 63, 477, 19054, 459, 4788, 696, 262, 551, 913, 10741, 9791, 25, 279, 2385, 10741, 734, 477, 1160, 315, 2385, 10741, 5865, 311, 1005, 13, 362, 42022, 11, 264, 198, 262, 14743, 33791, 481, 11, 1520, 6619, 2966, 705, 264, 14743, 33791, 481, 11, 8060, 1857, 705, 477, 264, 1160, 315, 3892, 1778, 5540, 13, 72842, 11725, 198, 262, 527, 7396, 323, 13519, 459, 18479, 1595, 438, 62, 63, 320, 21470, 439, 279, 1925, 1160, 570, 350, 29423, 13519, 459, 18479, 198, 262, 92721, 30039, 61069, 12329, 29687, 510, 37511, 52984, 9725, 2485, 1129, 3647, 67545, 11267 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2028, 734, 374, 9651, 1511, 422, 499, 3493, 264, 14743, 1595, 23561, 1723, 8226, 366, 3316, 69011, 269, 42843, 17965, 1857, 9414, 7964, 311, 904, 315, 279, 198, 262, 5528, 304, 420, 2199, 477, 311, 832, 315, 279, 1595, 1930, 23, 63, 63778, 13, 1102, 29575, 279, 3984, 31686, 1723, 44726, 1139, 264, 8060, 198, 262, 6503, 261, 11, 19054, 264, 38290, 315, 1595, 17965, 63, 304, 1162, 315, 8060, 320, 50998, 539, 13758, 1595, 2575, 63, 477, 19054, 459, 4788, 696, 262, 551, 913, 10741, 9791, 25, 279, 2385, 10741, 734, 477, 1160, 315, 2385, 10741, 5865, 311, 1005, 13, 362, 42022, 11, 264, 198, 262, 14743, 33791, 481, 11, 1520, 6619, 2966, 705, 264, 14743, 33791, 481, 11, 8060, 1857, 705, 477, 264, 1160, 315, 3892, 1778, 5540, 13, 72842, 11725, 198, 262, 527, 7396, 323, 13519, 459, 18479, 1595, 438, 62, 63, 320, 21470, 439, 279, 1925, 1160, 570, 350, 29423, 13519, 459, 18479, 198, 262, 92721, 30039, 61069, 12329, 29687, 510, 37511, 52984, 9725, 2485, 1129, 3647, 67545, 11267, 4340, 24147, 68454, 2922, 5816, 51907, 24282, 649, 387, 1511, 4619, 198, 262, 315, 1650, 4893, 11, 814, 690, 387, 24411, 311, 5865, 9651, 627, 262, 551, 913, 8060, 1857, 25, 264, 38290, 315, 1595, 36314, 3713, 17965, 63, 430, 1288, 387, 9408, 304, 1162, 315, 8060, 198, 262, 551, 913, 1520, 6619, 25, 264, 925, 1520, 1984, 369, 279, 9408, 1595, 36314, 3713, 17965, 29687, 12536, 320, 2309, 284, 32730, 3713, 17965, 449, 198, 262, 912, 1520, 1984, 4390, 262, 551, 913, 30625, 8634, 8550, 198, 262, 551, 693, 1473, 14711, 6075, 512, 755, 8060, 61069, 12329, 4163, 12564, 9791, 11, 256, 674, 955, 25, 19490, 9823, 82, 198, 4391, 3146, 9872, 198, 4391, 21711, 262, 674, 955, 25, 66877, 1492, 54223, 198, 262, 3270, 262, 1115, 734, 374, 9651, 1511, 422, 499, 3493, 264, 14743, 1595, 23561, 1723, 8226, 366, 3316, 69011, 269, 42843, 17965, 1857, 9414, 7964, 311, 904, 315, 279, 198, 262, 5528, 304, 420, 2199, 477, 311, 832, 315, 279, 1595, 1930, 23, 63, 63778, 13, 1102, 29575, 279, 3984, 31686, 1723, 44726, 1139, 264, 8060, 198, 262, 6503, 261, 11, 19054, 264, 38290, 315, 1595, 17965, 63, 304, 1162, 315, 8060, 320, 50998, 539, 13758, 1595, 2575, 63, 477, 19054, 459, 4788, 696, 262, 551, 913, 10741, 9791, 25, 279, 2385, 10741, 734, 477, 1160, 315, 2385, 10741, 5865, 311, 1005, 13, 362, 42022, 11, 264, 198, 262, 14743, 33791, 481, 11, 1520, 6619, 2966, 705, 264, 14743, 33791, 481, 11, 8060, 1857, 705, 477, 264, 1160, 315, 3892, 1778, 5540, 13, 72842, 11725, 198, 262, 527, 7396, 323, 13519, 459, 18479, 1595, 438, 62, 63, 320, 21470, 439, 279, 1925, 1160, 570, 350, 29423, 13519, 459, 18479, 198, 262, 92721, 30039, 61069, 12329, 29687, 510, 37511, 52984, 9725, 2485, 1129, 3647, 67545, 11267 ]
jciskey/pygraph
pygraph/functions/planarity/kocay_algorithm.py
S_star
def S_star(u, dfs_data): """The set of all descendants of u, with u added.""" s_u = S(u, dfs_data) if u not in s_u: s_u.append(u) return s_u
python
def S_star(u, dfs_data): """The set of all descendants of u, with u added.""" s_u = S(u, dfs_data) if u not in s_u: s_u.append(u) return s_u
[ "def", "S_star", "(", "u", ",", "dfs_data", ")", ":", "s_u", "=", "S", "(", "u", ",", "dfs_data", ")", "if", "u", "not", "in", "s_u", ":", "s_u", ".", "append", "(", "u", ")", "return", "s_u" ]
The set of all descendants of u, with u added.
[ "The", "set", "of", "all", "descendants", "of", "u", "with", "u", "added", "." ]
train
https://github.com/jciskey/pygraph/blob/037bb2f32503fecb60d62921f9766d54109f15e2/pygraph/functions/planarity/kocay_algorithm.py#L955-L960
<|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: The set of all descendants of u, with u added. ### Response: def S_star(u, dfs_data): """The set of all descendants of u, with u added.""" s_u = S(u, dfs_data) if u not in s_u: s_u.append(u) return s_u <|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, 791, 743, 315, 682, 49446, 315, 577, 11, 449, 577, 3779, 382, 14711, 6075, 512, 755, 328, 32781, 8317, 11, 26877, 1807, 997, 262, 4304, 791, 743, 315, 682, 49446, 315, 577, 11, 449, 577, 3779, 14781, 262, 274, 7448, 284, 328, 8317, 11, 26877, 1807, 340, 262, 422, 577, 539, 304, 274, 7448, 512, 286, 274, 7448, 2102, 8317, 340, 262, 471, 274, 7448, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 791, 743, 315, 682, 49446, 315, 577, 11, 449, 577, 3779, 382, 14711, 6075, 512, 755, 328, 32781, 8317, 11, 26877, 1807, 997, 262, 4304, 791, 743, 315, 682, 49446, 315, 577, 11, 449, 577, 3779, 14781, 262, 274, 7448, 284, 328, 8317, 11, 26877, 1807, 340, 262, 422, 577, 539, 304, 274, 7448, 512, 286, 274, 7448, 2102, 8317, 340, 262, 471, 274, 7448, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
psss/did
did/utils.py
listed
def listed(items, singular=None, plural=None, max=None, quote=""): """ Convert an iterable into a nice, human readable list or description:: listed(range(1)) .................... 0 listed(range(2)) .................... 0 and 1 listed(range(3), quote='"') ......... "0", "1" and "2" listed(range(4), max=3) ............. 0, 1, 2 and 1 more listed(range(5), 'number', max=3) ... 0, 1, 2 and 2 more numbers listed(range(6), 'category') ........ 6 categories listed(7, "leaf", "leaves") ......... 7 leaves If singular form is provided but max not set the description-only mode is activated as shown in the last two examples. Also, an int can be used in this case to get a simple inflection functionality. """ # Convert items to list if necessary items = range(items) if isinstance(items, int) else list(items) more = " more" # Description mode expected when singular provided but no maximum set if singular is not None and max is None: max = 0 more = "" # Set the default plural form if singular is not None and plural is None: plural = pluralize(singular) # Convert to strings and optionally quote each item items = ["{0}{1}{0}".format(quote, item) for item in items] # Select the maximum of items and describe the rest if max provided if max is not None: # Special case when the list is empty (0 items) if max == 0 and len(items) == 0: return "0 {0}".format(plural) # Cut the list if maximum exceeded if len(items) > max: rest = len(items[max:]) items = items[:max] if singular is not None: more += " {0}".format(singular if rest == 1 else plural) items.append("{0}{1}".format(rest, more)) # For two and more items use 'and' instead of the last comma if len(items) < 2: return "".join(items) else: return ", ".join(items[0:-2] + [" and ".join(items[-2:])])
python
def listed(items, singular=None, plural=None, max=None, quote=""): """ Convert an iterable into a nice, human readable list or description:: listed(range(1)) .................... 0 listed(range(2)) .................... 0 and 1 listed(range(3), quote='"') ......... "0", "1" and "2" listed(range(4), max=3) ............. 0, 1, 2 and 1 more listed(range(5), 'number', max=3) ... 0, 1, 2 and 2 more numbers listed(range(6), 'category') ........ 6 categories listed(7, "leaf", "leaves") ......... 7 leaves If singular form is provided but max not set the description-only mode is activated as shown in the last two examples. Also, an int can be used in this case to get a simple inflection functionality. """ # Convert items to list if necessary items = range(items) if isinstance(items, int) else list(items) more = " more" # Description mode expected when singular provided but no maximum set if singular is not None and max is None: max = 0 more = "" # Set the default plural form if singular is not None and plural is None: plural = pluralize(singular) # Convert to strings and optionally quote each item items = ["{0}{1}{0}".format(quote, item) for item in items] # Select the maximum of items and describe the rest if max provided if max is not None: # Special case when the list is empty (0 items) if max == 0 and len(items) == 0: return "0 {0}".format(plural) # Cut the list if maximum exceeded if len(items) > max: rest = len(items[max:]) items = items[:max] if singular is not None: more += " {0}".format(singular if rest == 1 else plural) items.append("{0}{1}".format(rest, more)) # For two and more items use 'and' instead of the last comma if len(items) < 2: return "".join(items) else: return ", ".join(items[0:-2] + [" and ".join(items[-2:])])
[ "def", "listed", "(", "items", ",", "singular", "=", "None", ",", "plural", "=", "None", ",", "max", "=", "None", ",", "quote", "=", "\"\"", ")", ":", "# Convert items to list if necessary", "items", "=", "range", "(", "items", ")", "if", "isinstance", "(", "items", ",", "int", ")", "else", "list", "(", "items", ")", "more", "=", "\" more\"", "# Description mode expected when singular provided but no maximum set", "if", "singular", "is", "not", "None", "and", "max", "is", "None", ":", "max", "=", "0", "more", "=", "\"\"", "# Set the default plural form", "if", "singular", "is", "not", "None", "and", "plural", "is", "None", ":", "plural", "=", "pluralize", "(", "singular", ")", "# Convert to strings and optionally quote each item", "items", "=", "[", "\"{0}{1}{0}\"", ".", "format", "(", "quote", ",", "item", ")", "for", "item", "in", "items", "]", "# Select the maximum of items and describe the rest if max provided", "if", "max", "is", "not", "None", ":", "# Special case when the list is empty (0 items)", "if", "max", "==", "0", "and", "len", "(", "items", ")", "==", "0", ":", "return", "\"0 {0}\"", ".", "format", "(", "plural", ")", "# Cut the list if maximum exceeded", "if", "len", "(", "items", ")", ">", "max", ":", "rest", "=", "len", "(", "items", "[", "max", ":", "]", ")", "items", "=", "items", "[", ":", "max", "]", "if", "singular", "is", "not", "None", ":", "more", "+=", "\" {0}\"", ".", "format", "(", "singular", "if", "rest", "==", "1", "else", "plural", ")", "items", ".", "append", "(", "\"{0}{1}\"", ".", "format", "(", "rest", ",", "more", ")", ")", "# For two and more items use 'and' instead of the last comma", "if", "len", "(", "items", ")", "<", "2", ":", "return", "\"\"", ".", "join", "(", "items", ")", "else", ":", "return", "\", \"", ".", "join", "(", "items", "[", "0", ":", "-", "2", "]", "+", "[", "\" and \"", ".", "join", "(", "items", "[", "-", "2", ":", "]", ")", "]", ")" ]
Convert an iterable into a nice, human readable list or description:: listed(range(1)) .................... 0 listed(range(2)) .................... 0 and 1 listed(range(3), quote='"') ......... "0", "1" and "2" listed(range(4), max=3) ............. 0, 1, 2 and 1 more listed(range(5), 'number', max=3) ... 0, 1, 2 and 2 more numbers listed(range(6), 'category') ........ 6 categories listed(7, "leaf", "leaves") ......... 7 leaves If singular form is provided but max not set the description-only mode is activated as shown in the last two examples. Also, an int can be used in this case to get a simple inflection functionality.
[ "Convert", "an", "iterable", "into", "a", "nice", "human", "readable", "list", "or", "description", "::" ]
train
https://github.com/psss/did/blob/04e4ee6f1aa14c0cae3ba9f9803871f3f98279cb/did/utils.py#L90-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: Convert an iterable into a nice, human readable list or description:: listed(range(1)) .................... 0 listed(range(2)) .................... 0 and 1 listed(range(3), quote='"') ......... "0", "1" and "2" listed(range(4), max=3) ............. 0, 1, 2 and 1 more listed(range(5), 'number', max=3) ... 0, 1, 2 and 2 more numbers listed(range(6), 'category') ........ 6 categories listed(7, "leaf", "leaves") ......... 7 leaves If singular form is provided but max not set the description-only mode is activated as shown in the last two examples. Also, an int can be used in this case to get a simple inflection functionality. ### Response: def listed(items, singular=None, plural=None, max=None, quote=""): """ Convert an iterable into a nice, human readable list or description:: listed(range(1)) .................... 0 listed(range(2)) .................... 0 and 1 listed(range(3), quote='"') ......... "0", "1" and "2" listed(range(4), max=3) ............. 0, 1, 2 and 1 more listed(range(5), 'number', max=3) ... 0, 1, 2 and 2 more numbers listed(range(6), 'category') ........ 6 categories listed(7, "leaf", "leaves") ......... 7 leaves If singular form is provided but max not set the description-only mode is activated as shown in the last two examples. Also, an int can be used in this case to get a simple inflection functionality. """ # Convert items to list if necessary items = range(items) if isinstance(items, int) else list(items) more = " more" # Description mode expected when singular provided but no maximum set if singular is not None and max is None: max = 0 more = "" # Set the default plural form if singular is not None and plural is None: plural = pluralize(singular) # Convert to strings and optionally quote each item items = ["{0}{1}{0}".format(quote, item) for item in items] # Select the maximum of items and describe the rest if max provided if max is not None: # Special case when the list is empty (0 items) if max == 0 and len(items) == 0: return "0 {0}".format(plural) # Cut the list if maximum exceeded if len(items) > max: rest = len(items[max:]) items = items[:max] if singular is not None: more += " {0}".format(singular if rest == 1 else plural) items.append("{0}{1}".format(rest, more)) # For two and more items use 'and' instead of the last comma if len(items) < 2: return "".join(items) else: return ", ".join(items[0:-2] + [" and ".join(items[-2:])]) <|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, 51934, 1139, 264, 6555, 11, 3823, 34898, 1160, 477, 4096, 66152, 286, 10212, 23147, 7, 16, 595, 90014, 1975, 220, 15, 198, 286, 10212, 23147, 7, 17, 595, 90014, 1975, 220, 15, 323, 220, 16, 198, 286, 10212, 23147, 7, 18, 705, 12929, 15707, 873, 22666, 18575, 330, 15, 498, 330, 16, 1, 323, 330, 17, 702, 286, 10212, 23147, 7, 19, 705, 1973, 28, 18, 8, 46196, 18575, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 16, 810, 198, 286, 10212, 23147, 7, 20, 705, 364, 4174, 518, 1973, 28, 18, 8, 2564, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 17, 810, 5219, 198, 286, 10212, 23147, 7, 21, 705, 364, 5588, 873, 46196, 220, 21, 11306, 198, 286, 10212, 7, 22, 11, 330, 25126, 498, 330, 273, 4798, 909, 22666, 18575, 220, 22, 11141, 271, 262, 1442, 35044, 1376, 374, 3984, 719, 1973, 539, 743, 279, 4096, 15744, 198, 262, 3941, 374, 22756, 439, 6982, 304, 279, 1566, 1403, 10507, 13, 7429, 11, 459, 528, 198, 262, 649, 387, 1511, 304, 420, 1162, 311, 636, 264, 4382, 4225, 1191, 15293, 382, 14711, 6075, 512, 755, 10212, 25331, 11, 35044, 5980, 11, 39598, 5980, 11, 1973, 5980, 11, 12929, 429, 15497, 262, 3270, 262, 7316, 459, 51934, 1139, 264, 6555, 11, 3823, 34898, 1160, 477, 4096, 66152, 286, 10212, 23147, 7, 16, 595, 90014, 1975, 220, 15, 198, 286, 10212, 23147, 7, 17, 595, 90014, 1975, 220, 15, 323, 220, 16, 198, 286, 10212, 23147, 7, 18, 705, 12929, 15707, 873, 22666, 18575, 330, 15, 498, 330, 16, 1, 323, 330, 17, 702, 286, 10212, 23147, 7, 19, 705, 1973, 28, 18, 8, 46196, 18575, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 16, 810, 198, 286, 10212, 23147, 7, 20, 705, 364, 4174, 518, 1973, 28, 18, 8, 2564, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 17, 810, 5219, 198, 286, 10212, 23147, 7, 21, 705, 364, 5588, 873, 46196, 220, 21, 11306, 198, 286, 10212, 7, 22, 11, 330, 25126, 498, 330, 273, 4798, 909, 22666, 18575, 220, 22, 11141, 271, 262, 1442, 35044, 1376, 374, 3984, 719, 1973, 539, 743, 279, 4096, 15744, 198, 262, 3941, 374, 22756, 439, 6982, 304, 279, 1566, 1403, 10507, 13, 7429, 11, 459, 528, 198, 262, 649, 387, 1511, 304, 420, 1162, 311, 636, 264, 4382, 4225, 1191, 15293, 627, 262, 12713, 262, 674, 7316, 3673, 311, 1160, 422, 5995, 198, 262, 3673, 284, 2134, 25331, 8, 422, 11656, 25331, 11, 528, 8, 775, 1160, 25331, 340, 262, 810, 284, 330, 810, 702, 262, 674, 7817, 3941, 3685, 994, 35044, 3984, 719, 912, 7340, 743, 198, 262, 422, 35044, 374, 539, 2290, 323, 1973, 374, 2290, 512, 286, 1973, 284, 220, 15, 198, 286, 810, 284, 8555, 262, 674, 2638, 279 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 51934, 1139, 264, 6555, 11, 3823, 34898, 1160, 477, 4096, 66152, 286, 10212, 23147, 7, 16, 595, 90014, 1975, 220, 15, 198, 286, 10212, 23147, 7, 17, 595, 90014, 1975, 220, 15, 323, 220, 16, 198, 286, 10212, 23147, 7, 18, 705, 12929, 15707, 873, 22666, 18575, 330, 15, 498, 330, 16, 1, 323, 330, 17, 702, 286, 10212, 23147, 7, 19, 705, 1973, 28, 18, 8, 46196, 18575, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 16, 810, 198, 286, 10212, 23147, 7, 20, 705, 364, 4174, 518, 1973, 28, 18, 8, 2564, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 17, 810, 5219, 198, 286, 10212, 23147, 7, 21, 705, 364, 5588, 873, 46196, 220, 21, 11306, 198, 286, 10212, 7, 22, 11, 330, 25126, 498, 330, 273, 4798, 909, 22666, 18575, 220, 22, 11141, 271, 262, 1442, 35044, 1376, 374, 3984, 719, 1973, 539, 743, 279, 4096, 15744, 198, 262, 3941, 374, 22756, 439, 6982, 304, 279, 1566, 1403, 10507, 13, 7429, 11, 459, 528, 198, 262, 649, 387, 1511, 304, 420, 1162, 311, 636, 264, 4382, 4225, 1191, 15293, 382, 14711, 6075, 512, 755, 10212, 25331, 11, 35044, 5980, 11, 39598, 5980, 11, 1973, 5980, 11, 12929, 429, 15497, 262, 3270, 262, 7316, 459, 51934, 1139, 264, 6555, 11, 3823, 34898, 1160, 477, 4096, 66152, 286, 10212, 23147, 7, 16, 595, 90014, 1975, 220, 15, 198, 286, 10212, 23147, 7, 17, 595, 90014, 1975, 220, 15, 323, 220, 16, 198, 286, 10212, 23147, 7, 18, 705, 12929, 15707, 873, 22666, 18575, 330, 15, 498, 330, 16, 1, 323, 330, 17, 702, 286, 10212, 23147, 7, 19, 705, 1973, 28, 18, 8, 46196, 18575, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 16, 810, 198, 286, 10212, 23147, 7, 20, 705, 364, 4174, 518, 1973, 28, 18, 8, 2564, 220, 15, 11, 220, 16, 11, 220, 17, 323, 220, 17, 810, 5219, 198, 286, 10212, 23147, 7, 21, 705, 364, 5588, 873, 46196, 220, 21, 11306, 198, 286, 10212, 7, 22, 11, 330, 25126, 498, 330, 273, 4798, 909, 22666, 18575, 220, 22, 11141, 271, 262, 1442, 35044, 1376, 374, 3984, 719, 1973, 539, 743, 279, 4096, 15744, 198, 262, 3941, 374, 22756, 439, 6982, 304, 279, 1566, 1403, 10507, 13, 7429, 11, 459, 528, 198, 262, 649, 387, 1511, 304, 420, 1162, 311, 636, 264, 4382, 4225, 1191, 15293, 627, 262, 12713, 262, 674, 7316, 3673, 311, 1160, 422, 5995, 198, 262, 3673, 284, 2134, 25331, 8, 422, 11656, 25331, 11, 528, 8, 775, 1160, 25331, 340, 262, 810, 284, 330, 810, 702, 262, 674, 7817, 3941, 3685, 994, 35044, 3984, 719, 912, 7340, 743, 198, 262, 422, 35044, 374, 539, 2290, 323, 1973, 374, 2290, 512, 286, 1973, 284, 220, 15, 198, 286, 810, 284, 8555, 262, 674, 2638, 279 ]
SpriteLink/NIPAP
nipap-cli/nipap_cli/nipap_cli.py
get_vrf
def get_vrf(arg = None, default_var = 'default_vrf_rt', abort = False): """ Returns VRF to work in Returns a pynipap.VRF object representing the VRF we are working in. If there is a VRF set globally, return this. If not, fetch the VRF named 'arg'. If 'arg' is None, fetch the default_vrf attribute from the config file and return this VRF. """ # yep, global variables are evil global vrf # if there is a VRF set, return it if vrf is not None: return vrf if arg is None: # fetch default vrf try: vrf_rt = cfg.get('global', default_var) except configparser.NoOptionError: # default to all VRFs vrf_rt = 'all' else: vrf_rt = arg if vrf_rt.lower() == 'all': vrf = VRF() vrf.rt = 'all' else: if vrf_rt.lower() in ('-', 'none'): vrf_rt = None try: vrf = VRF.search({ 'val1': 'rt', 'operator': 'equals', 'val2': vrf_rt })['result'][0] except (KeyError, IndexError): if abort: print("VRF with [RT: %s] not found." % str(vrf_rt), file=sys.stderr) sys.exit(1) else: vrf = False return vrf
python
def get_vrf(arg = None, default_var = 'default_vrf_rt', abort = False): """ Returns VRF to work in Returns a pynipap.VRF object representing the VRF we are working in. If there is a VRF set globally, return this. If not, fetch the VRF named 'arg'. If 'arg' is None, fetch the default_vrf attribute from the config file and return this VRF. """ # yep, global variables are evil global vrf # if there is a VRF set, return it if vrf is not None: return vrf if arg is None: # fetch default vrf try: vrf_rt = cfg.get('global', default_var) except configparser.NoOptionError: # default to all VRFs vrf_rt = 'all' else: vrf_rt = arg if vrf_rt.lower() == 'all': vrf = VRF() vrf.rt = 'all' else: if vrf_rt.lower() in ('-', 'none'): vrf_rt = None try: vrf = VRF.search({ 'val1': 'rt', 'operator': 'equals', 'val2': vrf_rt })['result'][0] except (KeyError, IndexError): if abort: print("VRF with [RT: %s] not found." % str(vrf_rt), file=sys.stderr) sys.exit(1) else: vrf = False return vrf
[ "def", "get_vrf", "(", "arg", "=", "None", ",", "default_var", "=", "'default_vrf_rt'", ",", "abort", "=", "False", ")", ":", "# yep, global variables are evil", "global", "vrf", "# if there is a VRF set, return it", "if", "vrf", "is", "not", "None", ":", "return", "vrf", "if", "arg", "is", "None", ":", "# fetch default vrf", "try", ":", "vrf_rt", "=", "cfg", ".", "get", "(", "'global'", ",", "default_var", ")", "except", "configparser", ".", "NoOptionError", ":", "# default to all VRFs", "vrf_rt", "=", "'all'", "else", ":", "vrf_rt", "=", "arg", "if", "vrf_rt", ".", "lower", "(", ")", "==", "'all'", ":", "vrf", "=", "VRF", "(", ")", "vrf", ".", "rt", "=", "'all'", "else", ":", "if", "vrf_rt", ".", "lower", "(", ")", "in", "(", "'-'", ",", "'none'", ")", ":", "vrf_rt", "=", "None", "try", ":", "vrf", "=", "VRF", ".", "search", "(", "{", "'val1'", ":", "'rt'", ",", "'operator'", ":", "'equals'", ",", "'val2'", ":", "vrf_rt", "}", ")", "[", "'result'", "]", "[", "0", "]", "except", "(", "KeyError", ",", "IndexError", ")", ":", "if", "abort", ":", "print", "(", "\"VRF with [RT: %s] not found.\"", "%", "str", "(", "vrf_rt", ")", ",", "file", "=", "sys", ".", "stderr", ")", "sys", ".", "exit", "(", "1", ")", "else", ":", "vrf", "=", "False", "return", "vrf" ]
Returns VRF to work in Returns a pynipap.VRF object representing the VRF we are working in. If there is a VRF set globally, return this. If not, fetch the VRF named 'arg'. If 'arg' is None, fetch the default_vrf attribute from the config file and return this VRF.
[ "Returns", "VRF", "to", "work", "in" ]
train
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/nipap-cli/nipap_cli/nipap_cli.py#L109-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 VRF to work in Returns a pynipap.VRF object representing the VRF we are working in. If there is a VRF set globally, return this. If not, fetch the VRF named 'arg'. If 'arg' is None, fetch the default_vrf attribute from the config file and return this VRF. ### Response: def get_vrf(arg = None, default_var = 'default_vrf_rt', abort = False): """ Returns VRF to work in Returns a pynipap.VRF object representing the VRF we are working in. If there is a VRF set globally, return this. If not, fetch the VRF named 'arg'. If 'arg' is None, fetch the default_vrf attribute from the config file and return this VRF. """ # yep, global variables are evil global vrf # if there is a VRF set, return it if vrf is not None: return vrf if arg is None: # fetch default vrf try: vrf_rt = cfg.get('global', default_var) except configparser.NoOptionError: # default to all VRFs vrf_rt = 'all' else: vrf_rt = arg if vrf_rt.lower() == 'all': vrf = VRF() vrf.rt = 'all' else: if vrf_rt.lower() in ('-', 'none'): vrf_rt = None try: vrf = VRF.search({ 'val1': 'rt', 'operator': 'equals', 'val2': vrf_rt })['result'][0] except (KeyError, IndexError): if abort: print("VRF with [RT: %s] not found." % str(vrf_rt), file=sys.stderr) sys.exit(1) else: vrf = False return vrf <|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, 650, 18077, 311, 990, 304, 271, 286, 5295, 264, 281, 1910, 575, 391, 5168, 18077, 1665, 14393, 279, 650, 18077, 584, 527, 3318, 198, 286, 304, 13, 1442, 1070, 374, 264, 650, 18077, 743, 31550, 11, 471, 420, 13, 1442, 539, 11, 7963, 279, 198, 286, 650, 18077, 7086, 364, 867, 4527, 1442, 364, 867, 6, 374, 2290, 11, 7963, 279, 1670, 2325, 8212, 198, 286, 7180, 505, 279, 2242, 1052, 323, 471, 420, 650, 18077, 382, 14711, 6075, 512, 755, 636, 2325, 8212, 9590, 284, 2290, 11, 1670, 4715, 284, 364, 2309, 2325, 8212, 41269, 518, 11578, 284, 3641, 997, 262, 4304, 5295, 650, 18077, 311, 990, 304, 271, 286, 5295, 264, 281, 1910, 575, 391, 5168, 18077, 1665, 14393, 279, 650, 18077, 584, 527, 3318, 198, 286, 304, 13, 1442, 1070, 374, 264, 650, 18077, 743, 31550, 11, 471, 420, 13, 1442, 539, 11, 7963, 279, 198, 286, 650, 18077, 7086, 364, 867, 4527, 1442, 364, 867, 6, 374, 2290, 11, 7963, 279, 1670, 2325, 8212, 198, 286, 7180, 505, 279, 2242, 1052, 323, 471, 420, 650, 18077, 627, 262, 12713, 262, 674, 379, 752, 11, 3728, 7482, 527, 14289, 198, 262, 3728, 348, 8212, 271, 262, 674, 422, 1070, 374, 264, 650, 18077, 743, 11, 471, 433, 198, 262, 422, 348, 8212, 374, 539, 2290, 512, 286, 471, 348, 8212, 271, 262, 422, 1417, 374, 2290, 512, 286, 674, 7963, 1670, 348, 8212, 198, 286, 1456, 512, 310, 348, 8212, 41269, 284, 13589, 673, 493, 9951, 518, 1670, 4715, 340, 286, 3734, 98537, 17184, 5454, 1480, 512, 310, 674, 1670, 311, 682, 650, 18077, 82, 198, 310, 348, 8212, 41269, 284, 364, 543, 1270, 262, 775, 512, 286, 348, 8212, 41269, 284, 1417, 271, 262, 422, 348, 8212, 41269, 18564, 368, 624, 364, 543, 3730, 286, 348, 8212, 284, 650, 18077, 746, 286, 348, 8212, 71316, 284, 364, 543, 1270, 262, 775, 512, 286, 422, 348, 8212, 41269, 18564, 368, 304, 4417, 54919, 364, 6836, 11290, 310, 348, 8212, 41269, 284, 2290, 271, 286, 1456, 512, 310, 348, 8212, 284, 650, 18077, 9472, 2358, 364, 838, 16, 1232, 364, 3423, 756, 394, 364, 8043, 1232, 364, 7324, 756, 394, 364, 838, 17, 1232, 348, 8212, 41269, 198, 394, 6547, 681, 1407, 10136, 15, 933, 286, 3734, 320, 1622, 1480, 11, 61303, 997, 310, 422, 11578, 512, 394, 1194, 446, 53, 18077, 449, 510, 5463, 25, 1034, 82, 60, 539, 1766, 1210, 1034, 610, 3832, 8212, 41269, 705, 1052, 59970, 35842, 340, 394, 5826, 13955, 7, 16, 340, 310, 775, 512, 394, 348, 8212, 284, 3641, 271, 262, 471, 348, 8212, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 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, 650, 18077, 311, 990, 304, 271, 286, 5295, 264, 281, 1910, 575, 391, 5168, 18077, 1665, 14393, 279, 650, 18077, 584, 527, 3318, 198, 286, 304, 13, 1442, 1070, 374, 264, 650, 18077, 743, 31550, 11, 471, 420, 13, 1442, 539, 11, 7963, 279, 198, 286, 650, 18077, 7086, 364, 867, 4527, 1442, 364, 867, 6, 374, 2290, 11, 7963, 279, 1670, 2325, 8212, 198, 286, 7180, 505, 279, 2242, 1052, 323, 471, 420, 650, 18077, 382, 14711, 6075, 512, 755, 636, 2325, 8212, 9590, 284, 2290, 11, 1670, 4715, 284, 364, 2309, 2325, 8212, 41269, 518, 11578, 284, 3641, 997, 262, 4304, 5295, 650, 18077, 311, 990, 304, 271, 286, 5295, 264, 281, 1910, 575, 391, 5168, 18077, 1665, 14393, 279, 650, 18077, 584, 527, 3318, 198, 286, 304, 13, 1442, 1070, 374, 264, 650, 18077, 743, 31550, 11, 471, 420, 13, 1442, 539, 11, 7963, 279, 198, 286, 650, 18077, 7086, 364, 867, 4527, 1442, 364, 867, 6, 374, 2290, 11, 7963, 279, 1670, 2325, 8212, 198, 286, 7180, 505, 279, 2242, 1052, 323, 471, 420, 650, 18077, 627, 262, 12713, 262, 674, 379, 752, 11, 3728, 7482, 527, 14289, 198, 262, 3728, 348, 8212, 271, 262, 674, 422, 1070, 374, 264, 650, 18077, 743, 11, 471, 433, 198, 262, 422, 348, 8212, 374, 539, 2290, 512, 286, 471, 348, 8212, 271, 262, 422, 1417, 374, 2290, 512, 286, 674, 7963, 1670, 348, 8212, 198, 286, 1456, 512, 310, 348, 8212, 41269, 284, 13589, 673, 493, 9951, 518, 1670, 4715, 340, 286, 3734, 98537, 17184, 5454, 1480, 512, 310, 674, 1670, 311, 682, 650, 18077, 82, 198, 310, 348, 8212, 41269, 284, 364, 543, 1270, 262, 775, 512, 286, 348, 8212, 41269, 284, 1417, 271, 262, 422, 348, 8212, 41269, 18564, 368, 624, 364, 543, 3730, 286, 348, 8212, 284, 650, 18077, 746, 286, 348, 8212, 71316, 284, 364, 543, 1270, 262, 775, 512, 286, 422, 348, 8212, 41269, 18564, 368, 304, 4417, 54919, 364, 6836, 11290, 310, 348, 8212, 41269, 284, 2290, 271, 286, 1456, 512, 310, 348, 8212, 284, 650, 18077, 9472, 2358, 364, 838, 16, 1232, 364, 3423, 756, 394, 364, 8043, 1232, 364, 7324, 756, 394, 364, 838, 17, 1232, 348, 8212, 41269, 198, 394, 6547, 681, 1407, 10136, 15, 933, 286, 3734, 320, 1622, 1480, 11, 61303, 997, 310, 422, 11578, 512, 394, 1194, 446, 53, 18077, 449, 510, 5463, 25, 1034, 82, 60, 539, 1766, 1210, 1034, 610, 3832, 8212, 41269, 705, 1052, 59970, 35842, 340, 394, 5826, 13955, 7, 16, 340, 310, 775, 512, 394, 348, 8212, 284, 3641, 271, 262, 471, 348, 8212, 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 ]
BD2KGenomics/toil-scripts
src/toil_scripts/adam_kmers/count_kmers.py
download_count_upload
def download_count_upload(job, master_ip, input_file, output_file, kmer_length, spark_conf, memory, sudo): ''' Runs k-mer counting. 1. If the input file is located in S3, the file is copied into HDFS. 2. If the input file is not in Parquet format, the file is converted into Parquet. 3. The k-mers are counted and saved as text. 4. If the output path is an S3 URL, the file is copied back to S3. :param job: Toil job :param input_file: URL/path to input file to count k-mers on :param output_file: URL/path to save k-mer counts at :param kmer_length: The length of k-mer substrings to count. :param spark_conf: Optional Spark configuration. If set, memory should \ not be set. :param memory: Amount of memory to provided to Spark workers. Must be set \ if spark_conf is not set. :param sudo: Whether or not to run Spark containers with sudo. :type job: toil.Job :type input_file: string :type output_file: string :type kmer_length: int or string :type spark_conf: list of string or None :type memory: int or None :type sudo: boolean ''' if master_ip is not None: hdfs_dir = "hdfs://{0}:{1}/".format(master_ip, HDFS_MASTER_PORT) else: _log.warn('Master IP is not set. If default filesystem is not set, jobs may fail.') hdfs_dir = "" # if the file isn't already in hdfs, copy it in hdfs_input_file = hdfs_dir if input_file.startswith("s3://"): # append the s3 file name to our hdfs path hdfs_input_file += input_file.split("/")[-1] # run the download _log.info("Downloading input file %s to %s.", input_file, hdfs_input_file) call_conductor(job, master_ip, input_file, hdfs_input_file, memory=memory, override_parameters=spark_conf) else: if not input_file.startswith("hdfs://"): _log.warn("If not in S3, input file (%s) expected to be in HDFS (%s).", input_file, hdfs_dir) # where are we writing the output to? is it going to a location in hdfs or not? run_upload = True hdfs_output_file = hdfs_dir + "kmer_output.txt" if output_file.startswith(hdfs_dir): run_upload = False hdfs_output_file = output_file # do we need to convert to adam? if (hdfs_input_file.endswith('.bam') or hdfs_input_file.endswith('.sam') or hdfs_input_file.endswith('.fq') or hdfs_input_file.endswith('.fastq')): hdfs_tmp_file = hdfs_input_file # change the file extension to adam hdfs_input_file = '.'.join(hdfs_input_file.split('.')[:-1].append('adam')) # convert the file _log.info('Converting %s into ADAM format at %s.', hdfs_tmp_file, hdfs_input_file) call_adam(job, master_ip, ['transform', hdfs_tmp_file, hdfs_input_file], memory=memory, override_parameters=spark_conf) # run k-mer counting _log.info('Counting %d-mers in %s, and saving to %s.', kmer_length, hdfs_input_file, hdfs_output_file) call_adam(job, master_ip, ['count_kmers', hdfs_input_file, hdfs_output_file, str(kmer_length)], memory=memory, override_parameters=spark_conf) # do we need to upload the file back? if so, run upload if run_upload: _log.info("Uploading output file %s to %s.", hdfs_output_file, output_file) call_conductor(job, master_ip, hdfs_output_file, output_file, memory=memory, override_parameters=spark_conf)
python
def download_count_upload(job, master_ip, input_file, output_file, kmer_length, spark_conf, memory, sudo): ''' Runs k-mer counting. 1. If the input file is located in S3, the file is copied into HDFS. 2. If the input file is not in Parquet format, the file is converted into Parquet. 3. The k-mers are counted and saved as text. 4. If the output path is an S3 URL, the file is copied back to S3. :param job: Toil job :param input_file: URL/path to input file to count k-mers on :param output_file: URL/path to save k-mer counts at :param kmer_length: The length of k-mer substrings to count. :param spark_conf: Optional Spark configuration. If set, memory should \ not be set. :param memory: Amount of memory to provided to Spark workers. Must be set \ if spark_conf is not set. :param sudo: Whether or not to run Spark containers with sudo. :type job: toil.Job :type input_file: string :type output_file: string :type kmer_length: int or string :type spark_conf: list of string or None :type memory: int or None :type sudo: boolean ''' if master_ip is not None: hdfs_dir = "hdfs://{0}:{1}/".format(master_ip, HDFS_MASTER_PORT) else: _log.warn('Master IP is not set. If default filesystem is not set, jobs may fail.') hdfs_dir = "" # if the file isn't already in hdfs, copy it in hdfs_input_file = hdfs_dir if input_file.startswith("s3://"): # append the s3 file name to our hdfs path hdfs_input_file += input_file.split("/")[-1] # run the download _log.info("Downloading input file %s to %s.", input_file, hdfs_input_file) call_conductor(job, master_ip, input_file, hdfs_input_file, memory=memory, override_parameters=spark_conf) else: if not input_file.startswith("hdfs://"): _log.warn("If not in S3, input file (%s) expected to be in HDFS (%s).", input_file, hdfs_dir) # where are we writing the output to? is it going to a location in hdfs or not? run_upload = True hdfs_output_file = hdfs_dir + "kmer_output.txt" if output_file.startswith(hdfs_dir): run_upload = False hdfs_output_file = output_file # do we need to convert to adam? if (hdfs_input_file.endswith('.bam') or hdfs_input_file.endswith('.sam') or hdfs_input_file.endswith('.fq') or hdfs_input_file.endswith('.fastq')): hdfs_tmp_file = hdfs_input_file # change the file extension to adam hdfs_input_file = '.'.join(hdfs_input_file.split('.')[:-1].append('adam')) # convert the file _log.info('Converting %s into ADAM format at %s.', hdfs_tmp_file, hdfs_input_file) call_adam(job, master_ip, ['transform', hdfs_tmp_file, hdfs_input_file], memory=memory, override_parameters=spark_conf) # run k-mer counting _log.info('Counting %d-mers in %s, and saving to %s.', kmer_length, hdfs_input_file, hdfs_output_file) call_adam(job, master_ip, ['count_kmers', hdfs_input_file, hdfs_output_file, str(kmer_length)], memory=memory, override_parameters=spark_conf) # do we need to upload the file back? if so, run upload if run_upload: _log.info("Uploading output file %s to %s.", hdfs_output_file, output_file) call_conductor(job, master_ip, hdfs_output_file, output_file, memory=memory, override_parameters=spark_conf)
[ "def", "download_count_upload", "(", "job", ",", "master_ip", ",", "input_file", ",", "output_file", ",", "kmer_length", ",", "spark_conf", ",", "memory", ",", "sudo", ")", ":", "if", "master_ip", "is", "not", "None", ":", "hdfs_dir", "=", "\"hdfs://{0}:{1}/\"", ".", "format", "(", "master_ip", ",", "HDFS_MASTER_PORT", ")", "else", ":", "_log", ".", "warn", "(", "'Master IP is not set. If default filesystem is not set, jobs may fail.'", ")", "hdfs_dir", "=", "\"\"", "# if the file isn't already in hdfs, copy it in", "hdfs_input_file", "=", "hdfs_dir", "if", "input_file", ".", "startswith", "(", "\"s3://\"", ")", ":", "# append the s3 file name to our hdfs path", "hdfs_input_file", "+=", "input_file", ".", "split", "(", "\"/\"", ")", "[", "-", "1", "]", "# run the download", "_log", ".", "info", "(", "\"Downloading input file %s to %s.\"", ",", "input_file", ",", "hdfs_input_file", ")", "call_conductor", "(", "job", ",", "master_ip", ",", "input_file", ",", "hdfs_input_file", ",", "memory", "=", "memory", ",", "override_parameters", "=", "spark_conf", ")", "else", ":", "if", "not", "input_file", ".", "startswith", "(", "\"hdfs://\"", ")", ":", "_log", ".", "warn", "(", "\"If not in S3, input file (%s) expected to be in HDFS (%s).\"", ",", "input_file", ",", "hdfs_dir", ")", "# where are we writing the output to? is it going to a location in hdfs or not?", "run_upload", "=", "True", "hdfs_output_file", "=", "hdfs_dir", "+", "\"kmer_output.txt\"", "if", "output_file", ".", "startswith", "(", "hdfs_dir", ")", ":", "run_upload", "=", "False", "hdfs_output_file", "=", "output_file", "# do we need to convert to adam?", "if", "(", "hdfs_input_file", ".", "endswith", "(", "'.bam'", ")", "or", "hdfs_input_file", ".", "endswith", "(", "'.sam'", ")", "or", "hdfs_input_file", ".", "endswith", "(", "'.fq'", ")", "or", "hdfs_input_file", ".", "endswith", "(", "'.fastq'", ")", ")", ":", "hdfs_tmp_file", "=", "hdfs_input_file", "# change the file extension to adam", "hdfs_input_file", "=", "'.'", ".", "join", "(", "hdfs_input_file", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ".", "append", "(", "'adam'", ")", ")", "# convert the file", "_log", ".", "info", "(", "'Converting %s into ADAM format at %s.'", ",", "hdfs_tmp_file", ",", "hdfs_input_file", ")", "call_adam", "(", "job", ",", "master_ip", ",", "[", "'transform'", ",", "hdfs_tmp_file", ",", "hdfs_input_file", "]", ",", "memory", "=", "memory", ",", "override_parameters", "=", "spark_conf", ")", "# run k-mer counting", "_log", ".", "info", "(", "'Counting %d-mers in %s, and saving to %s.'", ",", "kmer_length", ",", "hdfs_input_file", ",", "hdfs_output_file", ")", "call_adam", "(", "job", ",", "master_ip", ",", "[", "'count_kmers'", ",", "hdfs_input_file", ",", "hdfs_output_file", ",", "str", "(", "kmer_length", ")", "]", ",", "memory", "=", "memory", ",", "override_parameters", "=", "spark_conf", ")", "# do we need to upload the file back? if so, run upload", "if", "run_upload", ":", "_log", ".", "info", "(", "\"Uploading output file %s to %s.\"", ",", "hdfs_output_file", ",", "output_file", ")", "call_conductor", "(", "job", ",", "master_ip", ",", "hdfs_output_file", ",", "output_file", ",", "memory", "=", "memory", ",", "override_parameters", "=", "spark_conf", ")" ]
Runs k-mer counting. 1. If the input file is located in S3, the file is copied into HDFS. 2. If the input file is not in Parquet format, the file is converted into Parquet. 3. The k-mers are counted and saved as text. 4. If the output path is an S3 URL, the file is copied back to S3. :param job: Toil job :param input_file: URL/path to input file to count k-mers on :param output_file: URL/path to save k-mer counts at :param kmer_length: The length of k-mer substrings to count. :param spark_conf: Optional Spark configuration. If set, memory should \ not be set. :param memory: Amount of memory to provided to Spark workers. Must be set \ if spark_conf is not set. :param sudo: Whether or not to run Spark containers with sudo. :type job: toil.Job :type input_file: string :type output_file: string :type kmer_length: int or string :type spark_conf: list of string or None :type memory: int or None :type sudo: boolean
[ "Runs", "k", "-", "mer", "counting", "." ]
train
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L76-L172
<|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: Runs k-mer counting. 1. If the input file is located in S3, the file is copied into HDFS. 2. If the input file is not in Parquet format, the file is converted into Parquet. 3. The k-mers are counted and saved as text. 4. If the output path is an S3 URL, the file is copied back to S3. :param job: Toil job :param input_file: URL/path to input file to count k-mers on :param output_file: URL/path to save k-mer counts at :param kmer_length: The length of k-mer substrings to count. :param spark_conf: Optional Spark configuration. If set, memory should \ not be set. :param memory: Amount of memory to provided to Spark workers. Must be set \ if spark_conf is not set. :param sudo: Whether or not to run Spark containers with sudo. :type job: toil.Job :type input_file: string :type output_file: string :type kmer_length: int or string :type spark_conf: list of string or None :type memory: int or None :type sudo: boolean ### Response: def download_count_upload(job, master_ip, input_file, output_file, kmer_length, spark_conf, memory, sudo): ''' Runs k-mer counting. 1. If the input file is located in S3, the file is copied into HDFS. 2. If the input file is not in Parquet format, the file is converted into Parquet. 3. The k-mers are counted and saved as text. 4. If the output path is an S3 URL, the file is copied back to S3. :param job: Toil job :param input_file: URL/path to input file to count k-mers on :param output_file: URL/path to save k-mer counts at :param kmer_length: The length of k-mer substrings to count. :param spark_conf: Optional Spark configuration. If set, memory should \ not be set. :param memory: Amount of memory to provided to Spark workers. Must be set \ if spark_conf is not set. :param sudo: Whether or not to run Spark containers with sudo. :type job: toil.Job :type input_file: string :type output_file: string :type kmer_length: int or string :type spark_conf: list of string or None :type memory: int or None :type sudo: boolean ''' if master_ip is not None: hdfs_dir = "hdfs://{0}:{1}/".format(master_ip, HDFS_MASTER_PORT) else: _log.warn('Master IP is not set. If default filesystem is not set, jobs may fail.') hdfs_dir = "" # if the file isn't already in hdfs, copy it in hdfs_input_file = hdfs_dir if input_file.startswith("s3://"): # append the s3 file name to our hdfs path hdfs_input_file += input_file.split("/")[-1] # run the download _log.info("Downloading input file %s to %s.", input_file, hdfs_input_file) call_conductor(job, master_ip, input_file, hdfs_input_file, memory=memory, override_parameters=spark_conf) else: if not input_file.startswith("hdfs://"): _log.warn("If not in S3, input file (%s) expected to be in HDFS (%s).", input_file, hdfs_dir) # where are we writing the output to? is it going to a location in hdfs or not? run_upload = True hdfs_output_file = hdfs_dir + "kmer_output.txt" if output_file.startswith(hdfs_dir): run_upload = False hdfs_output_file = output_file # do we need to convert to adam? if (hdfs_input_file.endswith('.bam') or hdfs_input_file.endswith('.sam') or hdfs_input_file.endswith('.fq') or hdfs_input_file.endswith('.fastq')): hdfs_tmp_file = hdfs_input_file # change the file extension to adam hdfs_input_file = '.'.join(hdfs_input_file.split('.')[:-1].append('adam')) # convert the file _log.info('Converting %s into ADAM format at %s.', hdfs_tmp_file, hdfs_input_file) call_adam(job, master_ip, ['transform', hdfs_tmp_file, hdfs_input_file], memory=memory, override_parameters=spark_conf) # run k-mer counting _log.info('Counting %d-mers in %s, and saving to %s.', kmer_length, hdfs_input_file, hdfs_output_file) call_adam(job, master_ip, ['count_kmers', hdfs_input_file, hdfs_output_file, str(kmer_length)], memory=memory, override_parameters=spark_conf) # do we need to upload the file back? if so, run upload if run_upload: _log.info("Uploading output file %s to %s.", hdfs_output_file, output_file) call_conductor(job, master_ip, hdfs_output_file, output_file, memory=memory, override_parameters=spark_conf) <|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, 75020, 597, 12, 1195, 26060, 382, 262, 220, 16, 13, 1442, 279, 1988, 1052, 374, 7559, 304, 328, 18, 11, 279, 1052, 374, 22523, 1139, 473, 63366, 627, 262, 220, 17, 13, 1442, 279, 1988, 1052, 374, 539, 304, 4366, 24181, 3645, 11, 279, 1052, 374, 16489, 1139, 4366, 24181, 627, 262, 220, 18, 13, 578, 597, 1474, 388, 527, 31094, 323, 6924, 439, 1495, 627, 262, 220, 19, 13, 1442, 279, 2612, 1853, 374, 459, 328, 18, 5665, 11, 279, 1052, 374, 22523, 1203, 311, 328, 18, 382, 262, 551, 913, 2683, 25, 2057, 321, 2683, 198, 262, 551, 913, 1988, 2517, 25, 5665, 52076, 311, 1988, 1052, 311, 1797, 597, 1474, 388, 389, 198, 262, 551, 913, 2612, 2517, 25, 5665, 52076, 311, 3665, 597, 12, 1195, 14921, 520, 198, 262, 551, 913, 597, 1195, 5228, 25, 578, 3160, 315, 597, 12, 1195, 16146, 826, 311, 1797, 627, 262, 551, 913, 15541, 16445, 25, 12536, 27565, 6683, 13, 1442, 743, 11, 5044, 1288, 3120, 262, 539, 387, 743, 627, 262, 551, 913, 5044, 25, 26868, 315, 5044, 311, 3984, 311, 27565, 7487, 13, 15832, 387, 743, 3120, 262, 422, 15541, 16445, 374, 539, 743, 627, 262, 551, 913, 26481, 25, 13440, 477, 539, 311, 1629, 27565, 24794, 449, 26481, 382, 262, 551, 1337, 2683, 25, 311, 321, 46393, 198, 262, 551, 1337, 1988, 2517, 25, 925, 198, 262, 551, 1337, 2612, 2517, 25, 925, 198, 262, 551, 1337, 597, 1195, 5228, 25, 528, 477, 925, 198, 262, 551, 1337, 15541, 16445, 25, 1160, 315, 925, 477, 2290, 198, 262, 551, 1337, 5044, 25, 528, 477, 2290, 198, 262, 551, 1337, 26481, 25, 2777, 271, 14711, 6075, 512, 755, 4232, 3259, 22433, 29429, 345, 3586, 7491, 10601, 345, 3586, 1988, 2517, 345, 3586, 2612, 2517, 345, 3586, 597, 1195, 5228, 345, 3586, 15541, 16445, 345, 3586, 5044, 345, 3586, 26481, 997, 262, 11414, 262, 51090, 597, 12, 1195, 26060, 382, 262, 220, 16, 13, 1442, 279, 1988, 1052, 374, 7559, 304, 328, 18, 11, 279, 1052, 374, 22523, 1139, 473, 63366, 627, 262, 220, 17, 13, 1442, 279, 1988, 1052, 374, 539, 304, 4366, 24181, 3645, 11, 279, 1052, 374, 16489, 1139, 4366, 24181, 627, 262, 220, 18, 13, 578, 597, 1474, 388, 527, 31094, 323, 6924, 439, 1495, 627, 262, 220, 19, 13, 1442, 279, 2612, 1853, 374, 459, 328, 18, 5665, 11, 279, 1052, 374, 22523, 1203, 311, 328, 18, 382, 262, 551, 913, 2683, 25, 2057, 321, 2683, 198, 262, 551, 913, 1988, 2517, 25, 5665, 52076, 311, 1988, 1052, 311, 1797, 597, 1474, 388, 389, 198, 262, 551, 913, 2612, 2517, 25, 5665, 52076, 311, 3665, 597, 12, 1195, 14921, 520, 198, 262, 551, 913, 597, 1195, 5228, 25, 578, 3160, 315, 597, 12,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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, 75020, 597, 12, 1195, 26060, 382, 262, 220, 16, 13, 1442, 279, 1988, 1052, 374, 7559, 304, 328, 18, 11, 279, 1052, 374, 22523, 1139, 473, 63366, 627, 262, 220, 17, 13, 1442, 279, 1988, 1052, 374, 539, 304, 4366, 24181, 3645, 11, 279, 1052, 374, 16489, 1139, 4366, 24181, 627, 262, 220, 18, 13, 578, 597, 1474, 388, 527, 31094, 323, 6924, 439, 1495, 627, 262, 220, 19, 13, 1442, 279, 2612, 1853, 374, 459, 328, 18, 5665, 11, 279, 1052, 374, 22523, 1203, 311, 328, 18, 382, 262, 551, 913, 2683, 25, 2057, 321, 2683, 198, 262, 551, 913, 1988, 2517, 25, 5665, 52076, 311, 1988, 1052, 311, 1797, 597, 1474, 388, 389, 198, 262, 551, 913, 2612, 2517, 25, 5665, 52076, 311, 3665, 597, 12, 1195, 14921, 520, 198, 262, 551, 913, 597, 1195, 5228, 25, 578, 3160, 315, 597, 12, 1195, 16146, 826, 311, 1797, 627, 262, 551, 913, 15541, 16445, 25, 12536, 27565, 6683, 13, 1442, 743, 11, 5044, 1288, 3120, 262, 539, 387, 743, 627, 262, 551, 913, 5044, 25, 26868, 315, 5044, 311, 3984, 311, 27565, 7487, 13, 15832, 387, 743, 3120, 262, 422, 15541, 16445, 374, 539, 743, 627, 262, 551, 913, 26481, 25, 13440, 477, 539, 311, 1629, 27565, 24794, 449, 26481, 382, 262, 551, 1337, 2683, 25, 311, 321, 46393, 198, 262, 551, 1337, 1988, 2517, 25, 925, 198, 262, 551, 1337, 2612, 2517, 25, 925, 198, 262, 551, 1337, 597, 1195, 5228, 25, 528, 477, 925, 198, 262, 551, 1337, 15541, 16445, 25, 1160, 315, 925, 477, 2290, 198, 262, 551, 1337, 5044, 25, 528, 477, 2290, 198, 262, 551, 1337, 26481, 25, 2777, 271, 14711, 6075, 512, 755, 4232, 3259, 22433, 29429, 345, 3586, 7491, 10601, 345, 3586, 1988, 2517, 345, 3586, 2612, 2517, 345, 3586, 597, 1195, 5228, 345, 3586, 15541, 16445, 345, 3586, 5044, 345, 3586, 26481, 997, 262, 11414, 262, 51090, 597, 12, 1195, 26060, 382, 262, 220, 16, 13, 1442, 279, 1988, 1052, 374, 7559, 304, 328, 18, 11, 279, 1052, 374, 22523, 1139, 473, 63366, 627, 262, 220, 17, 13, 1442, 279, 1988, 1052, 374, 539, 304, 4366, 24181, 3645, 11, 279, 1052, 374, 16489, 1139, 4366, 24181, 627, 262, 220, 18, 13, 578, 597, 1474, 388, 527, 31094, 323, 6924, 439, 1495, 627, 262, 220, 19, 13, 1442, 279, 2612, 1853, 374, 459, 328, 18, 5665, 11, 279, 1052, 374, 22523, 1203, 311, 328, 18, 382, 262, 551, 913, 2683, 25, 2057, 321, 2683, 198, 262, 551, 913, 1988, 2517, 25, 5665, 52076, 311, 1988, 1052, 311, 1797, 597, 1474, 388, 389, 198, 262, 551, 913, 2612, 2517, 25, 5665, 52076, 311, 3665, 597, 12, 1195, 14921, 520, 198, 262, 551, 913, 597, 1195, 5228, 25, 578, 3160, 315, 597, 12, 1195, 16146, 826, 311, 1797, 627, 262, 551, 913, 15541, 16445, 25, 12536, 27565 ]
peterldowns/python-mustache
mustache/utils.py
html_escape
def html_escape(s, encoding='utf-8', encoding_errors='strict'): """ Return the HTML-escaped version of an input. """ return escape(make_unicode(s, encoding, encoding_errors), quote=True)
python
def html_escape(s, encoding='utf-8', encoding_errors='strict'): """ Return the HTML-escaped version of an input. """ return escape(make_unicode(s, encoding, encoding_errors), quote=True)
[ "def", "html_escape", "(", "s", ",", "encoding", "=", "'utf-8'", ",", "encoding_errors", "=", "'strict'", ")", ":", "return", "escape", "(", "make_unicode", "(", "s", ",", "encoding", ",", "encoding_errors", ")", ",", "quote", "=", "True", ")" ]
Return the HTML-escaped version of an input.
[ "Return", "the", "HTML", "-", "escaped", "version", "of", "an", "input", "." ]
train
https://github.com/peterldowns/python-mustache/blob/ea3753696ea9886b6eb39cc5de27db7054adc069/mustache/utils.py#L12-L14
<|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 the HTML-escaped version of an input. ### Response: def html_escape(s, encoding='utf-8', encoding_errors='strict'): """ Return the HTML-escaped version of an input. """ return escape(make_unicode(s, encoding, encoding_errors), quote=True) <|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, 279, 9492, 12, 66926, 2373, 315, 459, 1988, 382, 14711, 6075, 512, 755, 5385, 22585, 1161, 11, 11418, 1151, 4867, 12, 23, 518, 11418, 20808, 1151, 6765, 11290, 262, 4304, 3494, 279, 9492, 12, 66926, 2373, 315, 459, 1988, 13, 3270, 262, 471, 12731, 38044, 55762, 1161, 11, 11418, 11, 11418, 20808, 705, 12929, 3702, 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, 128009, 128009, 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, 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, 279, 9492, 12, 66926, 2373, 315, 459, 1988, 382, 14711, 6075, 512, 755, 5385, 22585, 1161, 11, 11418, 1151, 4867, 12, 23, 518, 11418, 20808, 1151, 6765, 11290, 262, 4304, 3494, 279, 9492, 12, 66926, 2373, 315, 459, 1988, 13, 3270, 262, 471, 12731, 38044, 55762, 1161, 11, 11418, 11, 11418, 20808, 705, 12929, 3702, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
LeKono/pyhgnc
src/pyhgnc/manager/query.py
QueryManager._limit_and_df
def _limit_and_df(self, query, limit, as_df=False): """adds a limit (limit==None := no limit) to any query and allow a return as pandas.DataFrame :param bool as_df: if is set to True results return as pandas.DataFrame :param `sqlalchemy.orm.query.Query` query: SQL Alchemy query :param int,tuple limit: maximum number of results :return: query result of pyhgnc.manager.models.XY objects """ if limit: if isinstance(limit, int): query = query.limit(limit) if isinstance(limit, Iterable) and len(limit) == 2 and [int, int] == [type(x) for x in limit]: page, page_size = limit query = query.limit(page_size) query = query.offset(page * page_size) if as_df: results = read_sql(query.statement, self.engine) else: try: results = query.all() except: query.session.rollback() results = query.all() return results
python
def _limit_and_df(self, query, limit, as_df=False): """adds a limit (limit==None := no limit) to any query and allow a return as pandas.DataFrame :param bool as_df: if is set to True results return as pandas.DataFrame :param `sqlalchemy.orm.query.Query` query: SQL Alchemy query :param int,tuple limit: maximum number of results :return: query result of pyhgnc.manager.models.XY objects """ if limit: if isinstance(limit, int): query = query.limit(limit) if isinstance(limit, Iterable) and len(limit) == 2 and [int, int] == [type(x) for x in limit]: page, page_size = limit query = query.limit(page_size) query = query.offset(page * page_size) if as_df: results = read_sql(query.statement, self.engine) else: try: results = query.all() except: query.session.rollback() results = query.all() return results
[ "def", "_limit_and_df", "(", "self", ",", "query", ",", "limit", ",", "as_df", "=", "False", ")", ":", "if", "limit", ":", "if", "isinstance", "(", "limit", ",", "int", ")", ":", "query", "=", "query", ".", "limit", "(", "limit", ")", "if", "isinstance", "(", "limit", ",", "Iterable", ")", "and", "len", "(", "limit", ")", "==", "2", "and", "[", "int", ",", "int", "]", "==", "[", "type", "(", "x", ")", "for", "x", "in", "limit", "]", ":", "page", ",", "page_size", "=", "limit", "query", "=", "query", ".", "limit", "(", "page_size", ")", "query", "=", "query", ".", "offset", "(", "page", "*", "page_size", ")", "if", "as_df", ":", "results", "=", "read_sql", "(", "query", ".", "statement", ",", "self", ".", "engine", ")", "else", ":", "try", ":", "results", "=", "query", ".", "all", "(", ")", "except", ":", "query", ".", "session", ".", "rollback", "(", ")", "results", "=", "query", ".", "all", "(", ")", "return", "results" ]
adds a limit (limit==None := no limit) to any query and allow a return as pandas.DataFrame :param bool as_df: if is set to True results return as pandas.DataFrame :param `sqlalchemy.orm.query.Query` query: SQL Alchemy query :param int,tuple limit: maximum number of results :return: query result of pyhgnc.manager.models.XY objects
[ "adds", "a", "limit", "(", "limit", "==", "None", ":", "=", "no", "limit", ")", "to", "any", "query", "and", "allow", "a", "return", "as", "pandas", ".", "DataFrame" ]
train
https://github.com/LeKono/pyhgnc/blob/1cae20c40874bfb51581b7c5c1481707e942b5d0/src/pyhgnc/manager/query.py#L14-L42
<|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 limit (limit==None := no limit) to any query and allow a return as pandas.DataFrame :param bool as_df: if is set to True results return as pandas.DataFrame :param `sqlalchemy.orm.query.Query` query: SQL Alchemy query :param int,tuple limit: maximum number of results :return: query result of pyhgnc.manager.models.XY objects ### Response: def _limit_and_df(self, query, limit, as_df=False): """adds a limit (limit==None := no limit) to any query and allow a return as pandas.DataFrame :param bool as_df: if is set to True results return as pandas.DataFrame :param `sqlalchemy.orm.query.Query` query: SQL Alchemy query :param int,tuple limit: maximum number of results :return: query result of pyhgnc.manager.models.XY objects """ if limit: if isinstance(limit, int): query = query.limit(limit) if isinstance(limit, Iterable) and len(limit) == 2 and [int, int] == [type(x) for x in limit]: page, page_size = limit query = query.limit(page_size) query = query.offset(page * page_size) if as_df: results = read_sql(query.statement, self.engine) else: try: results = query.all() except: query.session.rollback() results = query.all() return results <|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, 74094, 264, 4017, 320, 9696, 419, 4155, 1703, 912, 4017, 8, 311, 904, 3319, 323, 2187, 264, 471, 439, 19130, 21756, 271, 286, 551, 913, 1845, 439, 11133, 25, 422, 374, 743, 311, 3082, 3135, 471, 439, 19130, 21756, 198, 286, 551, 913, 1595, 3628, 36005, 48849, 4891, 16060, 63, 3319, 25, 8029, 1708, 25055, 3319, 198, 286, 551, 913, 528, 14287, 6189, 4017, 25, 7340, 1396, 315, 3135, 198, 286, 551, 693, 25, 3319, 1121, 315, 4611, 67702, 1031, 33915, 8399, 4436, 56, 6302, 271, 14711, 6075, 512, 755, 721, 9696, 8543, 11133, 1214, 11, 3319, 11, 4017, 11, 439, 11133, 5725, 997, 286, 4304, 74094, 264, 4017, 320, 9696, 419, 4155, 1703, 912, 4017, 8, 311, 904, 3319, 323, 2187, 264, 471, 439, 19130, 21756, 271, 286, 551, 913, 1845, 439, 11133, 25, 422, 374, 743, 311, 3082, 3135, 471, 439, 19130, 21756, 198, 286, 551, 913, 1595, 3628, 36005, 48849, 4891, 16060, 63, 3319, 25, 8029, 1708, 25055, 3319, 198, 286, 551, 913, 528, 14287, 6189, 4017, 25, 7340, 1396, 315, 3135, 198, 286, 551, 693, 25, 3319, 1121, 315, 4611, 67702, 1031, 33915, 8399, 4436, 56, 6302, 198, 286, 3270, 286, 422, 4017, 1473, 310, 422, 11656, 53362, 11, 528, 997, 394, 3319, 284, 3319, 39683, 53362, 696, 310, 422, 11656, 53362, 11, 39116, 8, 323, 2479, 53362, 8, 624, 220, 17, 323, 510, 396, 11, 528, 60, 624, 510, 1337, 2120, 8, 369, 865, 304, 4017, 10556, 394, 2199, 11, 2199, 2424, 284, 4017, 198, 394, 3319, 284, 3319, 39683, 12293, 2424, 340, 394, 3319, 284, 3319, 15103, 12293, 353, 2199, 2424, 696, 286, 422, 439, 11133, 512, 310, 3135, 284, 1373, 18554, 10974, 1258, 5722, 11, 659, 25421, 696, 286, 775, 512, 310, 1456, 512, 394, 3135, 284, 3319, 7825, 746, 310, 3734, 512, 394, 3319, 10387, 59111, 746, 394, 3135, 284, 3319, 7825, 2892, 286, 471, 3135, 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 ]
[ 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, 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, 74094, 264, 4017, 320, 9696, 419, 4155, 1703, 912, 4017, 8, 311, 904, 3319, 323, 2187, 264, 471, 439, 19130, 21756, 271, 286, 551, 913, 1845, 439, 11133, 25, 422, 374, 743, 311, 3082, 3135, 471, 439, 19130, 21756, 198, 286, 551, 913, 1595, 3628, 36005, 48849, 4891, 16060, 63, 3319, 25, 8029, 1708, 25055, 3319, 198, 286, 551, 913, 528, 14287, 6189, 4017, 25, 7340, 1396, 315, 3135, 198, 286, 551, 693, 25, 3319, 1121, 315, 4611, 67702, 1031, 33915, 8399, 4436, 56, 6302, 271, 14711, 6075, 512, 755, 721, 9696, 8543, 11133, 1214, 11, 3319, 11, 4017, 11, 439, 11133, 5725, 997, 286, 4304, 74094, 264, 4017, 320, 9696, 419, 4155, 1703, 912, 4017, 8, 311, 904, 3319, 323, 2187, 264, 471, 439, 19130, 21756, 271, 286, 551, 913, 1845, 439, 11133, 25, 422, 374, 743, 311, 3082, 3135, 471, 439, 19130, 21756, 198, 286, 551, 913, 1595, 3628, 36005, 48849, 4891, 16060, 63, 3319, 25, 8029, 1708, 25055, 3319, 198, 286, 551, 913, 528, 14287, 6189, 4017, 25, 7340, 1396, 315, 3135, 198, 286, 551, 693, 25, 3319, 1121, 315, 4611, 67702, 1031, 33915, 8399, 4436, 56, 6302, 198, 286, 3270, 286, 422, 4017, 1473, 310, 422, 11656, 53362, 11, 528, 997, 394, 3319, 284, 3319, 39683, 53362, 696, 310, 422, 11656, 53362, 11, 39116, 8, 323, 2479, 53362, 8, 624, 220, 17, 323, 510, 396, 11, 528, 60, 624, 510, 1337, 2120, 8, 369, 865, 304, 4017, 10556, 394, 2199, 11, 2199, 2424, 284, 4017, 198, 394, 3319, 284, 3319, 39683, 12293, 2424, 340, 394, 3319, 284, 3319, 15103, 12293, 353, 2199, 2424, 696, 286, 422, 439, 11133, 512, 310, 3135, 284, 1373, 18554, 10974, 1258, 5722, 11, 659, 25421, 696, 286, 775, 512, 310, 1456, 512, 394, 3135, 284, 3319, 7825, 746, 310, 3734, 512, 394, 3319, 10387, 59111, 746, 394, 3135, 284, 3319, 7825, 2892, 286, 471, 3135, 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 ]
cltk/cltk
cltk/prosody/latin/pentameter_scanner.py
PentameterScanner.correct_penultimate_dactyl_chain
def correct_penultimate_dactyl_chain(self, scansion: str) -> str: """ For pentameter the last two feet of the verse are predictable dactyls, and do not regularly allow substitutions. :param scansion: scansion line thus far :return: corrected line of scansion >>> print(PentameterScanner().correct_penultimate_dactyl_chain( ... "U U U U U U U U U U U U U U")) U U U U U U U - U U - U U U """ mark_list = string_utils.mark_list(scansion) vals = list(scansion.replace(" ", "")) n_vals = vals[:-7] + [self.constants.DACTYL + self.constants.DACTYL] + [vals[-1]] corrected = "".join(n_vals) new_line = list(" " * len(scansion)) for idx, car in enumerate(corrected): new_line[mark_list[idx]] = car return "".join(new_line)
python
def correct_penultimate_dactyl_chain(self, scansion: str) -> str: """ For pentameter the last two feet of the verse are predictable dactyls, and do not regularly allow substitutions. :param scansion: scansion line thus far :return: corrected line of scansion >>> print(PentameterScanner().correct_penultimate_dactyl_chain( ... "U U U U U U U U U U U U U U")) U U U U U U U - U U - U U U """ mark_list = string_utils.mark_list(scansion) vals = list(scansion.replace(" ", "")) n_vals = vals[:-7] + [self.constants.DACTYL + self.constants.DACTYL] + [vals[-1]] corrected = "".join(n_vals) new_line = list(" " * len(scansion)) for idx, car in enumerate(corrected): new_line[mark_list[idx]] = car return "".join(new_line)
[ "def", "correct_penultimate_dactyl_chain", "(", "self", ",", "scansion", ":", "str", ")", "->", "str", ":", "mark_list", "=", "string_utils", ".", "mark_list", "(", "scansion", ")", "vals", "=", "list", "(", "scansion", ".", "replace", "(", "\" \"", ",", "\"\"", ")", ")", "n_vals", "=", "vals", "[", ":", "-", "7", "]", "+", "[", "self", ".", "constants", ".", "DACTYL", "+", "self", ".", "constants", ".", "DACTYL", "]", "+", "[", "vals", "[", "-", "1", "]", "]", "corrected", "=", "\"\"", ".", "join", "(", "n_vals", ")", "new_line", "=", "list", "(", "\" \"", "*", "len", "(", "scansion", ")", ")", "for", "idx", ",", "car", "in", "enumerate", "(", "corrected", ")", ":", "new_line", "[", "mark_list", "[", "idx", "]", "]", "=", "car", "return", "\"\"", ".", "join", "(", "new_line", ")" ]
For pentameter the last two feet of the verse are predictable dactyls, and do not regularly allow substitutions. :param scansion: scansion line thus far :return: corrected line of scansion >>> print(PentameterScanner().correct_penultimate_dactyl_chain( ... "U U U U U U U U U U U U U U")) U U U U U U U - U U - U U U
[ "For", "pentameter", "the", "last", "two", "feet", "of", "the", "verse", "are", "predictable", "dactyls", "and", "do", "not", "regularly", "allow", "substitutions", "." ]
train
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/prosody/latin/pentameter_scanner.py#L207-L226
<|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: For pentameter the last two feet of the verse are predictable dactyls, and do not regularly allow substitutions. :param scansion: scansion line thus far :return: corrected line of scansion >>> print(PentameterScanner().correct_penultimate_dactyl_chain( ... "U U U U U U U U U U U U U U")) U U U U U U U - U U - U U U ### Response: def correct_penultimate_dactyl_chain(self, scansion: str) -> str: """ For pentameter the last two feet of the verse are predictable dactyls, and do not regularly allow substitutions. :param scansion: scansion line thus far :return: corrected line of scansion >>> print(PentameterScanner().correct_penultimate_dactyl_chain( ... "U U U U U U U U U U U U U U")) U U U U U U U - U U - U U U """ mark_list = string_utils.mark_list(scansion) vals = list(scansion.replace(" ", "")) n_vals = vals[:-7] + [self.constants.DACTYL + self.constants.DACTYL] + [vals[-1]] corrected = "".join(n_vals) new_line = list(" " * len(scansion)) for idx, car in enumerate(corrected): new_line[mark_list[idx]] = car return "".join(new_line) <|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, 2520, 20801, 309, 1430, 279, 1566, 1403, 7693, 315, 279, 33487, 527, 45207, 294, 533, 4010, 82, 345, 286, 323, 656, 539, 15870, 2187, 94750, 382, 286, 551, 913, 1156, 10722, 25, 1156, 10722, 1584, 8617, 3117, 198, 286, 551, 693, 25, 37065, 1584, 315, 1156, 10722, 271, 286, 12382, 1194, 5417, 306, 309, 1430, 32102, 1020, 20523, 39214, 67666, 821, 533, 4010, 31683, 1021, 286, 2564, 330, 52, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 5572, 286, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 549, 271, 14711, 6075, 512, 755, 4495, 39214, 67666, 821, 533, 4010, 31683, 1214, 11, 1156, 10722, 25, 610, 8, 1492, 610, 512, 286, 3270, 286, 1789, 20801, 309, 1430, 279, 1566, 1403, 7693, 315, 279, 33487, 527, 45207, 294, 533, 4010, 82, 345, 286, 323, 656, 539, 15870, 2187, 94750, 382, 286, 551, 913, 1156, 10722, 25, 1156, 10722, 1584, 8617, 3117, 198, 286, 551, 693, 25, 37065, 1584, 315, 1156, 10722, 271, 286, 12382, 1194, 5417, 306, 309, 1430, 32102, 1020, 20523, 39214, 67666, 821, 533, 4010, 31683, 1021, 286, 2564, 330, 52, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 5572, 286, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 549, 198, 286, 3270, 286, 1906, 2062, 284, 925, 17758, 18913, 2062, 17285, 10722, 340, 286, 29456, 284, 1160, 17285, 10722, 7125, 446, 3755, 78661, 286, 308, 30650, 284, 29456, 27141, 22, 60, 489, 510, 726, 39327, 920, 6966, 57070, 489, 659, 39327, 920, 6966, 57070, 60, 489, 510, 26678, 7764, 16, 14623, 286, 37065, 284, 46007, 6115, 1471, 30650, 340, 286, 502, 6665, 284, 1160, 446, 330, 353, 2479, 17285, 10722, 1192, 286, 369, 7335, 11, 1841, 304, 13555, 89064, 291, 997, 310, 502, 6665, 58, 4075, 2062, 11858, 5163, 284, 1841, 198, 286, 471, 46007, 6115, 1792, 6665, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2520, 20801, 309, 1430, 279, 1566, 1403, 7693, 315, 279, 33487, 527, 45207, 294, 533, 4010, 82, 345, 286, 323, 656, 539, 15870, 2187, 94750, 382, 286, 551, 913, 1156, 10722, 25, 1156, 10722, 1584, 8617, 3117, 198, 286, 551, 693, 25, 37065, 1584, 315, 1156, 10722, 271, 286, 12382, 1194, 5417, 306, 309, 1430, 32102, 1020, 20523, 39214, 67666, 821, 533, 4010, 31683, 1021, 286, 2564, 330, 52, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 5572, 286, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 549, 271, 14711, 6075, 512, 755, 4495, 39214, 67666, 821, 533, 4010, 31683, 1214, 11, 1156, 10722, 25, 610, 8, 1492, 610, 512, 286, 3270, 286, 1789, 20801, 309, 1430, 279, 1566, 1403, 7693, 315, 279, 33487, 527, 45207, 294, 533, 4010, 82, 345, 286, 323, 656, 539, 15870, 2187, 94750, 382, 286, 551, 913, 1156, 10722, 25, 1156, 10722, 1584, 8617, 3117, 198, 286, 551, 693, 25, 37065, 1584, 315, 1156, 10722, 271, 286, 12382, 1194, 5417, 306, 309, 1430, 32102, 1020, 20523, 39214, 67666, 821, 533, 4010, 31683, 1021, 286, 2564, 330, 52, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 5572, 286, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 482, 220, 549, 220, 549, 220, 549, 198, 286, 3270, 286, 1906, 2062, 284, 925, 17758, 18913, 2062, 17285, 10722, 340, 286, 29456, 284, 1160, 17285, 10722, 7125, 446, 3755, 78661, 286, 308, 30650, 284, 29456, 27141, 22, 60, 489, 510, 726, 39327, 920, 6966, 57070, 489, 659, 39327, 920, 6966, 57070, 60, 489, 510, 26678, 7764, 16, 14623, 286, 37065, 284, 46007, 6115, 1471, 30650, 340, 286, 502, 6665, 284, 1160, 446, 330, 353, 2479, 17285, 10722, 1192, 286, 369, 7335, 11, 1841, 304, 13555, 89064, 291, 997, 310, 502, 6665, 58, 4075, 2062, 11858, 5163, 284, 1841, 198, 286, 471, 46007, 6115, 1792, 6665, 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 ]
networks-lab/metaknowledge
metaknowledge/proquest/recordProQuest.py
proQuestRecordParser
def proQuestRecordParser(enRecordFile, recNum): """The parser [ProQuestRecords](../classes/ProQuestRecord.html#metaknowledge.proquest.ProQuestRecord) use. This takes an entry from [proQuestParser()](#metaknowledge.proquest.proQuestHandlers.proQuestParser) and parses it a part of the creation of a `ProQuestRecord`. # Parameters _enRecordFile_ : `enumerate object` > a file wrapped by `enumerate()` _recNum_ : `int` > The number given to the entry in the first section of the ProQuest file # Returns `collections.OrderedDict` > An ordered dictionary of the key-vaue pairs in the entry """ tagDict = collections.OrderedDict() currentEntry = 'Name' while True: lineNum, line = next(enRecordFile) if line == '_' * 60 + '\n': break elif line == '\n': pass elif currentEntry is 'Name' or currentEntry is 'url': tagDict[currentEntry] = [line.rstrip()] currentEntry = None elif ':' in line and not line.startswith('http://'): splitLine = line.split(': ') currentEntry = splitLine[0] tagDict[currentEntry] = [': '.join(splitLine[1:]).rstrip()] if currentEntry == 'Author': currentEntry = 'url' else: tagDict[currentEntry].append(line.rstrip()) return tagDict
python
def proQuestRecordParser(enRecordFile, recNum): """The parser [ProQuestRecords](../classes/ProQuestRecord.html#metaknowledge.proquest.ProQuestRecord) use. This takes an entry from [proQuestParser()](#metaknowledge.proquest.proQuestHandlers.proQuestParser) and parses it a part of the creation of a `ProQuestRecord`. # Parameters _enRecordFile_ : `enumerate object` > a file wrapped by `enumerate()` _recNum_ : `int` > The number given to the entry in the first section of the ProQuest file # Returns `collections.OrderedDict` > An ordered dictionary of the key-vaue pairs in the entry """ tagDict = collections.OrderedDict() currentEntry = 'Name' while True: lineNum, line = next(enRecordFile) if line == '_' * 60 + '\n': break elif line == '\n': pass elif currentEntry is 'Name' or currentEntry is 'url': tagDict[currentEntry] = [line.rstrip()] currentEntry = None elif ':' in line and not line.startswith('http://'): splitLine = line.split(': ') currentEntry = splitLine[0] tagDict[currentEntry] = [': '.join(splitLine[1:]).rstrip()] if currentEntry == 'Author': currentEntry = 'url' else: tagDict[currentEntry].append(line.rstrip()) return tagDict
[ "def", "proQuestRecordParser", "(", "enRecordFile", ",", "recNum", ")", ":", "tagDict", "=", "collections", ".", "OrderedDict", "(", ")", "currentEntry", "=", "'Name'", "while", "True", ":", "lineNum", ",", "line", "=", "next", "(", "enRecordFile", ")", "if", "line", "==", "'_'", "*", "60", "+", "'\\n'", ":", "break", "elif", "line", "==", "'\\n'", ":", "pass", "elif", "currentEntry", "is", "'Name'", "or", "currentEntry", "is", "'url'", ":", "tagDict", "[", "currentEntry", "]", "=", "[", "line", ".", "rstrip", "(", ")", "]", "currentEntry", "=", "None", "elif", "':'", "in", "line", "and", "not", "line", ".", "startswith", "(", "'http://'", ")", ":", "splitLine", "=", "line", ".", "split", "(", "': '", ")", "currentEntry", "=", "splitLine", "[", "0", "]", "tagDict", "[", "currentEntry", "]", "=", "[", "': '", ".", "join", "(", "splitLine", "[", "1", ":", "]", ")", ".", "rstrip", "(", ")", "]", "if", "currentEntry", "==", "'Author'", ":", "currentEntry", "=", "'url'", "else", ":", "tagDict", "[", "currentEntry", "]", ".", "append", "(", "line", ".", "rstrip", "(", ")", ")", "return", "tagDict" ]
The parser [ProQuestRecords](../classes/ProQuestRecord.html#metaknowledge.proquest.ProQuestRecord) use. This takes an entry from [proQuestParser()](#metaknowledge.proquest.proQuestHandlers.proQuestParser) and parses it a part of the creation of a `ProQuestRecord`. # Parameters _enRecordFile_ : `enumerate object` > a file wrapped by `enumerate()` _recNum_ : `int` > The number given to the entry in the first section of the ProQuest file # Returns `collections.OrderedDict` > An ordered dictionary of the key-vaue pairs in the entry
[ "The", "parser", "[", "ProQuestRecords", "]", "(", "..", "/", "classes", "/", "ProQuestRecord", ".", "html#metaknowledge", ".", "proquest", ".", "ProQuestRecord", ")", "use", ".", "This", "takes", "an", "entry", "from", "[", "proQuestParser", "()", "]", "(", "#metaknowledge", ".", "proquest", ".", "proQuestHandlers", ".", "proQuestParser", ")", "and", "parses", "it", "a", "part", "of", "the", "creation", "of", "a", "ProQuestRecord", "." ]
train
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/proquest/recordProQuest.py#L70-L108
<|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: The parser [ProQuestRecords](../classes/ProQuestRecord.html#metaknowledge.proquest.ProQuestRecord) use. This takes an entry from [proQuestParser()](#metaknowledge.proquest.proQuestHandlers.proQuestParser) and parses it a part of the creation of a `ProQuestRecord`. # Parameters _enRecordFile_ : `enumerate object` > a file wrapped by `enumerate()` _recNum_ : `int` > The number given to the entry in the first section of the ProQuest file # Returns `collections.OrderedDict` > An ordered dictionary of the key-vaue pairs in the entry ### Response: def proQuestRecordParser(enRecordFile, recNum): """The parser [ProQuestRecords](../classes/ProQuestRecord.html#metaknowledge.proquest.ProQuestRecord) use. This takes an entry from [proQuestParser()](#metaknowledge.proquest.proQuestHandlers.proQuestParser) and parses it a part of the creation of a `ProQuestRecord`. # Parameters _enRecordFile_ : `enumerate object` > a file wrapped by `enumerate()` _recNum_ : `int` > The number given to the entry in the first section of the ProQuest file # Returns `collections.OrderedDict` > An ordered dictionary of the key-vaue pairs in the entry """ tagDict = collections.OrderedDict() currentEntry = 'Name' while True: lineNum, line = next(enRecordFile) if line == '_' * 60 + '\n': break elif line == '\n': pass elif currentEntry is 'Name' or currentEntry is 'url': tagDict[currentEntry] = [line.rstrip()] currentEntry = None elif ':' in line and not line.startswith('http://'): splitLine = line.split(': ') currentEntry = splitLine[0] tagDict[currentEntry] = [': '.join(splitLine[1:]).rstrip()] if currentEntry == 'Author': currentEntry = 'url' else: tagDict[currentEntry].append(line.rstrip()) return tagDict <|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, 791, 6871, 510, 1360, 20368, 26962, 9725, 1266, 9031, 14, 1360, 20368, 6607, 2628, 2, 4150, 587, 52286, 2776, 724, 7919, 20368, 6607, 8, 1005, 13, 1115, 5097, 459, 4441, 505, 510, 782, 20368, 6707, 368, 9725, 2, 4150, 587, 52286, 2776, 724, 2776, 20368, 41049, 2776, 20368, 6707, 8, 323, 71935, 433, 264, 961, 315, 279, 9886, 315, 264, 1595, 1360, 20368, 6607, 63438, 262, 674, 13831, 271, 262, 721, 268, 6607, 1738, 62, 551, 1595, 77669, 1665, 19884, 262, 871, 264, 1052, 20037, 555, 1595, 77669, 368, 19884, 262, 721, 2827, 4755, 62, 551, 1595, 396, 19884, 262, 871, 578, 1396, 2728, 311, 279, 4441, 304, 279, 1176, 3857, 315, 279, 1322, 20368, 1052, 271, 262, 674, 5295, 271, 262, 1595, 52237, 20240, 291, 13755, 19884, 262, 871, 1556, 11713, 11240, 315, 279, 1401, 12, 6723, 361, 13840, 304, 279, 4441, 271, 14711, 6075, 512, 755, 463, 20368, 6607, 6707, 46708, 6607, 1738, 11, 1421, 4755, 997, 262, 4304, 791, 6871, 510, 1360, 20368, 26962, 9725, 1266, 9031, 14, 1360, 20368, 6607, 2628, 2, 4150, 587, 52286, 2776, 724, 7919, 20368, 6607, 8, 1005, 13, 1115, 5097, 459, 4441, 505, 510, 782, 20368, 6707, 368, 9725, 2, 4150, 587, 52286, 2776, 724, 2776, 20368, 41049, 2776, 20368, 6707, 8, 323, 71935, 433, 264, 961, 315, 279, 9886, 315, 264, 1595, 1360, 20368, 6607, 63438, 262, 674, 13831, 271, 262, 721, 268, 6607, 1738, 62, 551, 1595, 77669, 1665, 19884, 262, 871, 264, 1052, 20037, 555, 1595, 77669, 368, 19884, 262, 721, 2827, 4755, 62, 551, 1595, 396, 19884, 262, 871, 578, 1396, 2728, 311, 279, 4441, 304, 279, 1176, 3857, 315, 279, 1322, 20368, 1052, 271, 262, 674, 5295, 271, 262, 1595, 52237, 20240, 291, 13755, 19884, 262, 871, 1556, 11713, 11240, 315, 279, 1401, 12, 6723, 361, 13840, 304, 279, 4441, 198, 262, 3270, 262, 4877, 13755, 284, 15661, 20240, 291, 13755, 746, 262, 1510, 5998, 284, 364, 678, 1270, 262, 1418, 3082, 512, 286, 1584, 4755, 11, 1584, 284, 1828, 46708, 6607, 1738, 340, 286, 422, 1584, 624, 36402, 353, 220, 1399, 489, 5307, 77, 3730, 310, 1464, 198, 286, 4508, 1584, 624, 5307, 77, 3730, 310, 1522, 198, 286, 4508, 1510, 5998, 374, 364, 678, 6, 477, 1510, 5998, 374, 364, 1103, 3730, 310, 4877, 13755, 26851, 5998, 60, 284, 510, 1074, 60663, 28866, 310, 1510, 5998, 284, 2290, 198, 286, 4508, 37404, 304, 1584, 323, 539, 1584, 27249, 493, 1277, 1129, 11290, 310, 6859, 2519, 284, 1584, 5402, 16364, 22428, 310, 1510, 5998, 284, 6859, 2519, 58, 15, 933, 310, 4877, 13755, 26851, 5998, 60, 284, 510, 1232, 6389, 6115, 41055, 2519, 58, 16, 25, 10927, 71498, 28866, 310, 422, 1510, 5998, 624, 364, 7279, 3730, 394, 1510, 5998, 284, 364, 1103, 1270, 286, 775, 512, 310, 4877, 13755, 26851, 5998, 948, 5200, 8973, 60663, 2455, 262 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 791, 6871, 510, 1360, 20368, 26962, 9725, 1266, 9031, 14, 1360, 20368, 6607, 2628, 2, 4150, 587, 52286, 2776, 724, 7919, 20368, 6607, 8, 1005, 13, 1115, 5097, 459, 4441, 505, 510, 782, 20368, 6707, 368, 9725, 2, 4150, 587, 52286, 2776, 724, 2776, 20368, 41049, 2776, 20368, 6707, 8, 323, 71935, 433, 264, 961, 315, 279, 9886, 315, 264, 1595, 1360, 20368, 6607, 63438, 262, 674, 13831, 271, 262, 721, 268, 6607, 1738, 62, 551, 1595, 77669, 1665, 19884, 262, 871, 264, 1052, 20037, 555, 1595, 77669, 368, 19884, 262, 721, 2827, 4755, 62, 551, 1595, 396, 19884, 262, 871, 578, 1396, 2728, 311, 279, 4441, 304, 279, 1176, 3857, 315, 279, 1322, 20368, 1052, 271, 262, 674, 5295, 271, 262, 1595, 52237, 20240, 291, 13755, 19884, 262, 871, 1556, 11713, 11240, 315, 279, 1401, 12, 6723, 361, 13840, 304, 279, 4441, 271, 14711, 6075, 512, 755, 463, 20368, 6607, 6707, 46708, 6607, 1738, 11, 1421, 4755, 997, 262, 4304, 791, 6871, 510, 1360, 20368, 26962, 9725, 1266, 9031, 14, 1360, 20368, 6607, 2628, 2, 4150, 587, 52286, 2776, 724, 7919, 20368, 6607, 8, 1005, 13, 1115, 5097, 459, 4441, 505, 510, 782, 20368, 6707, 368, 9725, 2, 4150, 587, 52286, 2776, 724, 2776, 20368, 41049, 2776, 20368, 6707, 8, 323, 71935, 433, 264, 961, 315, 279, 9886, 315, 264, 1595, 1360, 20368, 6607, 63438, 262, 674, 13831, 271, 262, 721, 268, 6607, 1738, 62, 551, 1595, 77669, 1665, 19884, 262, 871, 264, 1052, 20037, 555, 1595, 77669, 368, 19884, 262, 721, 2827, 4755, 62, 551, 1595, 396, 19884, 262, 871, 578, 1396, 2728, 311, 279, 4441, 304, 279, 1176, 3857, 315, 279, 1322, 20368, 1052, 271, 262, 674, 5295, 271, 262, 1595, 52237, 20240, 291, 13755, 19884, 262, 871, 1556, 11713, 11240, 315, 279, 1401, 12, 6723, 361, 13840, 304, 279, 4441, 198, 262, 3270, 262, 4877, 13755, 284, 15661, 20240, 291, 13755, 746, 262, 1510, 5998, 284, 364, 678, 1270, 262, 1418, 3082, 512, 286, 1584, 4755, 11, 1584, 284, 1828, 46708, 6607, 1738, 340, 286, 422, 1584, 624, 36402, 353, 220, 1399, 489, 5307, 77, 3730, 310, 1464, 198, 286, 4508, 1584, 624, 5307, 77, 3730, 310, 1522, 198, 286, 4508, 1510, 5998, 374, 364, 678, 6, 477, 1510, 5998, 374, 364, 1103, 3730, 310, 4877, 13755, 26851, 5998, 60, 284, 510, 1074, 60663, 28866, 310, 1510, 5998, 284, 2290, 198, 286, 4508, 37404, 304, 1584, 323, 539, 1584, 27249, 493, 1277, 1129, 11290, 310, 6859, 2519, 284, 1584, 5402, 16364, 22428, 310, 1510, 5998, 284, 6859, 2519, 58, 15, 933, 310, 4877, 13755, 26851, 5998, 60, 284, 510, 1232, 6389, 6115, 41055, 2519, 58, 16, 25, 10927, 71498, 28866, 310, 422, 1510, 5998, 624, 364, 7279, 3730, 394, 1510, 5998, 284, 364, 1103, 1270, 286, 775, 512, 310, 4877, 13755, 26851, 5998, 948, 5200, 8973, 60663, 2455, 262 ]
halcy/Mastodon.py
mastodon/Mastodon.py
Mastodon.retrieve_mastodon_version
def retrieve_mastodon_version(self): """ Determine installed mastodon version and set major, minor and patch (not including RC info) accordingly. Returns the version string, possibly including rc info. """ try: version_str = self.__instance()["version"] except: # instance() was added in 1.1.0, so our best guess is 1.0.0. version_str = "1.0.0" self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(version_str) return version_str
python
def retrieve_mastodon_version(self): """ Determine installed mastodon version and set major, minor and patch (not including RC info) accordingly. Returns the version string, possibly including rc info. """ try: version_str = self.__instance()["version"] except: # instance() was added in 1.1.0, so our best guess is 1.0.0. version_str = "1.0.0" self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(version_str) return version_str
[ "def", "retrieve_mastodon_version", "(", "self", ")", ":", "try", ":", "version_str", "=", "self", ".", "__instance", "(", ")", "[", "\"version\"", "]", "except", ":", "# instance() was added in 1.1.0, so our best guess is 1.0.0.", "version_str", "=", "\"1.0.0\"", "self", ".", "mastodon_major", ",", "self", ".", "mastodon_minor", ",", "self", ".", "mastodon_patch", "=", "parse_version_string", "(", "version_str", ")", "return", "version_str" ]
Determine installed mastodon version and set major, minor and patch (not including RC info) accordingly. Returns the version string, possibly including rc info.
[ "Determine", "installed", "mastodon", "version", "and", "set", "major", "minor", "and", "patch", "(", "not", "including", "RC", "info", ")", "accordingly", ".", "Returns", "the", "version", "string", "possibly", "including", "rc", "info", "." ]
train
https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L344-L357
<|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: Determine installed mastodon version and set major, minor and patch (not including RC info) accordingly. Returns the version string, possibly including rc info. ### Response: def retrieve_mastodon_version(self): """ Determine installed mastodon version and set major, minor and patch (not including RC info) accordingly. Returns the version string, possibly including rc info. """ try: version_str = self.__instance()["version"] except: # instance() was added in 1.1.0, so our best guess is 1.0.0. version_str = "1.0.0" self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(version_str) return version_str <|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, 35, 25296, 10487, 19218, 77152, 2373, 323, 743, 3682, 11, 9099, 323, 11140, 320, 1962, 2737, 22322, 3630, 8, 28178, 627, 1827, 286, 5295, 279, 2373, 925, 11, 11000, 2737, 10402, 3630, 382, 14711, 6075, 512, 755, 17622, 722, 561, 77152, 9625, 1214, 997, 286, 3270, 286, 31001, 10487, 19218, 77152, 2373, 323, 743, 3682, 11, 9099, 323, 11140, 320, 1962, 2737, 22322, 3630, 8, 28178, 627, 1827, 286, 5295, 279, 2373, 925, 11, 11000, 2737, 10402, 3630, 627, 286, 3270, 286, 1456, 512, 310, 2373, 2966, 284, 659, 4952, 4956, 65422, 4464, 7171, 286, 3734, 512, 310, 674, 2937, 368, 574, 3779, 304, 220, 16, 13, 16, 13, 15, 11, 779, 1057, 1888, 8101, 374, 220, 16, 13, 15, 13, 15, 627, 310, 2373, 2966, 284, 330, 16, 13, 15, 13, 15, 702, 3456, 286, 659, 749, 561, 77152, 49016, 11, 659, 749, 561, 77152, 71961, 11, 659, 749, 561, 77152, 40743, 284, 4820, 9625, 3991, 38870, 2966, 340, 286, 471, 2373, 2966, 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 ]
[ 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, 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, 35, 25296, 10487, 19218, 77152, 2373, 323, 743, 3682, 11, 9099, 323, 11140, 320, 1962, 2737, 22322, 3630, 8, 28178, 627, 1827, 286, 5295, 279, 2373, 925, 11, 11000, 2737, 10402, 3630, 382, 14711, 6075, 512, 755, 17622, 722, 561, 77152, 9625, 1214, 997, 286, 3270, 286, 31001, 10487, 19218, 77152, 2373, 323, 743, 3682, 11, 9099, 323, 11140, 320, 1962, 2737, 22322, 3630, 8, 28178, 627, 1827, 286, 5295, 279, 2373, 925, 11, 11000, 2737, 10402, 3630, 627, 286, 3270, 286, 1456, 512, 310, 2373, 2966, 284, 659, 4952, 4956, 65422, 4464, 7171, 286, 3734, 512, 310, 674, 2937, 368, 574, 3779, 304, 220, 16, 13, 16, 13, 15, 11, 779, 1057, 1888, 8101, 374, 220, 16, 13, 15, 13, 15, 627, 310, 2373, 2966, 284, 330, 16, 13, 15, 13, 15, 702, 3456, 286, 659, 749, 561, 77152, 49016, 11, 659, 749, 561, 77152, 71961, 11, 659, 749, 561, 77152, 40743, 284, 4820, 9625, 3991, 38870, 2966, 340, 286, 471, 2373, 2966, 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 ]
evhub/coconut
coconut/compiler/compiler.py
Compiler.destructuring_stmt_handle
def destructuring_stmt_handle(self, original, loc, tokens): """Process match assign blocks.""" internal_assert(len(tokens) == 2, "invalid destructuring assignment tokens", tokens) matches, item = tokens out = match_handle(loc, [matches, "in", item, None]) out += self.pattern_error(original, loc, match_to_var, match_check_var) return out
python
def destructuring_stmt_handle(self, original, loc, tokens): """Process match assign blocks.""" internal_assert(len(tokens) == 2, "invalid destructuring assignment tokens", tokens) matches, item = tokens out = match_handle(loc, [matches, "in", item, None]) out += self.pattern_error(original, loc, match_to_var, match_check_var) return out
[ "def", "destructuring_stmt_handle", "(", "self", ",", "original", ",", "loc", ",", "tokens", ")", ":", "internal_assert", "(", "len", "(", "tokens", ")", "==", "2", ",", "\"invalid destructuring assignment tokens\"", ",", "tokens", ")", "matches", ",", "item", "=", "tokens", "out", "=", "match_handle", "(", "loc", ",", "[", "matches", ",", "\"in\"", ",", "item", ",", "None", "]", ")", "out", "+=", "self", ".", "pattern_error", "(", "original", ",", "loc", ",", "match_to_var", ",", "match_check_var", ")", "return", "out" ]
Process match assign blocks.
[ "Process", "match", "assign", "blocks", "." ]
train
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/compiler.py#L1424-L1430
<|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: Process match assign blocks. ### Response: def destructuring_stmt_handle(self, original, loc, tokens): """Process match assign blocks.""" internal_assert(len(tokens) == 2, "invalid destructuring assignment tokens", tokens) matches, item = tokens out = match_handle(loc, [matches, "in", item, None]) out += self.pattern_error(original, loc, match_to_var, match_check_var) return out <|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, 7575, 2489, 9993, 10215, 382, 14711, 6075, 512, 755, 21443, 1711, 22577, 10855, 1214, 11, 4113, 11, 1353, 11, 11460, 997, 286, 4304, 7575, 2489, 9993, 10215, 14781, 286, 5419, 16962, 7046, 35152, 8, 624, 220, 17, 11, 330, 12071, 21443, 1711, 16720, 11460, 498, 11460, 340, 286, 9248, 11, 1537, 284, 11460, 198, 286, 704, 284, 2489, 10855, 23476, 11, 510, 20509, 11, 330, 258, 498, 1537, 11, 2290, 2608, 286, 704, 1447, 659, 40209, 4188, 40909, 11, 1353, 11, 2489, 2401, 4715, 11, 2489, 7348, 4715, 340, 286, 471, 704, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7575, 2489, 9993, 10215, 382, 14711, 6075, 512, 755, 21443, 1711, 22577, 10855, 1214, 11, 4113, 11, 1353, 11, 11460, 997, 286, 4304, 7575, 2489, 9993, 10215, 14781, 286, 5419, 16962, 7046, 35152, 8, 624, 220, 17, 11, 330, 12071, 21443, 1711, 16720, 11460, 498, 11460, 340, 286, 9248, 11, 1537, 284, 11460, 198, 286, 704, 284, 2489, 10855, 23476, 11, 510, 20509, 11, 330, 258, 498, 1537, 11, 2290, 2608, 286, 704, 1447, 659, 40209, 4188, 40909, 11, 1353, 11, 2489, 2401, 4715, 11, 2489, 7348, 4715, 340, 286, 471, 704, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
taskcluster/taskcluster-client.py
taskcluster/aio/awsprovisioner.py
AwsProvisioner.createWorkerType
async def createWorkerType(self, *args, **kwargs): """ Create new Worker Type Create a worker type. A worker type contains all the configuration needed for the provisioner to manage the instances. Each worker type knows which regions and which instance types are allowed for that worker type. Remember that Capacity is the number of concurrent tasks that can be run on a given EC2 resource and that Utility is the relative performance rate between different instance types. There is no way to configure different regions to have different sets of instance types so ensure that all instance types are available in all regions. This function is idempotent. Once a worker type is in the provisioner, a back ground process will begin creating instances for it based on its capacity bounds and its pending task count from the Queue. It is the worker's responsibility to shut itself down. The provisioner has a limit (currently 96hours) for all instances to prevent zombie instances from running indefinitely. The provisioner will ensure that all instances created are tagged with aws resource tags containing the provisioner id and the worker type. If provided, the secrets in the global, region and instance type sections are available using the secrets api. If specified, the scopes provided will be used to generate a set of temporary credentials available with the other secrets. This method takes input: ``http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#`` This method gives output: ``http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#`` This method is ``stable`` """ return await self._makeApiCall(self.funcinfo["createWorkerType"], *args, **kwargs)
python
async def createWorkerType(self, *args, **kwargs): """ Create new Worker Type Create a worker type. A worker type contains all the configuration needed for the provisioner to manage the instances. Each worker type knows which regions and which instance types are allowed for that worker type. Remember that Capacity is the number of concurrent tasks that can be run on a given EC2 resource and that Utility is the relative performance rate between different instance types. There is no way to configure different regions to have different sets of instance types so ensure that all instance types are available in all regions. This function is idempotent. Once a worker type is in the provisioner, a back ground process will begin creating instances for it based on its capacity bounds and its pending task count from the Queue. It is the worker's responsibility to shut itself down. The provisioner has a limit (currently 96hours) for all instances to prevent zombie instances from running indefinitely. The provisioner will ensure that all instances created are tagged with aws resource tags containing the provisioner id and the worker type. If provided, the secrets in the global, region and instance type sections are available using the secrets api. If specified, the scopes provided will be used to generate a set of temporary credentials available with the other secrets. This method takes input: ``http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#`` This method gives output: ``http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#`` This method is ``stable`` """ return await self._makeApiCall(self.funcinfo["createWorkerType"], *args, **kwargs)
[ "async", "def", "createWorkerType", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"createWorkerType\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Create new Worker Type Create a worker type. A worker type contains all the configuration needed for the provisioner to manage the instances. Each worker type knows which regions and which instance types are allowed for that worker type. Remember that Capacity is the number of concurrent tasks that can be run on a given EC2 resource and that Utility is the relative performance rate between different instance types. There is no way to configure different regions to have different sets of instance types so ensure that all instance types are available in all regions. This function is idempotent. Once a worker type is in the provisioner, a back ground process will begin creating instances for it based on its capacity bounds and its pending task count from the Queue. It is the worker's responsibility to shut itself down. The provisioner has a limit (currently 96hours) for all instances to prevent zombie instances from running indefinitely. The provisioner will ensure that all instances created are tagged with aws resource tags containing the provisioner id and the worker type. If provided, the secrets in the global, region and instance type sections are available using the secrets api. If specified, the scopes provided will be used to generate a set of temporary credentials available with the other secrets. This method takes input: ``http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#`` This method gives output: ``http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#`` This method is ``stable``
[ "Create", "new", "Worker", "Type" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/awsprovisioner.py#L67-L102
<|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: Create new Worker Type Create a worker type. A worker type contains all the configuration needed for the provisioner to manage the instances. Each worker type knows which regions and which instance types are allowed for that worker type. Remember that Capacity is the number of concurrent tasks that can be run on a given EC2 resource and that Utility is the relative performance rate between different instance types. There is no way to configure different regions to have different sets of instance types so ensure that all instance types are available in all regions. This function is idempotent. Once a worker type is in the provisioner, a back ground process will begin creating instances for it based on its capacity bounds and its pending task count from the Queue. It is the worker's responsibility to shut itself down. The provisioner has a limit (currently 96hours) for all instances to prevent zombie instances from running indefinitely. The provisioner will ensure that all instances created are tagged with aws resource tags containing the provisioner id and the worker type. If provided, the secrets in the global, region and instance type sections are available using the secrets api. If specified, the scopes provided will be used to generate a set of temporary credentials available with the other secrets. This method takes input: ``http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#`` This method gives output: ``http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#`` This method is ``stable`` ### Response: async def createWorkerType(self, *args, **kwargs): """ Create new Worker Type Create a worker type. A worker type contains all the configuration needed for the provisioner to manage the instances. Each worker type knows which regions and which instance types are allowed for that worker type. Remember that Capacity is the number of concurrent tasks that can be run on a given EC2 resource and that Utility is the relative performance rate between different instance types. There is no way to configure different regions to have different sets of instance types so ensure that all instance types are available in all regions. This function is idempotent. Once a worker type is in the provisioner, a back ground process will begin creating instances for it based on its capacity bounds and its pending task count from the Queue. It is the worker's responsibility to shut itself down. The provisioner has a limit (currently 96hours) for all instances to prevent zombie instances from running indefinitely. The provisioner will ensure that all instances created are tagged with aws resource tags containing the provisioner id and the worker type. If provided, the secrets in the global, region and instance type sections are available using the secrets api. If specified, the scopes provided will be used to generate a set of temporary credentials available with the other secrets. This method takes input: ``http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#`` This method gives output: ``http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#`` This method is ``stable`` """ return await self._makeApiCall(self.funcinfo["createWorkerType"], *args, **kwargs) <|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, 4110, 502, 34186, 4078, 271, 286, 4324, 264, 12128, 955, 13, 220, 362, 12128, 955, 5727, 682, 279, 6683, 198, 286, 4460, 369, 279, 17575, 261, 311, 10299, 279, 13422, 13, 220, 9062, 12128, 955, 198, 286, 8964, 902, 13918, 323, 902, 2937, 4595, 527, 5535, 369, 430, 198, 286, 12128, 955, 13, 220, 20474, 430, 41210, 374, 279, 1396, 315, 35135, 9256, 198, 286, 430, 649, 387, 1629, 389, 264, 2728, 21283, 17, 5211, 323, 430, 26230, 374, 279, 8844, 198, 286, 5178, 4478, 1990, 2204, 2937, 4595, 13, 220, 2684, 374, 912, 1648, 311, 198, 286, 14749, 2204, 13918, 311, 617, 2204, 7437, 315, 2937, 4595, 198, 286, 779, 6106, 430, 682, 2937, 4595, 527, 2561, 304, 682, 13918, 627, 286, 1115, 734, 374, 887, 3342, 64632, 382, 286, 9843, 264, 12128, 955, 374, 304, 279, 17575, 261, 11, 264, 1203, 5015, 1920, 690, 198, 286, 3240, 6968, 13422, 369, 433, 3196, 389, 1202, 8824, 14597, 323, 1202, 198, 286, 15639, 3465, 1797, 505, 279, 19267, 13, 220, 1102, 374, 279, 12128, 596, 12014, 198, 286, 311, 9495, 5196, 1523, 13, 220, 578, 17575, 261, 706, 264, 4017, 320, 59302, 220, 4161, 31482, 340, 286, 369, 682, 13422, 311, 5471, 38836, 13422, 505, 4401, 56334, 382, 286, 578, 17575, 261, 690, 6106, 430, 682, 13422, 3549, 527, 38213, 449, 198, 286, 32621, 5211, 9681, 8649, 279, 17575, 261, 887, 323, 279, 12128, 955, 382, 286, 1442, 3984, 11, 279, 24511, 304, 279, 3728, 11, 5654, 323, 2937, 955, 14491, 198, 286, 527, 2561, 1701, 279, 24511, 6464, 13, 220, 1442, 5300, 11, 279, 51698, 3984, 198, 286, 690, 387, 1511, 311, 7068, 264, 743, 315, 13643, 16792, 2561, 449, 198, 286, 279, 1023, 24511, 382, 286, 1115, 1749, 5097, 1988, 25, 10103, 1277, 1129, 57643, 15384, 19386, 5181, 42373, 10039, 13311, 261, 5574, 16, 26658, 66616, 10827, 45908, 4421, 2, 14196, 271, 286, 1115, 1749, 6835, 2612, 25, 10103, 1277, 1129, 57643, 15384, 19386, 5181, 42373, 10039, 13311, 261, 5574, 16, 24183, 66616, 10827, 59569, 4421, 2, 14196, 271, 286, 1115, 1749, 374, 10103, 29092, 14196, 271, 14711, 6075, 512, 7847, 711, 1893, 22701, 941, 1214, 11, 353, 2164, 11, 3146, 9872, 997, 286, 3270, 286, 4324, 502, 34186, 4078, 271, 286, 4324, 264, 12128, 955, 13, 220, 362, 12128, 955, 5727, 682, 279, 6683, 198, 286, 4460, 369, 279, 17575, 261, 311, 10299, 279, 13422, 13, 220, 9062, 12128, 955, 198, 286, 8964, 902, 13918, 323, 902, 2937, 4595, 527, 5535, 369, 430, 198, 286, 12128, 955, 13, 220, 20474, 430, 41210, 374, 279, 1396, 315, 35135, 9256, 198, 286, 430, 649, 387, 1629, 389, 264, 2728, 21283, 17, 5211, 323, 430, 26230, 374, 279, 8844, 198, 286, 5178, 4478, 1990, 2204, 2937, 4595, 13, 220, 2684, 374, 912, 1648, 311, 198, 286, 14749, 2204, 13918, 311, 617, 2204, 7437 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4110, 502, 34186, 4078, 271, 286, 4324, 264, 12128, 955, 13, 220, 362, 12128, 955, 5727, 682, 279, 6683, 198, 286, 4460, 369, 279, 17575, 261, 311, 10299, 279, 13422, 13, 220, 9062, 12128, 955, 198, 286, 8964, 902, 13918, 323, 902, 2937, 4595, 527, 5535, 369, 430, 198, 286, 12128, 955, 13, 220, 20474, 430, 41210, 374, 279, 1396, 315, 35135, 9256, 198, 286, 430, 649, 387, 1629, 389, 264, 2728, 21283, 17, 5211, 323, 430, 26230, 374, 279, 8844, 198, 286, 5178, 4478, 1990, 2204, 2937, 4595, 13, 220, 2684, 374, 912, 1648, 311, 198, 286, 14749, 2204, 13918, 311, 617, 2204, 7437, 315, 2937, 4595, 198, 286, 779, 6106, 430, 682, 2937, 4595, 527, 2561, 304, 682, 13918, 627, 286, 1115, 734, 374, 887, 3342, 64632, 382, 286, 9843, 264, 12128, 955, 374, 304, 279, 17575, 261, 11, 264, 1203, 5015, 1920, 690, 198, 286, 3240, 6968, 13422, 369, 433, 3196, 389, 1202, 8824, 14597, 323, 1202, 198, 286, 15639, 3465, 1797, 505, 279, 19267, 13, 220, 1102, 374, 279, 12128, 596, 12014, 198, 286, 311, 9495, 5196, 1523, 13, 220, 578, 17575, 261, 706, 264, 4017, 320, 59302, 220, 4161, 31482, 340, 286, 369, 682, 13422, 311, 5471, 38836, 13422, 505, 4401, 56334, 382, 286, 578, 17575, 261, 690, 6106, 430, 682, 13422, 3549, 527, 38213, 449, 198, 286, 32621, 5211, 9681, 8649, 279, 17575, 261, 887, 323, 279, 12128, 955, 382, 286, 1442, 3984, 11, 279, 24511, 304, 279, 3728, 11, 5654, 323, 2937, 955, 14491, 198, 286, 527, 2561, 1701, 279, 24511, 6464, 13, 220, 1442, 5300, 11, 279, 51698, 3984, 198, 286, 690, 387, 1511, 311, 7068, 264, 743, 315, 13643, 16792, 2561, 449, 198, 286, 279, 1023, 24511, 382, 286, 1115, 1749, 5097, 1988, 25, 10103, 1277, 1129, 57643, 15384, 19386, 5181, 42373, 10039, 13311, 261, 5574, 16, 26658, 66616, 10827, 45908, 4421, 2, 14196, 271, 286, 1115, 1749, 6835, 2612, 25, 10103, 1277, 1129, 57643, 15384, 19386, 5181, 42373, 10039, 13311, 261, 5574, 16, 24183, 66616, 10827, 59569, 4421, 2, 14196, 271, 286, 1115, 1749, 374, 10103, 29092, 14196, 271, 14711, 6075, 512, 7847, 711, 1893, 22701, 941, 1214, 11, 353, 2164, 11, 3146, 9872, 997, 286, 3270, 286, 4324, 502, 34186, 4078, 271, 286, 4324, 264, 12128, 955, 13, 220, 362, 12128, 955, 5727, 682, 279, 6683, 198, 286, 4460, 369, 279, 17575, 261, 311, 10299, 279, 13422, 13, 220, 9062, 12128, 955, 198, 286, 8964, 902, 13918, 323, 902, 2937, 4595, 527, 5535, 369, 430, 198, 286, 12128, 955, 13, 220, 20474, 430, 41210, 374, 279, 1396, 315, 35135, 9256, 198, 286, 430, 649, 387, 1629, 389, 264, 2728, 21283, 17, 5211, 323, 430, 26230, 374, 279, 8844, 198, 286, 5178, 4478, 1990, 2204, 2937, 4595, 13, 220, 2684, 374, 912, 1648, 311, 198, 286, 14749, 2204, 13918, 311, 617, 2204, 7437 ]
jorgenschaefer/elpy
elpy/server.py
ElpyRPCServer.rpc_get_names
def rpc_get_names(self, filename, source, offset): """Get all possible names """ source = get_source(source) if hasattr(self.backend, "rpc_get_names"): return self.backend.rpc_get_names(filename, source, offset) else: raise Fault("get_names not implemented by current backend", code=400)
python
def rpc_get_names(self, filename, source, offset): """Get all possible names """ source = get_source(source) if hasattr(self.backend, "rpc_get_names"): return self.backend.rpc_get_names(filename, source, offset) else: raise Fault("get_names not implemented by current backend", code=400)
[ "def", "rpc_get_names", "(", "self", ",", "filename", ",", "source", ",", "offset", ")", ":", "source", "=", "get_source", "(", "source", ")", "if", "hasattr", "(", "self", ".", "backend", ",", "\"rpc_get_names\"", ")", ":", "return", "self", ".", "backend", ".", "rpc_get_names", "(", "filename", ",", "source", ",", "offset", ")", "else", ":", "raise", "Fault", "(", "\"get_names not implemented by current backend\"", ",", "code", "=", "400", ")" ]
Get all possible names
[ "Get", "all", "possible", "names" ]
train
https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/server.py#L199-L208
<|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: Get all possible names ### Response: def rpc_get_names(self, filename, source, offset): """Get all possible names """ source = get_source(source) if hasattr(self.backend, "rpc_get_names"): return self.backend.rpc_get_names(filename, source, offset) else: raise Fault("get_names not implemented by current backend", code=400) <|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, 1991, 682, 3284, 5144, 271, 14711, 6075, 512, 755, 36696, 3138, 9366, 1214, 11, 3986, 11, 2592, 11, 4445, 997, 286, 4304, 1991, 682, 3284, 5144, 271, 286, 3270, 286, 2592, 284, 636, 10561, 12719, 340, 286, 422, 32156, 1214, 38287, 11, 330, 30514, 3138, 9366, 15497, 310, 471, 659, 38287, 56277, 3138, 9366, 11202, 11, 2592, 11, 4445, 340, 286, 775, 512, 310, 4933, 60249, 446, 456, 9366, 539, 11798, 555, 1510, 19713, 761, 667, 2082, 28, 3443, 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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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, 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, 1991, 682, 3284, 5144, 271, 14711, 6075, 512, 755, 36696, 3138, 9366, 1214, 11, 3986, 11, 2592, 11, 4445, 997, 286, 4304, 1991, 682, 3284, 5144, 271, 286, 3270, 286, 2592, 284, 636, 10561, 12719, 340, 286, 422, 32156, 1214, 38287, 11, 330, 30514, 3138, 9366, 15497, 310, 471, 659, 38287, 56277, 3138, 9366, 11202, 11, 2592, 11, 4445, 340, 286, 775, 512, 310, 4933, 60249, 446, 456, 9366, 539, 11798, 555, 1510, 19713, 761, 667, 2082, 28, 3443, 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, 128009, 128009, 128009 ]
bartTC/django-attachments
attachments/templatetags/attachments_tags.py
attachment_form
def attachment_form(context, obj): """ Renders a "upload attachment" form. The user must own ``attachments.add_attachment permission`` to add attachments. """ if context['user'].has_perm('attachments.add_attachment'): return { 'form': AttachmentForm(), 'form_url': add_url_for_obj(obj), 'next': context.request.build_absolute_uri(), } else: return {'form': None}
python
def attachment_form(context, obj): """ Renders a "upload attachment" form. The user must own ``attachments.add_attachment permission`` to add attachments. """ if context['user'].has_perm('attachments.add_attachment'): return { 'form': AttachmentForm(), 'form_url': add_url_for_obj(obj), 'next': context.request.build_absolute_uri(), } else: return {'form': None}
[ "def", "attachment_form", "(", "context", ",", "obj", ")", ":", "if", "context", "[", "'user'", "]", ".", "has_perm", "(", "'attachments.add_attachment'", ")", ":", "return", "{", "'form'", ":", "AttachmentForm", "(", ")", ",", "'form_url'", ":", "add_url_for_obj", "(", "obj", ")", ",", "'next'", ":", "context", ".", "request", ".", "build_absolute_uri", "(", ")", ",", "}", "else", ":", "return", "{", "'form'", ":", "None", "}" ]
Renders a "upload attachment" form. The user must own ``attachments.add_attachment permission`` to add attachments.
[ "Renders", "a", "upload", "attachment", "form", "." ]
train
https://github.com/bartTC/django-attachments/blob/012b7168f9342e07683a54ceab57696e0072962e/attachments/templatetags/attachments_tags.py#L12-L26
<|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: Renders a "upload attachment" form. The user must own ``attachments.add_attachment permission`` to add attachments. ### Response: def attachment_form(context, obj): """ Renders a "upload attachment" form. The user must own ``attachments.add_attachment permission`` to add attachments. """ if context['user'].has_perm('attachments.add_attachment'): return { 'form': AttachmentForm(), 'form_url': add_url_for_obj(obj), 'next': context.request.build_absolute_uri(), } else: return {'form': None} <|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, 49, 14846, 264, 330, 6248, 20581, 1, 1376, 382, 262, 578, 1217, 2011, 1866, 10103, 46978, 1388, 41968, 8041, 14196, 311, 923, 198, 262, 34779, 382, 14711, 6075, 512, 755, 20581, 8074, 5491, 11, 2909, 997, 262, 3270, 262, 94833, 264, 330, 6248, 20581, 1, 1376, 382, 262, 578, 1217, 2011, 1866, 10103, 46978, 1388, 41968, 8041, 14196, 311, 923, 198, 262, 34779, 627, 262, 3270, 262, 422, 2317, 681, 882, 7352, 4752, 33061, 493, 46978, 1388, 41968, 11290, 286, 471, 341, 310, 364, 630, 1232, 56848, 1876, 3227, 310, 364, 630, 2975, 1232, 923, 2975, 5595, 7478, 6922, 1350, 310, 364, 3684, 1232, 2317, 8387, 13542, 51974, 15943, 3227, 286, 457, 262, 775, 512, 286, 471, 5473, 630, 1232, 2290, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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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, 1193, 304, 6498, 382, 14711, 5546, 512, 49, 14846, 264, 330, 6248, 20581, 1, 1376, 382, 262, 578, 1217, 2011, 1866, 10103, 46978, 1388, 41968, 8041, 14196, 311, 923, 198, 262, 34779, 382, 14711, 6075, 512, 755, 20581, 8074, 5491, 11, 2909, 997, 262, 3270, 262, 94833, 264, 330, 6248, 20581, 1, 1376, 382, 262, 578, 1217, 2011, 1866, 10103, 46978, 1388, 41968, 8041, 14196, 311, 923, 198, 262, 34779, 627, 262, 3270, 262, 422, 2317, 681, 882, 7352, 4752, 33061, 493, 46978, 1388, 41968, 11290, 286, 471, 341, 310, 364, 630, 1232, 56848, 1876, 3227, 310, 364, 630, 2975, 1232, 923, 2975, 5595, 7478, 6922, 1350, 310, 364, 3684, 1232, 2317, 8387, 13542, 51974, 15943, 3227, 286, 457, 262, 775, 512, 286, 471, 5473, 630, 1232, 2290, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
F5Networks/f5-common-python
f5/bigip/tm/ltm/pool.py
Members.update
def update(self, **kwargs): """Call this to change the configuration of the service on the device. This method uses HTTP PUT to alter the service state on the device. The attributes of the instance will be packaged as a dictionary. That dictionary will be updated with kwargs. It is then submitted as JSON to the device. Various edge cases are handled: * read-only attributes that are unchangeable are removed * If ``fqdn`` is in the kwargs or set as an attribute, removes the ``autopopulate`` and ``addressFamily`` keys from it. :param kwargs: keys and associated values to alter on the device """ checked = self._check_member_parameters(**kwargs) return super(Members, self)._update(**checked)
python
def update(self, **kwargs): """Call this to change the configuration of the service on the device. This method uses HTTP PUT to alter the service state on the device. The attributes of the instance will be packaged as a dictionary. That dictionary will be updated with kwargs. It is then submitted as JSON to the device. Various edge cases are handled: * read-only attributes that are unchangeable are removed * If ``fqdn`` is in the kwargs or set as an attribute, removes the ``autopopulate`` and ``addressFamily`` keys from it. :param kwargs: keys and associated values to alter on the device """ checked = self._check_member_parameters(**kwargs) return super(Members, self)._update(**checked)
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "checked", "=", "self", ".", "_check_member_parameters", "(", "*", "*", "kwargs", ")", "return", "super", "(", "Members", ",", "self", ")", ".", "_update", "(", "*", "*", "checked", ")" ]
Call this to change the configuration of the service on the device. This method uses HTTP PUT to alter the service state on the device. The attributes of the instance will be packaged as a dictionary. That dictionary will be updated with kwargs. It is then submitted as JSON to the device. Various edge cases are handled: * read-only attributes that are unchangeable are removed * If ``fqdn`` is in the kwargs or set as an attribute, removes the ``autopopulate`` and ``addressFamily`` keys from it. :param kwargs: keys and associated values to alter on the device
[ "Call", "this", "to", "change", "the", "configuration", "of", "the", "service", "on", "the", "device", "." ]
train
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/pool.py#L144-L160
<|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 this to change the configuration of the service on the device. This method uses HTTP PUT to alter the service state on the device. The attributes of the instance will be packaged as a dictionary. That dictionary will be updated with kwargs. It is then submitted as JSON to the device. Various edge cases are handled: * read-only attributes that are unchangeable are removed * If ``fqdn`` is in the kwargs or set as an attribute, removes the ``autopopulate`` and ``addressFamily`` keys from it. :param kwargs: keys and associated values to alter on the device ### Response: def update(self, **kwargs): """Call this to change the configuration of the service on the device. This method uses HTTP PUT to alter the service state on the device. The attributes of the instance will be packaged as a dictionary. That dictionary will be updated with kwargs. It is then submitted as JSON to the device. Various edge cases are handled: * read-only attributes that are unchangeable are removed * If ``fqdn`` is in the kwargs or set as an attribute, removes the ``autopopulate`` and ``addressFamily`` keys from it. :param kwargs: keys and associated values to alter on the device """ checked = self._check_member_parameters(**kwargs) return super(Members, self)._update(**checked) <|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, 420, 311, 2349, 279, 6683, 315, 279, 2532, 389, 279, 3756, 382, 286, 1115, 1749, 5829, 10339, 35480, 311, 11857, 279, 2532, 1614, 389, 279, 3756, 382, 286, 578, 8365, 315, 279, 2937, 690, 387, 47237, 439, 264, 11240, 13, 220, 3011, 198, 286, 11240, 690, 387, 6177, 449, 16901, 13, 220, 1102, 374, 1243, 14976, 439, 4823, 198, 286, 311, 279, 3756, 13, 220, 40741, 6964, 5157, 527, 18073, 1473, 286, 353, 1373, 15744, 8365, 430, 527, 653, 3455, 481, 527, 7108, 198, 286, 353, 1442, 10103, 65019, 17851, 14196, 374, 304, 279, 16901, 477, 743, 439, 459, 7180, 11, 29260, 279, 198, 692, 10103, 88421, 454, 6468, 14196, 323, 10103, 5102, 15547, 14196, 7039, 505, 433, 382, 286, 551, 913, 16901, 25, 7039, 323, 5938, 2819, 311, 11857, 389, 279, 3756, 271, 14711, 6075, 512, 755, 2713, 1214, 11, 3146, 9872, 997, 286, 4304, 7368, 420, 311, 2349, 279, 6683, 315, 279, 2532, 389, 279, 3756, 382, 286, 1115, 1749, 5829, 10339, 35480, 311, 11857, 279, 2532, 1614, 389, 279, 3756, 382, 286, 578, 8365, 315, 279, 2937, 690, 387, 47237, 439, 264, 11240, 13, 220, 3011, 198, 286, 11240, 690, 387, 6177, 449, 16901, 13, 220, 1102, 374, 1243, 14976, 439, 4823, 198, 286, 311, 279, 3756, 13, 220, 40741, 6964, 5157, 527, 18073, 1473, 286, 353, 1373, 15744, 8365, 430, 527, 653, 3455, 481, 527, 7108, 198, 286, 353, 1442, 10103, 65019, 17851, 14196, 374, 304, 279, 16901, 477, 743, 439, 459, 7180, 11, 29260, 279, 198, 692, 10103, 88421, 454, 6468, 14196, 323, 10103, 5102, 15547, 14196, 7039, 505, 433, 382, 286, 551, 913, 16901, 25, 7039, 323, 5938, 2819, 311, 11857, 389, 279, 3756, 198, 286, 3270, 286, 10273, 284, 659, 1462, 2071, 19951, 18764, 22551, 9872, 340, 286, 471, 2307, 3269, 7207, 11, 659, 67756, 2443, 22551, 7702, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 420, 311, 2349, 279, 6683, 315, 279, 2532, 389, 279, 3756, 382, 286, 1115, 1749, 5829, 10339, 35480, 311, 11857, 279, 2532, 1614, 389, 279, 3756, 382, 286, 578, 8365, 315, 279, 2937, 690, 387, 47237, 439, 264, 11240, 13, 220, 3011, 198, 286, 11240, 690, 387, 6177, 449, 16901, 13, 220, 1102, 374, 1243, 14976, 439, 4823, 198, 286, 311, 279, 3756, 13, 220, 40741, 6964, 5157, 527, 18073, 1473, 286, 353, 1373, 15744, 8365, 430, 527, 653, 3455, 481, 527, 7108, 198, 286, 353, 1442, 10103, 65019, 17851, 14196, 374, 304, 279, 16901, 477, 743, 439, 459, 7180, 11, 29260, 279, 198, 692, 10103, 88421, 454, 6468, 14196, 323, 10103, 5102, 15547, 14196, 7039, 505, 433, 382, 286, 551, 913, 16901, 25, 7039, 323, 5938, 2819, 311, 11857, 389, 279, 3756, 271, 14711, 6075, 512, 755, 2713, 1214, 11, 3146, 9872, 997, 286, 4304, 7368, 420, 311, 2349, 279, 6683, 315, 279, 2532, 389, 279, 3756, 382, 286, 1115, 1749, 5829, 10339, 35480, 311, 11857, 279, 2532, 1614, 389, 279, 3756, 382, 286, 578, 8365, 315, 279, 2937, 690, 387, 47237, 439, 264, 11240, 13, 220, 3011, 198, 286, 11240, 690, 387, 6177, 449, 16901, 13, 220, 1102, 374, 1243, 14976, 439, 4823, 198, 286, 311, 279, 3756, 13, 220, 40741, 6964, 5157, 527, 18073, 1473, 286, 353, 1373, 15744, 8365, 430, 527, 653, 3455, 481, 527, 7108, 198, 286, 353, 1442, 10103, 65019, 17851, 14196, 374, 304, 279, 16901, 477, 743, 439, 459, 7180, 11, 29260, 279, 198, 692, 10103, 88421, 454, 6468, 14196, 323, 10103, 5102, 15547, 14196, 7039, 505, 433, 382, 286, 551, 913, 16901, 25, 7039, 323, 5938, 2819, 311, 11857, 389, 279, 3756, 198, 286, 3270, 286, 10273, 284, 659, 1462, 2071, 19951, 18764, 22551, 9872, 340, 286, 471, 2307, 3269, 7207, 11, 659, 67756, 2443, 22551, 7702, 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 ]
ethereum/py-evm
eth/estimators/gas.py
binary_gas_search
def binary_gas_search(state: BaseState, transaction: BaseTransaction, tolerance: int=1) -> int: """ Run the transaction with various gas limits, progressively approaching the minimum needed to succeed without an OutOfGas exception. The starting range of possible estimates is: [transaction.intrinsic_gas, state.gas_limit]. After the first OutOfGas exception, the range is: (largest_limit_out_of_gas, state.gas_limit]. After the first run not out of gas, the range is: (largest_limit_out_of_gas, smallest_success]. :param int tolerance: When the range of estimates is less than tolerance, return the top of the range. :returns int: The smallest confirmed gas to not throw an OutOfGas exception, subject to tolerance. If OutOfGas is thrown at block limit, return block limit. :raises VMError: if the computation fails even when given the block gas_limit to complete """ if not hasattr(transaction, 'sender'): raise TypeError( "Transaction is missing attribute sender.", "If sending an unsigned transaction, use SpoofTransaction and provide the", "sender using the 'from' parameter") minimum_transaction = SpoofTransaction( transaction, gas=transaction.intrinsic_gas, gas_price=0, ) if _get_computation_error(state, minimum_transaction) is None: return transaction.intrinsic_gas maximum_transaction = SpoofTransaction( transaction, gas=state.gas_limit, gas_price=0, ) error = _get_computation_error(state, maximum_transaction) if error is not None: raise error minimum_viable = state.gas_limit maximum_out_of_gas = transaction.intrinsic_gas while minimum_viable - maximum_out_of_gas > tolerance: midpoint = (minimum_viable + maximum_out_of_gas) // 2 test_transaction = SpoofTransaction(transaction, gas=midpoint) if _get_computation_error(state, test_transaction) is None: minimum_viable = midpoint else: maximum_out_of_gas = midpoint return minimum_viable
python
def binary_gas_search(state: BaseState, transaction: BaseTransaction, tolerance: int=1) -> int: """ Run the transaction with various gas limits, progressively approaching the minimum needed to succeed without an OutOfGas exception. The starting range of possible estimates is: [transaction.intrinsic_gas, state.gas_limit]. After the first OutOfGas exception, the range is: (largest_limit_out_of_gas, state.gas_limit]. After the first run not out of gas, the range is: (largest_limit_out_of_gas, smallest_success]. :param int tolerance: When the range of estimates is less than tolerance, return the top of the range. :returns int: The smallest confirmed gas to not throw an OutOfGas exception, subject to tolerance. If OutOfGas is thrown at block limit, return block limit. :raises VMError: if the computation fails even when given the block gas_limit to complete """ if not hasattr(transaction, 'sender'): raise TypeError( "Transaction is missing attribute sender.", "If sending an unsigned transaction, use SpoofTransaction and provide the", "sender using the 'from' parameter") minimum_transaction = SpoofTransaction( transaction, gas=transaction.intrinsic_gas, gas_price=0, ) if _get_computation_error(state, minimum_transaction) is None: return transaction.intrinsic_gas maximum_transaction = SpoofTransaction( transaction, gas=state.gas_limit, gas_price=0, ) error = _get_computation_error(state, maximum_transaction) if error is not None: raise error minimum_viable = state.gas_limit maximum_out_of_gas = transaction.intrinsic_gas while minimum_viable - maximum_out_of_gas > tolerance: midpoint = (minimum_viable + maximum_out_of_gas) // 2 test_transaction = SpoofTransaction(transaction, gas=midpoint) if _get_computation_error(state, test_transaction) is None: minimum_viable = midpoint else: maximum_out_of_gas = midpoint return minimum_viable
[ "def", "binary_gas_search", "(", "state", ":", "BaseState", ",", "transaction", ":", "BaseTransaction", ",", "tolerance", ":", "int", "=", "1", ")", "->", "int", ":", "if", "not", "hasattr", "(", "transaction", ",", "'sender'", ")", ":", "raise", "TypeError", "(", "\"Transaction is missing attribute sender.\"", ",", "\"If sending an unsigned transaction, use SpoofTransaction and provide the\"", ",", "\"sender using the 'from' parameter\"", ")", "minimum_transaction", "=", "SpoofTransaction", "(", "transaction", ",", "gas", "=", "transaction", ".", "intrinsic_gas", ",", "gas_price", "=", "0", ",", ")", "if", "_get_computation_error", "(", "state", ",", "minimum_transaction", ")", "is", "None", ":", "return", "transaction", ".", "intrinsic_gas", "maximum_transaction", "=", "SpoofTransaction", "(", "transaction", ",", "gas", "=", "state", ".", "gas_limit", ",", "gas_price", "=", "0", ",", ")", "error", "=", "_get_computation_error", "(", "state", ",", "maximum_transaction", ")", "if", "error", "is", "not", "None", ":", "raise", "error", "minimum_viable", "=", "state", ".", "gas_limit", "maximum_out_of_gas", "=", "transaction", ".", "intrinsic_gas", "while", "minimum_viable", "-", "maximum_out_of_gas", ">", "tolerance", ":", "midpoint", "=", "(", "minimum_viable", "+", "maximum_out_of_gas", ")", "//", "2", "test_transaction", "=", "SpoofTransaction", "(", "transaction", ",", "gas", "=", "midpoint", ")", "if", "_get_computation_error", "(", "state", ",", "test_transaction", ")", "is", "None", ":", "minimum_viable", "=", "midpoint", "else", ":", "maximum_out_of_gas", "=", "midpoint", "return", "minimum_viable" ]
Run the transaction with various gas limits, progressively approaching the minimum needed to succeed without an OutOfGas exception. The starting range of possible estimates is: [transaction.intrinsic_gas, state.gas_limit]. After the first OutOfGas exception, the range is: (largest_limit_out_of_gas, state.gas_limit]. After the first run not out of gas, the range is: (largest_limit_out_of_gas, smallest_success]. :param int tolerance: When the range of estimates is less than tolerance, return the top of the range. :returns int: The smallest confirmed gas to not throw an OutOfGas exception, subject to tolerance. If OutOfGas is thrown at block limit, return block limit. :raises VMError: if the computation fails even when given the block gas_limit to complete
[ "Run", "the", "transaction", "with", "various", "gas", "limits", "progressively", "approaching", "the", "minimum", "needed", "to", "succeed", "without", "an", "OutOfGas", "exception", "." ]
train
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/estimators/gas.py#L28-L78
<|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: Run the transaction with various gas limits, progressively approaching the minimum needed to succeed without an OutOfGas exception. The starting range of possible estimates is: [transaction.intrinsic_gas, state.gas_limit]. After the first OutOfGas exception, the range is: (largest_limit_out_of_gas, state.gas_limit]. After the first run not out of gas, the range is: (largest_limit_out_of_gas, smallest_success]. :param int tolerance: When the range of estimates is less than tolerance, return the top of the range. :returns int: The smallest confirmed gas to not throw an OutOfGas exception, subject to tolerance. If OutOfGas is thrown at block limit, return block limit. :raises VMError: if the computation fails even when given the block gas_limit to complete ### Response: def binary_gas_search(state: BaseState, transaction: BaseTransaction, tolerance: int=1) -> int: """ Run the transaction with various gas limits, progressively approaching the minimum needed to succeed without an OutOfGas exception. The starting range of possible estimates is: [transaction.intrinsic_gas, state.gas_limit]. After the first OutOfGas exception, the range is: (largest_limit_out_of_gas, state.gas_limit]. After the first run not out of gas, the range is: (largest_limit_out_of_gas, smallest_success]. :param int tolerance: When the range of estimates is less than tolerance, return the top of the range. :returns int: The smallest confirmed gas to not throw an OutOfGas exception, subject to tolerance. If OutOfGas is thrown at block limit, return block limit. :raises VMError: if the computation fails even when given the block gas_limit to complete """ if not hasattr(transaction, 'sender'): raise TypeError( "Transaction is missing attribute sender.", "If sending an unsigned transaction, use SpoofTransaction and provide the", "sender using the 'from' parameter") minimum_transaction = SpoofTransaction( transaction, gas=transaction.intrinsic_gas, gas_price=0, ) if _get_computation_error(state, minimum_transaction) is None: return transaction.intrinsic_gas maximum_transaction = SpoofTransaction( transaction, gas=state.gas_limit, gas_price=0, ) error = _get_computation_error(state, maximum_transaction) if error is not None: raise error minimum_viable = state.gas_limit maximum_out_of_gas = transaction.intrinsic_gas while minimum_viable - maximum_out_of_gas > tolerance: midpoint = (minimum_viable + maximum_out_of_gas) // 2 test_transaction = SpoofTransaction(transaction, gas=midpoint) if _get_computation_error(state, test_transaction) is None: minimum_viable = midpoint else: maximum_out_of_gas = midpoint return minimum_viable <|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, 6869, 279, 7901, 449, 5370, 6962, 13693, 11, 72859, 198, 262, 31047, 279, 8187, 4460, 311, 12265, 2085, 459, 4470, 2173, 59828, 4788, 382, 262, 578, 6041, 2134, 315, 3284, 17989, 374, 512, 262, 510, 13838, 1896, 46102, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 4470, 2173, 59828, 4788, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 1629, 539, 704, 315, 6962, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 25655, 19147, 30662, 262, 551, 913, 528, 25065, 25, 3277, 279, 2134, 315, 17989, 374, 2753, 1109, 25065, 345, 286, 471, 279, 1948, 315, 279, 2134, 627, 262, 551, 4310, 528, 25, 578, 25655, 11007, 6962, 311, 539, 2571, 459, 4470, 2173, 59828, 4788, 345, 286, 3917, 311, 25065, 13, 1442, 4470, 2173, 59828, 374, 15338, 520, 2565, 4017, 11, 471, 2565, 4017, 627, 262, 551, 33371, 18270, 1480, 25, 422, 279, 35547, 14865, 1524, 994, 2728, 279, 2565, 6962, 15106, 311, 4686, 271, 14711, 6075, 512, 755, 8026, 83216, 10947, 8556, 25, 5464, 1423, 11, 7901, 25, 5464, 8230, 11, 25065, 25, 528, 28, 16, 8, 1492, 528, 512, 262, 3270, 262, 6588, 279, 7901, 449, 5370, 6962, 13693, 11, 72859, 198, 262, 31047, 279, 8187, 4460, 311, 12265, 2085, 459, 4470, 2173, 59828, 4788, 382, 262, 578, 6041, 2134, 315, 3284, 17989, 374, 512, 262, 510, 13838, 1896, 46102, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 4470, 2173, 59828, 4788, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 1629, 539, 704, 315, 6962, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 25655, 19147, 30662, 262, 551, 913, 528, 25065, 25, 3277, 279, 2134, 315, 17989, 374, 2753, 1109, 25065, 345, 286, 471, 279, 1948, 315, 279, 2134, 627, 262, 551, 4310, 528, 25, 578, 25655, 11007, 6962, 311, 539, 2571, 459, 4470, 2173, 59828, 4788, 345, 286, 3917, 311, 25065, 13, 1442, 4470, 2173, 59828, 374, 15338, 520, 2565, 4017, 11, 471, 2565, 4017, 627, 262, 551, 33371, 18270, 1480, 25, 422, 279, 35547, 14865, 1524, 994, 2728, 279, 2565, 6962, 15106, 311, 4686, 198, 262, 3270, 262, 422, 539, 32156, 45104, 11, 364, 11905, 11290, 286, 4933, 26082, 1021, 310, 330, 8230, 374, 7554, 7180, 4750, 10560, 310, 330, 2746, 11889, 459, 3859, 7901, 11, 1005, 57049, 1073, 8230, 323, 3493, 279, 761, 310, 330, 11905, 1701, 279, 364, 1527, 6, 5852, 5240, 262, 8187, 29984, 284, 57049, 1073, 8230, 1021, 286, 7901, 345, 286, 6962, 28, 13838, 1896, 46102, 83216, 345, 286, 6962, 9217, 28, 15, 345, 262, 5235, 262, 422, 721, 456, 3038, 13623, 4188, 8556, 11, 8187, 29984, 8, 374, 2290 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 6869, 279, 7901, 449, 5370, 6962, 13693, 11, 72859, 198, 262, 31047, 279, 8187, 4460, 311, 12265, 2085, 459, 4470, 2173, 59828, 4788, 382, 262, 578, 6041, 2134, 315, 3284, 17989, 374, 512, 262, 510, 13838, 1896, 46102, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 4470, 2173, 59828, 4788, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 1629, 539, 704, 315, 6962, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 25655, 19147, 30662, 262, 551, 913, 528, 25065, 25, 3277, 279, 2134, 315, 17989, 374, 2753, 1109, 25065, 345, 286, 471, 279, 1948, 315, 279, 2134, 627, 262, 551, 4310, 528, 25, 578, 25655, 11007, 6962, 311, 539, 2571, 459, 4470, 2173, 59828, 4788, 345, 286, 3917, 311, 25065, 13, 1442, 4470, 2173, 59828, 374, 15338, 520, 2565, 4017, 11, 471, 2565, 4017, 627, 262, 551, 33371, 18270, 1480, 25, 422, 279, 35547, 14865, 1524, 994, 2728, 279, 2565, 6962, 15106, 311, 4686, 271, 14711, 6075, 512, 755, 8026, 83216, 10947, 8556, 25, 5464, 1423, 11, 7901, 25, 5464, 8230, 11, 25065, 25, 528, 28, 16, 8, 1492, 528, 512, 262, 3270, 262, 6588, 279, 7901, 449, 5370, 6962, 13693, 11, 72859, 198, 262, 31047, 279, 8187, 4460, 311, 12265, 2085, 459, 4470, 2173, 59828, 4788, 382, 262, 578, 6041, 2134, 315, 3284, 17989, 374, 512, 262, 510, 13838, 1896, 46102, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 4470, 2173, 59828, 4788, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 1614, 1326, 300, 15106, 27218, 262, 4740, 279, 1176, 1629, 539, 704, 315, 6962, 11, 279, 2134, 374, 25, 320, 27995, 478, 15106, 6196, 3659, 83216, 11, 25655, 19147, 30662, 262, 551, 913, 528, 25065, 25, 3277, 279, 2134, 315, 17989, 374, 2753, 1109, 25065, 345, 286, 471, 279, 1948, 315, 279, 2134, 627, 262, 551, 4310, 528, 25, 578, 25655, 11007, 6962, 311, 539, 2571, 459, 4470, 2173, 59828, 4788, 345, 286, 3917, 311, 25065, 13, 1442, 4470, 2173, 59828, 374, 15338, 520, 2565, 4017, 11, 471, 2565, 4017, 627, 262, 551, 33371, 18270, 1480, 25, 422, 279, 35547, 14865, 1524, 994, 2728, 279, 2565, 6962, 15106, 311, 4686, 198, 262, 3270, 262, 422, 539, 32156, 45104, 11, 364, 11905, 11290, 286, 4933, 26082, 1021, 310, 330, 8230, 374, 7554, 7180, 4750, 10560, 310, 330, 2746, 11889, 459, 3859, 7901, 11, 1005, 57049, 1073, 8230, 323, 3493, 279, 761, 310, 330, 11905, 1701, 279, 364, 1527, 6, 5852, 5240, 262, 8187, 29984, 284, 57049, 1073, 8230, 1021, 286, 7901, 345, 286, 6962, 28, 13838, 1896, 46102, 83216, 345, 286, 6962, 9217, 28, 15, 345, 262, 5235, 262, 422, 721, 456, 3038, 13623, 4188, 8556, 11, 8187, 29984, 8, 374, 2290 ]
SatelliteQE/nailgun
nailgun/entities.py
ContentViewPuppetModule.read
def read(self, entity=None, attrs=None, ignore=None, params=None): """Provide a default value for ``entity``. By default, ``nailgun.entity_mixins.EntityReadMixin.read provides a default value for ``entity`` like so:: entity = type(self)() However, :class:`ContentViewPuppetModule` requires that an ``content_view`` be provided, so this technique will not work. Do this instead:: entity = type(self)(content_view=self.content_view.id) """ # read() should not change the state of the object it's called on, but # super() alters the attributes of any entity passed in. Creating a new # object and passing it to super() lets this one avoid changing state. if entity is None: entity = type(self)( self._server_config, content_view=self.content_view, # pylint:disable=no-member ) if ignore is None: ignore = set() ignore.add('content_view') return super(ContentViewPuppetModule, self).read( entity, attrs, ignore, params)
python
def read(self, entity=None, attrs=None, ignore=None, params=None): """Provide a default value for ``entity``. By default, ``nailgun.entity_mixins.EntityReadMixin.read provides a default value for ``entity`` like so:: entity = type(self)() However, :class:`ContentViewPuppetModule` requires that an ``content_view`` be provided, so this technique will not work. Do this instead:: entity = type(self)(content_view=self.content_view.id) """ # read() should not change the state of the object it's called on, but # super() alters the attributes of any entity passed in. Creating a new # object and passing it to super() lets this one avoid changing state. if entity is None: entity = type(self)( self._server_config, content_view=self.content_view, # pylint:disable=no-member ) if ignore is None: ignore = set() ignore.add('content_view') return super(ContentViewPuppetModule, self).read( entity, attrs, ignore, params)
[ "def", "read", "(", "self", ",", "entity", "=", "None", ",", "attrs", "=", "None", ",", "ignore", "=", "None", ",", "params", "=", "None", ")", ":", "# read() should not change the state of the object it's called on, but", "# super() alters the attributes of any entity passed in. Creating a new", "# object and passing it to super() lets this one avoid changing state.", "if", "entity", "is", "None", ":", "entity", "=", "type", "(", "self", ")", "(", "self", ".", "_server_config", ",", "content_view", "=", "self", ".", "content_view", ",", "# pylint:disable=no-member", ")", "if", "ignore", "is", "None", ":", "ignore", "=", "set", "(", ")", "ignore", ".", "add", "(", "'content_view'", ")", "return", "super", "(", "ContentViewPuppetModule", ",", "self", ")", ".", "read", "(", "entity", ",", "attrs", ",", "ignore", ",", "params", ")" ]
Provide a default value for ``entity``. By default, ``nailgun.entity_mixins.EntityReadMixin.read provides a default value for ``entity`` like so:: entity = type(self)() However, :class:`ContentViewPuppetModule` requires that an ``content_view`` be provided, so this technique will not work. Do this instead:: entity = type(self)(content_view=self.content_view.id)
[ "Provide", "a", "default", "value", "for", "entity", "." ]
train
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L2453-L2480
<|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: Provide a default value for ``entity``. By default, ``nailgun.entity_mixins.EntityReadMixin.read provides a default value for ``entity`` like so:: entity = type(self)() However, :class:`ContentViewPuppetModule` requires that an ``content_view`` be provided, so this technique will not work. Do this instead:: entity = type(self)(content_view=self.content_view.id) ### Response: def read(self, entity=None, attrs=None, ignore=None, params=None): """Provide a default value for ``entity``. By default, ``nailgun.entity_mixins.EntityReadMixin.read provides a default value for ``entity`` like so:: entity = type(self)() However, :class:`ContentViewPuppetModule` requires that an ``content_view`` be provided, so this technique will not work. Do this instead:: entity = type(self)(content_view=self.content_view.id) """ # read() should not change the state of the object it's called on, but # super() alters the attributes of any entity passed in. Creating a new # object and passing it to super() lets this one avoid changing state. if entity is None: entity = type(self)( self._server_config, content_view=self.content_view, # pylint:disable=no-member ) if ignore is None: ignore = set() ignore.add('content_view') return super(ContentViewPuppetModule, self).read( entity, attrs, ignore, params) <|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, 61524, 264, 1670, 907, 369, 10103, 3069, 14196, 382, 286, 3296, 1670, 11, 10103, 77, 607, 13562, 9926, 68829, 1354, 10100, 4518, 39556, 4217, 5825, 264, 198, 286, 1670, 907, 369, 10103, 3069, 14196, 1093, 779, 66152, 310, 5502, 284, 955, 1214, 8, 2892, 286, 4452, 11, 551, 1058, 19258, 18566, 47, 39936, 3413, 63, 7612, 430, 459, 198, 286, 10103, 1834, 7268, 14196, 387, 3984, 11, 779, 420, 15105, 690, 539, 990, 13, 3234, 198, 286, 420, 4619, 66152, 310, 5502, 284, 955, 1214, 2432, 1834, 7268, 7822, 5521, 7268, 1801, 696, 14711, 6075, 512, 755, 1373, 1214, 11, 5502, 5980, 11, 16602, 5980, 11, 10240, 5980, 11, 3712, 5980, 997, 286, 4304, 61524, 264, 1670, 907, 369, 10103, 3069, 14196, 382, 286, 3296, 1670, 11, 10103, 77, 607, 13562, 9926, 68829, 1354, 10100, 4518, 39556, 4217, 5825, 264, 198, 286, 1670, 907, 369, 10103, 3069, 14196, 1093, 779, 66152, 310, 5502, 284, 955, 1214, 8, 2892, 286, 4452, 11, 551, 1058, 19258, 18566, 47, 39936, 3413, 63, 7612, 430, 459, 198, 286, 10103, 1834, 7268, 14196, 387, 3984, 11, 779, 420, 15105, 690, 539, 990, 13, 3234, 198, 286, 420, 4619, 66152, 310, 5502, 284, 955, 1214, 2432, 1834, 7268, 7822, 5521, 7268, 1801, 696, 286, 3270, 286, 674, 1373, 368, 1288, 539, 2349, 279, 1614, 315, 279, 1665, 433, 596, 2663, 389, 11, 719, 198, 286, 674, 2307, 368, 88687, 279, 8365, 315, 904, 5502, 5946, 304, 13, 32406, 264, 502, 198, 286, 674, 1665, 323, 12579, 433, 311, 2307, 368, 15714, 420, 832, 5766, 10223, 1614, 627, 286, 422, 5502, 374, 2290, 512, 310, 5502, 284, 955, 1214, 71642, 394, 659, 1462, 4120, 5445, 345, 394, 2262, 7268, 7822, 5521, 7268, 11, 220, 674, 51471, 43166, 31415, 44650, 198, 310, 1763, 286, 422, 10240, 374, 2290, 512, 310, 10240, 284, 743, 746, 286, 10240, 1388, 493, 1834, 7268, 1329, 286, 471, 2307, 7, 18566, 47, 39936, 3413, 11, 659, 570, 888, 1021, 310, 5502, 11, 16602, 11, 10240, 11, 3712, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 61524, 264, 1670, 907, 369, 10103, 3069, 14196, 382, 286, 3296, 1670, 11, 10103, 77, 607, 13562, 9926, 68829, 1354, 10100, 4518, 39556, 4217, 5825, 264, 198, 286, 1670, 907, 369, 10103, 3069, 14196, 1093, 779, 66152, 310, 5502, 284, 955, 1214, 8, 2892, 286, 4452, 11, 551, 1058, 19258, 18566, 47, 39936, 3413, 63, 7612, 430, 459, 198, 286, 10103, 1834, 7268, 14196, 387, 3984, 11, 779, 420, 15105, 690, 539, 990, 13, 3234, 198, 286, 420, 4619, 66152, 310, 5502, 284, 955, 1214, 2432, 1834, 7268, 7822, 5521, 7268, 1801, 696, 14711, 6075, 512, 755, 1373, 1214, 11, 5502, 5980, 11, 16602, 5980, 11, 10240, 5980, 11, 3712, 5980, 997, 286, 4304, 61524, 264, 1670, 907, 369, 10103, 3069, 14196, 382, 286, 3296, 1670, 11, 10103, 77, 607, 13562, 9926, 68829, 1354, 10100, 4518, 39556, 4217, 5825, 264, 198, 286, 1670, 907, 369, 10103, 3069, 14196, 1093, 779, 66152, 310, 5502, 284, 955, 1214, 8, 2892, 286, 4452, 11, 551, 1058, 19258, 18566, 47, 39936, 3413, 63, 7612, 430, 459, 198, 286, 10103, 1834, 7268, 14196, 387, 3984, 11, 779, 420, 15105, 690, 539, 990, 13, 3234, 198, 286, 420, 4619, 66152, 310, 5502, 284, 955, 1214, 2432, 1834, 7268, 7822, 5521, 7268, 1801, 696, 286, 3270, 286, 674, 1373, 368, 1288, 539, 2349, 279, 1614, 315, 279, 1665, 433, 596, 2663, 389, 11, 719, 198, 286, 674, 2307, 368, 88687, 279, 8365, 315, 904, 5502, 5946, 304, 13, 32406, 264, 502, 198, 286, 674, 1665, 323, 12579, 433, 311, 2307, 368, 15714, 420, 832, 5766, 10223, 1614, 627, 286, 422, 5502, 374, 2290, 512, 310, 5502, 284, 955, 1214, 71642, 394, 659, 1462, 4120, 5445, 345, 394, 2262, 7268, 7822, 5521, 7268, 11, 220, 674, 51471, 43166, 31415, 44650, 198, 310, 1763, 286, 422, 10240, 374, 2290, 512, 310, 10240, 284, 743, 746, 286, 10240, 1388, 493, 1834, 7268, 1329, 286, 471, 2307, 7, 18566, 47, 39936, 3413, 11, 659, 570, 888, 1021, 310, 5502, 11, 16602, 11, 10240, 11, 3712, 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 ]
taskcluster/json-e
jsone/prattparser.py
ParseContext.attempt
def attempt(self, *kinds): """Try to get the next token if it matches one of the kinds given, otherwise returning None. If no kinds are given, any kind is accepted.""" if self._error: raise self._error token = self.next_token if not token: return None if kinds and token.kind not in kinds: return None self._advance() return token
python
def attempt(self, *kinds): """Try to get the next token if it matches one of the kinds given, otherwise returning None. If no kinds are given, any kind is accepted.""" if self._error: raise self._error token = self.next_token if not token: return None if kinds and token.kind not in kinds: return None self._advance() return token
[ "def", "attempt", "(", "self", ",", "*", "kinds", ")", ":", "if", "self", ".", "_error", ":", "raise", "self", ".", "_error", "token", "=", "self", ".", "next_token", "if", "not", "token", ":", "return", "None", "if", "kinds", "and", "token", ".", "kind", "not", "in", "kinds", ":", "return", "None", "self", ".", "_advance", "(", ")", "return", "token" ]
Try to get the next token if it matches one of the kinds given, otherwise returning None. If no kinds are given, any kind is accepted.
[ "Try", "to", "get", "the", "next", "token", "if", "it", "matches", "one", "of", "the", "kinds", "given", "otherwise", "returning", "None", ".", "If", "no", "kinds", "are", "given", "any", "kind", "is", "accepted", "." ]
train
https://github.com/taskcluster/json-e/blob/ac0c9fba1de3ed619f05a64dae929f6687789cbc/jsone/prattparser.py#L150-L162
<|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: Try to get the next token if it matches one of the kinds given, otherwise returning None. If no kinds are given, any kind is accepted. ### Response: def attempt(self, *kinds): """Try to get the next token if it matches one of the kinds given, otherwise returning None. If no kinds are given, any kind is accepted.""" if self._error: raise self._error token = self.next_token if not token: return None if kinds and token.kind not in kinds: return None self._advance() return token <|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, 22170, 311, 636, 279, 1828, 4037, 422, 433, 9248, 832, 315, 279, 13124, 2728, 345, 286, 6062, 13758, 2290, 13, 1442, 912, 13124, 527, 2728, 11, 904, 3169, 374, 198, 286, 11928, 382, 14711, 6075, 512, 755, 4879, 1214, 11, 353, 74, 8843, 997, 286, 4304, 22170, 311, 636, 279, 1828, 4037, 422, 433, 9248, 832, 315, 279, 13124, 2728, 345, 286, 6062, 13758, 2290, 13, 1442, 912, 13124, 527, 2728, 11, 904, 3169, 374, 198, 286, 11928, 14781, 286, 422, 659, 1462, 850, 512, 310, 4933, 659, 1462, 850, 198, 286, 4037, 284, 659, 4630, 6594, 198, 286, 422, 539, 4037, 512, 310, 471, 2290, 198, 286, 422, 13124, 323, 4037, 37732, 539, 304, 13124, 512, 310, 471, 2290, 198, 286, 659, 1462, 60420, 746, 286, 471, 4037, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 22170, 311, 636, 279, 1828, 4037, 422, 433, 9248, 832, 315, 279, 13124, 2728, 345, 286, 6062, 13758, 2290, 13, 1442, 912, 13124, 527, 2728, 11, 904, 3169, 374, 198, 286, 11928, 382, 14711, 6075, 512, 755, 4879, 1214, 11, 353, 74, 8843, 997, 286, 4304, 22170, 311, 636, 279, 1828, 4037, 422, 433, 9248, 832, 315, 279, 13124, 2728, 345, 286, 6062, 13758, 2290, 13, 1442, 912, 13124, 527, 2728, 11, 904, 3169, 374, 198, 286, 11928, 14781, 286, 422, 659, 1462, 850, 512, 310, 4933, 659, 1462, 850, 198, 286, 4037, 284, 659, 4630, 6594, 198, 286, 422, 539, 4037, 512, 310, 471, 2290, 198, 286, 422, 13124, 323, 4037, 37732, 539, 304, 13124, 512, 310, 471, 2290, 198, 286, 659, 1462, 60420, 746, 286, 471, 4037, 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 ]
markovmodel/PyEMMA
pyemma/plots/plots2d.py
plot_contour
def plot_contour( xall, yall, zall, ax=None, cmap=None, ncontours=100, vmin=None, vmax=None, levels=None, cbar=True, cax=None, cbar_label=None, cbar_orientation='vertical', norm=None, nbins=100, method='nearest', mask=False, **kwargs): """Plot a two-dimensional contour map by interpolating scattered data on a grid. Parameters ---------- xall : ndarray(T) Sample x-coordinates. yall : ndarray(T) Sample y-coordinates. zall : ndarray(T) Sample z-coordinates. ax : matplotlib.Axes object, optional, default=None The ax to plot to; if ax=None, a new ax (and fig) is created. cmap : matplotlib colormap, optional, default=None The color map to use. ncontours : int, optional, default=100 Number of contour levels. vmin : float, optional, default=None Lowest z-value to be plotted. vmax : float, optional, default=None Highest z-value to be plotted. levels : iterable of float, optional, default=None Contour levels to plot; use legacy style calculation if 'legacy'. cbar : boolean, optional, default=True Plot a color bar. cax : matplotlib.Axes object, optional, default=None Plot the colorbar into a custom axes object instead of stealing space from ax. cbar_label : str, optional, default=None Colorbar label string; use None to suppress it. cbar_orientation : str, optional, default='vertical' Colorbar orientation; choose 'vertical' or 'horizontal'. norm : matplotlib norm, optional, default=None Use a norm when coloring the contour plot. nbins : int, optional, default=100 Number of grid points used in each dimension. method : str, optional, default='nearest' Assignment method; scipy.interpolate.griddata supports the methods 'nearest', 'linear', and 'cubic'. mask : boolean, optional, default=False Hide unsampled areas is True. Optional parameters for contourf (**kwargs) ------------------------------------------- corner_mask : boolean, optional Enable/disable corner masking, which only has an effect if z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual. Defaults to rcParams['contour.corner_mask'], which defaults to True. alpha : float The alpha blending value. locator : [ None | ticker.Locator subclass ] If locator is None, the default MaxNLocator is used. The locator is used to determine the contour levels if they are not given explicitly via the levels argument. extend : [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ] Unless this is ‘neither’, contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via matplotlib.colors.Colormap.set_under() and matplotlib.colors.Colormap.set_over() methods. xunits, yunits : [ None | registered units ] Override axis units by specifying an instance of a matplotlib.units.ConversionInterface. antialiased : boolean, optional Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams[‘lines.antialiased’]. nchunk : [ 0 | integer ] If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha. hatches : A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only. zorder : float Set the zorder for the artist. Artists with lower zorder values are drawn first. Returns ------- fig : matplotlib.Figure object The figure in which the used ax resides. ax : matplotlib.Axes object The ax in which the map was plotted. misc : dict Contains a matplotlib.contour.QuadContourSet 'mappable' and, if requested, a matplotlib.Colorbar object 'cbar'. """ x, y, z = get_grid_data( xall, yall, zall, nbins=nbins, method=method) if vmin is None: vmin = _np.min(zall[zall > -_np.inf]) if vmax is None: vmax = _np.max(zall[zall < _np.inf]) if levels == 'legacy': eps = (vmax - vmin) / float(ncontours) levels = _np.linspace(vmin - eps, vmax + eps) if mask: _, _, counts = get_histogram( xall, yall, nbins=nbins, weights=None, avoid_zero_count=None) z = _np.ma.masked_where(counts.T <= 0, z) return plot_map( x, y, z, ax=ax, cmap=cmap, ncontours=ncontours, vmin=vmin, vmax=vmax, levels=levels, cbar=cbar, cax=cax, cbar_label=cbar_label, cbar_orientation=cbar_orientation, norm=norm, **kwargs)
python
def plot_contour( xall, yall, zall, ax=None, cmap=None, ncontours=100, vmin=None, vmax=None, levels=None, cbar=True, cax=None, cbar_label=None, cbar_orientation='vertical', norm=None, nbins=100, method='nearest', mask=False, **kwargs): """Plot a two-dimensional contour map by interpolating scattered data on a grid. Parameters ---------- xall : ndarray(T) Sample x-coordinates. yall : ndarray(T) Sample y-coordinates. zall : ndarray(T) Sample z-coordinates. ax : matplotlib.Axes object, optional, default=None The ax to plot to; if ax=None, a new ax (and fig) is created. cmap : matplotlib colormap, optional, default=None The color map to use. ncontours : int, optional, default=100 Number of contour levels. vmin : float, optional, default=None Lowest z-value to be plotted. vmax : float, optional, default=None Highest z-value to be plotted. levels : iterable of float, optional, default=None Contour levels to plot; use legacy style calculation if 'legacy'. cbar : boolean, optional, default=True Plot a color bar. cax : matplotlib.Axes object, optional, default=None Plot the colorbar into a custom axes object instead of stealing space from ax. cbar_label : str, optional, default=None Colorbar label string; use None to suppress it. cbar_orientation : str, optional, default='vertical' Colorbar orientation; choose 'vertical' or 'horizontal'. norm : matplotlib norm, optional, default=None Use a norm when coloring the contour plot. nbins : int, optional, default=100 Number of grid points used in each dimension. method : str, optional, default='nearest' Assignment method; scipy.interpolate.griddata supports the methods 'nearest', 'linear', and 'cubic'. mask : boolean, optional, default=False Hide unsampled areas is True. Optional parameters for contourf (**kwargs) ------------------------------------------- corner_mask : boolean, optional Enable/disable corner masking, which only has an effect if z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual. Defaults to rcParams['contour.corner_mask'], which defaults to True. alpha : float The alpha blending value. locator : [ None | ticker.Locator subclass ] If locator is None, the default MaxNLocator is used. The locator is used to determine the contour levels if they are not given explicitly via the levels argument. extend : [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ] Unless this is ‘neither’, contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via matplotlib.colors.Colormap.set_under() and matplotlib.colors.Colormap.set_over() methods. xunits, yunits : [ None | registered units ] Override axis units by specifying an instance of a matplotlib.units.ConversionInterface. antialiased : boolean, optional Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams[‘lines.antialiased’]. nchunk : [ 0 | integer ] If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha. hatches : A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only. zorder : float Set the zorder for the artist. Artists with lower zorder values are drawn first. Returns ------- fig : matplotlib.Figure object The figure in which the used ax resides. ax : matplotlib.Axes object The ax in which the map was plotted. misc : dict Contains a matplotlib.contour.QuadContourSet 'mappable' and, if requested, a matplotlib.Colorbar object 'cbar'. """ x, y, z = get_grid_data( xall, yall, zall, nbins=nbins, method=method) if vmin is None: vmin = _np.min(zall[zall > -_np.inf]) if vmax is None: vmax = _np.max(zall[zall < _np.inf]) if levels == 'legacy': eps = (vmax - vmin) / float(ncontours) levels = _np.linspace(vmin - eps, vmax + eps) if mask: _, _, counts = get_histogram( xall, yall, nbins=nbins, weights=None, avoid_zero_count=None) z = _np.ma.masked_where(counts.T <= 0, z) return plot_map( x, y, z, ax=ax, cmap=cmap, ncontours=ncontours, vmin=vmin, vmax=vmax, levels=levels, cbar=cbar, cax=cax, cbar_label=cbar_label, cbar_orientation=cbar_orientation, norm=norm, **kwargs)
[ "def", "plot_contour", "(", "xall", ",", "yall", ",", "zall", ",", "ax", "=", "None", ",", "cmap", "=", "None", ",", "ncontours", "=", "100", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ",", "levels", "=", "None", ",", "cbar", "=", "True", ",", "cax", "=", "None", ",", "cbar_label", "=", "None", ",", "cbar_orientation", "=", "'vertical'", ",", "norm", "=", "None", ",", "nbins", "=", "100", ",", "method", "=", "'nearest'", ",", "mask", "=", "False", ",", "*", "*", "kwargs", ")", ":", "x", ",", "y", ",", "z", "=", "get_grid_data", "(", "xall", ",", "yall", ",", "zall", ",", "nbins", "=", "nbins", ",", "method", "=", "method", ")", "if", "vmin", "is", "None", ":", "vmin", "=", "_np", ".", "min", "(", "zall", "[", "zall", ">", "-", "_np", ".", "inf", "]", ")", "if", "vmax", "is", "None", ":", "vmax", "=", "_np", ".", "max", "(", "zall", "[", "zall", "<", "_np", ".", "inf", "]", ")", "if", "levels", "==", "'legacy'", ":", "eps", "=", "(", "vmax", "-", "vmin", ")", "/", "float", "(", "ncontours", ")", "levels", "=", "_np", ".", "linspace", "(", "vmin", "-", "eps", ",", "vmax", "+", "eps", ")", "if", "mask", ":", "_", ",", "_", ",", "counts", "=", "get_histogram", "(", "xall", ",", "yall", ",", "nbins", "=", "nbins", ",", "weights", "=", "None", ",", "avoid_zero_count", "=", "None", ")", "z", "=", "_np", ".", "ma", ".", "masked_where", "(", "counts", ".", "T", "<=", "0", ",", "z", ")", "return", "plot_map", "(", "x", ",", "y", ",", "z", ",", "ax", "=", "ax", ",", "cmap", "=", "cmap", ",", "ncontours", "=", "ncontours", ",", "vmin", "=", "vmin", ",", "vmax", "=", "vmax", ",", "levels", "=", "levels", ",", "cbar", "=", "cbar", ",", "cax", "=", "cax", ",", "cbar_label", "=", "cbar_label", ",", "cbar_orientation", "=", "cbar_orientation", ",", "norm", "=", "norm", ",", "*", "*", "kwargs", ")" ]
Plot a two-dimensional contour map by interpolating scattered data on a grid. Parameters ---------- xall : ndarray(T) Sample x-coordinates. yall : ndarray(T) Sample y-coordinates. zall : ndarray(T) Sample z-coordinates. ax : matplotlib.Axes object, optional, default=None The ax to plot to; if ax=None, a new ax (and fig) is created. cmap : matplotlib colormap, optional, default=None The color map to use. ncontours : int, optional, default=100 Number of contour levels. vmin : float, optional, default=None Lowest z-value to be plotted. vmax : float, optional, default=None Highest z-value to be plotted. levels : iterable of float, optional, default=None Contour levels to plot; use legacy style calculation if 'legacy'. cbar : boolean, optional, default=True Plot a color bar. cax : matplotlib.Axes object, optional, default=None Plot the colorbar into a custom axes object instead of stealing space from ax. cbar_label : str, optional, default=None Colorbar label string; use None to suppress it. cbar_orientation : str, optional, default='vertical' Colorbar orientation; choose 'vertical' or 'horizontal'. norm : matplotlib norm, optional, default=None Use a norm when coloring the contour plot. nbins : int, optional, default=100 Number of grid points used in each dimension. method : str, optional, default='nearest' Assignment method; scipy.interpolate.griddata supports the methods 'nearest', 'linear', and 'cubic'. mask : boolean, optional, default=False Hide unsampled areas is True. Optional parameters for contourf (**kwargs) ------------------------------------------- corner_mask : boolean, optional Enable/disable corner masking, which only has an effect if z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual. Defaults to rcParams['contour.corner_mask'], which defaults to True. alpha : float The alpha blending value. locator : [ None | ticker.Locator subclass ] If locator is None, the default MaxNLocator is used. The locator is used to determine the contour levels if they are not given explicitly via the levels argument. extend : [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ] Unless this is ‘neither’, contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via matplotlib.colors.Colormap.set_under() and matplotlib.colors.Colormap.set_over() methods. xunits, yunits : [ None | registered units ] Override axis units by specifying an instance of a matplotlib.units.ConversionInterface. antialiased : boolean, optional Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams[‘lines.antialiased’]. nchunk : [ 0 | integer ] If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha. hatches : A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only. zorder : float Set the zorder for the artist. Artists with lower zorder values are drawn first. Returns ------- fig : matplotlib.Figure object The figure in which the used ax resides. ax : matplotlib.Axes object The ax in which the map was plotted. misc : dict Contains a matplotlib.contour.QuadContourSet 'mappable' and, if requested, a matplotlib.Colorbar object 'cbar'.
[ "Plot", "a", "two", "-", "dimensional", "contour", "map", "by", "interpolating", "scattered", "data", "on", "a", "grid", "." ]
train
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/plots/plots2d.py#L686-L815
<|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: Plot a two-dimensional contour map by interpolating scattered data on a grid. Parameters ---------- xall : ndarray(T) Sample x-coordinates. yall : ndarray(T) Sample y-coordinates. zall : ndarray(T) Sample z-coordinates. ax : matplotlib.Axes object, optional, default=None The ax to plot to; if ax=None, a new ax (and fig) is created. cmap : matplotlib colormap, optional, default=None The color map to use. ncontours : int, optional, default=100 Number of contour levels. vmin : float, optional, default=None Lowest z-value to be plotted. vmax : float, optional, default=None Highest z-value to be plotted. levels : iterable of float, optional, default=None Contour levels to plot; use legacy style calculation if 'legacy'. cbar : boolean, optional, default=True Plot a color bar. cax : matplotlib.Axes object, optional, default=None Plot the colorbar into a custom axes object instead of stealing space from ax. cbar_label : str, optional, default=None Colorbar label string; use None to suppress it. cbar_orientation : str, optional, default='vertical' Colorbar orientation; choose 'vertical' or 'horizontal'. norm : matplotlib norm, optional, default=None Use a norm when coloring the contour plot. nbins : int, optional, default=100 Number of grid points used in each dimension. method : str, optional, default='nearest' Assignment method; scipy.interpolate.griddata supports the methods 'nearest', 'linear', and 'cubic'. mask : boolean, optional, default=False Hide unsampled areas is True. Optional parameters for contourf (**kwargs) ------------------------------------------- corner_mask : boolean, optional Enable/disable corner masking, which only has an effect if z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual. Defaults to rcParams['contour.corner_mask'], which defaults to True. alpha : float The alpha blending value. locator : [ None | ticker.Locator subclass ] If locator is None, the default MaxNLocator is used. The locator is used to determine the contour levels if they are not given explicitly via the levels argument. extend : [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ] Unless this is ‘neither’, contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via matplotlib.colors.Colormap.set_under() and matplotlib.colors.Colormap.set_over() methods. xunits, yunits : [ None | registered units ] Override axis units by specifying an instance of a matplotlib.units.ConversionInterface. antialiased : boolean, optional Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams[‘lines.antialiased’]. nchunk : [ 0 | integer ] If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha. hatches : A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only. zorder : float Set the zorder for the artist. Artists with lower zorder values are drawn first. Returns ------- fig : matplotlib.Figure object The figure in which the used ax resides. ax : matplotlib.Axes object The ax in which the map was plotted. misc : dict Contains a matplotlib.contour.QuadContourSet 'mappable' and, if requested, a matplotlib.Colorbar object 'cbar'. ### Response: def plot_contour( xall, yall, zall, ax=None, cmap=None, ncontours=100, vmin=None, vmax=None, levels=None, cbar=True, cax=None, cbar_label=None, cbar_orientation='vertical', norm=None, nbins=100, method='nearest', mask=False, **kwargs): """Plot a two-dimensional contour map by interpolating scattered data on a grid. Parameters ---------- xall : ndarray(T) Sample x-coordinates. yall : ndarray(T) Sample y-coordinates. zall : ndarray(T) Sample z-coordinates. ax : matplotlib.Axes object, optional, default=None The ax to plot to; if ax=None, a new ax (and fig) is created. cmap : matplotlib colormap, optional, default=None The color map to use. ncontours : int, optional, default=100 Number of contour levels. vmin : float, optional, default=None Lowest z-value to be plotted. vmax : float, optional, default=None Highest z-value to be plotted. levels : iterable of float, optional, default=None Contour levels to plot; use legacy style calculation if 'legacy'. cbar : boolean, optional, default=True Plot a color bar. cax : matplotlib.Axes object, optional, default=None Plot the colorbar into a custom axes object instead of stealing space from ax. cbar_label : str, optional, default=None Colorbar label string; use None to suppress it. cbar_orientation : str, optional, default='vertical' Colorbar orientation; choose 'vertical' or 'horizontal'. norm : matplotlib norm, optional, default=None Use a norm when coloring the contour plot. nbins : int, optional, default=100 Number of grid points used in each dimension. method : str, optional, default='nearest' Assignment method; scipy.interpolate.griddata supports the methods 'nearest', 'linear', and 'cubic'. mask : boolean, optional, default=False Hide unsampled areas is True. Optional parameters for contourf (**kwargs) ------------------------------------------- corner_mask : boolean, optional Enable/disable corner masking, which only has an effect if z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual. Defaults to rcParams['contour.corner_mask'], which defaults to True. alpha : float The alpha blending value. locator : [ None | ticker.Locator subclass ] If locator is None, the default MaxNLocator is used. The locator is used to determine the contour levels if they are not given explicitly via the levels argument. extend : [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ] Unless this is ‘neither’, contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via matplotlib.colors.Colormap.set_under() and matplotlib.colors.Colormap.set_over() methods. xunits, yunits : [ None | registered units ] Override axis units by specifying an instance of a matplotlib.units.ConversionInterface. antialiased : boolean, optional Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams[‘lines.antialiased’]. nchunk : [ 0 | integer ] If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha. hatches : A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only. zorder : float Set the zorder for the artist. Artists with lower zorder values are drawn first. Returns ------- fig : matplotlib.Figure object The figure in which the used ax resides. ax : matplotlib.Axes object The ax in which the map was plotted. misc : dict Contains a matplotlib.contour.QuadContourSet 'mappable' and, if requested, a matplotlib.Colorbar object 'cbar'. """ x, y, z = get_grid_data( xall, yall, zall, nbins=nbins, method=method) if vmin is None: vmin = _np.min(zall[zall > -_np.inf]) if vmax is None: vmax = _np.max(zall[zall < _np.inf]) if levels == 'legacy': eps = (vmax - vmin) / float(ncontours) levels = _np.linspace(vmin - eps, vmax + eps) if mask: _, _, counts = get_histogram( xall, yall, nbins=nbins, weights=None, avoid_zero_count=None) z = _np.ma.masked_where(counts.T <= 0, z) return plot_map( x, y, z, ax=ax, cmap=cmap, ncontours=ncontours, vmin=vmin, vmax=vmax, levels=levels, cbar=cbar, cax=cax, cbar_label=cbar_label, cbar_orientation=cbar_orientation, norm=norm, **kwargs) <|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, 26687, 264, 1403, 33520, 42533, 2472, 555, 23725, 1113, 198, 262, 38067, 828, 389, 264, 5950, 382, 262, 13831, 198, 262, 31423, 262, 865, 543, 551, 67983, 4233, 340, 286, 19690, 865, 23283, 8916, 627, 262, 379, 543, 551, 67983, 4233, 340, 286, 19690, 379, 23283, 8916, 627, 262, 1167, 543, 551, 67983, 4233, 340, 286, 19690, 1167, 23283, 8916, 627, 262, 3944, 551, 17220, 885, 90774, 1665, 11, 10309, 11, 1670, 5980, 198, 286, 578, 3944, 311, 7234, 311, 26, 422, 3944, 5980, 11, 264, 502, 3944, 320, 438, 4237, 8, 374, 3549, 627, 262, 41878, 551, 17220, 77110, 11, 10309, 11, 1670, 5980, 198, 286, 578, 1933, 2472, 311, 1005, 627, 262, 308, 778, 2530, 551, 528, 11, 10309, 11, 1670, 28, 1041, 198, 286, 5742, 315, 42533, 5990, 627, 262, 89363, 551, 2273, 11, 10309, 11, 1670, 5980, 198, 286, 69630, 1167, 19625, 311, 387, 68683, 627, 262, 78115, 551, 2273, 11, 10309, 11, 1670, 5980, 198, 286, 60713, 1167, 19625, 311, 387, 68683, 627, 262, 5990, 551, 51934, 315, 2273, 11, 10309, 11, 1670, 5980, 198, 286, 2140, 414, 5990, 311, 7234, 26, 1005, 20160, 1742, 22702, 198, 286, 422, 364, 40984, 24482, 262, 272, 2308, 551, 2777, 11, 10309, 11, 1670, 3702, 198, 286, 27124, 264, 1933, 3703, 627, 262, 272, 710, 551, 17220, 885, 90774, 1665, 11, 10309, 11, 1670, 5980, 198, 286, 27124, 279, 1933, 2308, 1139, 264, 2587, 25776, 1665, 4619, 315, 198, 286, 39098, 3634, 505, 3944, 627, 262, 272, 2308, 6234, 551, 610, 11, 10309, 11, 1670, 5980, 198, 286, 3562, 2308, 2440, 925, 26, 1005, 2290, 311, 28321, 433, 627, 262, 272, 2308, 67369, 551, 610, 11, 10309, 11, 1670, 1151, 15651, 1270, 286, 3562, 2308, 17140, 26, 5268, 364, 15651, 6, 477, 364, 31729, 24482, 262, 7617, 551, 17220, 7617, 11, 10309, 11, 1670, 5980, 198, 286, 5560, 264, 7617, 994, 35987, 279, 42533, 7234, 627, 262, 17062, 1354, 551, 528, 11, 10309, 11, 1670, 28, 1041, 198, 286, 5742, 315, 5950, 3585, 1511, 304, 1855, 13167, 627, 262, 1749, 551, 610, 11, 10309, 11, 1670, 1151, 70611, 1270, 286, 35527, 1749, 26, 29190, 82753, 10000, 695, 11815, 279, 198, 286, 5528, 364, 70611, 518, 364, 23603, 518, 323, 364, 66, 42281, 24482, 262, 7056, 551, 2777, 11, 10309, 11, 1670, 5725, 198, 286, 26672, 7120, 66107, 5789, 374, 3082, 382, 262, 12536, 5137, 369, 42533, 69, 77596, 9872, 340, 262, 20308, 26999, 262, 9309, 10204, 551, 2777, 11, 10309, 198, 286, 19078, 88477, 9309, 79176, 11, 902, 1193, 706, 459, 2515, 422, 198, 286, 1167, 374, 264, 43248, 1358, 13, 1442, 3641, 11, 904, 28181, 31687, 264, 43248, 198, 286, 1486, 374, 43248, 704, 13, 1442, 3082, 11, 1193, 279, 66594, 24359, 198, 286, 315, 934, 7819, 24379, 1884, 3585, 527, 2744, 43248, 704, 11, 1023, 198, 286, 66594, 24359 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 26687, 264, 1403, 33520, 42533, 2472, 555, 23725, 1113, 198, 262, 38067, 828, 389, 264, 5950, 382, 262, 13831, 198, 262, 31423, 262, 865, 543, 551, 67983, 4233, 340, 286, 19690, 865, 23283, 8916, 627, 262, 379, 543, 551, 67983, 4233, 340, 286, 19690, 379, 23283, 8916, 627, 262, 1167, 543, 551, 67983, 4233, 340, 286, 19690, 1167, 23283, 8916, 627, 262, 3944, 551, 17220, 885, 90774, 1665, 11, 10309, 11, 1670, 5980, 198, 286, 578, 3944, 311, 7234, 311, 26, 422, 3944, 5980, 11, 264, 502, 3944, 320, 438, 4237, 8, 374, 3549, 627, 262, 41878, 551, 17220, 77110, 11, 10309, 11, 1670, 5980, 198, 286, 578, 1933, 2472, 311, 1005, 627, 262, 308, 778, 2530, 551, 528, 11, 10309, 11, 1670, 28, 1041, 198, 286, 5742, 315, 42533, 5990, 627, 262, 89363, 551, 2273, 11, 10309, 11, 1670, 5980, 198, 286, 69630, 1167, 19625, 311, 387, 68683, 627, 262, 78115, 551, 2273, 11, 10309, 11, 1670, 5980, 198, 286, 60713, 1167, 19625, 311, 387, 68683, 627, 262, 5990, 551, 51934, 315, 2273, 11, 10309, 11, 1670, 5980, 198, 286, 2140, 414, 5990, 311, 7234, 26, 1005, 20160, 1742, 22702, 198, 286, 422, 364, 40984, 24482, 262, 272, 2308, 551, 2777, 11, 10309, 11, 1670, 3702, 198, 286, 27124, 264, 1933, 3703, 627, 262, 272, 710, 551, 17220, 885, 90774, 1665, 11, 10309, 11, 1670, 5980, 198, 286, 27124, 279, 1933, 2308, 1139, 264, 2587, 25776, 1665, 4619, 315, 198, 286, 39098, 3634, 505, 3944, 627, 262, 272, 2308, 6234, 551, 610, 11, 10309, 11, 1670, 5980, 198, 286, 3562, 2308, 2440, 925, 26, 1005, 2290, 311, 28321, 433, 627, 262, 272, 2308, 67369, 551, 610, 11, 10309, 11, 1670, 1151, 15651, 1270, 286, 3562, 2308, 17140, 26, 5268, 364, 15651, 6, 477, 364, 31729, 24482, 262, 7617, 551, 17220, 7617, 11, 10309, 11, 1670, 5980, 198, 286, 5560, 264, 7617, 994, 35987, 279, 42533, 7234, 627, 262, 17062, 1354, 551, 528, 11, 10309, 11, 1670, 28, 1041, 198, 286, 5742, 315, 5950, 3585, 1511, 304, 1855, 13167, 627, 262, 1749, 551, 610, 11, 10309, 11, 1670, 1151, 70611, 1270, 286, 35527, 1749, 26, 29190, 82753, 10000, 695, 11815, 279, 198, 286, 5528, 364, 70611, 518, 364, 23603, 518, 323, 364, 66, 42281, 24482, 262, 7056, 551, 2777, 11, 10309, 11, 1670, 5725, 198, 286, 26672, 7120, 66107, 5789, 374, 3082, 382, 262, 12536, 5137, 369, 42533, 69, 77596, 9872, 340, 262, 20308, 26999, 262, 9309, 10204, 551, 2777, 11, 10309, 198, 286, 19078, 88477, 9309, 79176, 11, 902, 1193, 706, 459, 2515, 422, 198, 286, 1167, 374, 264, 43248, 1358, 13, 1442, 3641, 11, 904, 28181, 31687, 264, 43248, 198, 286, 1486, 374, 43248, 704, 13, 1442, 3082, 11, 1193, 279, 66594, 24359, 198, 286, 315, 934, 7819, 24379, 1884, 3585, 527, 2744, 43248, 704, 11, 1023, 198, 286, 66594, 24359 ]
Jaymon/prom
prom/query.py
CacheNamespace.ttl
def ttl(self): """how long you should cache results for cacheable queries""" ret = 3600 cn = self.get_process() if "ttl" in cn: ret = cn["ttl"] return ret
python
def ttl(self): """how long you should cache results for cacheable queries""" ret = 3600 cn = self.get_process() if "ttl" in cn: ret = cn["ttl"] return ret
[ "def", "ttl", "(", "self", ")", ":", "ret", "=", "3600", "cn", "=", "self", ".", "get_process", "(", ")", "if", "\"ttl\"", "in", "cn", ":", "ret", "=", "cn", "[", "\"ttl\"", "]", "return", "ret" ]
how long you should cache results for cacheable queries
[ "how", "long", "you", "should", "cache", "results", "for", "cacheable", "queries" ]
train
https://github.com/Jaymon/prom/blob/b7ad2c259eca198da03e1e4bc7d95014c168c361/prom/query.py#L1440-L1446
<|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: how long you should cache results for cacheable queries ### Response: def ttl(self): """how long you should cache results for cacheable queries""" ret = 3600 cn = self.get_process() if "ttl" in cn: ret = cn["ttl"] return ret <|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, 5269, 1317, 499, 1288, 6636, 3135, 369, 6636, 481, 20126, 271, 14711, 6075, 512, 755, 55032, 1214, 997, 286, 4304, 5269, 1317, 499, 1288, 6636, 3135, 369, 6636, 481, 20126, 7275, 286, 2160, 284, 220, 6843, 15, 198, 286, 13979, 284, 659, 673, 11557, 746, 286, 422, 330, 63958, 1, 304, 13979, 512, 310, 2160, 284, 13979, 1204, 63958, 7171, 286, 471, 2160, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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 ]
[ 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, 5269, 1317, 499, 1288, 6636, 3135, 369, 6636, 481, 20126, 271, 14711, 6075, 512, 755, 55032, 1214, 997, 286, 4304, 5269, 1317, 499, 1288, 6636, 3135, 369, 6636, 481, 20126, 7275, 286, 2160, 284, 220, 6843, 15, 198, 286, 13979, 284, 659, 673, 11557, 746, 286, 422, 330, 63958, 1, 304, 13979, 512, 310, 2160, 284, 13979, 1204, 63958, 7171, 286, 471, 2160, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
INM-6/hybridLFPy
hybridLFPy/gdf.py
GDF.create
def create(self, re='brunel-py-ex-*.gdf', index=True): """ Create db from list of gdf file glob Parameters ---------- re : str File glob to load. index : bool Create index on neurons for speed. Returns ------- None See also -------- sqlite3.connect.cursor, sqlite3.connect """ self.cursor.execute('CREATE TABLE IF NOT EXISTS spikes (neuron INT UNSIGNED, time REAL)') tic = now() for f in glob.glob(re): print(f) while True: try: for data in self._blockread(f): self.cursor.executemany('INSERT INTO spikes VALUES (?, ?)', data) self.conn.commit() except: continue break toc = now() if self.debug: print('Inserts took %g seconds.' % (toc-tic)) # Optionally, create index for speed if index: tic = now() self.cursor.execute('CREATE INDEX neuron_index on spikes (neuron)') toc = now() if self.debug: print('Indexed db in %g seconds.' % (toc-tic))
python
def create(self, re='brunel-py-ex-*.gdf', index=True): """ Create db from list of gdf file glob Parameters ---------- re : str File glob to load. index : bool Create index on neurons for speed. Returns ------- None See also -------- sqlite3.connect.cursor, sqlite3.connect """ self.cursor.execute('CREATE TABLE IF NOT EXISTS spikes (neuron INT UNSIGNED, time REAL)') tic = now() for f in glob.glob(re): print(f) while True: try: for data in self._blockread(f): self.cursor.executemany('INSERT INTO spikes VALUES (?, ?)', data) self.conn.commit() except: continue break toc = now() if self.debug: print('Inserts took %g seconds.' % (toc-tic)) # Optionally, create index for speed if index: tic = now() self.cursor.execute('CREATE INDEX neuron_index on spikes (neuron)') toc = now() if self.debug: print('Indexed db in %g seconds.' % (toc-tic))
[ "def", "create", "(", "self", ",", "re", "=", "'brunel-py-ex-*.gdf'", ",", "index", "=", "True", ")", ":", "self", ".", "cursor", ".", "execute", "(", "'CREATE TABLE IF NOT EXISTS spikes (neuron INT UNSIGNED, time REAL)'", ")", "tic", "=", "now", "(", ")", "for", "f", "in", "glob", ".", "glob", "(", "re", ")", ":", "print", "(", "f", ")", "while", "True", ":", "try", ":", "for", "data", "in", "self", ".", "_blockread", "(", "f", ")", ":", "self", ".", "cursor", ".", "executemany", "(", "'INSERT INTO spikes VALUES (?, ?)'", ",", "data", ")", "self", ".", "conn", ".", "commit", "(", ")", "except", ":", "continue", "break", "toc", "=", "now", "(", ")", "if", "self", ".", "debug", ":", "print", "(", "'Inserts took %g seconds.'", "%", "(", "toc", "-", "tic", ")", ")", "# Optionally, create index for speed", "if", "index", ":", "tic", "=", "now", "(", ")", "self", ".", "cursor", ".", "execute", "(", "'CREATE INDEX neuron_index on spikes (neuron)'", ")", "toc", "=", "now", "(", ")", "if", "self", ".", "debug", ":", "print", "(", "'Indexed db in %g seconds.'", "%", "(", "toc", "-", "tic", ")", ")" ]
Create db from list of gdf file glob Parameters ---------- re : str File glob to load. index : bool Create index on neurons for speed. Returns ------- None See also -------- sqlite3.connect.cursor, sqlite3.connect
[ "Create", "db", "from", "list", "of", "gdf", "file", "glob" ]
train
https://github.com/INM-6/hybridLFPy/blob/c38bdf38982c4624c2f70caeb50c40f1d5980abd/hybridLFPy/gdf.py#L133-L178
<|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: Create db from list of gdf file glob Parameters ---------- re : str File glob to load. index : bool Create index on neurons for speed. Returns ------- None See also -------- sqlite3.connect.cursor, sqlite3.connect ### Response: def create(self, re='brunel-py-ex-*.gdf', index=True): """ Create db from list of gdf file glob Parameters ---------- re : str File glob to load. index : bool Create index on neurons for speed. Returns ------- None See also -------- sqlite3.connect.cursor, sqlite3.connect """ self.cursor.execute('CREATE TABLE IF NOT EXISTS spikes (neuron INT UNSIGNED, time REAL)') tic = now() for f in glob.glob(re): print(f) while True: try: for data in self._blockread(f): self.cursor.executemany('INSERT INTO spikes VALUES (?, ?)', data) self.conn.commit() except: continue break toc = now() if self.debug: print('Inserts took %g seconds.' % (toc-tic)) # Optionally, create index for speed if index: tic = now() self.cursor.execute('CREATE INDEX neuron_index on spikes (neuron)') toc = now() if self.debug: print('Indexed db in %g seconds.' % (toc-tic)) <|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, 4110, 3000, 505, 1160, 315, 342, 3013, 1052, 13509, 1432, 286, 13831, 198, 286, 31423, 286, 312, 551, 610, 198, 310, 2958, 13509, 311, 2865, 627, 286, 1963, 551, 1845, 198, 310, 4324, 1963, 389, 34313, 369, 4732, 627, 10912, 1827, 286, 5295, 198, 286, 39707, 286, 2290, 80233, 286, 3580, 1101, 198, 286, 90238, 286, 22775, 18, 11034, 21361, 11, 22775, 18, 11034, 271, 14711, 6075, 512, 755, 1893, 1214, 11, 312, 1151, 1347, 359, 301, 2320, 88, 10397, 12, 20517, 70, 3013, 518, 1963, 3702, 997, 286, 3270, 286, 4324, 3000, 505, 1160, 315, 342, 3013, 1052, 13509, 1432, 286, 13831, 198, 286, 31423, 286, 312, 551, 610, 198, 310, 2958, 13509, 311, 2865, 627, 286, 1963, 551, 1845, 198, 310, 4324, 1963, 389, 34313, 369, 4732, 627, 10912, 1827, 286, 5295, 198, 286, 39707, 286, 2290, 80233, 286, 3580, 1101, 198, 286, 90238, 286, 22775, 18, 11034, 21361, 11, 22775, 18, 11034, 9122, 286, 3270, 286, 659, 21361, 7925, 493, 23421, 14700, 11812, 4276, 35939, 51760, 320, 818, 37190, 9403, 95278, 11, 892, 26339, 8, 4713, 286, 62547, 284, 1457, 746, 286, 369, 282, 304, 13509, 45471, 5921, 997, 310, 1194, 968, 340, 310, 1418, 3082, 512, 394, 1456, 512, 504, 369, 828, 304, 659, 1462, 4677, 888, 968, 997, 667, 659, 21361, 16153, 332, 336, 3852, 493, 12987, 12779, 51760, 15052, 65085, 949, 19255, 828, 340, 667, 659, 23656, 16105, 746, 394, 3734, 512, 504, 3136, 198, 394, 1464, 72348, 286, 55961, 284, 1457, 746, 286, 422, 659, 8042, 25, 1194, 493, 14099, 82, 3952, 1034, 70, 6622, 3238, 1034, 320, 55880, 2442, 292, 4489, 286, 674, 97295, 11, 1893, 1963, 369, 4732, 198, 286, 422, 1963, 512, 310, 62547, 284, 1457, 746, 310, 659, 21361, 7925, 493, 23421, 40400, 49384, 3644, 389, 51760, 320, 818, 37190, 34113, 310, 55961, 284, 1457, 746, 310, 422, 659, 8042, 25, 1194, 493, 71041, 3000, 304, 1034, 70, 6622, 3238, 1034, 320, 55880, 2442, 292, 1192, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 4110, 3000, 505, 1160, 315, 342, 3013, 1052, 13509, 1432, 286, 13831, 198, 286, 31423, 286, 312, 551, 610, 198, 310, 2958, 13509, 311, 2865, 627, 286, 1963, 551, 1845, 198, 310, 4324, 1963, 389, 34313, 369, 4732, 627, 10912, 1827, 286, 5295, 198, 286, 39707, 286, 2290, 80233, 286, 3580, 1101, 198, 286, 90238, 286, 22775, 18, 11034, 21361, 11, 22775, 18, 11034, 271, 14711, 6075, 512, 755, 1893, 1214, 11, 312, 1151, 1347, 359, 301, 2320, 88, 10397, 12, 20517, 70, 3013, 518, 1963, 3702, 997, 286, 3270, 286, 4324, 3000, 505, 1160, 315, 342, 3013, 1052, 13509, 1432, 286, 13831, 198, 286, 31423, 286, 312, 551, 610, 198, 310, 2958, 13509, 311, 2865, 627, 286, 1963, 551, 1845, 198, 310, 4324, 1963, 389, 34313, 369, 4732, 627, 10912, 1827, 286, 5295, 198, 286, 39707, 286, 2290, 80233, 286, 3580, 1101, 198, 286, 90238, 286, 22775, 18, 11034, 21361, 11, 22775, 18, 11034, 9122, 286, 3270, 286, 659, 21361, 7925, 493, 23421, 14700, 11812, 4276, 35939, 51760, 320, 818, 37190, 9403, 95278, 11, 892, 26339, 8, 4713, 286, 62547, 284, 1457, 746, 286, 369, 282, 304, 13509, 45471, 5921, 997, 310, 1194, 968, 340, 310, 1418, 3082, 512, 394, 1456, 512, 504, 369, 828, 304, 659, 1462, 4677, 888, 968, 997, 667, 659, 21361, 16153, 332, 336, 3852, 493, 12987, 12779, 51760, 15052, 65085, 949, 19255, 828, 340, 667, 659, 23656, 16105, 746, 394, 3734, 512, 504, 3136, 198, 394, 1464, 72348, 286, 55961, 284, 1457, 746, 286, 422, 659, 8042, 25, 1194, 493, 14099, 82, 3952, 1034, 70, 6622, 3238, 1034, 320, 55880, 2442, 292, 4489, 286, 674, 97295, 11, 1893, 1963, 369, 4732, 198, 286, 422, 1963, 512, 310, 62547, 284, 1457, 746, 310, 659, 21361, 7925, 493, 23421, 40400, 49384, 3644, 389, 51760, 320, 818, 37190, 34113, 310, 55961, 284, 1457, 746, 310, 422, 659, 8042, 25, 1194, 493, 71041, 3000, 304, 1034, 70, 6622, 3238, 1034, 320, 55880, 2442, 292, 1192, 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 ]
Esri/ArcREST
src/arcrest/ags/layer.py
FeatureLayer_Depricated._chunks
def _chunks(self, l, n): """ Yield n successive chunks from a list l. """ l.sort() newn = int(1.0 * len(l) / n + 0.5) for i in range(0, n-1): yield l[i*newn:i*newn+newn] yield l[n*newn-newn:]
python
def _chunks(self, l, n): """ Yield n successive chunks from a list l. """ l.sort() newn = int(1.0 * len(l) / n + 0.5) for i in range(0, n-1): yield l[i*newn:i*newn+newn] yield l[n*newn-newn:]
[ "def", "_chunks", "(", "self", ",", "l", ",", "n", ")", ":", "l", ".", "sort", "(", ")", "newn", "=", "int", "(", "1.0", "*", "len", "(", "l", ")", "/", "n", "+", "0.5", ")", "for", "i", "in", "range", "(", "0", ",", "n", "-", "1", ")", ":", "yield", "l", "[", "i", "*", "newn", ":", "i", "*", "newn", "+", "newn", "]", "yield", "l", "[", "n", "*", "newn", "-", "newn", ":", "]" ]
Yield n successive chunks from a list l.
[ "Yield", "n", "successive", "chunks", "from", "a", "list", "l", "." ]
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/layer.py#L512-L519
<|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: Yield n successive chunks from a list l. ### Response: def _chunks(self, l, n): """ Yield n successive chunks from a list l. """ l.sort() newn = int(1.0 * len(l) / n + 0.5) for i in range(0, n-1): yield l[i*newn:i*newn+newn] yield l[n*newn-newn:] <|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, 56, 823, 308, 50024, 27855, 505, 264, 1160, 326, 382, 14711, 6075, 512, 755, 721, 85363, 1214, 11, 326, 11, 308, 997, 286, 4304, 78478, 308, 50024, 27855, 505, 264, 1160, 326, 627, 286, 3270, 286, 326, 10838, 746, 286, 502, 77, 284, 528, 7, 16, 13, 15, 353, 2479, 2387, 8, 611, 308, 489, 220, 15, 13, 20, 340, 286, 369, 602, 304, 2134, 7, 15, 11, 308, 12, 16, 997, 310, 7692, 326, 1004, 9, 943, 77, 15007, 9, 943, 77, 10, 943, 77, 933, 286, 7692, 326, 7824, 9, 943, 77, 23065, 77, 25106, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 56, 823, 308, 50024, 27855, 505, 264, 1160, 326, 382, 14711, 6075, 512, 755, 721, 85363, 1214, 11, 326, 11, 308, 997, 286, 4304, 78478, 308, 50024, 27855, 505, 264, 1160, 326, 627, 286, 3270, 286, 326, 10838, 746, 286, 502, 77, 284, 528, 7, 16, 13, 15, 353, 2479, 2387, 8, 611, 308, 489, 220, 15, 13, 20, 340, 286, 369, 602, 304, 2134, 7, 15, 11, 308, 12, 16, 997, 310, 7692, 326, 1004, 9, 943, 77, 15007, 9, 943, 77, 10, 943, 77, 933, 286, 7692, 326, 7824, 9, 943, 77, 23065, 77, 25106, 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 ]
cs50/python-cs50
src/cs50/cs50.py
eprint
def eprint(*args, **kwargs): """ Print an error message to standard error, prefixing it with file name and line number from which method was called. """ end = kwargs.get("end", "\n") sep = kwargs.get("sep", " ") (filename, lineno) = inspect.stack()[1][1:3] print("{}:{}: ".format(filename, lineno), end="") print(*args, end=end, file=sys.stderr, sep=sep)
python
def eprint(*args, **kwargs): """ Print an error message to standard error, prefixing it with file name and line number from which method was called. """ end = kwargs.get("end", "\n") sep = kwargs.get("sep", " ") (filename, lineno) = inspect.stack()[1][1:3] print("{}:{}: ".format(filename, lineno), end="") print(*args, end=end, file=sys.stderr, sep=sep)
[ "def", "eprint", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "end", "=", "kwargs", ".", "get", "(", "\"end\"", ",", "\"\\n\"", ")", "sep", "=", "kwargs", ".", "get", "(", "\"sep\"", ",", "\" \"", ")", "(", "filename", ",", "lineno", ")", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "1", ":", "3", "]", "print", "(", "\"{}:{}: \"", ".", "format", "(", "filename", ",", "lineno", ")", ",", "end", "=", "\"\"", ")", "print", "(", "*", "args", ",", "end", "=", "end", ",", "file", "=", "sys", ".", "stderr", ",", "sep", "=", "sep", ")" ]
Print an error message to standard error, prefixing it with file name and line number from which method was called.
[ "Print", "an", "error", "message", "to", "standard", "error", "prefixing", "it", "with", "file", "name", "and", "line", "number", "from", "which", "method", "was", "called", "." ]
train
https://github.com/cs50/python-cs50/blob/f987e9036bcf1bf60adf50a2827cc2cd5b9fd08a/src/cs50/cs50.py#L35-L44
<|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: Print an error message to standard error, prefixing it with file name and line number from which method was called. ### Response: def eprint(*args, **kwargs): """ Print an error message to standard error, prefixing it with file name and line number from which method was called. """ end = kwargs.get("end", "\n") sep = kwargs.get("sep", " ") (filename, lineno) = inspect.stack()[1][1:3] print("{}:{}: ".format(filename, lineno), end="") print(*args, end=end, file=sys.stderr, sep=sep) <|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, 9171, 459, 1493, 1984, 311, 5410, 1493, 11, 9436, 287, 433, 449, 198, 262, 1052, 836, 323, 1584, 1396, 505, 902, 1749, 574, 2663, 382, 14711, 6075, 512, 755, 384, 1374, 4163, 2164, 11, 3146, 9872, 997, 262, 3270, 262, 8377, 459, 1493, 1984, 311, 5410, 1493, 11, 9436, 287, 433, 449, 198, 262, 1052, 836, 323, 1584, 1396, 505, 902, 1749, 574, 2663, 627, 262, 3270, 262, 842, 284, 16901, 673, 446, 408, 498, 2990, 77, 1158, 262, 21693, 284, 16901, 673, 446, 29136, 498, 330, 14501, 262, 320, 8570, 11, 86195, 8, 284, 25052, 23228, 10324, 16, 1483, 16, 25, 18, 933, 262, 1194, 54530, 80511, 25, 6058, 2293, 11202, 11, 86195, 705, 842, 64841, 262, 1194, 4163, 2164, 11, 842, 62621, 11, 1052, 59970, 35842, 11, 21693, 28, 29136, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 9171, 459, 1493, 1984, 311, 5410, 1493, 11, 9436, 287, 433, 449, 198, 262, 1052, 836, 323, 1584, 1396, 505, 902, 1749, 574, 2663, 382, 14711, 6075, 512, 755, 384, 1374, 4163, 2164, 11, 3146, 9872, 997, 262, 3270, 262, 8377, 459, 1493, 1984, 311, 5410, 1493, 11, 9436, 287, 433, 449, 198, 262, 1052, 836, 323, 1584, 1396, 505, 902, 1749, 574, 2663, 627, 262, 3270, 262, 842, 284, 16901, 673, 446, 408, 498, 2990, 77, 1158, 262, 21693, 284, 16901, 673, 446, 29136, 498, 330, 14501, 262, 320, 8570, 11, 86195, 8, 284, 25052, 23228, 10324, 16, 1483, 16, 25, 18, 933, 262, 1194, 54530, 80511, 25, 6058, 2293, 11202, 11, 86195, 705, 842, 64841, 262, 1194, 4163, 2164, 11, 842, 62621, 11, 1052, 59970, 35842, 11, 21693, 28, 29136, 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 ]
pandas-dev/pandas
pandas/core/generic.py
NDFrame._reindex_axes
def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy): """Perform the reindex for all the axes.""" obj = self for a in self._AXIS_ORDERS: labels = axes[a] if labels is None: continue ax = self._get_axis(a) new_index, indexer = ax.reindex(labels, level=level, limit=limit, tolerance=tolerance, method=method) axis = self._get_axis_number(a) obj = obj._reindex_with_indexers({axis: [new_index, indexer]}, fill_value=fill_value, copy=copy, allow_dups=False) return obj
python
def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy): """Perform the reindex for all the axes.""" obj = self for a in self._AXIS_ORDERS: labels = axes[a] if labels is None: continue ax = self._get_axis(a) new_index, indexer = ax.reindex(labels, level=level, limit=limit, tolerance=tolerance, method=method) axis = self._get_axis_number(a) obj = obj._reindex_with_indexers({axis: [new_index, indexer]}, fill_value=fill_value, copy=copy, allow_dups=False) return obj
[ "def", "_reindex_axes", "(", "self", ",", "axes", ",", "level", ",", "limit", ",", "tolerance", ",", "method", ",", "fill_value", ",", "copy", ")", ":", "obj", "=", "self", "for", "a", "in", "self", ".", "_AXIS_ORDERS", ":", "labels", "=", "axes", "[", "a", "]", "if", "labels", "is", "None", ":", "continue", "ax", "=", "self", ".", "_get_axis", "(", "a", ")", "new_index", ",", "indexer", "=", "ax", ".", "reindex", "(", "labels", ",", "level", "=", "level", ",", "limit", "=", "limit", ",", "tolerance", "=", "tolerance", ",", "method", "=", "method", ")", "axis", "=", "self", ".", "_get_axis_number", "(", "a", ")", "obj", "=", "obj", ".", "_reindex_with_indexers", "(", "{", "axis", ":", "[", "new_index", ",", "indexer", "]", "}", ",", "fill_value", "=", "fill_value", ",", "copy", "=", "copy", ",", "allow_dups", "=", "False", ")", "return", "obj" ]
Perform the reindex for all the axes.
[ "Perform", "the", "reindex", "for", "all", "the", "axes", "." ]
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L4393-L4411
<|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: Perform the reindex for all the axes. ### Response: def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy): """Perform the reindex for all the axes.""" obj = self for a in self._AXIS_ORDERS: labels = axes[a] if labels is None: continue ax = self._get_axis(a) new_index, indexer = ax.reindex(labels, level=level, limit=limit, tolerance=tolerance, method=method) axis = self._get_axis_number(a) obj = obj._reindex_with_indexers({axis: [new_index, indexer]}, fill_value=fill_value, copy=copy, allow_dups=False) return obj <|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, 48051, 279, 312, 1275, 369, 682, 279, 25776, 382, 14711, 6075, 512, 755, 721, 265, 1275, 59494, 1214, 11, 25776, 11, 2237, 11, 4017, 11, 25065, 11, 1749, 11, 5266, 3220, 345, 2611, 3048, 997, 286, 4304, 48051, 279, 312, 1275, 369, 682, 279, 25776, 14781, 286, 2909, 284, 659, 198, 286, 369, 264, 304, 659, 1462, 3027, 1669, 86970, 4419, 512, 310, 9382, 284, 25776, 15848, 933, 310, 422, 9382, 374, 2290, 512, 394, 3136, 271, 310, 3944, 284, 659, 1462, 456, 24480, 2948, 340, 310, 502, 3644, 11, 88316, 284, 3944, 1351, 1275, 38015, 11, 2237, 28, 3374, 11, 4017, 28, 9696, 345, 3425, 25065, 28, 21220, 261, 685, 11, 1749, 28, 4492, 696, 310, 8183, 284, 659, 1462, 456, 24480, 5617, 2948, 340, 310, 2909, 284, 2909, 1462, 265, 1275, 6753, 3644, 388, 2358, 7332, 25, 510, 943, 3644, 11, 88316, 58452, 15791, 5266, 3220, 28, 7712, 3220, 345, 15791, 3048, 28, 8728, 11, 2187, 821, 8772, 5725, 696, 286, 471, 2909, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 48051, 279, 312, 1275, 369, 682, 279, 25776, 382, 14711, 6075, 512, 755, 721, 265, 1275, 59494, 1214, 11, 25776, 11, 2237, 11, 4017, 11, 25065, 11, 1749, 11, 5266, 3220, 345, 2611, 3048, 997, 286, 4304, 48051, 279, 312, 1275, 369, 682, 279, 25776, 14781, 286, 2909, 284, 659, 198, 286, 369, 264, 304, 659, 1462, 3027, 1669, 86970, 4419, 512, 310, 9382, 284, 25776, 15848, 933, 310, 422, 9382, 374, 2290, 512, 394, 3136, 271, 310, 3944, 284, 659, 1462, 456, 24480, 2948, 340, 310, 502, 3644, 11, 88316, 284, 3944, 1351, 1275, 38015, 11, 2237, 28, 3374, 11, 4017, 28, 9696, 345, 3425, 25065, 28, 21220, 261, 685, 11, 1749, 28, 4492, 696, 310, 8183, 284, 659, 1462, 456, 24480, 5617, 2948, 340, 310, 2909, 284, 2909, 1462, 265, 1275, 6753, 3644, 388, 2358, 7332, 25, 510, 943, 3644, 11, 88316, 58452, 15791, 5266, 3220, 28, 7712, 3220, 345, 15791, 3048, 28, 8728, 11, 2187, 821, 8772, 5725, 696, 286, 471, 2909, 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 ]
olt/corsa
corsa/app.py
parse_bind_address
def parse_bind_address(address, default=('localhost', 8080)): """ >>> parse_bind_address('80') ('localhost', 80) >>> parse_bind_address('0.0.0.0') ('0.0.0.0', 8080) >>> parse_bind_address('0.0.0.0:8081') ('0.0.0.0', 8081) """ if ':' in address: host, port = address.split(':', 1) port = int(port) elif re.match('^\d+$', address): host = default[0] port = int(address) else: host = address port = default[1] return host, port
python
def parse_bind_address(address, default=('localhost', 8080)): """ >>> parse_bind_address('80') ('localhost', 80) >>> parse_bind_address('0.0.0.0') ('0.0.0.0', 8080) >>> parse_bind_address('0.0.0.0:8081') ('0.0.0.0', 8081) """ if ':' in address: host, port = address.split(':', 1) port = int(port) elif re.match('^\d+$', address): host = default[0] port = int(address) else: host = address port = default[1] return host, port
[ "def", "parse_bind_address", "(", "address", ",", "default", "=", "(", "'localhost'", ",", "8080", ")", ")", ":", "if", "':'", "in", "address", ":", "host", ",", "port", "=", "address", ".", "split", "(", "':'", ",", "1", ")", "port", "=", "int", "(", "port", ")", "elif", "re", ".", "match", "(", "'^\\d+$'", ",", "address", ")", ":", "host", "=", "default", "[", "0", "]", "port", "=", "int", "(", "address", ")", "else", ":", "host", "=", "address", "port", "=", "default", "[", "1", "]", "return", "host", ",", "port" ]
>>> parse_bind_address('80') ('localhost', 80) >>> parse_bind_address('0.0.0.0') ('0.0.0.0', 8080) >>> parse_bind_address('0.0.0.0:8081') ('0.0.0.0', 8081)
[ ">>>", "parse_bind_address", "(", "80", ")", "(", "localhost", "80", ")", ">>>", "parse_bind_address", "(", "0", ".", "0", ".", "0", ".", "0", ")", "(", "0", ".", "0", ".", "0", ".", "0", "8080", ")", ">>>", "parse_bind_address", "(", "0", ".", "0", ".", "0", ".", "0", ":", "8081", ")", "(", "0", ".", "0", ".", "0", ".", "0", "8081", ")" ]
train
https://github.com/olt/corsa/blob/05de0a95b14d7c07fd61109ba786474a8acca74d/corsa/app.py#L31-L49
<|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: >>> parse_bind_address('80') ('localhost', 80) >>> parse_bind_address('0.0.0.0') ('0.0.0.0', 8080) >>> parse_bind_address('0.0.0.0:8081') ('0.0.0.0', 8081) ### Response: def parse_bind_address(address, default=('localhost', 8080)): """ >>> parse_bind_address('80') ('localhost', 80) >>> parse_bind_address('0.0.0.0') ('0.0.0.0', 8080) >>> parse_bind_address('0.0.0.0:8081') ('0.0.0.0', 8081) """ if ':' in address: host, port = address.split(':', 1) port = int(port) elif re.match('^\d+$', address): host = default[0] port = int(address) else: host = address port = default[1] return host, 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, 20761, 4820, 28561, 6886, 493, 1490, 1329, 262, 4417, 8465, 518, 220, 1490, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 15, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 25, 11770, 16, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 16, 696, 14711, 6075, 512, 755, 4820, 28561, 6886, 15797, 11, 1670, 47355, 8465, 518, 220, 11770, 15, 10162, 262, 3270, 262, 12382, 4820, 28561, 6886, 493, 1490, 1329, 262, 4417, 8465, 518, 220, 1490, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 15, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 25, 11770, 16, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 16, 340, 262, 3270, 262, 422, 37404, 304, 2686, 512, 286, 3552, 11, 2700, 284, 2686, 5402, 97680, 220, 16, 340, 286, 2700, 284, 528, 21924, 340, 262, 4508, 312, 11319, 493, 25928, 67, 32819, 518, 2686, 997, 286, 3552, 284, 1670, 58, 15, 933, 286, 2700, 284, 528, 15797, 340, 262, 775, 512, 286, 3552, 284, 2686, 198, 286, 2700, 284, 1670, 58, 16, 933, 262, 471, 3552, 11, 2700, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 20761, 4820, 28561, 6886, 493, 1490, 1329, 262, 4417, 8465, 518, 220, 1490, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 15, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 25, 11770, 16, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 16, 696, 14711, 6075, 512, 755, 4820, 28561, 6886, 15797, 11, 1670, 47355, 8465, 518, 220, 11770, 15, 10162, 262, 3270, 262, 12382, 4820, 28561, 6886, 493, 1490, 1329, 262, 4417, 8465, 518, 220, 1490, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 15, 340, 262, 12382, 4820, 28561, 6886, 493, 15, 13, 15, 13, 15, 13, 15, 25, 11770, 16, 1329, 262, 4417, 15, 13, 15, 13, 15, 13, 15, 518, 220, 11770, 16, 340, 262, 3270, 262, 422, 37404, 304, 2686, 512, 286, 3552, 11, 2700, 284, 2686, 5402, 97680, 220, 16, 340, 286, 2700, 284, 528, 21924, 340, 262, 4508, 312, 11319, 493, 25928, 67, 32819, 518, 2686, 997, 286, 3552, 284, 1670, 58, 15, 933, 286, 2700, 284, 528, 15797, 340, 262, 775, 512, 286, 3552, 284, 2686, 198, 286, 2700, 284, 1670, 58, 16, 933, 262, 471, 3552, 11, 2700, 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 ]
a1ezzz/wasp-general
wasp_general/task/thread_tracker.py
WSimpleTrackerStorage.register_start
def register_start(self, task, event_details=None): """ :meth:`.WSimpleTrackerStorage.register_start` method implementation """ if self.record_start() is True: record_type = WTrackerEvents.start record = WSimpleTrackerStorage.Record(record_type, task, event_details=event_details) self.__store_record(record)
python
def register_start(self, task, event_details=None): """ :meth:`.WSimpleTrackerStorage.register_start` method implementation """ if self.record_start() is True: record_type = WTrackerEvents.start record = WSimpleTrackerStorage.Record(record_type, task, event_details=event_details) self.__store_record(record)
[ "def", "register_start", "(", "self", ",", "task", ",", "event_details", "=", "None", ")", ":", "if", "self", ".", "record_start", "(", ")", "is", "True", ":", "record_type", "=", "WTrackerEvents", ".", "start", "record", "=", "WSimpleTrackerStorage", ".", "Record", "(", "record_type", ",", "task", ",", "event_details", "=", "event_details", ")", "self", ".", "__store_record", "(", "record", ")" ]
:meth:`.WSimpleTrackerStorage.register_start` method implementation
[ ":", "meth", ":", ".", "WSimpleTrackerStorage", ".", "register_start", "method", "implementation" ]
train
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/thread_tracker.py#L406-L412
<|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: :meth:`.WSimpleTrackerStorage.register_start` method implementation ### Response: def register_start(self, task, event_details=None): """ :meth:`.WSimpleTrackerStorage.register_start` method implementation """ if self.record_start() is True: record_type = WTrackerEvents.start record = WSimpleTrackerStorage.Record(record_type, task, event_details=event_details) self.__store_record(record) <|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, 31386, 774, 19258, 13, 7585, 6592, 32233, 5913, 10131, 5011, 63, 1749, 8292, 271, 14711, 6075, 512, 755, 4254, 5011, 1214, 11, 3465, 11, 1567, 13563, 5980, 997, 197, 197, 12885, 551, 69991, 19258, 13, 7585, 6592, 32233, 5913, 10131, 5011, 63, 1749, 8292, 198, 197, 197, 7275, 197, 748, 659, 33124, 5011, 368, 374, 3082, 512, 298, 73052, 1857, 284, 468, 32233, 8059, 5069, 198, 298, 73052, 284, 468, 16778, 32233, 5913, 51059, 24728, 1857, 11, 3465, 11, 1567, 13563, 96360, 13563, 340, 298, 5311, 4952, 4412, 14526, 24728, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 31386, 774, 19258, 13, 7585, 6592, 32233, 5913, 10131, 5011, 63, 1749, 8292, 271, 14711, 6075, 512, 755, 4254, 5011, 1214, 11, 3465, 11, 1567, 13563, 5980, 997, 197, 197, 12885, 551, 69991, 19258, 13, 7585, 6592, 32233, 5913, 10131, 5011, 63, 1749, 8292, 198, 197, 197, 7275, 197, 748, 659, 33124, 5011, 368, 374, 3082, 512, 298, 73052, 1857, 284, 468, 32233, 8059, 5069, 198, 298, 73052, 284, 468, 16778, 32233, 5913, 51059, 24728, 1857, 11, 3465, 11, 1567, 13563, 96360, 13563, 340, 298, 5311, 4952, 4412, 14526, 24728, 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 ]
ryanmcgrath/twython
twython/streaming/types.py
TwythonStreamerTypes.site
def site(self, **params): """Stream site Accepted params found at: https://dev.twitter.com/docs/api/1.1/get/site """ url = 'https://sitestream.twitter.com/%s/site.json' \ % self.streamer.api_version self.streamer._request(url, params=params)
python
def site(self, **params): """Stream site Accepted params found at: https://dev.twitter.com/docs/api/1.1/get/site """ url = 'https://sitestream.twitter.com/%s/site.json' \ % self.streamer.api_version self.streamer._request(url, params=params)
[ "def", "site", "(", "self", ",", "*", "*", "params", ")", ":", "url", "=", "'https://sitestream.twitter.com/%s/site.json'", "%", "self", ".", "streamer", ".", "api_version", "self", ".", "streamer", ".", "_request", "(", "url", ",", "params", "=", "params", ")" ]
Stream site Accepted params found at: https://dev.twitter.com/docs/api/1.1/get/site
[ "Stream", "site" ]
train
https://github.com/ryanmcgrath/twython/blob/7366de80efcbbdfaf615d3f1fea72546196916fc/twython/streaming/types.py#L33-L41
<|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: Stream site Accepted params found at: https://dev.twitter.com/docs/api/1.1/get/site ### Response: def site(self, **params): """Stream site Accepted params found at: https://dev.twitter.com/docs/api/1.1/get/site """ url = 'https://sitestream.twitter.com/%s/site.json' \ % self.streamer.api_version self.streamer._request(url, params=params) <|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, 3103, 2816, 271, 286, 64389, 3712, 1766, 520, 512, 286, 3788, 1129, 3667, 16535, 916, 27057, 10729, 14, 16, 13, 16, 24183, 48981, 271, 14711, 6075, 512, 755, 2816, 1214, 11, 3146, 3603, 997, 286, 4304, 3103, 2816, 271, 286, 64389, 3712, 1766, 520, 512, 286, 3788, 1129, 3667, 16535, 916, 27057, 10729, 14, 16, 13, 16, 24183, 48981, 198, 286, 3270, 286, 2576, 284, 364, 2485, 1129, 47965, 478, 1259, 16535, 916, 12915, 82, 48981, 4421, 6, 3120, 1078, 1034, 659, 15307, 261, 6314, 9625, 198, 286, 659, 15307, 261, 1462, 2079, 6659, 11, 3712, 58743, 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 ]
[ 1, 1, 1, 1, 1, 1, 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, 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, 3103, 2816, 271, 286, 64389, 3712, 1766, 520, 512, 286, 3788, 1129, 3667, 16535, 916, 27057, 10729, 14, 16, 13, 16, 24183, 48981, 271, 14711, 6075, 512, 755, 2816, 1214, 11, 3146, 3603, 997, 286, 4304, 3103, 2816, 271, 286, 64389, 3712, 1766, 520, 512, 286, 3788, 1129, 3667, 16535, 916, 27057, 10729, 14, 16, 13, 16, 24183, 48981, 198, 286, 3270, 286, 2576, 284, 364, 2485, 1129, 47965, 478, 1259, 16535, 916, 12915, 82, 48981, 4421, 6, 3120, 1078, 1034, 659, 15307, 261, 6314, 9625, 198, 286, 659, 15307, 261, 1462, 2079, 6659, 11, 3712, 58743, 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 ]
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_firmware.py
brocade_firmware.logical_chassis_fwdl_sanity_output_cluster_output_rbridge_id
def logical_chassis_fwdl_sanity_output_cluster_output_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") logical_chassis_fwdl_sanity = ET.Element("logical_chassis_fwdl_sanity") config = logical_chassis_fwdl_sanity output = ET.SubElement(logical_chassis_fwdl_sanity, "output") cluster_output = ET.SubElement(output, "cluster-output") rbridge_id = ET.SubElement(cluster_output, "rbridge-id") rbridge_id.text = kwargs.pop('rbridge_id') callback = kwargs.pop('callback', self._callback) return callback(config)
python
def logical_chassis_fwdl_sanity_output_cluster_output_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") logical_chassis_fwdl_sanity = ET.Element("logical_chassis_fwdl_sanity") config = logical_chassis_fwdl_sanity output = ET.SubElement(logical_chassis_fwdl_sanity, "output") cluster_output = ET.SubElement(output, "cluster-output") rbridge_id = ET.SubElement(cluster_output, "rbridge-id") rbridge_id.text = kwargs.pop('rbridge_id') callback = kwargs.pop('callback', self._callback) return callback(config)
[ "def", "logical_chassis_fwdl_sanity_output_cluster_output_rbridge_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "logical_chassis_fwdl_sanity", "=", "ET", ".", "Element", "(", "\"logical_chassis_fwdl_sanity\"", ")", "config", "=", "logical_chassis_fwdl_sanity", "output", "=", "ET", ".", "SubElement", "(", "logical_chassis_fwdl_sanity", ",", "\"output\"", ")", "cluster_output", "=", "ET", ".", "SubElement", "(", "output", ",", "\"cluster-output\"", ")", "rbridge_id", "=", "ET", ".", "SubElement", "(", "cluster_output", ",", "\"rbridge-id\"", ")", "rbridge_id", ".", "text", "=", "kwargs", ".", "pop", "(", "'rbridge_id'", ")", "callback", "=", "kwargs", ".", "pop", "(", "'callback'", ",", "self", ".", "_callback", ")", "return", "callback", "(", "config", ")" ]
Auto Generated Code
[ "Auto", "Generated", "Code" ]
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_firmware.py#L785-L797
<|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: Auto Generated Code ### Response: def logical_chassis_fwdl_sanity_output_cluster_output_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") logical_chassis_fwdl_sanity = ET.Element("logical_chassis_fwdl_sanity") config = logical_chassis_fwdl_sanity output = ET.SubElement(logical_chassis_fwdl_sanity, "output") cluster_output = ET.SubElement(output, "cluster-output") rbridge_id = ET.SubElement(cluster_output, "rbridge-id") rbridge_id.text = kwargs.pop('rbridge_id') callback = kwargs.pop('callback', self._callback) return callback(config) <|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, 13556, 31588, 6247, 271, 14711, 6075, 512, 755, 20406, 4231, 33567, 82183, 75, 646, 39370, 7800, 29541, 7800, 1745, 14024, 851, 1214, 11, 3146, 9872, 997, 286, 4304, 13556, 31588, 6247, 198, 286, 3270, 286, 2242, 284, 18241, 20743, 446, 1710, 1158, 286, 20406, 4231, 33567, 82183, 75, 646, 39370, 284, 18241, 20743, 446, 31356, 4231, 33567, 82183, 75, 646, 39370, 1158, 286, 2242, 284, 20406, 4231, 33567, 82183, 75, 646, 39370, 198, 286, 2612, 284, 18241, 93442, 12814, 950, 4231, 33567, 82183, 75, 646, 39370, 11, 330, 3081, 1158, 286, 10879, 7800, 284, 18241, 93442, 11304, 11, 330, 19386, 60624, 1158, 286, 436, 14024, 851, 284, 18241, 93442, 49130, 7800, 11, 330, 81, 14024, 13193, 1158, 286, 436, 14024, 851, 2858, 284, 16901, 8452, 493, 81, 14024, 851, 4713, 286, 4927, 284, 16901, 8452, 493, 13802, 518, 659, 1462, 13802, 340, 286, 471, 4927, 8928, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 13556, 31588, 6247, 271, 14711, 6075, 512, 755, 20406, 4231, 33567, 82183, 75, 646, 39370, 7800, 29541, 7800, 1745, 14024, 851, 1214, 11, 3146, 9872, 997, 286, 4304, 13556, 31588, 6247, 198, 286, 3270, 286, 2242, 284, 18241, 20743, 446, 1710, 1158, 286, 20406, 4231, 33567, 82183, 75, 646, 39370, 284, 18241, 20743, 446, 31356, 4231, 33567, 82183, 75, 646, 39370, 1158, 286, 2242, 284, 20406, 4231, 33567, 82183, 75, 646, 39370, 198, 286, 2612, 284, 18241, 93442, 12814, 950, 4231, 33567, 82183, 75, 646, 39370, 11, 330, 3081, 1158, 286, 10879, 7800, 284, 18241, 93442, 11304, 11, 330, 19386, 60624, 1158, 286, 436, 14024, 851, 284, 18241, 93442, 49130, 7800, 11, 330, 81, 14024, 13193, 1158, 286, 436, 14024, 851, 2858, 284, 16901, 8452, 493, 81, 14024, 851, 4713, 286, 4927, 284, 16901, 8452, 493, 13802, 518, 659, 1462, 13802, 340, 286, 471, 4927, 8928, 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 ]
eyurtsev/FlowCytometryTools
FlowCytometryTools/gui/fc_widget.py
BaseVertex.update_coordinates
def update_coordinates(self, new_coordinates): """ new_coordinates : dict """ for k, v in new_coordinates.items(): if k in self.coordinates: self.coordinates[k] = v for svertex in self.spawn_list: verts = tuple([self.coordinates.get(ch, None) for ch in svertex.channels]) if len(svertex.channels) == 1: # This means a histogram svertex.update_position(verts[0], None) else: svertex.update_position(verts[0], verts[1]) self.callback(Event(Event.BASE_GATE_CHANGED))
python
def update_coordinates(self, new_coordinates): """ new_coordinates : dict """ for k, v in new_coordinates.items(): if k in self.coordinates: self.coordinates[k] = v for svertex in self.spawn_list: verts = tuple([self.coordinates.get(ch, None) for ch in svertex.channels]) if len(svertex.channels) == 1: # This means a histogram svertex.update_position(verts[0], None) else: svertex.update_position(verts[0], verts[1]) self.callback(Event(Event.BASE_GATE_CHANGED))
[ "def", "update_coordinates", "(", "self", ",", "new_coordinates", ")", ":", "for", "k", ",", "v", "in", "new_coordinates", ".", "items", "(", ")", ":", "if", "k", "in", "self", ".", "coordinates", ":", "self", ".", "coordinates", "[", "k", "]", "=", "v", "for", "svertex", "in", "self", ".", "spawn_list", ":", "verts", "=", "tuple", "(", "[", "self", ".", "coordinates", ".", "get", "(", "ch", ",", "None", ")", "for", "ch", "in", "svertex", ".", "channels", "]", ")", "if", "len", "(", "svertex", ".", "channels", ")", "==", "1", ":", "# This means a histogram", "svertex", ".", "update_position", "(", "verts", "[", "0", "]", ",", "None", ")", "else", ":", "svertex", ".", "update_position", "(", "verts", "[", "0", "]", ",", "verts", "[", "1", "]", ")", "self", ".", "callback", "(", "Event", "(", "Event", ".", "BASE_GATE_CHANGED", ")", ")" ]
new_coordinates : dict
[ "new_coordinates", ":", "dict" ]
train
https://github.com/eyurtsev/FlowCytometryTools/blob/4355632508b875273d68c7e2972c17668bcf7b40/FlowCytometryTools/gui/fc_widget.py#L150-L165
<|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: new_coordinates : dict ### Response: def update_coordinates(self, new_coordinates): """ new_coordinates : dict """ for k, v in new_coordinates.items(): if k in self.coordinates: self.coordinates[k] = v for svertex in self.spawn_list: verts = tuple([self.coordinates.get(ch, None) for ch in svertex.channels]) if len(svertex.channels) == 1: # This means a histogram svertex.update_position(verts[0], None) else: svertex.update_position(verts[0], verts[1]) self.callback(Event(Event.BASE_GATE_CHANGED)) <|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, 943, 51184, 551, 6587, 271, 14711, 6075, 512, 755, 2713, 51184, 1214, 11, 502, 51184, 997, 286, 3270, 286, 502, 51184, 551, 6587, 198, 286, 3270, 286, 369, 597, 11, 348, 304, 502, 51184, 9812, 4019, 310, 422, 597, 304, 659, 65669, 512, 394, 659, 65669, 6874, 60, 284, 348, 271, 286, 369, 274, 12356, 304, 659, 60396, 2062, 512, 310, 60514, 284, 14743, 2625, 726, 65669, 673, 7672, 11, 2290, 8, 369, 523, 304, 274, 12356, 40995, 9801, 310, 422, 2479, 1161, 12356, 40995, 8, 624, 220, 16, 25, 220, 674, 1115, 3445, 264, 31381, 198, 394, 274, 12356, 5430, 9858, 7, 29263, 58, 15, 1145, 2290, 340, 310, 775, 512, 394, 274, 12356, 5430, 9858, 7, 29263, 58, 15, 1145, 60514, 58, 16, 2608, 286, 659, 28763, 31569, 31569, 35133, 82216, 49199, 1192, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 943, 51184, 551, 6587, 271, 14711, 6075, 512, 755, 2713, 51184, 1214, 11, 502, 51184, 997, 286, 3270, 286, 502, 51184, 551, 6587, 198, 286, 3270, 286, 369, 597, 11, 348, 304, 502, 51184, 9812, 4019, 310, 422, 597, 304, 659, 65669, 512, 394, 659, 65669, 6874, 60, 284, 348, 271, 286, 369, 274, 12356, 304, 659, 60396, 2062, 512, 310, 60514, 284, 14743, 2625, 726, 65669, 673, 7672, 11, 2290, 8, 369, 523, 304, 274, 12356, 40995, 9801, 310, 422, 2479, 1161, 12356, 40995, 8, 624, 220, 16, 25, 220, 674, 1115, 3445, 264, 31381, 198, 394, 274, 12356, 5430, 9858, 7, 29263, 58, 15, 1145, 2290, 340, 310, 775, 512, 394, 274, 12356, 5430, 9858, 7, 29263, 58, 15, 1145, 60514, 58, 16, 2608, 286, 659, 28763, 31569, 31569, 35133, 82216, 49199, 1192, 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 ]
dropbox/stone
stone/ir/api.py
ApiNamespace.get_namespaces_imported_by_route_io
def get_namespaces_imported_by_route_io(self): # type: () -> typing.List[ApiNamespace] """ Returns a list of Namespace objects. A namespace is a member of this list if it is imported by the current namespace and has a data type from it referenced as an argument, result, or error of a route. Namespaces are in ASCII order by name. """ namespace_data_types = sorted(self.get_route_io_data_types(), key=lambda dt: dt.name) referenced_namespaces = set() for data_type in namespace_data_types: if data_type.namespace != self: referenced_namespaces.add(data_type.namespace) return sorted(referenced_namespaces, key=lambda n: n.name)
python
def get_namespaces_imported_by_route_io(self): # type: () -> typing.List[ApiNamespace] """ Returns a list of Namespace objects. A namespace is a member of this list if it is imported by the current namespace and has a data type from it referenced as an argument, result, or error of a route. Namespaces are in ASCII order by name. """ namespace_data_types = sorted(self.get_route_io_data_types(), key=lambda dt: dt.name) referenced_namespaces = set() for data_type in namespace_data_types: if data_type.namespace != self: referenced_namespaces.add(data_type.namespace) return sorted(referenced_namespaces, key=lambda n: n.name)
[ "def", "get_namespaces_imported_by_route_io", "(", "self", ")", ":", "# type: () -> typing.List[ApiNamespace]", "namespace_data_types", "=", "sorted", "(", "self", ".", "get_route_io_data_types", "(", ")", ",", "key", "=", "lambda", "dt", ":", "dt", ".", "name", ")", "referenced_namespaces", "=", "set", "(", ")", "for", "data_type", "in", "namespace_data_types", ":", "if", "data_type", ".", "namespace", "!=", "self", ":", "referenced_namespaces", ".", "add", "(", "data_type", ".", "namespace", ")", "return", "sorted", "(", "referenced_namespaces", ",", "key", "=", "lambda", "n", ":", "n", ".", "name", ")" ]
Returns a list of Namespace objects. A namespace is a member of this list if it is imported by the current namespace and has a data type from it referenced as an argument, result, or error of a route. Namespaces are in ASCII order by name.
[ "Returns", "a", "list", "of", "Namespace", "objects", ".", "A", "namespace", "is", "a", "member", "of", "this", "list", "if", "it", "is", "imported", "by", "the", "current", "namespace", "and", "has", "a", "data", "type", "from", "it", "referenced", "as", "an", "argument", "result", "or", "error", "of", "a", "route", ".", "Namespaces", "are", "in", "ASCII", "order", "by", "name", "." ]
train
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/ir/api.py#L323-L337
<|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 a list of Namespace objects. A namespace is a member of this list if it is imported by the current namespace and has a data type from it referenced as an argument, result, or error of a route. Namespaces are in ASCII order by name. ### Response: def get_namespaces_imported_by_route_io(self): # type: () -> typing.List[ApiNamespace] """ Returns a list of Namespace objects. A namespace is a member of this list if it is imported by the current namespace and has a data type from it referenced as an argument, result, or error of a route. Namespaces are in ASCII order by name. """ namespace_data_types = sorted(self.get_route_io_data_types(), key=lambda dt: dt.name) referenced_namespaces = set() for data_type in namespace_data_types: if data_type.namespace != self: referenced_namespaces.add(data_type.namespace) return sorted(referenced_namespaces, key=lambda n: n.name) <|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, 264, 1160, 315, 43062, 6302, 13, 362, 4573, 374, 264, 4562, 315, 420, 198, 286, 1160, 422, 433, 374, 25973, 555, 279, 1510, 4573, 323, 706, 264, 828, 955, 198, 286, 505, 433, 25819, 439, 459, 5811, 11, 1121, 11, 477, 1493, 315, 264, 6149, 627, 286, 35975, 28438, 527, 304, 40416, 2015, 555, 836, 382, 14711, 6075, 512, 755, 636, 9366, 28438, 18941, 291, 3795, 29209, 17369, 1214, 997, 286, 674, 955, 25, 1754, 1492, 20061, 5937, 58, 6700, 23533, 933, 286, 3270, 286, 5295, 264, 1160, 315, 43062, 6302, 13, 362, 4573, 374, 264, 4562, 315, 420, 198, 286, 1160, 422, 433, 374, 25973, 555, 279, 1510, 4573, 323, 706, 264, 828, 955, 198, 286, 505, 433, 25819, 439, 459, 5811, 11, 1121, 11, 477, 1493, 315, 264, 6149, 627, 286, 35975, 28438, 527, 304, 40416, 2015, 555, 836, 627, 286, 3270, 286, 4573, 1807, 9962, 284, 10839, 1214, 673, 29209, 17369, 1807, 9962, 3227, 8497, 1401, 28604, 7748, 25, 7748, 2710, 340, 286, 25819, 9366, 28438, 284, 743, 746, 286, 369, 828, 1857, 304, 4573, 1807, 9962, 512, 310, 422, 828, 1857, 51509, 976, 659, 512, 394, 25819, 9366, 28438, 1388, 2657, 1857, 51509, 340, 286, 471, 10839, 5921, 809, 5886, 9366, 28438, 11, 1401, 28604, 308, 25, 308, 2710, 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,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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 ]
[ 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, 264, 1160, 315, 43062, 6302, 13, 362, 4573, 374, 264, 4562, 315, 420, 198, 286, 1160, 422, 433, 374, 25973, 555, 279, 1510, 4573, 323, 706, 264, 828, 955, 198, 286, 505, 433, 25819, 439, 459, 5811, 11, 1121, 11, 477, 1493, 315, 264, 6149, 627, 286, 35975, 28438, 527, 304, 40416, 2015, 555, 836, 382, 14711, 6075, 512, 755, 636, 9366, 28438, 18941, 291, 3795, 29209, 17369, 1214, 997, 286, 674, 955, 25, 1754, 1492, 20061, 5937, 58, 6700, 23533, 933, 286, 3270, 286, 5295, 264, 1160, 315, 43062, 6302, 13, 362, 4573, 374, 264, 4562, 315, 420, 198, 286, 1160, 422, 433, 374, 25973, 555, 279, 1510, 4573, 323, 706, 264, 828, 955, 198, 286, 505, 433, 25819, 439, 459, 5811, 11, 1121, 11, 477, 1493, 315, 264, 6149, 627, 286, 35975, 28438, 527, 304, 40416, 2015, 555, 836, 627, 286, 3270, 286, 4573, 1807, 9962, 284, 10839, 1214, 673, 29209, 17369, 1807, 9962, 3227, 8497, 1401, 28604, 7748, 25, 7748, 2710, 340, 286, 25819, 9366, 28438, 284, 743, 746, 286, 369, 828, 1857, 304, 4573, 1807, 9962, 512, 310, 422, 828, 1857, 51509, 976, 659, 512, 394, 25819, 9366, 28438, 1388, 2657, 1857, 51509, 340, 286, 471, 10839, 5921, 809, 5886, 9366, 28438, 11, 1401, 28604, 308, 25, 308, 2710, 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 ]
vmalloc/dessert
dessert/rewrite.py
_read_pyc
def _read_pyc(source, pyc): """Possibly read a pytest pyc containing rewritten code. Return rewritten code if successful or None if not. """ try: fp = open(pyc, "rb") except IOError: return None try: try: mtime = int(os.stat(source).st_mtime) data = fp.read(8) except EnvironmentError: return None # Check for invalid or out of date pyc file. if (len(data) != 8 or data[:4] != imp.get_magic() or struct.unpack("<l", data[4:])[0] != mtime): return None co = marshal.load(fp) if not isinstance(co, types.CodeType): # That's interesting.... return None return co finally: fp.close()
python
def _read_pyc(source, pyc): """Possibly read a pytest pyc containing rewritten code. Return rewritten code if successful or None if not. """ try: fp = open(pyc, "rb") except IOError: return None try: try: mtime = int(os.stat(source).st_mtime) data = fp.read(8) except EnvironmentError: return None # Check for invalid or out of date pyc file. if (len(data) != 8 or data[:4] != imp.get_magic() or struct.unpack("<l", data[4:])[0] != mtime): return None co = marshal.load(fp) if not isinstance(co, types.CodeType): # That's interesting.... return None return co finally: fp.close()
[ "def", "_read_pyc", "(", "source", ",", "pyc", ")", ":", "try", ":", "fp", "=", "open", "(", "pyc", ",", "\"rb\"", ")", "except", "IOError", ":", "return", "None", "try", ":", "try", ":", "mtime", "=", "int", "(", "os", ".", "stat", "(", "source", ")", ".", "st_mtime", ")", "data", "=", "fp", ".", "read", "(", "8", ")", "except", "EnvironmentError", ":", "return", "None", "# Check for invalid or out of date pyc file.", "if", "(", "len", "(", "data", ")", "!=", "8", "or", "data", "[", ":", "4", "]", "!=", "imp", ".", "get_magic", "(", ")", "or", "struct", ".", "unpack", "(", "\"<l\"", ",", "data", "[", "4", ":", "]", ")", "[", "0", "]", "!=", "mtime", ")", ":", "return", "None", "co", "=", "marshal", ".", "load", "(", "fp", ")", "if", "not", "isinstance", "(", "co", ",", "types", ".", "CodeType", ")", ":", "# That's interesting....", "return", "None", "return", "co", "finally", ":", "fp", ".", "close", "(", ")" ]
Possibly read a pytest pyc containing rewritten code. Return rewritten code if successful or None if not.
[ "Possibly", "read", "a", "pytest", "pyc", "containing", "rewritten", "code", "." ]
train
https://github.com/vmalloc/dessert/blob/fa86b39da4853f2c35f0686942db777c7cc57728/dessert/rewrite.py#L338-L363
<|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: Possibly read a pytest pyc containing rewritten code. Return rewritten code if successful or None if not. ### Response: def _read_pyc(source, pyc): """Possibly read a pytest pyc containing rewritten code. Return rewritten code if successful or None if not. """ try: fp = open(pyc, "rb") except IOError: return None try: try: mtime = int(os.stat(source).st_mtime) data = fp.read(8) except EnvironmentError: return None # Check for invalid or out of date pyc file. if (len(data) != 8 or data[:4] != imp.get_magic() or struct.unpack("<l", data[4:])[0] != mtime): return None co = marshal.load(fp) if not isinstance(co, types.CodeType): # That's interesting.... return None return co finally: fp.close() <|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, 83729, 6623, 1373, 264, 28864, 281, 3418, 8649, 59624, 2082, 382, 262, 3494, 59624, 2082, 422, 6992, 477, 2290, 422, 539, 382, 14711, 6075, 512, 755, 721, 888, 623, 3418, 12719, 11, 281, 3418, 997, 262, 4304, 83729, 6623, 1373, 264, 28864, 281, 3418, 8649, 59624, 2082, 382, 262, 3494, 59624, 2082, 422, 6992, 477, 2290, 422, 539, 627, 262, 3270, 262, 1456, 512, 286, 12276, 284, 1825, 1319, 3418, 11, 330, 10910, 1158, 262, 3734, 62061, 512, 286, 471, 2290, 198, 262, 1456, 512, 286, 1456, 512, 310, 296, 1712, 284, 528, 9835, 31187, 12719, 570, 267, 94774, 340, 310, 828, 284, 12276, 4217, 7, 23, 340, 286, 3734, 11847, 1480, 512, 310, 471, 2290, 198, 286, 674, 4343, 369, 8482, 477, 704, 315, 2457, 281, 3418, 1052, 627, 286, 422, 320, 2963, 2657, 8, 976, 220, 23, 477, 828, 3530, 19, 60, 976, 3242, 673, 55712, 368, 477, 198, 394, 2080, 51863, 9836, 75, 498, 828, 58, 19, 25, 41105, 15, 60, 976, 296, 1712, 997, 310, 471, 2290, 198, 286, 1080, 284, 61871, 5214, 18294, 340, 286, 422, 539, 11656, 20059, 11, 4595, 20889, 941, 997, 310, 674, 3011, 596, 7185, 78928, 310, 471, 2290, 198, 286, 471, 1080, 198, 262, 5616, 512, 286, 12276, 4757, 746, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 83729, 6623, 1373, 264, 28864, 281, 3418, 8649, 59624, 2082, 382, 262, 3494, 59624, 2082, 422, 6992, 477, 2290, 422, 539, 382, 14711, 6075, 512, 755, 721, 888, 623, 3418, 12719, 11, 281, 3418, 997, 262, 4304, 83729, 6623, 1373, 264, 28864, 281, 3418, 8649, 59624, 2082, 382, 262, 3494, 59624, 2082, 422, 6992, 477, 2290, 422, 539, 627, 262, 3270, 262, 1456, 512, 286, 12276, 284, 1825, 1319, 3418, 11, 330, 10910, 1158, 262, 3734, 62061, 512, 286, 471, 2290, 198, 262, 1456, 512, 286, 1456, 512, 310, 296, 1712, 284, 528, 9835, 31187, 12719, 570, 267, 94774, 340, 310, 828, 284, 12276, 4217, 7, 23, 340, 286, 3734, 11847, 1480, 512, 310, 471, 2290, 198, 286, 674, 4343, 369, 8482, 477, 704, 315, 2457, 281, 3418, 1052, 627, 286, 422, 320, 2963, 2657, 8, 976, 220, 23, 477, 828, 3530, 19, 60, 976, 3242, 673, 55712, 368, 477, 198, 394, 2080, 51863, 9836, 75, 498, 828, 58, 19, 25, 41105, 15, 60, 976, 296, 1712, 997, 310, 471, 2290, 198, 286, 1080, 284, 61871, 5214, 18294, 340, 286, 422, 539, 11656, 20059, 11, 4595, 20889, 941, 997, 310, 674, 3011, 596, 7185, 78928, 310, 471, 2290, 198, 286, 471, 1080, 198, 262, 5616, 512, 286, 12276, 4757, 746, 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 ]
infothrill/python-launchd
launchd/plist.py
write
def write(label, plist, scope=USER): ''' Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS) ''' fname = compute_filename(label, scope) with open(fname, "wb") as f: plistlib.writePlist(plist, f) return fname
python
def write(label, plist, scope=USER): ''' Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS) ''' fname = compute_filename(label, scope) with open(fname, "wb") as f: plistlib.writePlist(plist, f) return fname
[ "def", "write", "(", "label", ",", "plist", ",", "scope", "=", "USER", ")", ":", "fname", "=", "compute_filename", "(", "label", ",", "scope", ")", "with", "open", "(", "fname", ",", "\"wb\"", ")", "as", "f", ":", "plistlib", ".", "writePlist", "(", "plist", ",", "f", ")", "return", "fname" ]
Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS)
[ "Writes", "the", "given", "property", "list", "to", "the", "appropriate", "file", "on", "disk", "and", "returns", "the", "absolute", "filename", "." ]
train
https://github.com/infothrill/python-launchd/blob/2cd50579e808851b116f5a26f9b871a32b65ce0e/launchd/plist.py#L49-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: Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS) ### Response: def write(label, plist, scope=USER): ''' Writes the given property list to the appropriate file on disk and returns the absolute filename. :param plist: dict :param label: string :param scope: oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS) ''' fname = compute_filename(label, scope) with open(fname, "wb") as f: plistlib.writePlist(plist, f) return fname <|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, 94738, 279, 2728, 3424, 1160, 311, 279, 8475, 1052, 389, 13668, 323, 4780, 198, 262, 279, 10973, 3986, 382, 262, 551, 913, 69735, 25, 6587, 198, 262, 551, 913, 2440, 25, 925, 198, 262, 551, 913, 7036, 25, 832, 2173, 72489, 11, 14194, 31560, 11, 25561, 69470, 31560, 11, 14194, 31500, 11, 25561, 69470, 31500, 696, 14711, 6075, 512, 755, 3350, 13648, 11, 69735, 11, 7036, 28, 6584, 997, 262, 11414, 262, 54388, 279, 2728, 3424, 1160, 311, 279, 8475, 1052, 389, 13668, 323, 4780, 198, 262, 279, 10973, 3986, 382, 262, 551, 913, 69735, 25, 6587, 198, 262, 551, 913, 2440, 25, 925, 198, 262, 551, 913, 7036, 25, 832, 2173, 72489, 11, 14194, 31560, 11, 25561, 69470, 31560, 11, 14194, 31500, 11, 25561, 69470, 31500, 340, 262, 11414, 262, 23364, 284, 12849, 13626, 13648, 11, 7036, 340, 262, 449, 1825, 33426, 11, 330, 20824, 909, 439, 282, 512, 286, 69735, 2808, 3921, 47, 1638, 37709, 380, 11, 282, 340, 262, 471, 23364, 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 ]
[ 1, 1, 1, 1, 1, 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, 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, 94738, 279, 2728, 3424, 1160, 311, 279, 8475, 1052, 389, 13668, 323, 4780, 198, 262, 279, 10973, 3986, 382, 262, 551, 913, 69735, 25, 6587, 198, 262, 551, 913, 2440, 25, 925, 198, 262, 551, 913, 7036, 25, 832, 2173, 72489, 11, 14194, 31560, 11, 25561, 69470, 31560, 11, 14194, 31500, 11, 25561, 69470, 31500, 696, 14711, 6075, 512, 755, 3350, 13648, 11, 69735, 11, 7036, 28, 6584, 997, 262, 11414, 262, 54388, 279, 2728, 3424, 1160, 311, 279, 8475, 1052, 389, 13668, 323, 4780, 198, 262, 279, 10973, 3986, 382, 262, 551, 913, 69735, 25, 6587, 198, 262, 551, 913, 2440, 25, 925, 198, 262, 551, 913, 7036, 25, 832, 2173, 72489, 11, 14194, 31560, 11, 25561, 69470, 31560, 11, 14194, 31500, 11, 25561, 69470, 31500, 340, 262, 11414, 262, 23364, 284, 12849, 13626, 13648, 11, 7036, 340, 262, 449, 1825, 33426, 11, 330, 20824, 909, 439, 282, 512, 286, 69735, 2808, 3921, 47, 1638, 37709, 380, 11, 282, 340, 262, 471, 23364, 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 ]
pymc-devs/pymc
pymc/Matplot.py
autocorrelation
def autocorrelation( data, name, maxlags=100, format='png', reflected=False, suffix='-acf', path='./', fontmap=None, new=True, last=True, rows=1, columns=1, num=1, verbose=1): """ Generate bar plot of the autocorrelation function for a series (usually an MCMC trace). :Arguments: data: PyMC object, trace or array A trace from an MCMC sample or a PyMC object with one or more traces. name: string The name of the object. maxlags (optional): int The largest discrete value for the autocorrelation to be calculated (defaults to 100). format (optional): string Graphic output format (defaults to png). suffix (optional): string Filename suffix. path (optional): string Specifies location for saving plots (defaults to local directory). fontmap (optional): dict Font mapping for plot labels; most users should not specify this. verbose (optional): int Level of output verbosity. """ # Internal plotting specification for handling nested arrays if fontmap is None: fontmap = {1: 10, 2: 8, 3: 6, 4: 5, 5: 4} # Stand-alone plot or subplot? standalone = rows == 1 and columns == 1 and num == 1 if standalone: if verbose > 0: print_('Plotting', name) figure() subplot(rows, columns, num) if ndim(data) == 1: maxlags = min(len(data) - 1, maxlags) try: acorr(data, detrend=mlab.detrend_mean, maxlags=maxlags) except: print_('Cannot plot autocorrelation for %s' % name) return # Set axis bounds ylim(-.1, 1.1) xlim(-maxlags * reflected or 0, maxlags) # Plot options title( '\n\n %s acorr' % name, x=0., y=1., ha='left', va='top', fontsize='small') # Smaller tick labels tlabels = gca().get_xticklabels() setp(tlabels, 'fontsize', fontmap[1]) tlabels = gca().get_yticklabels() setp(tlabels, 'fontsize', fontmap[1]) elif ndim(data) == 2: # generate acorr plot for each dimension rows = data.shape[1] for j in range(rows): autocorrelation( data[:, j], '%s_%d' % (name, j), maxlags, fontmap=fontmap, rows=rows, columns=1, num=j + 1) else: raise ValueError( 'Only 1- and 2- dimensional functions can be displayed') if standalone: if not os.path.exists(path): os.mkdir(path) if not path.endswith('/'): path += '/' # Save to fiel savefig("%s%s%s.%s" % (path, name, suffix, format))
python
def autocorrelation( data, name, maxlags=100, format='png', reflected=False, suffix='-acf', path='./', fontmap=None, new=True, last=True, rows=1, columns=1, num=1, verbose=1): """ Generate bar plot of the autocorrelation function for a series (usually an MCMC trace). :Arguments: data: PyMC object, trace or array A trace from an MCMC sample or a PyMC object with one or more traces. name: string The name of the object. maxlags (optional): int The largest discrete value for the autocorrelation to be calculated (defaults to 100). format (optional): string Graphic output format (defaults to png). suffix (optional): string Filename suffix. path (optional): string Specifies location for saving plots (defaults to local directory). fontmap (optional): dict Font mapping for plot labels; most users should not specify this. verbose (optional): int Level of output verbosity. """ # Internal plotting specification for handling nested arrays if fontmap is None: fontmap = {1: 10, 2: 8, 3: 6, 4: 5, 5: 4} # Stand-alone plot or subplot? standalone = rows == 1 and columns == 1 and num == 1 if standalone: if verbose > 0: print_('Plotting', name) figure() subplot(rows, columns, num) if ndim(data) == 1: maxlags = min(len(data) - 1, maxlags) try: acorr(data, detrend=mlab.detrend_mean, maxlags=maxlags) except: print_('Cannot plot autocorrelation for %s' % name) return # Set axis bounds ylim(-.1, 1.1) xlim(-maxlags * reflected or 0, maxlags) # Plot options title( '\n\n %s acorr' % name, x=0., y=1., ha='left', va='top', fontsize='small') # Smaller tick labels tlabels = gca().get_xticklabels() setp(tlabels, 'fontsize', fontmap[1]) tlabels = gca().get_yticklabels() setp(tlabels, 'fontsize', fontmap[1]) elif ndim(data) == 2: # generate acorr plot for each dimension rows = data.shape[1] for j in range(rows): autocorrelation( data[:, j], '%s_%d' % (name, j), maxlags, fontmap=fontmap, rows=rows, columns=1, num=j + 1) else: raise ValueError( 'Only 1- and 2- dimensional functions can be displayed') if standalone: if not os.path.exists(path): os.mkdir(path) if not path.endswith('/'): path += '/' # Save to fiel savefig("%s%s%s.%s" % (path, name, suffix, format))
[ "def", "autocorrelation", "(", "data", ",", "name", ",", "maxlags", "=", "100", ",", "format", "=", "'png'", ",", "reflected", "=", "False", ",", "suffix", "=", "'-acf'", ",", "path", "=", "'./'", ",", "fontmap", "=", "None", ",", "new", "=", "True", ",", "last", "=", "True", ",", "rows", "=", "1", ",", "columns", "=", "1", ",", "num", "=", "1", ",", "verbose", "=", "1", ")", ":", "# Internal plotting specification for handling nested arrays", "if", "fontmap", "is", "None", ":", "fontmap", "=", "{", "1", ":", "10", ",", "2", ":", "8", ",", "3", ":", "6", ",", "4", ":", "5", ",", "5", ":", "4", "}", "# Stand-alone plot or subplot?", "standalone", "=", "rows", "==", "1", "and", "columns", "==", "1", "and", "num", "==", "1", "if", "standalone", ":", "if", "verbose", ">", "0", ":", "print_", "(", "'Plotting'", ",", "name", ")", "figure", "(", ")", "subplot", "(", "rows", ",", "columns", ",", "num", ")", "if", "ndim", "(", "data", ")", "==", "1", ":", "maxlags", "=", "min", "(", "len", "(", "data", ")", "-", "1", ",", "maxlags", ")", "try", ":", "acorr", "(", "data", ",", "detrend", "=", "mlab", ".", "detrend_mean", ",", "maxlags", "=", "maxlags", ")", "except", ":", "print_", "(", "'Cannot plot autocorrelation for %s'", "%", "name", ")", "return", "# Set axis bounds", "ylim", "(", "-", ".1", ",", "1.1", ")", "xlim", "(", "-", "maxlags", "*", "reflected", "or", "0", ",", "maxlags", ")", "# Plot options", "title", "(", "'\\n\\n %s acorr'", "%", "name", ",", "x", "=", "0.", ",", "y", "=", "1.", ",", "ha", "=", "'left'", ",", "va", "=", "'top'", ",", "fontsize", "=", "'small'", ")", "# Smaller tick labels", "tlabels", "=", "gca", "(", ")", ".", "get_xticklabels", "(", ")", "setp", "(", "tlabels", ",", "'fontsize'", ",", "fontmap", "[", "1", "]", ")", "tlabels", "=", "gca", "(", ")", ".", "get_yticklabels", "(", ")", "setp", "(", "tlabels", ",", "'fontsize'", ",", "fontmap", "[", "1", "]", ")", "elif", "ndim", "(", "data", ")", "==", "2", ":", "# generate acorr plot for each dimension", "rows", "=", "data", ".", "shape", "[", "1", "]", "for", "j", "in", "range", "(", "rows", ")", ":", "autocorrelation", "(", "data", "[", ":", ",", "j", "]", ",", "'%s_%d'", "%", "(", "name", ",", "j", ")", ",", "maxlags", ",", "fontmap", "=", "fontmap", ",", "rows", "=", "rows", ",", "columns", "=", "1", ",", "num", "=", "j", "+", "1", ")", "else", ":", "raise", "ValueError", "(", "'Only 1- and 2- dimensional functions can be displayed'", ")", "if", "standalone", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "os", ".", "mkdir", "(", "path", ")", "if", "not", "path", ".", "endswith", "(", "'/'", ")", ":", "path", "+=", "'/'", "# Save to fiel", "savefig", "(", "\"%s%s%s.%s\"", "%", "(", "path", ",", "name", ",", "suffix", ",", "format", ")", ")" ]
Generate bar plot of the autocorrelation function for a series (usually an MCMC trace). :Arguments: data: PyMC object, trace or array A trace from an MCMC sample or a PyMC object with one or more traces. name: string The name of the object. maxlags (optional): int The largest discrete value for the autocorrelation to be calculated (defaults to 100). format (optional): string Graphic output format (defaults to png). suffix (optional): string Filename suffix. path (optional): string Specifies location for saving plots (defaults to local directory). fontmap (optional): dict Font mapping for plot labels; most users should not specify this. verbose (optional): int Level of output verbosity.
[ "Generate", "bar", "plot", "of", "the", "autocorrelation", "function", "for", "a", "series", "(", "usually", "an", "MCMC", "trace", ")", "." ]
train
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/Matplot.py#L899-L997
<|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: Generate bar plot of the autocorrelation function for a series (usually an MCMC trace). :Arguments: data: PyMC object, trace or array A trace from an MCMC sample or a PyMC object with one or more traces. name: string The name of the object. maxlags (optional): int The largest discrete value for the autocorrelation to be calculated (defaults to 100). format (optional): string Graphic output format (defaults to png). suffix (optional): string Filename suffix. path (optional): string Specifies location for saving plots (defaults to local directory). fontmap (optional): dict Font mapping for plot labels; most users should not specify this. verbose (optional): int Level of output verbosity. ### Response: def autocorrelation( data, name, maxlags=100, format='png', reflected=False, suffix='-acf', path='./', fontmap=None, new=True, last=True, rows=1, columns=1, num=1, verbose=1): """ Generate bar plot of the autocorrelation function for a series (usually an MCMC trace). :Arguments: data: PyMC object, trace or array A trace from an MCMC sample or a PyMC object with one or more traces. name: string The name of the object. maxlags (optional): int The largest discrete value for the autocorrelation to be calculated (defaults to 100). format (optional): string Graphic output format (defaults to png). suffix (optional): string Filename suffix. path (optional): string Specifies location for saving plots (defaults to local directory). fontmap (optional): dict Font mapping for plot labels; most users should not specify this. verbose (optional): int Level of output verbosity. """ # Internal plotting specification for handling nested arrays if fontmap is None: fontmap = {1: 10, 2: 8, 3: 6, 4: 5, 5: 4} # Stand-alone plot or subplot? standalone = rows == 1 and columns == 1 and num == 1 if standalone: if verbose > 0: print_('Plotting', name) figure() subplot(rows, columns, num) if ndim(data) == 1: maxlags = min(len(data) - 1, maxlags) try: acorr(data, detrend=mlab.detrend_mean, maxlags=maxlags) except: print_('Cannot plot autocorrelation for %s' % name) return # Set axis bounds ylim(-.1, 1.1) xlim(-maxlags * reflected or 0, maxlags) # Plot options title( '\n\n %s acorr' % name, x=0., y=1., ha='left', va='top', fontsize='small') # Smaller tick labels tlabels = gca().get_xticklabels() setp(tlabels, 'fontsize', fontmap[1]) tlabels = gca().get_yticklabels() setp(tlabels, 'fontsize', fontmap[1]) elif ndim(data) == 2: # generate acorr plot for each dimension rows = data.shape[1] for j in range(rows): autocorrelation( data[:, j], '%s_%d' % (name, j), maxlags, fontmap=fontmap, rows=rows, columns=1, num=j + 1) else: raise ValueError( 'Only 1- and 2- dimensional functions can be displayed') if standalone: if not os.path.exists(path): os.mkdir(path) if not path.endswith('/'): path += '/' # Save to fiel savefig("%s%s%s.%s" % (path, name, suffix, format)) <|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, 32215, 3703, 7234, 315, 279, 57253, 269, 23013, 734, 369, 264, 4101, 320, 44066, 459, 386, 10190, 34, 11917, 3677, 262, 551, 19686, 512, 286, 828, 25, 5468, 11865, 1665, 11, 11917, 477, 1358, 198, 310, 362, 11917, 505, 459, 386, 10190, 34, 6205, 477, 264, 5468, 11865, 1665, 449, 832, 477, 810, 35483, 382, 286, 836, 25, 925, 198, 310, 578, 836, 315, 279, 1665, 382, 286, 1973, 23698, 320, 13099, 1680, 528, 198, 310, 578, 7928, 44279, 907, 369, 279, 57253, 269, 23013, 311, 387, 16997, 320, 27854, 311, 220, 1041, 3677, 286, 3645, 320, 13099, 1680, 925, 198, 310, 45051, 2612, 3645, 320, 27854, 311, 37251, 3677, 286, 21166, 320, 13099, 1680, 925, 198, 310, 50911, 21166, 382, 286, 1853, 320, 13099, 1680, 925, 198, 310, 46080, 3813, 369, 14324, 31794, 320, 27854, 311, 2254, 6352, 3677, 286, 3381, 2235, 320, 13099, 1680, 6587, 198, 310, 9757, 13021, 369, 7234, 9382, 26, 1455, 3932, 1288, 539, 14158, 420, 382, 286, 14008, 320, 13099, 1680, 528, 198, 310, 9580, 315, 2612, 72487, 382, 14711, 6075, 512, 755, 57253, 269, 23013, 1021, 262, 828, 11, 836, 11, 1973, 23698, 28, 1041, 11, 3645, 1151, 14395, 518, 27000, 5725, 11, 21166, 95093, 63694, 518, 1853, 72493, 756, 286, 3381, 2235, 5980, 11, 502, 3702, 11, 1566, 3702, 11, 7123, 28, 16, 11, 8310, 28, 16, 11, 1661, 28, 16, 11, 14008, 28, 16, 997, 262, 3270, 262, 20400, 3703, 7234, 315, 279, 57253, 269, 23013, 734, 369, 264, 4101, 320, 44066, 459, 386, 10190, 34, 11917, 3677, 262, 551, 19686, 512, 286, 828, 25, 5468, 11865, 1665, 11, 11917, 477, 1358, 198, 310, 362, 11917, 505, 459, 386, 10190, 34, 6205, 477, 264, 5468, 11865, 1665, 449, 832, 477, 810, 35483, 382, 286, 836, 25, 925, 198, 310, 578, 836, 315, 279, 1665, 382, 286, 1973, 23698, 320, 13099, 1680, 528, 198, 310, 578, 7928, 44279, 907, 369, 279, 57253, 269, 23013, 311, 387, 16997, 320, 27854, 311, 220, 1041, 3677, 286, 3645, 320, 13099, 1680, 925, 198, 310, 45051, 2612, 3645, 320, 27854, 311, 37251, 3677, 286, 21166, 320, 13099, 1680, 925, 198, 310, 50911, 21166, 382, 286, 1853, 320, 13099, 1680, 925, 198, 310, 46080, 3813, 369, 14324, 31794, 320, 27854, 311, 2254, 6352, 3677, 286, 3381, 2235, 320, 13099, 1680, 6587, 198, 310, 9757, 13021, 369, 7234, 9382, 26, 1455, 3932, 1288, 539, 14158, 420, 382, 286, 14008, 320, 13099, 1680, 528, 198, 310, 9580, 315, 2612, 72487, 382, 262, 3270, 262, 674, 15774, 45002, 26185, 369, 11850, 24997, 18893, 271, 262, 422, 3381, 2235, 374, 2290, 512, 286, 3381, 2235, 284, 314, 16, 25, 220, 605, 11, 220, 17, 25, 220, 23, 11, 220, 18, 25, 220, 21, 11, 220, 19, 25, 220, 20, 11, 220, 20, 25, 220, 19, 633, 262, 674, 15948, 74249, 7234, 477, 47726, 5380 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 32215, 3703, 7234, 315, 279, 57253, 269, 23013, 734, 369, 264, 4101, 320, 44066, 459, 386, 10190, 34, 11917, 3677, 262, 551, 19686, 512, 286, 828, 25, 5468, 11865, 1665, 11, 11917, 477, 1358, 198, 310, 362, 11917, 505, 459, 386, 10190, 34, 6205, 477, 264, 5468, 11865, 1665, 449, 832, 477, 810, 35483, 382, 286, 836, 25, 925, 198, 310, 578, 836, 315, 279, 1665, 382, 286, 1973, 23698, 320, 13099, 1680, 528, 198, 310, 578, 7928, 44279, 907, 369, 279, 57253, 269, 23013, 311, 387, 16997, 320, 27854, 311, 220, 1041, 3677, 286, 3645, 320, 13099, 1680, 925, 198, 310, 45051, 2612, 3645, 320, 27854, 311, 37251, 3677, 286, 21166, 320, 13099, 1680, 925, 198, 310, 50911, 21166, 382, 286, 1853, 320, 13099, 1680, 925, 198, 310, 46080, 3813, 369, 14324, 31794, 320, 27854, 311, 2254, 6352, 3677, 286, 3381, 2235, 320, 13099, 1680, 6587, 198, 310, 9757, 13021, 369, 7234, 9382, 26, 1455, 3932, 1288, 539, 14158, 420, 382, 286, 14008, 320, 13099, 1680, 528, 198, 310, 9580, 315, 2612, 72487, 382, 14711, 6075, 512, 755, 57253, 269, 23013, 1021, 262, 828, 11, 836, 11, 1973, 23698, 28, 1041, 11, 3645, 1151, 14395, 518, 27000, 5725, 11, 21166, 95093, 63694, 518, 1853, 72493, 756, 286, 3381, 2235, 5980, 11, 502, 3702, 11, 1566, 3702, 11, 7123, 28, 16, 11, 8310, 28, 16, 11, 1661, 28, 16, 11, 14008, 28, 16, 997, 262, 3270, 262, 20400, 3703, 7234, 315, 279, 57253, 269, 23013, 734, 369, 264, 4101, 320, 44066, 459, 386, 10190, 34, 11917, 3677, 262, 551, 19686, 512, 286, 828, 25, 5468, 11865, 1665, 11, 11917, 477, 1358, 198, 310, 362, 11917, 505, 459, 386, 10190, 34, 6205, 477, 264, 5468, 11865, 1665, 449, 832, 477, 810, 35483, 382, 286, 836, 25, 925, 198, 310, 578, 836, 315, 279, 1665, 382, 286, 1973, 23698, 320, 13099, 1680, 528, 198, 310, 578, 7928, 44279, 907, 369, 279, 57253, 269, 23013, 311, 387, 16997, 320, 27854, 311, 220, 1041, 3677, 286, 3645, 320, 13099, 1680, 925, 198, 310, 45051, 2612, 3645, 320, 27854, 311, 37251, 3677, 286, 21166, 320, 13099, 1680, 925, 198, 310, 50911, 21166, 382, 286, 1853, 320, 13099, 1680, 925, 198, 310, 46080, 3813, 369, 14324, 31794, 320, 27854, 311, 2254, 6352, 3677, 286, 3381, 2235, 320, 13099, 1680, 6587, 198, 310, 9757, 13021, 369, 7234, 9382, 26, 1455, 3932, 1288, 539, 14158, 420, 382, 286, 14008, 320, 13099, 1680, 528, 198, 310, 9580, 315, 2612, 72487, 382, 262, 3270, 262, 674, 15774, 45002, 26185, 369, 11850, 24997, 18893, 271, 262, 422, 3381, 2235, 374, 2290, 512, 286, 3381, 2235, 284, 314, 16, 25, 220, 605, 11, 220, 17, 25, 220, 23, 11, 220, 18, 25, 220, 21, 11, 220, 19, 25, 220, 20, 11, 220, 20, 25, 220, 19, 633, 262, 674, 15948, 74249, 7234, 477, 47726, 5380 ]
specialunderwear/django-easymode
easymode/tree/xml/serializers.py
RecursiveXmlSerializer.serialize
def serialize(self, queryset, **options): """ Serialize a queryset. THE OUTPUT OF THIS SERIALIZER IS NOT MEANT TO BE SERIALIZED BACK INTO THE DB. """ self.options = options self.stream = options.get("stream", StringIO()) self.selected_fields = options.get("fields") self.use_natural_keys = options.get("use_natural_keys", True) self.xml = options.get("xml", None) self.root = (self.xml == None) self.start_serialization() for obj in queryset: # hook for having custom serialization if hasattr(obj, '__serialize__'): obj.__serialize__(self.xml) else: self.serialize_object(obj) self.end_serialization() return self.getvalue()
python
def serialize(self, queryset, **options): """ Serialize a queryset. THE OUTPUT OF THIS SERIALIZER IS NOT MEANT TO BE SERIALIZED BACK INTO THE DB. """ self.options = options self.stream = options.get("stream", StringIO()) self.selected_fields = options.get("fields") self.use_natural_keys = options.get("use_natural_keys", True) self.xml = options.get("xml", None) self.root = (self.xml == None) self.start_serialization() for obj in queryset: # hook for having custom serialization if hasattr(obj, '__serialize__'): obj.__serialize__(self.xml) else: self.serialize_object(obj) self.end_serialization() return self.getvalue()
[ "def", "serialize", "(", "self", ",", "queryset", ",", "*", "*", "options", ")", ":", "self", ".", "options", "=", "options", "self", ".", "stream", "=", "options", ".", "get", "(", "\"stream\"", ",", "StringIO", "(", ")", ")", "self", ".", "selected_fields", "=", "options", ".", "get", "(", "\"fields\"", ")", "self", ".", "use_natural_keys", "=", "options", ".", "get", "(", "\"use_natural_keys\"", ",", "True", ")", "self", ".", "xml", "=", "options", ".", "get", "(", "\"xml\"", ",", "None", ")", "self", ".", "root", "=", "(", "self", ".", "xml", "==", "None", ")", "self", ".", "start_serialization", "(", ")", "for", "obj", "in", "queryset", ":", "# hook for having custom serialization", "if", "hasattr", "(", "obj", ",", "'__serialize__'", ")", ":", "obj", ".", "__serialize__", "(", "self", ".", "xml", ")", "else", ":", "self", ".", "serialize_object", "(", "obj", ")", "self", ".", "end_serialization", "(", ")", "return", "self", ".", "getvalue", "(", ")" ]
Serialize a queryset. THE OUTPUT OF THIS SERIALIZER IS NOT MEANT TO BE SERIALIZED BACK INTO THE DB.
[ "Serialize", "a", "queryset", ".", "THE", "OUTPUT", "OF", "THIS", "SERIALIZER", "IS", "NOT", "MEANT", "TO", "BE", "SERIALIZED", "BACK", "INTO", "THE", "DB", "." ]
train
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/tree/xml/serializers.py#L44-L67
<|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: Serialize a queryset. THE OUTPUT OF THIS SERIALIZER IS NOT MEANT TO BE SERIALIZED BACK INTO THE DB. ### Response: def serialize(self, queryset, **options): """ Serialize a queryset. THE OUTPUT OF THIS SERIALIZER IS NOT MEANT TO BE SERIALIZED BACK INTO THE DB. """ self.options = options self.stream = options.get("stream", StringIO()) self.selected_fields = options.get("fields") self.use_natural_keys = options.get("use_natural_keys", True) self.xml = options.get("xml", None) self.root = (self.xml == None) self.start_serialization() for obj in queryset: # hook for having custom serialization if hasattr(obj, '__serialize__'): obj.__serialize__(self.xml) else: self.serialize_object(obj) self.end_serialization() return self.getvalue() <|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, 16055, 264, 40627, 627, 286, 3247, 32090, 3083, 10245, 14311, 33701, 643, 3507, 4276, 16691, 2891, 5257, 7354, 14311, 89827, 33182, 198, 286, 12779, 3247, 6078, 382, 14711, 6075, 512, 755, 25217, 1214, 11, 40627, 11, 3146, 2945, 997, 286, 3270, 286, 41000, 264, 40627, 627, 286, 3247, 32090, 3083, 10245, 14311, 33701, 643, 3507, 4276, 16691, 2891, 5257, 7354, 14311, 89827, 33182, 198, 286, 12779, 3247, 6078, 13, 1827, 286, 3270, 286, 659, 11152, 284, 2671, 271, 286, 659, 15307, 284, 2671, 673, 446, 4116, 498, 68035, 2455, 286, 659, 12176, 12406, 284, 2671, 673, 446, 9184, 1158, 286, 659, 7549, 1107, 4688, 12919, 284, 2671, 673, 446, 817, 1107, 4688, 12919, 498, 3082, 340, 1827, 286, 659, 9205, 284, 2671, 673, 446, 6591, 498, 2290, 340, 286, 659, 12861, 284, 320, 726, 9205, 624, 2290, 340, 1827, 286, 659, 5069, 26684, 2065, 746, 286, 369, 2909, 304, 40627, 512, 310, 674, 9903, 369, 3515, 2587, 48543, 198, 310, 422, 32156, 6922, 11, 12385, 25140, 565, 11290, 394, 2909, 4952, 25140, 3889, 726, 9205, 340, 310, 775, 512, 394, 659, 35069, 5427, 6922, 340, 286, 659, 5183, 26684, 2065, 746, 286, 471, 659, 81766, 746, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 16055, 264, 40627, 627, 286, 3247, 32090, 3083, 10245, 14311, 33701, 643, 3507, 4276, 16691, 2891, 5257, 7354, 14311, 89827, 33182, 198, 286, 12779, 3247, 6078, 382, 14711, 6075, 512, 755, 25217, 1214, 11, 40627, 11, 3146, 2945, 997, 286, 3270, 286, 41000, 264, 40627, 627, 286, 3247, 32090, 3083, 10245, 14311, 33701, 643, 3507, 4276, 16691, 2891, 5257, 7354, 14311, 89827, 33182, 198, 286, 12779, 3247, 6078, 13, 1827, 286, 3270, 286, 659, 11152, 284, 2671, 271, 286, 659, 15307, 284, 2671, 673, 446, 4116, 498, 68035, 2455, 286, 659, 12176, 12406, 284, 2671, 673, 446, 9184, 1158, 286, 659, 7549, 1107, 4688, 12919, 284, 2671, 673, 446, 817, 1107, 4688, 12919, 498, 3082, 340, 1827, 286, 659, 9205, 284, 2671, 673, 446, 6591, 498, 2290, 340, 286, 659, 12861, 284, 320, 726, 9205, 624, 2290, 340, 1827, 286, 659, 5069, 26684, 2065, 746, 286, 369, 2909, 304, 40627, 512, 310, 674, 9903, 369, 3515, 2587, 48543, 198, 310, 422, 32156, 6922, 11, 12385, 25140, 565, 11290, 394, 2909, 4952, 25140, 3889, 726, 9205, 340, 310, 775, 512, 394, 659, 35069, 5427, 6922, 340, 286, 659, 5183, 26684, 2065, 746, 286, 471, 659, 81766, 746, 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 ]
MacHu-GWU/angora-project
angora/text/strtemplate.py
StrTemplate.indented_show
def indented_show(text, howmany=1): """Print a formatted indented text. """ print(StrTemplate.pad_indent(text=text, howmany=howmany))
python
def indented_show(text, howmany=1): """Print a formatted indented text. """ print(StrTemplate.pad_indent(text=text, howmany=howmany))
[ "def", "indented_show", "(", "text", ",", "howmany", "=", "1", ")", ":", "print", "(", "StrTemplate", ".", "pad_indent", "(", "text", "=", "text", ",", "howmany", "=", "howmany", ")", ")" ]
Print a formatted indented text.
[ "Print", "a", "formatted", "indented", "text", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/text/strtemplate.py#L60-L63
<|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: Print a formatted indented text. ### Response: def indented_show(text, howmany=1): """Print a formatted indented text. """ print(StrTemplate.pad_indent(text=text, howmany=howmany)) <|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, 9171, 264, 24001, 1280, 16243, 1495, 382, 14711, 6075, 512, 755, 1280, 16243, 15625, 7383, 11, 1268, 35676, 28, 16, 997, 286, 4304, 9171, 264, 24001, 1280, 16243, 1495, 627, 286, 3270, 286, 1194, 93184, 7423, 57366, 70145, 7383, 49406, 11, 1268, 35676, 28, 5269, 35676, 1192, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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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13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 9171, 264, 24001, 1280, 16243, 1495, 382, 14711, 6075, 512, 755, 1280, 16243, 15625, 7383, 11, 1268, 35676, 28, 16, 997, 286, 4304, 9171, 264, 24001, 1280, 16243, 1495, 627, 286, 3270, 286, 1194, 93184, 7423, 57366, 70145, 7383, 49406, 11, 1268, 35676, 28, 5269, 35676, 1192, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
houtianze/bypy
bypy/requester.py
UrllibRequester.request
def request(cls, method, url, **kwargs): """ :type method: str """ methodupper = method.upper() hasdata = 'data' in kwargs if methodupper == 'GET': if hasdata: print("ERROR: Can't do HTTP GET when the 'data' parameter presents") assert False resp = ulr.urlopen(url, **kwargs) elif methodupper == 'POST': if hasdata: resp = ulr.urlopen(url, **kwargs) else: resp = ulr.urlopen(url, data = '', **kwargs) else: raise NotImplementedError() return resp
python
def request(cls, method, url, **kwargs): """ :type method: str """ methodupper = method.upper() hasdata = 'data' in kwargs if methodupper == 'GET': if hasdata: print("ERROR: Can't do HTTP GET when the 'data' parameter presents") assert False resp = ulr.urlopen(url, **kwargs) elif methodupper == 'POST': if hasdata: resp = ulr.urlopen(url, **kwargs) else: resp = ulr.urlopen(url, data = '', **kwargs) else: raise NotImplementedError() return resp
[ "def", "request", "(", "cls", ",", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "methodupper", "=", "method", ".", "upper", "(", ")", "hasdata", "=", "'data'", "in", "kwargs", "if", "methodupper", "==", "'GET'", ":", "if", "hasdata", ":", "print", "(", "\"ERROR: Can't do HTTP GET when the 'data' parameter presents\"", ")", "assert", "False", "resp", "=", "ulr", ".", "urlopen", "(", "url", ",", "*", "*", "kwargs", ")", "elif", "methodupper", "==", "'POST'", ":", "if", "hasdata", ":", "resp", "=", "ulr", ".", "urlopen", "(", "url", ",", "*", "*", "kwargs", ")", "else", ":", "resp", "=", "ulr", ".", "urlopen", "(", "url", ",", "data", "=", "''", ",", "*", "*", "kwargs", ")", "else", ":", "raise", "NotImplementedError", "(", ")", "return", "resp" ]
:type method: str
[ ":", "type", "method", ":", "str" ]
train
https://github.com/houtianze/bypy/blob/c59b6183e2fca45f11138bbcdec6247449b2eaad/bypy/requester.py#L61-L80
<|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: :type method: str ### Response: def request(cls, method, url, **kwargs): """ :type method: str """ methodupper = method.upper() hasdata = 'data' in kwargs if methodupper == 'GET': if hasdata: print("ERROR: Can't do HTTP GET when the 'data' parameter presents") assert False resp = ulr.urlopen(url, **kwargs) elif methodupper == 'POST': if hasdata: resp = ulr.urlopen(url, **kwargs) else: resp = ulr.urlopen(url, data = '', **kwargs) else: raise NotImplementedError() return resp <|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, 47545, 1749, 25, 610, 271, 14711, 6075, 512, 755, 1715, 21024, 11, 1749, 11, 2576, 11, 3146, 9872, 997, 197, 197, 7275, 197, 197, 47545, 1749, 25, 610, 198, 197, 197, 7275, 197, 43357, 13886, 284, 1749, 34764, 746, 197, 64355, 695, 284, 364, 695, 6, 304, 16901, 198, 197, 748, 1749, 13886, 624, 364, 3891, 3730, 298, 748, 706, 695, 512, 573, 7045, 446, 3767, 25, 3053, 956, 656, 10339, 8049, 994, 279, 364, 695, 6, 5852, 18911, 1158, 573, 7093, 3641, 198, 298, 35753, 284, 8725, 81, 63695, 6659, 11, 3146, 9872, 340, 197, 23560, 1749, 13886, 624, 364, 3019, 3730, 298, 748, 706, 695, 512, 573, 35753, 284, 8725, 81, 63695, 6659, 11, 3146, 9872, 340, 298, 2525, 512, 573, 35753, 284, 8725, 81, 63695, 6659, 11, 828, 284, 9158, 3146, 9872, 340, 197, 2525, 512, 298, 55118, 39299, 2892, 197, 862, 9216, 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 ]
[ 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, 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, 47545, 1749, 25, 610, 271, 14711, 6075, 512, 755, 1715, 21024, 11, 1749, 11, 2576, 11, 3146, 9872, 997, 197, 197, 7275, 197, 197, 47545, 1749, 25, 610, 198, 197, 197, 7275, 197, 43357, 13886, 284, 1749, 34764, 746, 197, 64355, 695, 284, 364, 695, 6, 304, 16901, 198, 197, 748, 1749, 13886, 624, 364, 3891, 3730, 298, 748, 706, 695, 512, 573, 7045, 446, 3767, 25, 3053, 956, 656, 10339, 8049, 994, 279, 364, 695, 6, 5852, 18911, 1158, 573, 7093, 3641, 198, 298, 35753, 284, 8725, 81, 63695, 6659, 11, 3146, 9872, 340, 197, 23560, 1749, 13886, 624, 364, 3019, 3730, 298, 748, 706, 695, 512, 573, 35753, 284, 8725, 81, 63695, 6659, 11, 3146, 9872, 340, 298, 2525, 512, 573, 35753, 284, 8725, 81, 63695, 6659, 11, 828, 284, 9158, 3146, 9872, 340, 197, 2525, 512, 298, 55118, 39299, 2892, 197, 862, 9216, 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 ]
Phylliade/ikpy
contrib/transformations.py
pose_to_list
def pose_to_list(pose): """ Convert a Pose or PoseStamped in Python list ((position), (quaternion)) :param pose: geometry_msgs.msg.PoseStamped or geometry_msgs.msg.Pose :return: the equivalent in list ((position), (quaternion)) """ if type(pose) == geometry_msgs.msg.PoseStamped: return [[ pose.pose.position.x, pose.pose.position.y, pose.pose.position.z ], [ pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w ]] elif type(pose) == geometry_msgs.msg.Pose: return [[pose.position.x, pose.position.y, pose.position.z], [ pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w ]] else: raise Exception("pose_to_list: parameter of type %s unexpected", str(type(pose)))
python
def pose_to_list(pose): """ Convert a Pose or PoseStamped in Python list ((position), (quaternion)) :param pose: geometry_msgs.msg.PoseStamped or geometry_msgs.msg.Pose :return: the equivalent in list ((position), (quaternion)) """ if type(pose) == geometry_msgs.msg.PoseStamped: return [[ pose.pose.position.x, pose.pose.position.y, pose.pose.position.z ], [ pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w ]] elif type(pose) == geometry_msgs.msg.Pose: return [[pose.position.x, pose.position.y, pose.position.z], [ pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w ]] else: raise Exception("pose_to_list: parameter of type %s unexpected", str(type(pose)))
[ "def", "pose_to_list", "(", "pose", ")", ":", "if", "type", "(", "pose", ")", "==", "geometry_msgs", ".", "msg", ".", "PoseStamped", ":", "return", "[", "[", "pose", ".", "pose", ".", "position", ".", "x", ",", "pose", ".", "pose", ".", "position", ".", "y", ",", "pose", ".", "pose", ".", "position", ".", "z", "]", ",", "[", "pose", ".", "pose", ".", "orientation", ".", "x", ",", "pose", ".", "pose", ".", "orientation", ".", "y", ",", "pose", ".", "pose", ".", "orientation", ".", "z", ",", "pose", ".", "pose", ".", "orientation", ".", "w", "]", "]", "elif", "type", "(", "pose", ")", "==", "geometry_msgs", ".", "msg", ".", "Pose", ":", "return", "[", "[", "pose", ".", "position", ".", "x", ",", "pose", ".", "position", ".", "y", ",", "pose", ".", "position", ".", "z", "]", ",", "[", "pose", ".", "orientation", ".", "x", ",", "pose", ".", "orientation", ".", "y", ",", "pose", ".", "orientation", ".", "z", ",", "pose", ".", "orientation", ".", "w", "]", "]", "else", ":", "raise", "Exception", "(", "\"pose_to_list: parameter of type %s unexpected\"", ",", "str", "(", "type", "(", "pose", ")", ")", ")" ]
Convert a Pose or PoseStamped in Python list ((position), (quaternion)) :param pose: geometry_msgs.msg.PoseStamped or geometry_msgs.msg.Pose :return: the equivalent in list ((position), (quaternion))
[ "Convert", "a", "Pose", "or", "PoseStamped", "in", "Python", "list", "((", "position", ")", "(", "quaternion", "))", ":", "param", "pose", ":", "geometry_msgs", ".", "msg", ".", "PoseStamped", "or", "geometry_msgs", ".", "msg", ".", "Pose", ":", "return", ":", "the", "equivalent", "in", "list", "((", "position", ")", "(", "quaternion", "))" ]
train
https://github.com/Phylliade/ikpy/blob/60e36d6163136942bf520d952db17123c658d0b6/contrib/transformations.py#L48-L68
<|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 a Pose or PoseStamped in Python list ((position), (quaternion)) :param pose: geometry_msgs.msg.PoseStamped or geometry_msgs.msg.Pose :return: the equivalent in list ((position), (quaternion)) ### Response: def pose_to_list(pose): """ Convert a Pose or PoseStamped in Python list ((position), (quaternion)) :param pose: geometry_msgs.msg.PoseStamped or geometry_msgs.msg.Pose :return: the equivalent in list ((position), (quaternion)) """ if type(pose) == geometry_msgs.msg.PoseStamped: return [[ pose.pose.position.x, pose.pose.position.y, pose.pose.position.z ], [ pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w ]] elif type(pose) == geometry_msgs.msg.Pose: return [[pose.position.x, pose.position.y, pose.position.z], [ pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w ]] else: raise Exception("pose_to_list: parameter of type %s unexpected", str(type(pose))) <|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, 264, 51473, 477, 51473, 81128, 304, 13325, 1160, 1819, 3571, 705, 320, 447, 16755, 1192, 262, 551, 913, 17477, 25, 17484, 21440, 15488, 1087, 974, 81128, 477, 17484, 21440, 15488, 1087, 974, 198, 262, 551, 693, 25, 279, 13890, 304, 1160, 1819, 3571, 705, 320, 447, 16755, 4489, 14711, 6075, 512, 755, 17477, 2401, 2062, 1319, 974, 997, 262, 3270, 262, 7316, 264, 51473, 477, 51473, 81128, 304, 13325, 1160, 1819, 3571, 705, 320, 447, 16755, 1192, 262, 551, 913, 17477, 25, 17484, 21440, 15488, 1087, 974, 81128, 477, 17484, 21440, 15488, 1087, 974, 198, 262, 551, 693, 25, 279, 13890, 304, 1160, 1819, 3571, 705, 320, 447, 16755, 1192, 262, 3270, 262, 422, 955, 1319, 974, 8, 624, 17484, 21440, 15488, 1087, 974, 81128, 512, 286, 471, 4416, 198, 310, 17477, 44000, 6318, 2036, 11, 17477, 44000, 6318, 2441, 11, 17477, 44000, 6318, 4025, 198, 286, 10881, 2330, 310, 17477, 44000, 46807, 2036, 11, 17477, 44000, 46807, 2441, 345, 310, 17477, 44000, 46807, 4025, 11, 17477, 44000, 46807, 1444, 198, 286, 64140, 262, 4508, 955, 1319, 974, 8, 624, 17484, 21440, 15488, 1087, 974, 512, 286, 471, 4416, 2972, 6318, 2036, 11, 17477, 6318, 2441, 11, 17477, 6318, 4025, 1145, 2330, 310, 17477, 46807, 2036, 11, 17477, 46807, 2441, 11, 17477, 46807, 4025, 345, 310, 17477, 46807, 1444, 198, 286, 64140, 262, 775, 512, 286, 4933, 4204, 446, 2972, 2401, 2062, 25, 5852, 315, 955, 1034, 82, 16907, 761, 667, 610, 5930, 1319, 974, 6054, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 12281, 264, 51473, 477, 51473, 81128, 304, 13325, 1160, 1819, 3571, 705, 320, 447, 16755, 1192, 262, 551, 913, 17477, 25, 17484, 21440, 15488, 1087, 974, 81128, 477, 17484, 21440, 15488, 1087, 974, 198, 262, 551, 693, 25, 279, 13890, 304, 1160, 1819, 3571, 705, 320, 447, 16755, 4489, 14711, 6075, 512, 755, 17477, 2401, 2062, 1319, 974, 997, 262, 3270, 262, 7316, 264, 51473, 477, 51473, 81128, 304, 13325, 1160, 1819, 3571, 705, 320, 447, 16755, 1192, 262, 551, 913, 17477, 25, 17484, 21440, 15488, 1087, 974, 81128, 477, 17484, 21440, 15488, 1087, 974, 198, 262, 551, 693, 25, 279, 13890, 304, 1160, 1819, 3571, 705, 320, 447, 16755, 1192, 262, 3270, 262, 422, 955, 1319, 974, 8, 624, 17484, 21440, 15488, 1087, 974, 81128, 512, 286, 471, 4416, 198, 310, 17477, 44000, 6318, 2036, 11, 17477, 44000, 6318, 2441, 11, 17477, 44000, 6318, 4025, 198, 286, 10881, 2330, 310, 17477, 44000, 46807, 2036, 11, 17477, 44000, 46807, 2441, 345, 310, 17477, 44000, 46807, 4025, 11, 17477, 44000, 46807, 1444, 198, 286, 64140, 262, 4508, 955, 1319, 974, 8, 624, 17484, 21440, 15488, 1087, 974, 512, 286, 471, 4416, 2972, 6318, 2036, 11, 17477, 6318, 2441, 11, 17477, 6318, 4025, 1145, 2330, 310, 17477, 46807, 2036, 11, 17477, 46807, 2441, 11, 17477, 46807, 4025, 345, 310, 17477, 46807, 1444, 198, 286, 64140, 262, 775, 512, 286, 4933, 4204, 446, 2972, 2401, 2062, 25, 5852, 315, 955, 1034, 82, 16907, 761, 667, 610, 5930, 1319, 974, 6054, 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 ]
fmfn/BayesianOptimization
bayes_opt/bayesian_optimization.py
BayesianOptimization.suggest
def suggest(self, utility_function): """Most promissing point to probe next""" if len(self._space) == 0: return self._space.array_to_params(self._space.random_sample()) # Sklearn's GP throws a large number of warnings at times, but # we don't really need to see them here. with warnings.catch_warnings(): warnings.simplefilter("ignore") self._gp.fit(self._space.params, self._space.target) # Finding argmax of the acquisition function. suggestion = acq_max( ac=utility_function.utility, gp=self._gp, y_max=self._space.target.max(), bounds=self._space.bounds, random_state=self._random_state ) return self._space.array_to_params(suggestion)
python
def suggest(self, utility_function): """Most promissing point to probe next""" if len(self._space) == 0: return self._space.array_to_params(self._space.random_sample()) # Sklearn's GP throws a large number of warnings at times, but # we don't really need to see them here. with warnings.catch_warnings(): warnings.simplefilter("ignore") self._gp.fit(self._space.params, self._space.target) # Finding argmax of the acquisition function. suggestion = acq_max( ac=utility_function.utility, gp=self._gp, y_max=self._space.target.max(), bounds=self._space.bounds, random_state=self._random_state ) return self._space.array_to_params(suggestion)
[ "def", "suggest", "(", "self", ",", "utility_function", ")", ":", "if", "len", "(", "self", ".", "_space", ")", "==", "0", ":", "return", "self", ".", "_space", ".", "array_to_params", "(", "self", ".", "_space", ".", "random_sample", "(", ")", ")", "# Sklearn's GP throws a large number of warnings at times, but", "# we don't really need to see them here.", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "simplefilter", "(", "\"ignore\"", ")", "self", ".", "_gp", ".", "fit", "(", "self", ".", "_space", ".", "params", ",", "self", ".", "_space", ".", "target", ")", "# Finding argmax of the acquisition function.", "suggestion", "=", "acq_max", "(", "ac", "=", "utility_function", ".", "utility", ",", "gp", "=", "self", ".", "_gp", ",", "y_max", "=", "self", ".", "_space", ".", "target", ".", "max", "(", ")", ",", "bounds", "=", "self", ".", "_space", ".", "bounds", ",", "random_state", "=", "self", ".", "_random_state", ")", "return", "self", ".", "_space", ".", "array_to_params", "(", "suggestion", ")" ]
Most promissing point to probe next
[ "Most", "promissing", "point", "to", "probe", "next" ]
train
https://github.com/fmfn/BayesianOptimization/blob/8ce2292895137477963cf1bafa4e71fa20b2ce49/bayes_opt/bayesian_optimization.py#L115-L135
<|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: Most promissing point to probe next ### Response: def suggest(self, utility_function): """Most promissing point to probe next""" if len(self._space) == 0: return self._space.array_to_params(self._space.random_sample()) # Sklearn's GP throws a large number of warnings at times, but # we don't really need to see them here. with warnings.catch_warnings(): warnings.simplefilter("ignore") self._gp.fit(self._space.params, self._space.target) # Finding argmax of the acquisition function. suggestion = acq_max( ac=utility_function.utility, gp=self._gp, y_max=self._space.target.max(), bounds=self._space.bounds, random_state=self._random_state ) return self._space.array_to_params(suggestion) <|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, 13622, 2773, 13889, 1486, 311, 22477, 1828, 271, 14711, 6075, 512, 755, 4284, 1214, 11, 15919, 9353, 997, 286, 4304, 13622, 2773, 13889, 1486, 311, 22477, 1828, 7275, 286, 422, 2479, 1214, 1462, 8920, 8, 624, 220, 15, 512, 310, 471, 659, 1462, 8920, 7382, 2401, 6887, 1214, 1462, 8920, 7985, 17949, 12647, 286, 674, 4923, 12964, 596, 24618, 3872, 264, 3544, 1396, 315, 19530, 520, 3115, 11, 719, 198, 286, 674, 584, 1541, 956, 2216, 1205, 311, 1518, 1124, 1618, 627, 286, 449, 19530, 55732, 88758, 4019, 310, 19530, 25456, 5428, 446, 13431, 1158, 310, 659, 1462, 22650, 21529, 1214, 1462, 8920, 9180, 11, 659, 1462, 8920, 6676, 696, 286, 674, 43897, 1417, 2880, 315, 279, 24279, 734, 627, 286, 24710, 284, 1645, 80, 6479, 1021, 310, 1645, 28, 32000, 9353, 68656, 345, 310, 29805, 7822, 1462, 22650, 345, 310, 379, 6479, 7822, 1462, 8920, 6676, 6817, 3227, 310, 14597, 7822, 1462, 8920, 24477, 345, 310, 4288, 4486, 7822, 1462, 11719, 4486, 198, 286, 5235, 286, 471, 659, 1462, 8920, 7382, 2401, 6887, 1161, 43216, 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 ]
[ 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, 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, 13622, 2773, 13889, 1486, 311, 22477, 1828, 271, 14711, 6075, 512, 755, 4284, 1214, 11, 15919, 9353, 997, 286, 4304, 13622, 2773, 13889, 1486, 311, 22477, 1828, 7275, 286, 422, 2479, 1214, 1462, 8920, 8, 624, 220, 15, 512, 310, 471, 659, 1462, 8920, 7382, 2401, 6887, 1214, 1462, 8920, 7985, 17949, 12647, 286, 674, 4923, 12964, 596, 24618, 3872, 264, 3544, 1396, 315, 19530, 520, 3115, 11, 719, 198, 286, 674, 584, 1541, 956, 2216, 1205, 311, 1518, 1124, 1618, 627, 286, 449, 19530, 55732, 88758, 4019, 310, 19530, 25456, 5428, 446, 13431, 1158, 310, 659, 1462, 22650, 21529, 1214, 1462, 8920, 9180, 11, 659, 1462, 8920, 6676, 696, 286, 674, 43897, 1417, 2880, 315, 279, 24279, 734, 627, 286, 24710, 284, 1645, 80, 6479, 1021, 310, 1645, 28, 32000, 9353, 68656, 345, 310, 29805, 7822, 1462, 22650, 345, 310, 379, 6479, 7822, 1462, 8920, 6676, 6817, 3227, 310, 14597, 7822, 1462, 8920, 24477, 345, 310, 4288, 4486, 7822, 1462, 11719, 4486, 198, 286, 5235, 286, 471, 659, 1462, 8920, 7382, 2401, 6887, 1161, 43216, 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 ]