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
alerta/alerta
alerta/models/key.py
ApiKey.find_all
def find_all(query: Query=None) -> List['ApiKey']: """ List all API keys. """ return [ApiKey.from_db(key) for key in db.get_keys(query)]
python
def find_all(query: Query=None) -> List['ApiKey']: """ List all API keys. """ return [ApiKey.from_db(key) for key in db.get_keys(query)]
[ "def", "find_all", "(", "query", ":", "Query", "=", "None", ")", "->", "List", "[", "'ApiKey'", "]", ":", "return", "[", "ApiKey", ".", "from_db", "(", "key", ")", "for", "key", "in", "db", ".", "get_keys", "(", "query", ")", "]" ]
List all API keys.
[ "List", "all", "API", "keys", "." ]
train
https://github.com/alerta/alerta/blob/6478d6addc217c96a4a6688fab841035bef134e1/alerta/models/key.py#L120-L124
<|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: List all API keys. ### Response: def find_all(query: Query=None) -> List['ApiKey']: """ List all API keys. """ return [ApiKey.from_db(key) for key in db.get_keys(query)] <|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, 861, 682, 5446, 7039, 382, 14711, 6075, 512, 755, 1505, 5823, 10974, 25, 11615, 5980, 8, 1492, 1796, 681, 97031, 18888, 286, 3270, 286, 1796, 682, 5446, 7039, 627, 286, 3270, 286, 471, 510, 97031, 6521, 8856, 4962, 8, 369, 1401, 304, 3000, 673, 12919, 10974, 5680, 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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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, 861, 682, 5446, 7039, 382, 14711, 6075, 512, 755, 1505, 5823, 10974, 25, 11615, 5980, 8, 1492, 1796, 681, 97031, 18888, 286, 3270, 286, 1796, 682, 5446, 7039, 627, 286, 3270, 286, 471, 510, 97031, 6521, 8856, 4962, 8, 369, 1401, 304, 3000, 673, 12919, 10974, 5680, 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 ]
genialis/resolwe-runtime-utils
resolwe_runtime_utils.py
export_file
def export_file(file_path): """Prepend the given parameter with ``export``""" if not os.path.isfile(file_path): return error("Referenced file does not exist: '{}'.".format(file_path)) return "export {}".format(file_path)
python
def export_file(file_path): """Prepend the given parameter with ``export``""" if not os.path.isfile(file_path): return error("Referenced file does not exist: '{}'.".format(file_path)) return "export {}".format(file_path)
[ "def", "export_file", "(", "file_path", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "file_path", ")", ":", "return", "error", "(", "\"Referenced file does not exist: '{}'.\"", ".", "format", "(", "file_path", ")", ")", "return", "\"export {}\"", ".", "format", "(", "file_path", ")" ]
Prepend the given parameter with ``export``
[ "Prepend", "the", "given", "parameter", "with", "export" ]
train
https://github.com/genialis/resolwe-runtime-utils/blob/5657d7cf981972a5259b9b475eae220479401001/resolwe_runtime_utils.py#L305-L311
<|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: Prepend the given parameter with ``export`` ### Response: def export_file(file_path): """Prepend the given parameter with ``export``""" if not os.path.isfile(file_path): return error("Referenced file does not exist: '{}'.".format(file_path)) return "export {}".format(file_path) <|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, 4808, 3825, 279, 2728, 5852, 449, 10103, 1562, 14196, 271, 14711, 6075, 512, 755, 7637, 2517, 4971, 2703, 997, 262, 4304, 4808, 3825, 279, 2728, 5852, 449, 10103, 1562, 14196, 15425, 262, 422, 539, 2709, 3960, 40047, 4971, 2703, 997, 286, 471, 1493, 446, 48547, 5886, 1052, 1587, 539, 3073, 25, 70522, 38011, 2293, 4971, 2703, 4489, 262, 471, 330, 1562, 21532, 2293, 4971, 2703, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 4808, 3825, 279, 2728, 5852, 449, 10103, 1562, 14196, 271, 14711, 6075, 512, 755, 7637, 2517, 4971, 2703, 997, 262, 4304, 4808, 3825, 279, 2728, 5852, 449, 10103, 1562, 14196, 15425, 262, 422, 539, 2709, 3960, 40047, 4971, 2703, 997, 286, 471, 1493, 446, 48547, 5886, 1052, 1587, 539, 3073, 25, 70522, 38011, 2293, 4971, 2703, 4489, 262, 471, 330, 1562, 21532, 2293, 4971, 2703, 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 ]
djungelorm/sphinx-csharp
sphinx_csharp/csharp.py
parse_type_signature
def parse_type_signature(sig): """ Parse a type signature """ match = TYPE_SIG_RE.match(sig.strip()) if not match: raise RuntimeError('Type signature invalid, got ' + sig) groups = match.groups() typ = groups[0] generic_types = groups[1] if not generic_types: generic_types = [] else: generic_types = split_sig(generic_types[1:-1]) is_array = (groups[2] is not None) return typ, generic_types, is_array
python
def parse_type_signature(sig): """ Parse a type signature """ match = TYPE_SIG_RE.match(sig.strip()) if not match: raise RuntimeError('Type signature invalid, got ' + sig) groups = match.groups() typ = groups[0] generic_types = groups[1] if not generic_types: generic_types = [] else: generic_types = split_sig(generic_types[1:-1]) is_array = (groups[2] is not None) return typ, generic_types, is_array
[ "def", "parse_type_signature", "(", "sig", ")", ":", "match", "=", "TYPE_SIG_RE", ".", "match", "(", "sig", ".", "strip", "(", ")", ")", "if", "not", "match", ":", "raise", "RuntimeError", "(", "'Type signature invalid, got '", "+", "sig", ")", "groups", "=", "match", ".", "groups", "(", ")", "typ", "=", "groups", "[", "0", "]", "generic_types", "=", "groups", "[", "1", "]", "if", "not", "generic_types", ":", "generic_types", "=", "[", "]", "else", ":", "generic_types", "=", "split_sig", "(", "generic_types", "[", "1", ":", "-", "1", "]", ")", "is_array", "=", "(", "groups", "[", "2", "]", "is", "not", "None", ")", "return", "typ", ",", "generic_types", ",", "is_array" ]
Parse a type signature
[ "Parse", "a", "type", "signature" ]
train
https://github.com/djungelorm/sphinx-csharp/blob/aaa0c5fbe514d7f0b1a89625185fc608e5d30702/sphinx_csharp/csharp.py#L122-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: Parse a type signature ### Response: def parse_type_signature(sig): """ Parse a type signature """ match = TYPE_SIG_RE.match(sig.strip()) if not match: raise RuntimeError('Type signature invalid, got ' + sig) groups = match.groups() typ = groups[0] generic_types = groups[1] if not generic_types: generic_types = [] else: generic_types = split_sig(generic_types[1:-1]) is_array = (groups[2] is not None) return typ, generic_types, is_array <|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, 264, 955, 12223, 271, 14711, 6075, 512, 755, 4820, 1857, 40959, 50229, 997, 262, 4304, 15118, 264, 955, 12223, 3270, 262, 2489, 284, 12736, 56787, 2241, 11319, 50229, 17624, 2455, 262, 422, 539, 2489, 512, 286, 4933, 45643, 493, 941, 12223, 8482, 11, 2751, 364, 489, 8531, 340, 262, 5315, 284, 2489, 41721, 746, 262, 3666, 284, 5315, 58, 15, 933, 262, 14281, 9962, 284, 5315, 58, 16, 933, 262, 422, 539, 14281, 9962, 512, 286, 14281, 9962, 284, 4260, 262, 775, 512, 286, 14281, 9962, 284, 6859, 30352, 3348, 3553, 9962, 58, 16, 11184, 16, 2608, 262, 374, 3943, 284, 320, 17171, 58, 17, 60, 374, 539, 2290, 340, 262, 471, 3666, 11, 14281, 9962, 11, 374, 3943, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 264, 955, 12223, 271, 14711, 6075, 512, 755, 4820, 1857, 40959, 50229, 997, 262, 4304, 15118, 264, 955, 12223, 3270, 262, 2489, 284, 12736, 56787, 2241, 11319, 50229, 17624, 2455, 262, 422, 539, 2489, 512, 286, 4933, 45643, 493, 941, 12223, 8482, 11, 2751, 364, 489, 8531, 340, 262, 5315, 284, 2489, 41721, 746, 262, 3666, 284, 5315, 58, 15, 933, 262, 14281, 9962, 284, 5315, 58, 16, 933, 262, 422, 539, 14281, 9962, 512, 286, 14281, 9962, 284, 4260, 262, 775, 512, 286, 14281, 9962, 284, 6859, 30352, 3348, 3553, 9962, 58, 16, 11184, 16, 2608, 262, 374, 3943, 284, 320, 17171, 58, 17, 60, 374, 539, 2290, 340, 262, 471, 3666, 11, 14281, 9962, 11, 374, 3943, 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 ]
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
MAVLink.gps_raw_int_encode
def gps_raw_int_encode(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible): ''' The global position, as returned by the Global Positioning System (GPS). This is NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t) fix_type : See the GPS_FIX_TYPE enum. (uint8_t) lat : Latitude (WGS84), in degrees * 1E7 (int32_t) lon : Longitude (WGS84), in degrees * 1E7 (int32_t) alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t) eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t) cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t) satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t) ''' return MAVLink_gps_raw_int_message(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible)
python
def gps_raw_int_encode(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible): ''' The global position, as returned by the Global Positioning System (GPS). This is NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t) fix_type : See the GPS_FIX_TYPE enum. (uint8_t) lat : Latitude (WGS84), in degrees * 1E7 (int32_t) lon : Longitude (WGS84), in degrees * 1E7 (int32_t) alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t) eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t) cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t) satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t) ''' return MAVLink_gps_raw_int_message(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible)
[ "def", "gps_raw_int_encode", "(", "self", ",", "time_usec", ",", "fix_type", ",", "lat", ",", "lon", ",", "alt", ",", "eph", ",", "epv", ",", "vel", ",", "cog", ",", "satellites_visible", ")", ":", "return", "MAVLink_gps_raw_int_message", "(", "time_usec", ",", "fix_type", ",", "lat", ",", "lon", ",", "alt", ",", "eph", ",", "epv", ",", "vel", ",", "cog", ",", "satellites_visible", ")" ]
The global position, as returned by the Global Positioning System (GPS). This is NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t) fix_type : See the GPS_FIX_TYPE enum. (uint8_t) lat : Latitude (WGS84), in degrees * 1E7 (int32_t) lon : Longitude (WGS84), in degrees * 1E7 (int32_t) alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t) eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t) cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t) satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
[ "The", "global", "position", "as", "returned", "by", "the", "Global", "Positioning", "System", "(", "GPS", ")", ".", "This", "is", "NOT", "the", "global", "position", "estimate", "of", "the", "system", "but", "rather", "a", "RAW", "sensor", "value", ".", "See", "message", "GLOBAL_POSITION", "for", "the", "global", "position", "estimate", ".", "Coordinate", "frame", "is", "right", "-", "handed", "Z", "-", "axis", "up", "(", "GPS", "frame", ")", "." ]
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8913-L8934
<|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 global position, as returned by the Global Positioning System (GPS). This is NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t) fix_type : See the GPS_FIX_TYPE enum. (uint8_t) lat : Latitude (WGS84), in degrees * 1E7 (int32_t) lon : Longitude (WGS84), in degrees * 1E7 (int32_t) alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t) eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t) cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t) satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t) ### Response: def gps_raw_int_encode(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible): ''' The global position, as returned by the Global Positioning System (GPS). This is NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t) fix_type : See the GPS_FIX_TYPE enum. (uint8_t) lat : Latitude (WGS84), in degrees * 1E7 (int32_t) lon : Longitude (WGS84), in degrees * 1E7 (int32_t) alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t) eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t) cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t) satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t) ''' return MAVLink_gps_raw_int_message(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible) <|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, 3728, 2361, 11, 439, 6052, 555, 279, 8121, 12661, 287, 744, 198, 394, 320, 64276, 570, 1115, 374, 338, 4276, 279, 3728, 2361, 198, 394, 16430, 315, 279, 1887, 11, 719, 4856, 264, 53951, 12271, 907, 627, 394, 3580, 1984, 42387, 34680, 369, 279, 3728, 2361, 198, 394, 16430, 13, 42135, 4124, 374, 1314, 37240, 11, 1901, 36421, 709, 198, 394, 320, 64276, 4124, 3677, 394, 892, 44147, 338, 551, 33858, 320, 41543, 17859, 2533, 55910, 16746, 477, 85862, 2533, 1887, 10677, 8, 320, 2557, 1227, 530, 340, 394, 5155, 1857, 1733, 551, 3580, 279, 24229, 43735, 4283, 7773, 13, 320, 2557, 23, 530, 340, 394, 6987, 5291, 551, 68440, 320, 54, 16929, 5833, 705, 304, 12628, 353, 220, 16, 36, 22, 320, 396, 843, 530, 340, 394, 18285, 5291, 551, 80209, 320, 54, 16929, 5833, 705, 304, 12628, 353, 220, 16, 36, 22, 320, 396, 843, 530, 340, 394, 4902, 5291, 551, 24610, 3993, 320, 1428, 8143, 11, 4276, 468, 16929, 5833, 705, 304, 20645, 353, 220, 1041, 15, 320, 31587, 369, 709, 570, 7181, 430, 21907, 682, 24229, 13761, 3493, 279, 98370, 43, 36958, 304, 5369, 311, 279, 468, 16929, 5833, 36958, 13, 320, 396, 843, 530, 340, 394, 384, 764, 5291, 551, 24229, 12445, 3143, 16600, 19371, 1516, 315, 2361, 320, 3928, 1752, 570, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 4248, 85, 5291, 551, 24229, 650, 35, 3143, 12414, 19371, 1516, 315, 2361, 320, 3928, 1752, 570, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 9231, 5291, 551, 24229, 5015, 4732, 320, 76, 2754, 353, 220, 1041, 570, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 62666, 5291, 551, 17026, 927, 5015, 320, 14394, 14836, 11, 719, 5216, 315, 7351, 8, 304, 12628, 353, 220, 1041, 11, 220, 15, 13, 15, 497, 19192, 13, 1484, 12628, 13, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 47710, 35471, 286, 551, 5742, 315, 47710, 9621, 13, 1442, 9987, 11, 743, 311, 220, 3192, 320, 2557, 23, 530, 696, 14711, 6075, 512, 755, 46667, 16453, 4132, 11473, 1214, 11, 892, 44147, 11, 5155, 1857, 11, 6987, 11, 18285, 11, 4902, 11, 384, 764, 11, 4248, 85, 11, 9231, 11, 62666, 11, 47710, 35471, 997, 394, 11414, 394, 578, 3728, 2361, 11, 439, 6052, 555, 279, 8121, 12661, 287, 744, 198, 394, 320, 64276, 570, 1115, 374, 338, 4276, 279, 3728, 2361, 198, 394, 16430, 315, 279, 1887, 11, 719, 4856, 264, 53951, 12271, 907, 627, 394, 3580, 1984, 42387, 34680, 369, 279, 3728, 2361, 198, 394, 16430, 13, 42135, 4124, 374, 1314, 37240, 11, 1901, 36421, 709, 198, 394, 320, 64276, 4124, 3677, 394, 892, 44147, 338, 551, 33858, 320, 41543, 17859 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 3728, 2361, 11, 439, 6052, 555, 279, 8121, 12661, 287, 744, 198, 394, 320, 64276, 570, 1115, 374, 338, 4276, 279, 3728, 2361, 198, 394, 16430, 315, 279, 1887, 11, 719, 4856, 264, 53951, 12271, 907, 627, 394, 3580, 1984, 42387, 34680, 369, 279, 3728, 2361, 198, 394, 16430, 13, 42135, 4124, 374, 1314, 37240, 11, 1901, 36421, 709, 198, 394, 320, 64276, 4124, 3677, 394, 892, 44147, 338, 551, 33858, 320, 41543, 17859, 2533, 55910, 16746, 477, 85862, 2533, 1887, 10677, 8, 320, 2557, 1227, 530, 340, 394, 5155, 1857, 1733, 551, 3580, 279, 24229, 43735, 4283, 7773, 13, 320, 2557, 23, 530, 340, 394, 6987, 5291, 551, 68440, 320, 54, 16929, 5833, 705, 304, 12628, 353, 220, 16, 36, 22, 320, 396, 843, 530, 340, 394, 18285, 5291, 551, 80209, 320, 54, 16929, 5833, 705, 304, 12628, 353, 220, 16, 36, 22, 320, 396, 843, 530, 340, 394, 4902, 5291, 551, 24610, 3993, 320, 1428, 8143, 11, 4276, 468, 16929, 5833, 705, 304, 20645, 353, 220, 1041, 15, 320, 31587, 369, 709, 570, 7181, 430, 21907, 682, 24229, 13761, 3493, 279, 98370, 43, 36958, 304, 5369, 311, 279, 468, 16929, 5833, 36958, 13, 320, 396, 843, 530, 340, 394, 384, 764, 5291, 551, 24229, 12445, 3143, 16600, 19371, 1516, 315, 2361, 320, 3928, 1752, 570, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 4248, 85, 5291, 551, 24229, 650, 35, 3143, 12414, 19371, 1516, 315, 2361, 320, 3928, 1752, 570, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 9231, 5291, 551, 24229, 5015, 4732, 320, 76, 2754, 353, 220, 1041, 570, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 62666, 5291, 551, 17026, 927, 5015, 320, 14394, 14836, 11, 719, 5216, 315, 7351, 8, 304, 12628, 353, 220, 1041, 11, 220, 15, 13, 15, 497, 19192, 13, 1484, 12628, 13, 1442, 9987, 11, 743, 311, 25, 13975, 845, 6949, 320, 2557, 845, 530, 340, 394, 47710, 35471, 286, 551, 5742, 315, 47710, 9621, 13, 1442, 9987, 11, 743, 311, 220, 3192, 320, 2557, 23, 530, 696, 14711, 6075, 512, 755, 46667, 16453, 4132, 11473, 1214, 11, 892, 44147, 11, 5155, 1857, 11, 6987, 11, 18285, 11, 4902, 11, 384, 764, 11, 4248, 85, 11, 9231, 11, 62666, 11, 47710, 35471, 997, 394, 11414, 394, 578, 3728, 2361, 11, 439, 6052, 555, 279, 8121, 12661, 287, 744, 198, 394, 320, 64276, 570, 1115, 374, 338, 4276, 279, 3728, 2361, 198, 394, 16430, 315, 279, 1887, 11, 719, 4856, 264, 53951, 12271, 907, 627, 394, 3580, 1984, 42387, 34680, 369, 279, 3728, 2361, 198, 394, 16430, 13, 42135, 4124, 374, 1314, 37240, 11, 1901, 36421, 709, 198, 394, 320, 64276, 4124, 3677, 394, 892, 44147, 338, 551, 33858, 320, 41543, 17859 ]
ThreatConnect-Inc/tcex
tcex/tcex.py
TcEx.metric
def metric(self, name, description, data_type, interval, keyed=False): """Get instance of the Metrics module. Args: name (string): The name for the metric. description (string): The description of the metric. data_type (string): The type of metric: Sum, Count, Min, Max, First, Last, and Average. interval (string): The metric interval: Hourly, Daily, Weekly, Monthly, and Yearly. keyed (boolean): Indicates whether the data will have a keyed value. Returns: (object): An instance of the Metrics Class. """ from .tcex_metrics_v2 import TcExMetricsV2 return TcExMetricsV2(self, name, description, data_type, interval, keyed)
python
def metric(self, name, description, data_type, interval, keyed=False): """Get instance of the Metrics module. Args: name (string): The name for the metric. description (string): The description of the metric. data_type (string): The type of metric: Sum, Count, Min, Max, First, Last, and Average. interval (string): The metric interval: Hourly, Daily, Weekly, Monthly, and Yearly. keyed (boolean): Indicates whether the data will have a keyed value. Returns: (object): An instance of the Metrics Class. """ from .tcex_metrics_v2 import TcExMetricsV2 return TcExMetricsV2(self, name, description, data_type, interval, keyed)
[ "def", "metric", "(", "self", ",", "name", ",", "description", ",", "data_type", ",", "interval", ",", "keyed", "=", "False", ")", ":", "from", ".", "tcex_metrics_v2", "import", "TcExMetricsV2", "return", "TcExMetricsV2", "(", "self", ",", "name", ",", "description", ",", "data_type", ",", "interval", ",", "keyed", ")" ]
Get instance of the Metrics module. Args: name (string): The name for the metric. description (string): The description of the metric. data_type (string): The type of metric: Sum, Count, Min, Max, First, Last, and Average. interval (string): The metric interval: Hourly, Daily, Weekly, Monthly, and Yearly. keyed (boolean): Indicates whether the data will have a keyed value. Returns: (object): An instance of the Metrics Class.
[ "Get", "instance", "of", "the", "Metrics", "module", "." ]
train
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex.py#L667-L682
<|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 instance of the Metrics module. Args: name (string): The name for the metric. description (string): The description of the metric. data_type (string): The type of metric: Sum, Count, Min, Max, First, Last, and Average. interval (string): The metric interval: Hourly, Daily, Weekly, Monthly, and Yearly. keyed (boolean): Indicates whether the data will have a keyed value. Returns: (object): An instance of the Metrics Class. ### Response: def metric(self, name, description, data_type, interval, keyed=False): """Get instance of the Metrics module. Args: name (string): The name for the metric. description (string): The description of the metric. data_type (string): The type of metric: Sum, Count, Min, Max, First, Last, and Average. interval (string): The metric interval: Hourly, Daily, Weekly, Monthly, and Yearly. keyed (boolean): Indicates whether the data will have a keyed value. Returns: (object): An instance of the Metrics Class. """ from .tcex_metrics_v2 import TcExMetricsV2 return TcExMetricsV2(self, name, description, data_type, interval, keyed) <|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, 2937, 315, 279, 55290, 4793, 382, 286, 18161, 512, 310, 836, 320, 928, 1680, 578, 836, 369, 279, 18767, 627, 310, 4096, 320, 928, 1680, 578, 4096, 315, 279, 18767, 627, 310, 828, 1857, 320, 928, 1680, 578, 955, 315, 18767, 25, 8279, 11, 4605, 11, 3468, 11, 7639, 11, 5629, 11, 8155, 11, 323, 24478, 627, 310, 10074, 320, 928, 1680, 578, 18767, 10074, 25, 31933, 398, 11, 13690, 11, 34114, 11, 45434, 11, 323, 9941, 398, 627, 310, 91629, 320, 6245, 1680, 45367, 3508, 279, 828, 690, 617, 264, 91629, 907, 382, 286, 5295, 512, 310, 320, 1735, 1680, 1556, 2937, 315, 279, 55290, 3308, 382, 14711, 6075, 512, 755, 18767, 1214, 11, 836, 11, 4096, 11, 828, 1857, 11, 10074, 11, 91629, 5725, 997, 286, 4304, 1991, 2937, 315, 279, 55290, 4793, 382, 286, 18161, 512, 310, 836, 320, 928, 1680, 578, 836, 369, 279, 18767, 627, 310, 4096, 320, 928, 1680, 578, 4096, 315, 279, 18767, 627, 310, 828, 1857, 320, 928, 1680, 578, 955, 315, 18767, 25, 8279, 11, 4605, 11, 3468, 11, 7639, 11, 5629, 11, 8155, 11, 323, 24478, 627, 310, 10074, 320, 928, 1680, 578, 18767, 10074, 25, 31933, 398, 11, 13690, 11, 34114, 11, 45434, 11, 323, 9941, 398, 627, 310, 91629, 320, 6245, 1680, 45367, 3508, 279, 828, 690, 617, 264, 91629, 907, 382, 286, 5295, 512, 310, 320, 1735, 1680, 1556, 2937, 315, 279, 55290, 3308, 627, 286, 3270, 286, 505, 662, 10630, 327, 38786, 2325, 17, 1179, 350, 66, 849, 28428, 53, 17, 271, 286, 471, 350, 66, 849, 28428, 53, 17, 1214, 11, 836, 11, 4096, 11, 828, 1857, 11, 10074, 11, 91629, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 2937, 315, 279, 55290, 4793, 382, 286, 18161, 512, 310, 836, 320, 928, 1680, 578, 836, 369, 279, 18767, 627, 310, 4096, 320, 928, 1680, 578, 4096, 315, 279, 18767, 627, 310, 828, 1857, 320, 928, 1680, 578, 955, 315, 18767, 25, 8279, 11, 4605, 11, 3468, 11, 7639, 11, 5629, 11, 8155, 11, 323, 24478, 627, 310, 10074, 320, 928, 1680, 578, 18767, 10074, 25, 31933, 398, 11, 13690, 11, 34114, 11, 45434, 11, 323, 9941, 398, 627, 310, 91629, 320, 6245, 1680, 45367, 3508, 279, 828, 690, 617, 264, 91629, 907, 382, 286, 5295, 512, 310, 320, 1735, 1680, 1556, 2937, 315, 279, 55290, 3308, 382, 14711, 6075, 512, 755, 18767, 1214, 11, 836, 11, 4096, 11, 828, 1857, 11, 10074, 11, 91629, 5725, 997, 286, 4304, 1991, 2937, 315, 279, 55290, 4793, 382, 286, 18161, 512, 310, 836, 320, 928, 1680, 578, 836, 369, 279, 18767, 627, 310, 4096, 320, 928, 1680, 578, 4096, 315, 279, 18767, 627, 310, 828, 1857, 320, 928, 1680, 578, 955, 315, 18767, 25, 8279, 11, 4605, 11, 3468, 11, 7639, 11, 5629, 11, 8155, 11, 323, 24478, 627, 310, 10074, 320, 928, 1680, 578, 18767, 10074, 25, 31933, 398, 11, 13690, 11, 34114, 11, 45434, 11, 323, 9941, 398, 627, 310, 91629, 320, 6245, 1680, 45367, 3508, 279, 828, 690, 617, 264, 91629, 907, 382, 286, 5295, 512, 310, 320, 1735, 1680, 1556, 2937, 315, 279, 55290, 3308, 627, 286, 3270, 286, 505, 662, 10630, 327, 38786, 2325, 17, 1179, 350, 66, 849, 28428, 53, 17, 271, 286, 471, 350, 66, 849, 28428, 53, 17, 1214, 11, 836, 11, 4096, 11, 828, 1857, 11, 10074, 11, 91629, 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 ]
gwpy/gwpy
gwpy/spectrogram/spectrogram.py
Spectrogram.crop_frequencies
def crop_frequencies(self, low=None, high=None, copy=False): """Crop this `Spectrogram` to the specified frequencies Parameters ---------- low : `float` lower frequency bound for cropped `Spectrogram` high : `float` upper frequency bound for cropped `Spectrogram` copy : `bool` if `False` return a view of the original data, otherwise create a fresh memory copy Returns ------- spec : `Spectrogram` A new `Spectrogram` with a subset of data from the frequency axis """ if low is not None: low = units.Quantity(low, self._default_yunit) if high is not None: high = units.Quantity(high, self._default_yunit) # check low frequency if low is not None and low == self.f0: low = None elif low is not None and low < self.f0: warnings.warn('Spectrogram.crop_frequencies given low frequency ' 'cutoff below f0 of the input Spectrogram. Low ' 'frequency crop will have no effect.') # check high frequency if high is not None and high.value == self.band[1]: high = None elif high is not None and high.value > self.band[1]: warnings.warn('Spectrogram.crop_frequencies given high frequency ' 'cutoff above cutoff of the input Spectrogram. High ' 'frequency crop will have no effect.') # find low index if low is None: idx0 = None else: idx0 = int(float(low.value - self.f0.value) // self.df.value) # find high index if high is None: idx1 = None else: idx1 = int(float(high.value - self.f0.value) // self.df.value) # crop if copy: return self[:, idx0:idx1].copy() return self[:, idx0:idx1]
python
def crop_frequencies(self, low=None, high=None, copy=False): """Crop this `Spectrogram` to the specified frequencies Parameters ---------- low : `float` lower frequency bound for cropped `Spectrogram` high : `float` upper frequency bound for cropped `Spectrogram` copy : `bool` if `False` return a view of the original data, otherwise create a fresh memory copy Returns ------- spec : `Spectrogram` A new `Spectrogram` with a subset of data from the frequency axis """ if low is not None: low = units.Quantity(low, self._default_yunit) if high is not None: high = units.Quantity(high, self._default_yunit) # check low frequency if low is not None and low == self.f0: low = None elif low is not None and low < self.f0: warnings.warn('Spectrogram.crop_frequencies given low frequency ' 'cutoff below f0 of the input Spectrogram. Low ' 'frequency crop will have no effect.') # check high frequency if high is not None and high.value == self.band[1]: high = None elif high is not None and high.value > self.band[1]: warnings.warn('Spectrogram.crop_frequencies given high frequency ' 'cutoff above cutoff of the input Spectrogram. High ' 'frequency crop will have no effect.') # find low index if low is None: idx0 = None else: idx0 = int(float(low.value - self.f0.value) // self.df.value) # find high index if high is None: idx1 = None else: idx1 = int(float(high.value - self.f0.value) // self.df.value) # crop if copy: return self[:, idx0:idx1].copy() return self[:, idx0:idx1]
[ "def", "crop_frequencies", "(", "self", ",", "low", "=", "None", ",", "high", "=", "None", ",", "copy", "=", "False", ")", ":", "if", "low", "is", "not", "None", ":", "low", "=", "units", ".", "Quantity", "(", "low", ",", "self", ".", "_default_yunit", ")", "if", "high", "is", "not", "None", ":", "high", "=", "units", ".", "Quantity", "(", "high", ",", "self", ".", "_default_yunit", ")", "# check low frequency", "if", "low", "is", "not", "None", "and", "low", "==", "self", ".", "f0", ":", "low", "=", "None", "elif", "low", "is", "not", "None", "and", "low", "<", "self", ".", "f0", ":", "warnings", ".", "warn", "(", "'Spectrogram.crop_frequencies given low frequency '", "'cutoff below f0 of the input Spectrogram. Low '", "'frequency crop will have no effect.'", ")", "# check high frequency", "if", "high", "is", "not", "None", "and", "high", ".", "value", "==", "self", ".", "band", "[", "1", "]", ":", "high", "=", "None", "elif", "high", "is", "not", "None", "and", "high", ".", "value", ">", "self", ".", "band", "[", "1", "]", ":", "warnings", ".", "warn", "(", "'Spectrogram.crop_frequencies given high frequency '", "'cutoff above cutoff of the input Spectrogram. High '", "'frequency crop will have no effect.'", ")", "# find low index", "if", "low", "is", "None", ":", "idx0", "=", "None", "else", ":", "idx0", "=", "int", "(", "float", "(", "low", ".", "value", "-", "self", ".", "f0", ".", "value", ")", "//", "self", ".", "df", ".", "value", ")", "# find high index", "if", "high", "is", "None", ":", "idx1", "=", "None", "else", ":", "idx1", "=", "int", "(", "float", "(", "high", ".", "value", "-", "self", ".", "f0", ".", "value", ")", "//", "self", ".", "df", ".", "value", ")", "# crop", "if", "copy", ":", "return", "self", "[", ":", ",", "idx0", ":", "idx1", "]", ".", "copy", "(", ")", "return", "self", "[", ":", ",", "idx0", ":", "idx1", "]" ]
Crop this `Spectrogram` to the specified frequencies Parameters ---------- low : `float` lower frequency bound for cropped `Spectrogram` high : `float` upper frequency bound for cropped `Spectrogram` copy : `bool` if `False` return a view of the original data, otherwise create a fresh memory copy Returns ------- spec : `Spectrogram` A new `Spectrogram` with a subset of data from the frequency axis
[ "Crop", "this", "Spectrogram", "to", "the", "specified", "frequencies" ]
train
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/spectrogram/spectrogram.py#L541-L591
<|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: Crop this `Spectrogram` to the specified frequencies Parameters ---------- low : `float` lower frequency bound for cropped `Spectrogram` high : `float` upper frequency bound for cropped `Spectrogram` copy : `bool` if `False` return a view of the original data, otherwise create a fresh memory copy Returns ------- spec : `Spectrogram` A new `Spectrogram` with a subset of data from the frequency axis ### Response: def crop_frequencies(self, low=None, high=None, copy=False): """Crop this `Spectrogram` to the specified frequencies Parameters ---------- low : `float` lower frequency bound for cropped `Spectrogram` high : `float` upper frequency bound for cropped `Spectrogram` copy : `bool` if `False` return a view of the original data, otherwise create a fresh memory copy Returns ------- spec : `Spectrogram` A new `Spectrogram` with a subset of data from the frequency axis """ if low is not None: low = units.Quantity(low, self._default_yunit) if high is not None: high = units.Quantity(high, self._default_yunit) # check low frequency if low is not None and low == self.f0: low = None elif low is not None and low < self.f0: warnings.warn('Spectrogram.crop_frequencies given low frequency ' 'cutoff below f0 of the input Spectrogram. Low ' 'frequency crop will have no effect.') # check high frequency if high is not None and high.value == self.band[1]: high = None elif high is not None and high.value > self.band[1]: warnings.warn('Spectrogram.crop_frequencies given high frequency ' 'cutoff above cutoff of the input Spectrogram. High ' 'frequency crop will have no effect.') # find low index if low is None: idx0 = None else: idx0 = int(float(low.value - self.f0.value) // self.df.value) # find high index if high is None: idx1 = None else: idx1 = int(float(high.value - self.f0.value) // self.df.value) # crop if copy: return self[:, idx0:idx1].copy() return self[:, idx0:idx1] <|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, 63246, 420, 1595, 50, 1002, 87220, 63, 311, 279, 5300, 34873, 271, 286, 13831, 198, 286, 31423, 286, 3428, 551, 1595, 3733, 4077, 310, 4827, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 1579, 551, 1595, 3733, 4077, 310, 8582, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 3048, 551, 1595, 2707, 4077, 310, 422, 1595, 4139, 63, 471, 264, 1684, 315, 279, 4113, 828, 11, 6062, 1893, 198, 310, 264, 7878, 5044, 3048, 271, 286, 5295, 198, 286, 39707, 286, 1424, 551, 1595, 50, 1002, 87220, 4077, 310, 362, 502, 1595, 50, 1002, 87220, 63, 449, 264, 27084, 315, 828, 505, 279, 11900, 198, 310, 8183, 271, 14711, 6075, 512, 755, 19641, 766, 72831, 1214, 11, 3428, 5980, 11, 1579, 5980, 11, 3048, 5725, 997, 286, 4304, 63246, 420, 1595, 50, 1002, 87220, 63, 311, 279, 5300, 34873, 271, 286, 13831, 198, 286, 31423, 286, 3428, 551, 1595, 3733, 4077, 310, 4827, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 1579, 551, 1595, 3733, 4077, 310, 8582, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 3048, 551, 1595, 2707, 4077, 310, 422, 1595, 4139, 63, 471, 264, 1684, 315, 279, 4113, 828, 11, 6062, 1893, 198, 310, 264, 7878, 5044, 3048, 271, 286, 5295, 198, 286, 39707, 286, 1424, 551, 1595, 50, 1002, 87220, 4077, 310, 362, 502, 1595, 50, 1002, 87220, 63, 449, 264, 27084, 315, 828, 505, 279, 11900, 198, 310, 8183, 198, 286, 3270, 286, 422, 3428, 374, 539, 2290, 512, 310, 3428, 284, 8316, 67367, 58898, 11, 659, 1462, 2309, 4271, 3928, 340, 286, 422, 1579, 374, 539, 2290, 512, 310, 1579, 284, 8316, 67367, 73070, 11, 659, 1462, 2309, 4271, 3928, 340, 286, 674, 1817, 3428, 11900, 198, 286, 422, 3428, 374, 539, 2290, 323, 3428, 624, 659, 840, 15, 512, 310, 3428, 284, 2290, 198, 286, 4508, 3428, 374, 539, 2290, 323, 3428, 366, 659, 840, 15, 512, 310, 19530, 22123, 493, 50, 1002, 87220, 77378, 766, 72831, 2728, 3428, 11900, 8044, 3586, 364, 66, 28540, 3770, 282, 15, 315, 279, 1988, 27726, 87220, 13, 12310, 8044, 3586, 364, 47621, 19641, 690, 617, 912, 2515, 21537, 286, 674, 1817, 1579, 11900, 198, 286, 422, 1579, 374, 539, 2290, 323, 1579, 2894, 624, 659, 75339, 58, 16, 10556, 310, 1579, 284, 2290, 198, 286, 4508, 1579, 374, 539, 2290, 323, 1579, 2894, 871, 659, 75339, 58, 16, 10556, 310, 19530, 22123, 493, 50, 1002, 87220, 77378, 766, 72831, 2728, 1579, 11900, 8044, 3586, 364, 66, 28540, 3485, 45379, 315, 279, 1988, 27726, 87220, 13, 5234, 8044, 3586, 364, 47621, 19641, 690, 617, 912, 2515, 21537, 286, 674, 1505, 3428, 1963, 198, 286, 422, 3428, 374, 2290, 512, 310, 7335, 15, 284, 2290, 198, 286, 775, 512, 310, 7335, 15, 284, 528, 8432, 58898, 2894, 482, 659, 840, 15, 2894 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 63246, 420, 1595, 50, 1002, 87220, 63, 311, 279, 5300, 34873, 271, 286, 13831, 198, 286, 31423, 286, 3428, 551, 1595, 3733, 4077, 310, 4827, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 1579, 551, 1595, 3733, 4077, 310, 8582, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 3048, 551, 1595, 2707, 4077, 310, 422, 1595, 4139, 63, 471, 264, 1684, 315, 279, 4113, 828, 11, 6062, 1893, 198, 310, 264, 7878, 5044, 3048, 271, 286, 5295, 198, 286, 39707, 286, 1424, 551, 1595, 50, 1002, 87220, 4077, 310, 362, 502, 1595, 50, 1002, 87220, 63, 449, 264, 27084, 315, 828, 505, 279, 11900, 198, 310, 8183, 271, 14711, 6075, 512, 755, 19641, 766, 72831, 1214, 11, 3428, 5980, 11, 1579, 5980, 11, 3048, 5725, 997, 286, 4304, 63246, 420, 1595, 50, 1002, 87220, 63, 311, 279, 5300, 34873, 271, 286, 13831, 198, 286, 31423, 286, 3428, 551, 1595, 3733, 4077, 310, 4827, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 1579, 551, 1595, 3733, 4077, 310, 8582, 11900, 6965, 369, 61243, 1595, 50, 1002, 87220, 4077, 286, 3048, 551, 1595, 2707, 4077, 310, 422, 1595, 4139, 63, 471, 264, 1684, 315, 279, 4113, 828, 11, 6062, 1893, 198, 310, 264, 7878, 5044, 3048, 271, 286, 5295, 198, 286, 39707, 286, 1424, 551, 1595, 50, 1002, 87220, 4077, 310, 362, 502, 1595, 50, 1002, 87220, 63, 449, 264, 27084, 315, 828, 505, 279, 11900, 198, 310, 8183, 198, 286, 3270, 286, 422, 3428, 374, 539, 2290, 512, 310, 3428, 284, 8316, 67367, 58898, 11, 659, 1462, 2309, 4271, 3928, 340, 286, 422, 1579, 374, 539, 2290, 512, 310, 1579, 284, 8316, 67367, 73070, 11, 659, 1462, 2309, 4271, 3928, 340, 286, 674, 1817, 3428, 11900, 198, 286, 422, 3428, 374, 539, 2290, 323, 3428, 624, 659, 840, 15, 512, 310, 3428, 284, 2290, 198, 286, 4508, 3428, 374, 539, 2290, 323, 3428, 366, 659, 840, 15, 512, 310, 19530, 22123, 493, 50, 1002, 87220, 77378, 766, 72831, 2728, 3428, 11900, 8044, 3586, 364, 66, 28540, 3770, 282, 15, 315, 279, 1988, 27726, 87220, 13, 12310, 8044, 3586, 364, 47621, 19641, 690, 617, 912, 2515, 21537, 286, 674, 1817, 1579, 11900, 198, 286, 422, 1579, 374, 539, 2290, 323, 1579, 2894, 624, 659, 75339, 58, 16, 10556, 310, 1579, 284, 2290, 198, 286, 4508, 1579, 374, 539, 2290, 323, 1579, 2894, 871, 659, 75339, 58, 16, 10556, 310, 19530, 22123, 493, 50, 1002, 87220, 77378, 766, 72831, 2728, 1579, 11900, 8044, 3586, 364, 66, 28540, 3485, 45379, 315, 279, 1988, 27726, 87220, 13, 5234, 8044, 3586, 364, 47621, 19641, 690, 617, 912, 2515, 21537, 286, 674, 1505, 3428, 1963, 198, 286, 422, 3428, 374, 2290, 512, 310, 7335, 15, 284, 2290, 198, 286, 775, 512, 310, 7335, 15, 284, 528, 8432, 58898, 2894, 482, 659, 840, 15, 2894 ]
bokeh/bokeh
bokeh/document/document.py
Document.from_json
def from_json(cls, json): ''' Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document : ''' roots_json = json['roots'] root_ids = roots_json['root_ids'] references_json = roots_json['references'] references = instantiate_references_json(references_json) initialize_references_json(references_json, references) doc = Document() for r in root_ids: doc.add_root(references[r]) doc.title = json['title'] return doc
python
def from_json(cls, json): ''' Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document : ''' roots_json = json['roots'] root_ids = roots_json['root_ids'] references_json = roots_json['references'] references = instantiate_references_json(references_json) initialize_references_json(references_json, references) doc = Document() for r in root_ids: doc.add_root(references[r]) doc.title = json['title'] return doc
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "roots_json", "=", "json", "[", "'roots'", "]", "root_ids", "=", "roots_json", "[", "'root_ids'", "]", "references_json", "=", "roots_json", "[", "'references'", "]", "references", "=", "instantiate_references_json", "(", "references_json", ")", "initialize_references_json", "(", "references_json", ",", "references", ")", "doc", "=", "Document", "(", ")", "for", "r", "in", "root_ids", ":", "doc", ".", "add_root", "(", "references", "[", "r", "]", ")", "doc", ".", "title", "=", "json", "[", "'title'", "]", "return", "doc" ]
Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document :
[ "Load", "a", "document", "from", "JSON", "." ]
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L525-L548
<|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: Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document : ### Response: def from_json(cls, json): ''' Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document : ''' roots_json = json['roots'] root_ids = roots_json['root_ids'] references_json = roots_json['references'] references = instantiate_references_json(references_json) initialize_references_json(references_json, references) doc = Document() for r in root_ids: doc.add_root(references[r]) doc.title = json['title'] return doc <|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, 6003, 264, 2246, 505, 4823, 382, 286, 3024, 320, 5483, 14271, 8, 6394, 310, 362, 4823, 93362, 2246, 311, 1893, 264, 502, 12051, 505, 382, 286, 5295, 512, 310, 12051, 14852, 14711, 6075, 512, 755, 505, 9643, 21024, 11, 3024, 997, 286, 11712, 9069, 264, 2246, 505, 4823, 382, 286, 3024, 320, 5483, 14271, 8, 6394, 310, 362, 4823, 93362, 2246, 311, 1893, 264, 502, 12051, 505, 382, 286, 5295, 512, 310, 12051, 14852, 286, 11414, 286, 20282, 9643, 284, 3024, 681, 38265, 4532, 286, 3789, 8237, 284, 20282, 9643, 681, 2959, 8237, 4532, 286, 15407, 9643, 284, 20282, 9643, 681, 37009, 16049, 286, 15407, 284, 42002, 93802, 9643, 5921, 5006, 9643, 340, 286, 9656, 93802, 9643, 5921, 5006, 9643, 11, 15407, 696, 286, 4733, 284, 12051, 746, 286, 369, 436, 304, 3789, 8237, 512, 310, 4733, 1388, 13290, 5921, 5006, 16523, 9801, 286, 4733, 6195, 284, 3024, 681, 2150, 16049, 286, 471, 4733, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 6003, 264, 2246, 505, 4823, 382, 286, 3024, 320, 5483, 14271, 8, 6394, 310, 362, 4823, 93362, 2246, 311, 1893, 264, 502, 12051, 505, 382, 286, 5295, 512, 310, 12051, 14852, 14711, 6075, 512, 755, 505, 9643, 21024, 11, 3024, 997, 286, 11712, 9069, 264, 2246, 505, 4823, 382, 286, 3024, 320, 5483, 14271, 8, 6394, 310, 362, 4823, 93362, 2246, 311, 1893, 264, 502, 12051, 505, 382, 286, 5295, 512, 310, 12051, 14852, 286, 11414, 286, 20282, 9643, 284, 3024, 681, 38265, 4532, 286, 3789, 8237, 284, 20282, 9643, 681, 2959, 8237, 4532, 286, 15407, 9643, 284, 20282, 9643, 681, 37009, 16049, 286, 15407, 284, 42002, 93802, 9643, 5921, 5006, 9643, 340, 286, 9656, 93802, 9643, 5921, 5006, 9643, 11, 15407, 696, 286, 4733, 284, 12051, 746, 286, 369, 436, 304, 3789, 8237, 512, 310, 4733, 1388, 13290, 5921, 5006, 16523, 9801, 286, 4733, 6195, 284, 3024, 681, 2150, 16049, 286, 471, 4733, 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 ]
RJT1990/pyflux
pyflux/ssm/dynlin.py
DynReg._forecast_model
def _forecast_model(self,beta,Z,h): """ Creates forecasted states and variances Parameters ---------- beta : np.ndarray Contains untransformed starting values for latent variables Returns ---------- a : np.ndarray Forecasted states P : np.ndarray Variance of forecasted states """ T, _, R, Q, H = self._ss_matrices(beta) return dl_univariate_kalman_fcst(self.data,Z,H,T,Q,R,0.0,h)
python
def _forecast_model(self,beta,Z,h): """ Creates forecasted states and variances Parameters ---------- beta : np.ndarray Contains untransformed starting values for latent variables Returns ---------- a : np.ndarray Forecasted states P : np.ndarray Variance of forecasted states """ T, _, R, Q, H = self._ss_matrices(beta) return dl_univariate_kalman_fcst(self.data,Z,H,T,Q,R,0.0,h)
[ "def", "_forecast_model", "(", "self", ",", "beta", ",", "Z", ",", "h", ")", ":", "T", ",", "_", ",", "R", ",", "Q", ",", "H", "=", "self", ".", "_ss_matrices", "(", "beta", ")", "return", "dl_univariate_kalman_fcst", "(", "self", ".", "data", ",", "Z", ",", "H", ",", "T", ",", "Q", ",", "R", ",", "0.0", ",", "h", ")" ]
Creates forecasted states and variances Parameters ---------- beta : np.ndarray Contains untransformed starting values for latent variables Returns ---------- a : np.ndarray Forecasted states P : np.ndarray Variance of forecasted states
[ "Creates", "forecasted", "states", "and", "variances" ]
train
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/ssm/dynlin.py#L74-L92
<|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: Creates forecasted states and variances Parameters ---------- beta : np.ndarray Contains untransformed starting values for latent variables Returns ---------- a : np.ndarray Forecasted states P : np.ndarray Variance of forecasted states ### Response: def _forecast_model(self,beta,Z,h): """ Creates forecasted states and variances Parameters ---------- beta : np.ndarray Contains untransformed starting values for latent variables Returns ---------- a : np.ndarray Forecasted states P : np.ndarray Variance of forecasted states """ T, _, R, Q, H = self._ss_matrices(beta) return dl_univariate_kalman_fcst(self.data,Z,H,T,Q,R,0.0,h) <|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, 55968, 18057, 291, 5415, 323, 767, 22566, 271, 286, 13831, 198, 286, 31423, 286, 13746, 551, 2660, 36649, 198, 310, 31911, 653, 4806, 291, 6041, 2819, 369, 42767, 7482, 271, 286, 5295, 198, 286, 31423, 286, 264, 551, 2660, 36649, 198, 310, 56775, 291, 5415, 271, 286, 393, 551, 2660, 36649, 198, 310, 28968, 685, 315, 18057, 291, 5415, 271, 14711, 6075, 512, 755, 721, 60084, 5156, 1214, 8568, 1955, 51932, 20393, 997, 286, 4304, 15026, 18057, 291, 5415, 323, 767, 22566, 271, 286, 13831, 198, 286, 31423, 286, 13746, 551, 2660, 36649, 198, 310, 31911, 653, 4806, 291, 6041, 2819, 369, 42767, 7482, 271, 286, 5295, 198, 286, 31423, 286, 264, 551, 2660, 36649, 198, 310, 56775, 291, 5415, 271, 286, 393, 551, 2660, 36649, 198, 310, 28968, 685, 315, 18057, 291, 5415, 198, 286, 4304, 75625, 286, 350, 11, 8523, 432, 11, 1229, 11, 473, 284, 659, 1462, 784, 96290, 76983, 340, 286, 471, 28613, 5012, 56522, 4803, 278, 1543, 47606, 267, 1214, 2245, 51932, 44639, 20594, 50947, 24412, 11, 15, 13, 15, 20393, 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, 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 ]
[ 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, 55968, 18057, 291, 5415, 323, 767, 22566, 271, 286, 13831, 198, 286, 31423, 286, 13746, 551, 2660, 36649, 198, 310, 31911, 653, 4806, 291, 6041, 2819, 369, 42767, 7482, 271, 286, 5295, 198, 286, 31423, 286, 264, 551, 2660, 36649, 198, 310, 56775, 291, 5415, 271, 286, 393, 551, 2660, 36649, 198, 310, 28968, 685, 315, 18057, 291, 5415, 271, 14711, 6075, 512, 755, 721, 60084, 5156, 1214, 8568, 1955, 51932, 20393, 997, 286, 4304, 15026, 18057, 291, 5415, 323, 767, 22566, 271, 286, 13831, 198, 286, 31423, 286, 13746, 551, 2660, 36649, 198, 310, 31911, 653, 4806, 291, 6041, 2819, 369, 42767, 7482, 271, 286, 5295, 198, 286, 31423, 286, 264, 551, 2660, 36649, 198, 310, 56775, 291, 5415, 271, 286, 393, 551, 2660, 36649, 198, 310, 28968, 685, 315, 18057, 291, 5415, 198, 286, 4304, 75625, 286, 350, 11, 8523, 432, 11, 1229, 11, 473, 284, 659, 1462, 784, 96290, 76983, 340, 286, 471, 28613, 5012, 56522, 4803, 278, 1543, 47606, 267, 1214, 2245, 51932, 44639, 20594, 50947, 24412, 11, 15, 13, 15, 20393, 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 ]
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/core_v1_api.py
CoreV1Api.patch_namespaced_service
def patch_namespaced_service(self, name, namespace, body, **kwargs): # noqa: E501 """patch_namespaced_service # noqa: E501 partially update the specified Service # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_service(name, namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str name: name of the Service (required) :param str namespace: object name and auth scope, such as for teams and projects (required) :param UNKNOWN_BASE_TYPE body: (required) :param str pretty: If 'true', then the output is pretty printed. :param str dry_run: When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed :return: V1Service If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.patch_namespaced_service_with_http_info(name, namespace, body, **kwargs) # noqa: E501 else: (data) = self.patch_namespaced_service_with_http_info(name, namespace, body, **kwargs) # noqa: E501 return data
python
def patch_namespaced_service(self, name, namespace, body, **kwargs): # noqa: E501 """patch_namespaced_service # noqa: E501 partially update the specified Service # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_service(name, namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str name: name of the Service (required) :param str namespace: object name and auth scope, such as for teams and projects (required) :param UNKNOWN_BASE_TYPE body: (required) :param str pretty: If 'true', then the output is pretty printed. :param str dry_run: When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed :return: V1Service If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.patch_namespaced_service_with_http_info(name, namespace, body, **kwargs) # noqa: E501 else: (data) = self.patch_namespaced_service_with_http_info(name, namespace, body, **kwargs) # noqa: E501 return data
[ "def", "patch_namespaced_service", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "patch_namespaced_service_with_http_info", "(", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", "# noqa: E501", "else", ":", "(", "data", ")", "=", "self", ".", "patch_namespaced_service_with_http_info", "(", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", "# noqa: E501", "return", "data" ]
patch_namespaced_service # noqa: E501 partially update the specified Service # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_service(name, namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str name: name of the Service (required) :param str namespace: object name and auth scope, such as for teams and projects (required) :param UNKNOWN_BASE_TYPE body: (required) :param str pretty: If 'true', then the output is pretty printed. :param str dry_run: When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed :return: V1Service If the method is called asynchronously, returns the request thread.
[ "patch_namespaced_service", "#", "noqa", ":", "E501" ]
train
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/core_v1_api.py#L16771-L16795
<|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: patch_namespaced_service # noqa: E501 partially update the specified Service # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_service(name, namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str name: name of the Service (required) :param str namespace: object name and auth scope, such as for teams and projects (required) :param UNKNOWN_BASE_TYPE body: (required) :param str pretty: If 'true', then the output is pretty printed. :param str dry_run: When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed :return: V1Service If the method is called asynchronously, returns the request thread. ### Response: def patch_namespaced_service(self, name, namespace, body, **kwargs): # noqa: E501 """patch_namespaced_service # noqa: E501 partially update the specified Service # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_service(name, namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str name: name of the Service (required) :param str namespace: object name and auth scope, such as for teams and projects (required) :param UNKNOWN_BASE_TYPE body: (required) :param str pretty: If 'true', then the output is pretty printed. :param str dry_run: When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed :return: V1Service If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.patch_namespaced_service_with_http_info(name, namespace, body, **kwargs) # noqa: E501 else: (data) = self.patch_namespaced_service_with_http_info(name, namespace, body, **kwargs) # noqa: E501 return data <|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, 3482, 9366, 69652, 12547, 220, 674, 46721, 25, 469, 14408, 271, 286, 26310, 2713, 279, 5300, 5475, 220, 674, 46721, 25, 469, 14408, 198, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 1522, 3393, 18110, 3702, 198, 286, 12382, 4617, 284, 6464, 27799, 9366, 69652, 12547, 3232, 11, 4573, 11, 2547, 11, 3393, 18110, 3702, 340, 286, 12382, 1121, 284, 4617, 673, 2892, 286, 551, 913, 3393, 18110, 1845, 198, 286, 551, 913, 610, 836, 25, 836, 315, 279, 5475, 320, 6413, 340, 286, 551, 913, 610, 4573, 25, 1665, 836, 323, 4259, 7036, 11, 1778, 439, 369, 7411, 323, 7224, 320, 6413, 340, 286, 551, 913, 62495, 12024, 4283, 2547, 25, 320, 6413, 340, 286, 551, 913, 610, 5128, 25, 1442, 364, 1904, 518, 1243, 279, 2612, 374, 5128, 17124, 627, 286, 551, 913, 610, 9235, 14334, 25, 3277, 3118, 11, 15151, 430, 29882, 1288, 539, 387, 54095, 13, 1556, 8482, 477, 97239, 9235, 6869, 34959, 690, 1121, 304, 459, 1493, 2077, 323, 912, 4726, 8863, 315, 279, 1715, 13, 7974, 2819, 527, 25, 482, 2052, 25, 682, 9235, 1629, 18094, 690, 387, 15590, 198, 286, 551, 693, 25, 650, 16, 1898, 198, 338, 1442, 279, 1749, 374, 2663, 68881, 345, 338, 4780, 279, 1715, 4617, 382, 14711, 6075, 512, 755, 11140, 9366, 69652, 12547, 1214, 11, 836, 11, 4573, 11, 2547, 11, 3146, 9872, 1680, 220, 674, 46721, 25, 469, 14408, 198, 286, 4304, 3482, 9366, 69652, 12547, 220, 674, 46721, 25, 469, 14408, 271, 286, 26310, 2713, 279, 5300, 5475, 220, 674, 46721, 25, 469, 14408, 198, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 1522, 3393, 18110, 3702, 198, 286, 12382, 4617, 284, 6464, 27799, 9366, 69652, 12547, 3232, 11, 4573, 11, 2547, 11, 3393, 18110, 3702, 340, 286, 12382, 1121, 284, 4617, 673, 2892, 286, 551, 913, 3393, 18110, 1845, 198, 286, 551, 913, 610, 836, 25, 836, 315, 279, 5475, 320, 6413, 340, 286, 551, 913, 610, 4573, 25, 1665, 836, 323, 4259, 7036, 11, 1778, 439, 369, 7411, 323, 7224, 320, 6413, 340, 286, 551, 913, 62495, 12024, 4283, 2547, 25, 320, 6413, 340, 286, 551, 913, 610, 5128, 25, 1442, 364, 1904, 518, 1243, 279, 2612, 374, 5128, 17124, 627, 286, 551, 913, 610, 9235, 14334, 25, 3277, 3118, 11, 15151, 430, 29882, 1288, 539, 387, 54095, 13, 1556, 8482, 477, 97239, 9235, 6869, 34959, 690, 1121, 304, 459, 1493, 2077, 323, 912, 4726, 8863, 315, 279, 1715, 13, 7974, 2819, 527, 25, 482, 2052, 25, 682, 9235, 1629, 18094, 690, 387, 15590, 198, 286, 551, 693, 25, 650, 16, 1898, 198, 338, 1442, 279, 1749, 374, 2663, 68881, 345, 338, 4780, 279, 1715, 4617, 627, 286, 3270, 286 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 3482, 9366, 69652, 12547, 220, 674, 46721, 25, 469, 14408, 271, 286, 26310, 2713, 279, 5300, 5475, 220, 674, 46721, 25, 469, 14408, 198, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 1522, 3393, 18110, 3702, 198, 286, 12382, 4617, 284, 6464, 27799, 9366, 69652, 12547, 3232, 11, 4573, 11, 2547, 11, 3393, 18110, 3702, 340, 286, 12382, 1121, 284, 4617, 673, 2892, 286, 551, 913, 3393, 18110, 1845, 198, 286, 551, 913, 610, 836, 25, 836, 315, 279, 5475, 320, 6413, 340, 286, 551, 913, 610, 4573, 25, 1665, 836, 323, 4259, 7036, 11, 1778, 439, 369, 7411, 323, 7224, 320, 6413, 340, 286, 551, 913, 62495, 12024, 4283, 2547, 25, 320, 6413, 340, 286, 551, 913, 610, 5128, 25, 1442, 364, 1904, 518, 1243, 279, 2612, 374, 5128, 17124, 627, 286, 551, 913, 610, 9235, 14334, 25, 3277, 3118, 11, 15151, 430, 29882, 1288, 539, 387, 54095, 13, 1556, 8482, 477, 97239, 9235, 6869, 34959, 690, 1121, 304, 459, 1493, 2077, 323, 912, 4726, 8863, 315, 279, 1715, 13, 7974, 2819, 527, 25, 482, 2052, 25, 682, 9235, 1629, 18094, 690, 387, 15590, 198, 286, 551, 693, 25, 650, 16, 1898, 198, 338, 1442, 279, 1749, 374, 2663, 68881, 345, 338, 4780, 279, 1715, 4617, 382, 14711, 6075, 512, 755, 11140, 9366, 69652, 12547, 1214, 11, 836, 11, 4573, 11, 2547, 11, 3146, 9872, 1680, 220, 674, 46721, 25, 469, 14408, 198, 286, 4304, 3482, 9366, 69652, 12547, 220, 674, 46721, 25, 469, 14408, 271, 286, 26310, 2713, 279, 5300, 5475, 220, 674, 46721, 25, 469, 14408, 198, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 1522, 3393, 18110, 3702, 198, 286, 12382, 4617, 284, 6464, 27799, 9366, 69652, 12547, 3232, 11, 4573, 11, 2547, 11, 3393, 18110, 3702, 340, 286, 12382, 1121, 284, 4617, 673, 2892, 286, 551, 913, 3393, 18110, 1845, 198, 286, 551, 913, 610, 836, 25, 836, 315, 279, 5475, 320, 6413, 340, 286, 551, 913, 610, 4573, 25, 1665, 836, 323, 4259, 7036, 11, 1778, 439, 369, 7411, 323, 7224, 320, 6413, 340, 286, 551, 913, 62495, 12024, 4283, 2547, 25, 320, 6413, 340, 286, 551, 913, 610, 5128, 25, 1442, 364, 1904, 518, 1243, 279, 2612, 374, 5128, 17124, 627, 286, 551, 913, 610, 9235, 14334, 25, 3277, 3118, 11, 15151, 430, 29882, 1288, 539, 387, 54095, 13, 1556, 8482, 477, 97239, 9235, 6869, 34959, 690, 1121, 304, 459, 1493, 2077, 323, 912, 4726, 8863, 315, 279, 1715, 13, 7974, 2819, 527, 25, 482, 2052, 25, 682, 9235, 1629, 18094, 690, 387, 15590, 198, 286, 551, 693, 25, 650, 16, 1898, 198, 338, 1442, 279, 1749, 374, 2663, 68881, 345, 338, 4780, 279, 1715, 4617, 627, 286, 3270, 286 ]
OpenTreeOfLife/peyotl
peyotl/git_storage/git_action.py
GitActionBase._get_changed_docs
def _get_changed_docs(self, ancestral_commit_sha, doc_id_from_repo_path, doc_ids_to_check=None): """Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) 'doc_id_from_repo_path' is a required function if `doc_ids_to_check` is passed in, it should be an iterable list of IDs. Only IDs in this list will be returned. """ try: x = git(self.gitdir, self.gitwd, "diff-tree", "--name-only", "-r", ancestral_commit_sha, "master") except: _LOG.exception('diff-tree failed') return False touched = set() for f in x.split('\n'): found_id = doc_id_from_repo_path(f) if found_id: touched.add(found_id) if doc_ids_to_check: tc = set(doc_ids_to_check) return tc.intersection(touched) return touched
python
def _get_changed_docs(self, ancestral_commit_sha, doc_id_from_repo_path, doc_ids_to_check=None): """Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) 'doc_id_from_repo_path' is a required function if `doc_ids_to_check` is passed in, it should be an iterable list of IDs. Only IDs in this list will be returned. """ try: x = git(self.gitdir, self.gitwd, "diff-tree", "--name-only", "-r", ancestral_commit_sha, "master") except: _LOG.exception('diff-tree failed') return False touched = set() for f in x.split('\n'): found_id = doc_id_from_repo_path(f) if found_id: touched.add(found_id) if doc_ids_to_check: tc = set(doc_ids_to_check) return tc.intersection(touched) return touched
[ "def", "_get_changed_docs", "(", "self", ",", "ancestral_commit_sha", ",", "doc_id_from_repo_path", ",", "doc_ids_to_check", "=", "None", ")", ":", "try", ":", "x", "=", "git", "(", "self", ".", "gitdir", ",", "self", ".", "gitwd", ",", "\"diff-tree\"", ",", "\"--name-only\"", ",", "\"-r\"", ",", "ancestral_commit_sha", ",", "\"master\"", ")", "except", ":", "_LOG", ".", "exception", "(", "'diff-tree failed'", ")", "return", "False", "touched", "=", "set", "(", ")", "for", "f", "in", "x", ".", "split", "(", "'\\n'", ")", ":", "found_id", "=", "doc_id_from_repo_path", "(", "f", ")", "if", "found_id", ":", "touched", ".", "add", "(", "found_id", ")", "if", "doc_ids_to_check", ":", "tc", "=", "set", "(", "doc_ids_to_check", ")", "return", "tc", ".", "intersection", "(", "touched", ")", "return", "touched" ]
Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) 'doc_id_from_repo_path' is a required function if `doc_ids_to_check` is passed in, it should be an iterable list of IDs. Only IDs in this list will be returned.
[ "Returns", "the", "set", "of", "documents", "that", "have", "changed", "on", "the", "master", "since", "commit", "ancestral_commit_sha", "or", "False", "(", "on", "an", "error", ")" ]
train
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L343-L375
<|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 the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) 'doc_id_from_repo_path' is a required function if `doc_ids_to_check` is passed in, it should be an iterable list of IDs. Only IDs in this list will be returned. ### Response: def _get_changed_docs(self, ancestral_commit_sha, doc_id_from_repo_path, doc_ids_to_check=None): """Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) 'doc_id_from_repo_path' is a required function if `doc_ids_to_check` is passed in, it should be an iterable list of IDs. Only IDs in this list will be returned. """ try: x = git(self.gitdir, self.gitwd, "diff-tree", "--name-only", "-r", ancestral_commit_sha, "master") except: _LOG.exception('diff-tree failed') return False touched = set() for f in x.split('\n'): found_id = doc_id_from_repo_path(f) if found_id: touched.add(found_id) if doc_ids_to_check: tc = set(doc_ids_to_check) return tc.intersection(touched) return touched <|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, 279, 743, 315, 9477, 430, 617, 5614, 389, 279, 7491, 2533, 198, 286, 5379, 1595, 685, 56070, 37446, 49936, 63, 477, 1595, 4139, 63, 320, 263, 459, 1493, 696, 286, 364, 5349, 851, 5791, 38884, 2703, 6, 374, 264, 2631, 734, 271, 286, 422, 1595, 5349, 8237, 2401, 7348, 63, 374, 5946, 304, 11, 433, 1288, 387, 459, 51934, 1160, 315, 198, 310, 29460, 13, 8442, 29460, 304, 420, 1160, 690, 387, 6052, 382, 14711, 6075, 512, 755, 721, 456, 26278, 50792, 1214, 345, 3586, 78771, 37446, 49936, 345, 3586, 4733, 851, 5791, 38884, 2703, 345, 3586, 4733, 8237, 2401, 7348, 5980, 997, 286, 4304, 16851, 279, 743, 315, 9477, 430, 617, 5614, 389, 279, 7491, 2533, 198, 286, 5379, 1595, 685, 56070, 37446, 49936, 63, 477, 1595, 4139, 63, 320, 263, 459, 1493, 696, 286, 364, 5349, 851, 5791, 38884, 2703, 6, 374, 264, 2631, 734, 271, 286, 422, 1595, 5349, 8237, 2401, 7348, 63, 374, 5946, 304, 11, 433, 1288, 387, 459, 51934, 1160, 315, 198, 310, 29460, 13, 8442, 29460, 304, 420, 1160, 690, 387, 6052, 627, 286, 3270, 286, 1456, 512, 310, 865, 284, 16749, 1214, 33899, 3826, 345, 504, 659, 33899, 6511, 345, 504, 330, 13798, 41538, 761, 504, 14822, 609, 15744, 761, 504, 6660, 81, 761, 504, 78771, 37446, 49936, 345, 504, 330, 13943, 1158, 286, 3734, 512, 310, 721, 7391, 14161, 493, 13798, 41538, 4745, 1329, 310, 471, 3641, 198, 286, 24891, 284, 743, 746, 286, 369, 282, 304, 865, 5402, 11270, 77, 11290, 310, 1766, 851, 284, 4733, 851, 5791, 38884, 2703, 968, 340, 310, 422, 1766, 851, 512, 394, 24891, 1388, 56798, 851, 696, 286, 422, 4733, 8237, 2401, 7348, 512, 310, 17568, 284, 743, 19702, 8237, 2401, 7348, 340, 310, 471, 17568, 98175, 1175, 34170, 340, 286, 471, 24891, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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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, 279, 743, 315, 9477, 430, 617, 5614, 389, 279, 7491, 2533, 198, 286, 5379, 1595, 685, 56070, 37446, 49936, 63, 477, 1595, 4139, 63, 320, 263, 459, 1493, 696, 286, 364, 5349, 851, 5791, 38884, 2703, 6, 374, 264, 2631, 734, 271, 286, 422, 1595, 5349, 8237, 2401, 7348, 63, 374, 5946, 304, 11, 433, 1288, 387, 459, 51934, 1160, 315, 198, 310, 29460, 13, 8442, 29460, 304, 420, 1160, 690, 387, 6052, 382, 14711, 6075, 512, 755, 721, 456, 26278, 50792, 1214, 345, 3586, 78771, 37446, 49936, 345, 3586, 4733, 851, 5791, 38884, 2703, 345, 3586, 4733, 8237, 2401, 7348, 5980, 997, 286, 4304, 16851, 279, 743, 315, 9477, 430, 617, 5614, 389, 279, 7491, 2533, 198, 286, 5379, 1595, 685, 56070, 37446, 49936, 63, 477, 1595, 4139, 63, 320, 263, 459, 1493, 696, 286, 364, 5349, 851, 5791, 38884, 2703, 6, 374, 264, 2631, 734, 271, 286, 422, 1595, 5349, 8237, 2401, 7348, 63, 374, 5946, 304, 11, 433, 1288, 387, 459, 51934, 1160, 315, 198, 310, 29460, 13, 8442, 29460, 304, 420, 1160, 690, 387, 6052, 627, 286, 3270, 286, 1456, 512, 310, 865, 284, 16749, 1214, 33899, 3826, 345, 504, 659, 33899, 6511, 345, 504, 330, 13798, 41538, 761, 504, 14822, 609, 15744, 761, 504, 6660, 81, 761, 504, 78771, 37446, 49936, 345, 504, 330, 13943, 1158, 286, 3734, 512, 310, 721, 7391, 14161, 493, 13798, 41538, 4745, 1329, 310, 471, 3641, 198, 286, 24891, 284, 743, 746, 286, 369, 282, 304, 865, 5402, 11270, 77, 11290, 310, 1766, 851, 284, 4733, 851, 5791, 38884, 2703, 968, 340, 310, 422, 1766, 851, 512, 394, 24891, 1388, 56798, 851, 696, 286, 422, 4733, 8237, 2401, 7348, 512, 310, 17568, 284, 743, 19702, 8237, 2401, 7348, 340, 310, 471, 17568, 98175, 1175, 34170, 340, 286, 471, 24891, 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 ]
PyCQA/astroid
astroid/brain/brain_nose.py
_nose_tools_functions
def _nose_tools_functions(): """Get an iterator of names and bound methods.""" module = _BUILDER.string_build( textwrap.dedent( """ import unittest class Test(unittest.TestCase): pass a = Test() """ ) ) try: case = next(module["a"].infer()) except astroid.InferenceError: return for method in case.methods(): if method.name.startswith("assert") and "_" not in method.name: pep8_name = _pep8(method.name) yield pep8_name, astroid.BoundMethod(method, case) if method.name == "assertEqual": # nose also exports assert_equals. yield "assert_equals", astroid.BoundMethod(method, case)
python
def _nose_tools_functions(): """Get an iterator of names and bound methods.""" module = _BUILDER.string_build( textwrap.dedent( """ import unittest class Test(unittest.TestCase): pass a = Test() """ ) ) try: case = next(module["a"].infer()) except astroid.InferenceError: return for method in case.methods(): if method.name.startswith("assert") and "_" not in method.name: pep8_name = _pep8(method.name) yield pep8_name, astroid.BoundMethod(method, case) if method.name == "assertEqual": # nose also exports assert_equals. yield "assert_equals", astroid.BoundMethod(method, case)
[ "def", "_nose_tools_functions", "(", ")", ":", "module", "=", "_BUILDER", ".", "string_build", "(", "textwrap", ".", "dedent", "(", "\"\"\"\n import unittest\n\n class Test(unittest.TestCase):\n pass\n a = Test()\n \"\"\"", ")", ")", "try", ":", "case", "=", "next", "(", "module", "[", "\"a\"", "]", ".", "infer", "(", ")", ")", "except", "astroid", ".", "InferenceError", ":", "return", "for", "method", "in", "case", ".", "methods", "(", ")", ":", "if", "method", ".", "name", ".", "startswith", "(", "\"assert\"", ")", "and", "\"_\"", "not", "in", "method", ".", "name", ":", "pep8_name", "=", "_pep8", "(", "method", ".", "name", ")", "yield", "pep8_name", ",", "astroid", ".", "BoundMethod", "(", "method", ",", "case", ")", "if", "method", ".", "name", "==", "\"assertEqual\"", ":", "# nose also exports assert_equals.", "yield", "\"assert_equals\"", ",", "astroid", ".", "BoundMethod", "(", "method", ",", "case", ")" ]
Get an iterator of names and bound methods.
[ "Get", "an", "iterator", "of", "names", "and", "bound", "methods", "." ]
train
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/brain/brain_nose.py#L23-L46
<|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 an iterator of names and bound methods. ### Response: def _nose_tools_functions(): """Get an iterator of names and bound methods.""" module = _BUILDER.string_build( textwrap.dedent( """ import unittest class Test(unittest.TestCase): pass a = Test() """ ) ) try: case = next(module["a"].infer()) except astroid.InferenceError: return for method in case.methods(): if method.name.startswith("assert") and "_" not in method.name: pep8_name = _pep8(method.name) yield pep8_name, astroid.BoundMethod(method, case) if method.name == "assertEqual": # nose also exports assert_equals. yield "assert_equals", astroid.BoundMethod(method, case) <|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, 459, 15441, 315, 5144, 323, 6965, 5528, 382, 14711, 6075, 512, 755, 721, 77, 974, 40823, 32808, 4019, 262, 4304, 1991, 459, 15441, 315, 5144, 323, 6965, 5528, 14781, 262, 4793, 284, 721, 33, 90792, 4909, 21465, 1021, 286, 1495, 10305, 962, 291, 306, 1021, 310, 3270, 262, 1179, 20499, 271, 262, 538, 3475, 38278, 32463, 997, 286, 1522, 198, 262, 264, 284, 3475, 746, 262, 3270, 286, 1763, 262, 1763, 262, 1456, 512, 286, 1162, 284, 1828, 19669, 1204, 64, 5638, 90659, 2455, 262, 3734, 12025, 1607, 5450, 2251, 1480, 512, 286, 471, 198, 262, 369, 1749, 304, 1162, 44013, 4019, 286, 422, 1749, 2710, 27249, 446, 2256, 909, 323, 33825, 539, 304, 1749, 2710, 512, 310, 87695, 23, 1292, 284, 721, 375, 79, 23, 17709, 2710, 340, 310, 7692, 87695, 23, 1292, 11, 12025, 1607, 1823, 801, 3607, 17709, 11, 1162, 340, 286, 422, 1749, 2710, 624, 330, 2256, 3066, 4764, 310, 674, 19689, 1101, 13086, 2105, 62764, 627, 310, 7692, 330, 2256, 62764, 498, 12025, 1607, 1823, 801, 3607, 17709, 11, 1162, 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,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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 ]
[ 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, 459, 15441, 315, 5144, 323, 6965, 5528, 382, 14711, 6075, 512, 755, 721, 77, 974, 40823, 32808, 4019, 262, 4304, 1991, 459, 15441, 315, 5144, 323, 6965, 5528, 14781, 262, 4793, 284, 721, 33, 90792, 4909, 21465, 1021, 286, 1495, 10305, 962, 291, 306, 1021, 310, 3270, 262, 1179, 20499, 271, 262, 538, 3475, 38278, 32463, 997, 286, 1522, 198, 262, 264, 284, 3475, 746, 262, 3270, 286, 1763, 262, 1763, 262, 1456, 512, 286, 1162, 284, 1828, 19669, 1204, 64, 5638, 90659, 2455, 262, 3734, 12025, 1607, 5450, 2251, 1480, 512, 286, 471, 198, 262, 369, 1749, 304, 1162, 44013, 4019, 286, 422, 1749, 2710, 27249, 446, 2256, 909, 323, 33825, 539, 304, 1749, 2710, 512, 310, 87695, 23, 1292, 284, 721, 375, 79, 23, 17709, 2710, 340, 310, 7692, 87695, 23, 1292, 11, 12025, 1607, 1823, 801, 3607, 17709, 11, 1162, 340, 286, 422, 1749, 2710, 624, 330, 2256, 3066, 4764, 310, 674, 19689, 1101, 13086, 2105, 62764, 627, 310, 7692, 330, 2256, 62764, 498, 12025, 1607, 1823, 801, 3607, 17709, 11, 1162, 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 ]
JasonKessler/scattertext
scattertext/categoryprojector/CategoryProjector.py
CategoryProjectorBase.project_with_metadata
def project_with_metadata(self, term_doc_mat, x_dim=0, y_dim=1): ''' Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection ''' return self._project_category_corpus(self._get_category_metadata_corpus_and_replace_terms(term_doc_mat), x_dim, y_dim)
python
def project_with_metadata(self, term_doc_mat, x_dim=0, y_dim=1): ''' Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection ''' return self._project_category_corpus(self._get_category_metadata_corpus_and_replace_terms(term_doc_mat), x_dim, y_dim)
[ "def", "project_with_metadata", "(", "self", ",", "term_doc_mat", ",", "x_dim", "=", "0", ",", "y_dim", "=", "1", ")", ":", "return", "self", ".", "_project_category_corpus", "(", "self", ".", "_get_category_metadata_corpus_and_replace_terms", "(", "term_doc_mat", ")", ",", "x_dim", ",", "y_dim", ")" ]
Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection
[ "Returns", "a", "projection", "of", "the" ]
train
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/categoryprojector/CategoryProjector.py#L41-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: Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection ### Response: def project_with_metadata(self, term_doc_mat, x_dim=0, y_dim=1): ''' Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection ''' return self._project_category_corpus(self._get_category_metadata_corpus_and_replace_terms(term_doc_mat), x_dim, y_dim) <|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, 22343, 315, 279, 271, 286, 551, 913, 4751, 19401, 17021, 25, 264, 17978, 9743, 6828, 198, 286, 551, 693, 25, 10260, 47421, 271, 14711, 6075, 512, 755, 2447, 6753, 23012, 1214, 11, 4751, 19401, 17021, 11, 865, 11024, 28, 15, 11, 379, 11024, 28, 16, 997, 286, 11414, 286, 5295, 264, 22343, 315, 279, 271, 286, 551, 913, 4751, 19401, 17021, 25, 264, 17978, 9743, 6828, 198, 286, 551, 693, 25, 10260, 47421, 198, 286, 11414, 286, 471, 659, 1462, 5094, 12110, 95326, 1214, 1462, 456, 12110, 23012, 95326, 8543, 10858, 38598, 45754, 19401, 17021, 1350, 15791, 865, 11024, 11, 379, 11024, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 22343, 315, 279, 271, 286, 551, 913, 4751, 19401, 17021, 25, 264, 17978, 9743, 6828, 198, 286, 551, 693, 25, 10260, 47421, 271, 14711, 6075, 512, 755, 2447, 6753, 23012, 1214, 11, 4751, 19401, 17021, 11, 865, 11024, 28, 15, 11, 379, 11024, 28, 16, 997, 286, 11414, 286, 5295, 264, 22343, 315, 279, 271, 286, 551, 913, 4751, 19401, 17021, 25, 264, 17978, 9743, 6828, 198, 286, 551, 693, 25, 10260, 47421, 198, 286, 11414, 286, 471, 659, 1462, 5094, 12110, 95326, 1214, 1462, 456, 12110, 23012, 95326, 8543, 10858, 38598, 45754, 19401, 17021, 1350, 15791, 865, 11024, 11, 379, 11024, 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 ]
thelabnyc/wagtail_blog
blog/utils.py
unique_slugify
def unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'): """ Calculates and stores a unique slug of ``value`` for an instance. ``slug_field_name`` should be a string matching the name of the field to store the slug in (and the field to check against for uniqueness). ``queryset`` usually doesn't need to be explicitly provided - it'll default to using the ``.all()`` queryset from the model's default manager. """ slug_field = instance._meta.get_field(slug_field_name) slug = getattr(instance, slug_field.attname) slug_len = slug_field.max_length # Sort out the initial slug, limiting its length if necessary. slug = slugify(value) if slug_len: slug = slug[:slug_len] slug = _slug_strip(slug, slug_separator) original_slug = slug # Create the queryset if one wasn't explicitly provided and exclude the # current instance from the queryset. if queryset is None: queryset = instance.__class__._default_manager.all() if instance.pk: queryset = queryset.exclude(pk=instance.pk) # Find a unique slug. If one matches, at '-2' to the end and try again # (then '-3', etc). next = 2 while not slug or queryset.filter(**{slug_field_name: slug}): slug = original_slug end = '%s%s' % (slug_separator, next) if slug_len and len(slug) + len(end) > slug_len: slug = slug[:slug_len-len(end)] slug = _slug_strip(slug, slug_separator) slug = '%s%s' % (slug, end) next += 1 setattr(instance, slug_field.attname, slug)
python
def unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'): """ Calculates and stores a unique slug of ``value`` for an instance. ``slug_field_name`` should be a string matching the name of the field to store the slug in (and the field to check against for uniqueness). ``queryset`` usually doesn't need to be explicitly provided - it'll default to using the ``.all()`` queryset from the model's default manager. """ slug_field = instance._meta.get_field(slug_field_name) slug = getattr(instance, slug_field.attname) slug_len = slug_field.max_length # Sort out the initial slug, limiting its length if necessary. slug = slugify(value) if slug_len: slug = slug[:slug_len] slug = _slug_strip(slug, slug_separator) original_slug = slug # Create the queryset if one wasn't explicitly provided and exclude the # current instance from the queryset. if queryset is None: queryset = instance.__class__._default_manager.all() if instance.pk: queryset = queryset.exclude(pk=instance.pk) # Find a unique slug. If one matches, at '-2' to the end and try again # (then '-3', etc). next = 2 while not slug or queryset.filter(**{slug_field_name: slug}): slug = original_slug end = '%s%s' % (slug_separator, next) if slug_len and len(slug) + len(end) > slug_len: slug = slug[:slug_len-len(end)] slug = _slug_strip(slug, slug_separator) slug = '%s%s' % (slug, end) next += 1 setattr(instance, slug_field.attname, slug)
[ "def", "unique_slugify", "(", "instance", ",", "value", ",", "slug_field_name", "=", "'slug'", ",", "queryset", "=", "None", ",", "slug_separator", "=", "'-'", ")", ":", "slug_field", "=", "instance", ".", "_meta", ".", "get_field", "(", "slug_field_name", ")", "slug", "=", "getattr", "(", "instance", ",", "slug_field", ".", "attname", ")", "slug_len", "=", "slug_field", ".", "max_length", "# Sort out the initial slug, limiting its length if necessary.", "slug", "=", "slugify", "(", "value", ")", "if", "slug_len", ":", "slug", "=", "slug", "[", ":", "slug_len", "]", "slug", "=", "_slug_strip", "(", "slug", ",", "slug_separator", ")", "original_slug", "=", "slug", "# Create the queryset if one wasn't explicitly provided and exclude the", "# current instance from the queryset.", "if", "queryset", "is", "None", ":", "queryset", "=", "instance", ".", "__class__", ".", "_default_manager", ".", "all", "(", ")", "if", "instance", ".", "pk", ":", "queryset", "=", "queryset", ".", "exclude", "(", "pk", "=", "instance", ".", "pk", ")", "# Find a unique slug. If one matches, at '-2' to the end and try again", "# (then '-3', etc).", "next", "=", "2", "while", "not", "slug", "or", "queryset", ".", "filter", "(", "*", "*", "{", "slug_field_name", ":", "slug", "}", ")", ":", "slug", "=", "original_slug", "end", "=", "'%s%s'", "%", "(", "slug_separator", ",", "next", ")", "if", "slug_len", "and", "len", "(", "slug", ")", "+", "len", "(", "end", ")", ">", "slug_len", ":", "slug", "=", "slug", "[", ":", "slug_len", "-", "len", "(", "end", ")", "]", "slug", "=", "_slug_strip", "(", "slug", ",", "slug_separator", ")", "slug", "=", "'%s%s'", "%", "(", "slug", ",", "end", ")", "next", "+=", "1", "setattr", "(", "instance", ",", "slug_field", ".", "attname", ",", "slug", ")" ]
Calculates and stores a unique slug of ``value`` for an instance. ``slug_field_name`` should be a string matching the name of the field to store the slug in (and the field to check against for uniqueness). ``queryset`` usually doesn't need to be explicitly provided - it'll default to using the ``.all()`` queryset from the model's default manager.
[ "Calculates", "and", "stores", "a", "unique", "slug", "of", "value", "for", "an", "instance", "." ]
train
https://github.com/thelabnyc/wagtail_blog/blob/7e092c02d10ec427c9a2c4b5dcbe910d88c628cf/blog/utils.py#L6-L48
<|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: Calculates and stores a unique slug of ``value`` for an instance. ``slug_field_name`` should be a string matching the name of the field to store the slug in (and the field to check against for uniqueness). ``queryset`` usually doesn't need to be explicitly provided - it'll default to using the ``.all()`` queryset from the model's default manager. ### Response: def unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'): """ Calculates and stores a unique slug of ``value`` for an instance. ``slug_field_name`` should be a string matching the name of the field to store the slug in (and the field to check against for uniqueness). ``queryset`` usually doesn't need to be explicitly provided - it'll default to using the ``.all()`` queryset from the model's default manager. """ slug_field = instance._meta.get_field(slug_field_name) slug = getattr(instance, slug_field.attname) slug_len = slug_field.max_length # Sort out the initial slug, limiting its length if necessary. slug = slugify(value) if slug_len: slug = slug[:slug_len] slug = _slug_strip(slug, slug_separator) original_slug = slug # Create the queryset if one wasn't explicitly provided and exclude the # current instance from the queryset. if queryset is None: queryset = instance.__class__._default_manager.all() if instance.pk: queryset = queryset.exclude(pk=instance.pk) # Find a unique slug. If one matches, at '-2' to the end and try again # (then '-3', etc). next = 2 while not slug or queryset.filter(**{slug_field_name: slug}): slug = original_slug end = '%s%s' % (slug_separator, next) if slug_len and len(slug) + len(end) > slug_len: slug = slug[:slug_len-len(end)] slug = _slug_strip(slug, slug_separator) slug = '%s%s' % (slug, end) next += 1 setattr(instance, slug_field.attname, slug) <|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, 59008, 988, 323, 10756, 264, 5016, 25478, 315, 10103, 970, 14196, 369, 459, 2937, 382, 262, 10103, 15476, 5121, 1292, 14196, 1288, 387, 264, 925, 12864, 279, 836, 315, 279, 2115, 311, 198, 262, 3637, 279, 25478, 304, 320, 438, 279, 2115, 311, 1817, 2403, 369, 60157, 3677, 262, 10103, 1663, 751, 14196, 6118, 3250, 956, 1205, 311, 387, 21650, 3984, 482, 433, 3358, 1670, 198, 262, 311, 1701, 279, 10103, 13, 543, 368, 14196, 40627, 505, 279, 1646, 596, 1670, 6783, 382, 14711, 6075, 512, 755, 5016, 32124, 1463, 22384, 11, 907, 11, 25478, 5121, 1292, 1151, 15476, 518, 40627, 5980, 345, 4391, 25478, 59304, 95093, 11290, 262, 3270, 262, 60953, 323, 10756, 264, 5016, 25478, 315, 10103, 970, 14196, 369, 459, 2937, 382, 262, 10103, 15476, 5121, 1292, 14196, 1288, 387, 264, 925, 12864, 279, 836, 315, 279, 2115, 311, 198, 262, 3637, 279, 25478, 304, 320, 438, 279, 2115, 311, 1817, 2403, 369, 60157, 3677, 262, 10103, 1663, 751, 14196, 6118, 3250, 956, 1205, 311, 387, 21650, 3984, 482, 433, 3358, 1670, 198, 262, 311, 1701, 279, 10103, 13, 543, 368, 14196, 40627, 505, 279, 1646, 596, 1670, 6783, 627, 262, 3270, 262, 25478, 5121, 284, 2937, 1462, 5607, 673, 5121, 99829, 5121, 1292, 696, 262, 25478, 284, 31097, 22384, 11, 25478, 5121, 45157, 609, 340, 262, 25478, 6171, 284, 25478, 5121, 6817, 5228, 271, 262, 674, 16347, 704, 279, 2926, 25478, 11, 33994, 1202, 3160, 422, 5995, 627, 262, 25478, 284, 25478, 1463, 3764, 340, 262, 422, 25478, 6171, 512, 286, 25478, 284, 25478, 3530, 15476, 6171, 933, 262, 25478, 284, 721, 15476, 67230, 99829, 11, 25478, 59304, 340, 262, 4113, 32124, 284, 25478, 271, 262, 674, 4324, 279, 40627, 422, 832, 5828, 956, 21650, 3984, 323, 22429, 279, 198, 262, 674, 1510, 2937, 505, 279, 40627, 627, 262, 422, 40627, 374, 2290, 512, 286, 40627, 284, 2937, 4952, 1058, 565, 1462, 2309, 12418, 7825, 746, 262, 422, 2937, 39728, 512, 286, 40627, 284, 40627, 91041, 41028, 28, 4956, 39728, 696, 262, 674, 7531, 264, 5016, 25478, 13, 1442, 832, 9248, 11, 520, 7944, 17, 6, 311, 279, 842, 323, 1456, 1578, 198, 262, 674, 320, 3473, 7944, 18, 518, 5099, 4390, 262, 1828, 284, 220, 17, 198, 262, 1418, 539, 25478, 477, 40627, 7081, 22551, 90, 15476, 5121, 1292, 25, 25478, 92, 997, 286, 25478, 284, 4113, 32124, 198, 286, 842, 284, 7832, 82, 13249, 6, 1034, 320, 15476, 59304, 11, 1828, 340, 286, 422, 25478, 6171, 323, 2479, 99829, 8, 489, 2479, 15426, 8, 871, 25478, 6171, 512, 310, 25478, 284, 25478, 3530, 15476, 6171, 86657, 15426, 5680, 310, 25478, 284, 721, 15476, 67230, 99829, 11, 25478, 59304, 340, 286, 25478, 284, 7832, 82, 13249, 6, 1034, 320, 15476, 11, 842, 340, 286, 1828, 1447, 220, 16, 271, 262, 62214, 22384, 11, 25478, 5121, 45157, 609, 11 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 59008, 988, 323, 10756, 264, 5016, 25478, 315, 10103, 970, 14196, 369, 459, 2937, 382, 262, 10103, 15476, 5121, 1292, 14196, 1288, 387, 264, 925, 12864, 279, 836, 315, 279, 2115, 311, 198, 262, 3637, 279, 25478, 304, 320, 438, 279, 2115, 311, 1817, 2403, 369, 60157, 3677, 262, 10103, 1663, 751, 14196, 6118, 3250, 956, 1205, 311, 387, 21650, 3984, 482, 433, 3358, 1670, 198, 262, 311, 1701, 279, 10103, 13, 543, 368, 14196, 40627, 505, 279, 1646, 596, 1670, 6783, 382, 14711, 6075, 512, 755, 5016, 32124, 1463, 22384, 11, 907, 11, 25478, 5121, 1292, 1151, 15476, 518, 40627, 5980, 345, 4391, 25478, 59304, 95093, 11290, 262, 3270, 262, 60953, 323, 10756, 264, 5016, 25478, 315, 10103, 970, 14196, 369, 459, 2937, 382, 262, 10103, 15476, 5121, 1292, 14196, 1288, 387, 264, 925, 12864, 279, 836, 315, 279, 2115, 311, 198, 262, 3637, 279, 25478, 304, 320, 438, 279, 2115, 311, 1817, 2403, 369, 60157, 3677, 262, 10103, 1663, 751, 14196, 6118, 3250, 956, 1205, 311, 387, 21650, 3984, 482, 433, 3358, 1670, 198, 262, 311, 1701, 279, 10103, 13, 543, 368, 14196, 40627, 505, 279, 1646, 596, 1670, 6783, 627, 262, 3270, 262, 25478, 5121, 284, 2937, 1462, 5607, 673, 5121, 99829, 5121, 1292, 696, 262, 25478, 284, 31097, 22384, 11, 25478, 5121, 45157, 609, 340, 262, 25478, 6171, 284, 25478, 5121, 6817, 5228, 271, 262, 674, 16347, 704, 279, 2926, 25478, 11, 33994, 1202, 3160, 422, 5995, 627, 262, 25478, 284, 25478, 1463, 3764, 340, 262, 422, 25478, 6171, 512, 286, 25478, 284, 25478, 3530, 15476, 6171, 933, 262, 25478, 284, 721, 15476, 67230, 99829, 11, 25478, 59304, 340, 262, 4113, 32124, 284, 25478, 271, 262, 674, 4324, 279, 40627, 422, 832, 5828, 956, 21650, 3984, 323, 22429, 279, 198, 262, 674, 1510, 2937, 505, 279, 40627, 627, 262, 422, 40627, 374, 2290, 512, 286, 40627, 284, 2937, 4952, 1058, 565, 1462, 2309, 12418, 7825, 746, 262, 422, 2937, 39728, 512, 286, 40627, 284, 40627, 91041, 41028, 28, 4956, 39728, 696, 262, 674, 7531, 264, 5016, 25478, 13, 1442, 832, 9248, 11, 520, 7944, 17, 6, 311, 279, 842, 323, 1456, 1578, 198, 262, 674, 320, 3473, 7944, 18, 518, 5099, 4390, 262, 1828, 284, 220, 17, 198, 262, 1418, 539, 25478, 477, 40627, 7081, 22551, 90, 15476, 5121, 1292, 25, 25478, 92, 997, 286, 25478, 284, 4113, 32124, 198, 286, 842, 284, 7832, 82, 13249, 6, 1034, 320, 15476, 59304, 11, 1828, 340, 286, 422, 25478, 6171, 323, 2479, 99829, 8, 489, 2479, 15426, 8, 871, 25478, 6171, 512, 310, 25478, 284, 25478, 3530, 15476, 6171, 86657, 15426, 5680, 310, 25478, 284, 721, 15476, 67230, 99829, 11, 25478, 59304, 340, 286, 25478, 284, 7832, 82, 13249, 6, 1034, 320, 15476, 11, 842, 340, 286, 1828, 1447, 220, 16, 271, 262, 62214, 22384, 11, 25478, 5121, 45157, 609, 11 ]
beregond/jsonmodels
jsonmodels/utilities.py
compare_schemas
def compare_schemas(one, two): """Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to match, which can lead to wrong results. :param one: First schema to compare. :param two: Second schema to compare. :rtype: `bool` """ one = _normalize_string_type(one) two = _normalize_string_type(two) _assert_same_types(one, two) if isinstance(one, list): return _compare_lists(one, two) elif isinstance(one, dict): return _compare_dicts(one, two) elif isinstance(one, SCALAR_TYPES): return one == two elif one is None: return one is two else: raise RuntimeError('Not allowed type "{type}"'.format( type=type(one).__name__))
python
def compare_schemas(one, two): """Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to match, which can lead to wrong results. :param one: First schema to compare. :param two: Second schema to compare. :rtype: `bool` """ one = _normalize_string_type(one) two = _normalize_string_type(two) _assert_same_types(one, two) if isinstance(one, list): return _compare_lists(one, two) elif isinstance(one, dict): return _compare_dicts(one, two) elif isinstance(one, SCALAR_TYPES): return one == two elif one is None: return one is two else: raise RuntimeError('Not allowed type "{type}"'.format( type=type(one).__name__))
[ "def", "compare_schemas", "(", "one", ",", "two", ")", ":", "one", "=", "_normalize_string_type", "(", "one", ")", "two", "=", "_normalize_string_type", "(", "two", ")", "_assert_same_types", "(", "one", ",", "two", ")", "if", "isinstance", "(", "one", ",", "list", ")", ":", "return", "_compare_lists", "(", "one", ",", "two", ")", "elif", "isinstance", "(", "one", ",", "dict", ")", ":", "return", "_compare_dicts", "(", "one", ",", "two", ")", "elif", "isinstance", "(", "one", ",", "SCALAR_TYPES", ")", ":", "return", "one", "==", "two", "elif", "one", "is", "None", ":", "return", "one", "is", "two", "else", ":", "raise", "RuntimeError", "(", "'Not allowed type \"{type}\"'", ".", "format", "(", "type", "=", "type", "(", "one", ")", ".", "__name__", ")", ")" ]
Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to match, which can lead to wrong results. :param one: First schema to compare. :param two: Second schema to compare. :rtype: `bool`
[ "Compare", "two", "structures", "that", "represents", "JSON", "schemas", "." ]
train
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/utilities.py#L60-L90
<|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: Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to match, which can lead to wrong results. :param one: First schema to compare. :param two: Second schema to compare. :rtype: `bool` ### Response: def compare_schemas(one, two): """Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to match, which can lead to wrong results. :param one: First schema to compare. :param two: Second schema to compare. :rtype: `bool` """ one = _normalize_string_type(one) two = _normalize_string_type(two) _assert_same_types(one, two) if isinstance(one, list): return _compare_lists(one, two) elif isinstance(one, dict): return _compare_dicts(one, two) elif isinstance(one, SCALAR_TYPES): return one == two elif one is None: return one is two else: raise RuntimeError('Not allowed type "{type}"'.format( type=type(one).__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, 28474, 1403, 14726, 430, 11105, 4823, 62900, 382, 262, 1789, 12593, 499, 649, 956, 1005, 4725, 12593, 11, 1606, 304, 4823, 11036, 198, 262, 11725, 9503, 4276, 2567, 2015, 320, 438, 13325, 11725, 656, 705, 779, 420, 2011, 387, 4529, 1139, 198, 262, 2759, 2391, 12593, 382, 262, 7181, 420, 40464, 1817, 682, 33483, 11, 1193, 1176, 832, 430, 5084, 311, 198, 262, 2489, 11, 902, 649, 3063, 311, 5076, 3135, 382, 262, 551, 913, 832, 25, 5629, 11036, 311, 9616, 627, 262, 551, 913, 1403, 25, 10657, 11036, 311, 9616, 627, 262, 551, 33613, 25, 1595, 2707, 19884, 14711, 6075, 512, 755, 9616, 646, 32226, 52167, 11, 1403, 997, 262, 4304, 28474, 1403, 14726, 430, 11105, 4823, 62900, 382, 262, 1789, 12593, 499, 649, 956, 1005, 4725, 12593, 11, 1606, 304, 4823, 11036, 198, 262, 11725, 9503, 4276, 2567, 2015, 320, 438, 13325, 11725, 656, 705, 779, 420, 2011, 387, 4529, 1139, 198, 262, 2759, 2391, 12593, 382, 262, 7181, 420, 40464, 1817, 682, 33483, 11, 1193, 1176, 832, 430, 5084, 311, 198, 262, 2489, 11, 902, 649, 3063, 311, 5076, 3135, 382, 262, 551, 913, 832, 25, 5629, 11036, 311, 9616, 627, 262, 551, 913, 1403, 25, 10657, 11036, 311, 9616, 627, 262, 551, 33613, 25, 1595, 2707, 19884, 262, 3270, 262, 832, 284, 721, 31690, 3991, 1857, 52167, 340, 262, 1403, 284, 721, 31690, 3991, 1857, 1175, 1146, 696, 262, 721, 2256, 34674, 9962, 52167, 11, 1403, 696, 262, 422, 11656, 52167, 11, 1160, 997, 286, 471, 721, 19484, 38388, 52167, 11, 1403, 340, 262, 4508, 11656, 52167, 11, 6587, 997, 286, 471, 721, 19484, 90061, 52167, 11, 1403, 340, 262, 4508, 11656, 52167, 11, 7683, 73865, 26879, 997, 286, 471, 832, 624, 1403, 198, 262, 4508, 832, 374, 2290, 512, 286, 471, 832, 374, 1403, 198, 262, 775, 512, 286, 4933, 45643, 493, 2688, 5535, 955, 14190, 1337, 10064, 4527, 2293, 1021, 310, 955, 28, 1337, 52167, 21015, 609, 65213, 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,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 28474, 1403, 14726, 430, 11105, 4823, 62900, 382, 262, 1789, 12593, 499, 649, 956, 1005, 4725, 12593, 11, 1606, 304, 4823, 11036, 198, 262, 11725, 9503, 4276, 2567, 2015, 320, 438, 13325, 11725, 656, 705, 779, 420, 2011, 387, 4529, 1139, 198, 262, 2759, 2391, 12593, 382, 262, 7181, 420, 40464, 1817, 682, 33483, 11, 1193, 1176, 832, 430, 5084, 311, 198, 262, 2489, 11, 902, 649, 3063, 311, 5076, 3135, 382, 262, 551, 913, 832, 25, 5629, 11036, 311, 9616, 627, 262, 551, 913, 1403, 25, 10657, 11036, 311, 9616, 627, 262, 551, 33613, 25, 1595, 2707, 19884, 14711, 6075, 512, 755, 9616, 646, 32226, 52167, 11, 1403, 997, 262, 4304, 28474, 1403, 14726, 430, 11105, 4823, 62900, 382, 262, 1789, 12593, 499, 649, 956, 1005, 4725, 12593, 11, 1606, 304, 4823, 11036, 198, 262, 11725, 9503, 4276, 2567, 2015, 320, 438, 13325, 11725, 656, 705, 779, 420, 2011, 387, 4529, 1139, 198, 262, 2759, 2391, 12593, 382, 262, 7181, 420, 40464, 1817, 682, 33483, 11, 1193, 1176, 832, 430, 5084, 311, 198, 262, 2489, 11, 902, 649, 3063, 311, 5076, 3135, 382, 262, 551, 913, 832, 25, 5629, 11036, 311, 9616, 627, 262, 551, 913, 1403, 25, 10657, 11036, 311, 9616, 627, 262, 551, 33613, 25, 1595, 2707, 19884, 262, 3270, 262, 832, 284, 721, 31690, 3991, 1857, 52167, 340, 262, 1403, 284, 721, 31690, 3991, 1857, 1175, 1146, 696, 262, 721, 2256, 34674, 9962, 52167, 11, 1403, 696, 262, 422, 11656, 52167, 11, 1160, 997, 286, 471, 721, 19484, 38388, 52167, 11, 1403, 340, 262, 4508, 11656, 52167, 11, 6587, 997, 286, 471, 721, 19484, 90061, 52167, 11, 1403, 340, 262, 4508, 11656, 52167, 11, 7683, 73865, 26879, 997, 286, 471, 832, 624, 1403, 198, 262, 4508, 832, 374, 2290, 512, 286, 471, 832, 374, 1403, 198, 262, 775, 512, 286, 4933, 45643, 493, 2688, 5535, 955, 14190, 1337, 10064, 4527, 2293, 1021, 310, 955, 28, 1337, 52167, 21015, 609, 65213, 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 ]
edoburu/django-private-storage
private_storage/models.py
PrivateFile.open
def open(self, mode='rb'): """ Open the file for reading. :rtype: django.core.files.storage.File """ file = self.storage.open(self.relative_name, mode=mode) # type: File return file
python
def open(self, mode='rb'): """ Open the file for reading. :rtype: django.core.files.storage.File """ file = self.storage.open(self.relative_name, mode=mode) # type: File return file
[ "def", "open", "(", "self", ",", "mode", "=", "'rb'", ")", ":", "file", "=", "self", ".", "storage", ".", "open", "(", "self", ".", "relative_name", ",", "mode", "=", "mode", ")", "# type: File", "return", "file" ]
Open the file for reading. :rtype: django.core.files.storage.File
[ "Open", "the", "file", "for", "reading", ".", ":", "rtype", ":", "django", ".", "core", ".", "files", ".", "storage", ".", "File" ]
train
https://github.com/edoburu/django-private-storage/blob/35b718024fee75b0ed3400f601976b20246c7d05/private_storage/models.py#L26-L32
<|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 the file for reading. :rtype: django.core.files.storage.File ### Response: def open(self, mode='rb'): """ Open the file for reading. :rtype: django.core.files.storage.File """ file = self.storage.open(self.relative_name, mode=mode) # type: File return file <|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, 279, 1052, 369, 5403, 627, 286, 551, 33613, 25, 8426, 4976, 20881, 23209, 8744, 271, 14711, 6075, 512, 755, 1825, 1214, 11, 3941, 1151, 10910, 11290, 286, 3270, 286, 5377, 279, 1052, 369, 5403, 627, 286, 551, 33613, 25, 8426, 4976, 20881, 23209, 8744, 198, 286, 3270, 286, 1052, 284, 659, 23209, 5949, 1214, 75414, 1292, 11, 3941, 28, 8684, 8, 220, 674, 955, 25, 2958, 198, 286, 471, 1052, 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 ]
[ 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, 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, 279, 1052, 369, 5403, 627, 286, 551, 33613, 25, 8426, 4976, 20881, 23209, 8744, 271, 14711, 6075, 512, 755, 1825, 1214, 11, 3941, 1151, 10910, 11290, 286, 3270, 286, 5377, 279, 1052, 369, 5403, 627, 286, 551, 33613, 25, 8426, 4976, 20881, 23209, 8744, 198, 286, 3270, 286, 1052, 284, 659, 23209, 5949, 1214, 75414, 1292, 11, 3941, 28, 8684, 8, 220, 674, 955, 25, 2958, 198, 286, 471, 1052, 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 ]
ui/django-post_office
post_office/models.py
get_upload_path
def get_upload_path(instance, filename): """Overriding to store the original filename""" if not instance.name: instance.name = filename # set original filename date = timezone.now().date() filename = '{name}.{ext}'.format(name=uuid4().hex, ext=filename.split('.')[-1]) return os.path.join('post_office_attachments', str(date.year), str(date.month), str(date.day), filename)
python
def get_upload_path(instance, filename): """Overriding to store the original filename""" if not instance.name: instance.name = filename # set original filename date = timezone.now().date() filename = '{name}.{ext}'.format(name=uuid4().hex, ext=filename.split('.')[-1]) return os.path.join('post_office_attachments', str(date.year), str(date.month), str(date.day), filename)
[ "def", "get_upload_path", "(", "instance", ",", "filename", ")", ":", "if", "not", "instance", ".", "name", ":", "instance", ".", "name", "=", "filename", "# set original filename", "date", "=", "timezone", ".", "now", "(", ")", ".", "date", "(", ")", "filename", "=", "'{name}.{ext}'", ".", "format", "(", "name", "=", "uuid4", "(", ")", ".", "hex", ",", "ext", "=", "filename", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "return", "os", ".", "path", ".", "join", "(", "'post_office_attachments'", ",", "str", "(", "date", ".", "year", ")", ",", "str", "(", "date", ".", "month", ")", ",", "str", "(", "date", ".", "day", ")", ",", "filename", ")" ]
Overriding to store the original filename
[ "Overriding", "to", "store", "the", "original", "filename" ]
train
https://github.com/ui/django-post_office/blob/03e1ffb69829b475402f0f3ecd9f8a90af7da4bd/post_office/models.py#L274-L283
<|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: Overriding to store the original filename ### Response: def get_upload_path(instance, filename): """Overriding to store the original filename""" if not instance.name: instance.name = filename # set original filename date = timezone.now().date() filename = '{name}.{ext}'.format(name=uuid4().hex, ext=filename.split('.')[-1]) return os.path.join('post_office_attachments', str(date.year), str(date.month), str(date.day), filename) <|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, 1959, 50780, 311, 3637, 279, 4113, 3986, 271, 14711, 6075, 512, 755, 636, 22433, 2703, 22384, 11, 3986, 997, 262, 4304, 1959, 50780, 311, 3637, 279, 4113, 3986, 7275, 262, 422, 539, 2937, 2710, 512, 286, 2937, 2710, 284, 3986, 220, 674, 743, 4113, 3986, 198, 262, 2457, 284, 35057, 10930, 1020, 1045, 746, 262, 3986, 284, 11834, 609, 66984, 428, 24398, 2293, 3232, 28, 17566, 19, 1020, 17757, 345, 10812, 1327, 28, 8570, 5402, 80368, 7764, 16, 9801, 262, 471, 2709, 3960, 5563, 493, 2252, 80704, 99681, 518, 610, 12237, 25418, 1350, 667, 610, 12237, 28151, 705, 610, 12237, 27308, 705, 3986, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 1959, 50780, 311, 3637, 279, 4113, 3986, 271, 14711, 6075, 512, 755, 636, 22433, 2703, 22384, 11, 3986, 997, 262, 4304, 1959, 50780, 311, 3637, 279, 4113, 3986, 7275, 262, 422, 539, 2937, 2710, 512, 286, 2937, 2710, 284, 3986, 220, 674, 743, 4113, 3986, 198, 262, 2457, 284, 35057, 10930, 1020, 1045, 746, 262, 3986, 284, 11834, 609, 66984, 428, 24398, 2293, 3232, 28, 17566, 19, 1020, 17757, 345, 10812, 1327, 28, 8570, 5402, 80368, 7764, 16, 9801, 262, 471, 2709, 3960, 5563, 493, 2252, 80704, 99681, 518, 610, 12237, 25418, 1350, 667, 610, 12237, 28151, 705, 610, 12237, 27308, 705, 3986, 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 ]
OpenGov/carpenter
carpenter/blocks/block.py
BlockValidator._stringify_row
def _stringify_row(self, row_index): ''' Stringifies an entire row, filling in blanks with prior titles as they are found. ''' table_row = self.table[row_index] prior_cell = None for column_index in range(self.start[1], self.end[1]): cell, changed = self._check_interpret_cell(table_row[column_index], prior_cell, row_index, column_index) if changed: table_row[column_index] = cell prior_cell = cell
python
def _stringify_row(self, row_index): ''' Stringifies an entire row, filling in blanks with prior titles as they are found. ''' table_row = self.table[row_index] prior_cell = None for column_index in range(self.start[1], self.end[1]): cell, changed = self._check_interpret_cell(table_row[column_index], prior_cell, row_index, column_index) if changed: table_row[column_index] = cell prior_cell = cell
[ "def", "_stringify_row", "(", "self", ",", "row_index", ")", ":", "table_row", "=", "self", ".", "table", "[", "row_index", "]", "prior_cell", "=", "None", "for", "column_index", "in", "range", "(", "self", ".", "start", "[", "1", "]", ",", "self", ".", "end", "[", "1", "]", ")", ":", "cell", ",", "changed", "=", "self", ".", "_check_interpret_cell", "(", "table_row", "[", "column_index", "]", ",", "prior_cell", ",", "row_index", ",", "column_index", ")", "if", "changed", ":", "table_row", "[", "column_index", "]", "=", "cell", "prior_cell", "=", "cell" ]
Stringifies an entire row, filling in blanks with prior titles as they are found.
[ "Stringifies", "an", "entire", "row", "filling", "in", "blanks", "with", "prior", "titles", "as", "they", "are", "found", "." ]
train
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/blocks/block.py#L417-L427
<|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: Stringifies an entire row, filling in blanks with prior titles as they are found. ### Response: def _stringify_row(self, row_index): ''' Stringifies an entire row, filling in blanks with prior titles as they are found. ''' table_row = self.table[row_index] prior_cell = None for column_index in range(self.start[1], self.end[1]): cell, changed = self._check_interpret_cell(table_row[column_index], prior_cell, row_index, column_index) if changed: table_row[column_index] = cell prior_cell = cell <|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, 707, 9803, 459, 4553, 2872, 11, 21973, 304, 79640, 449, 4972, 15671, 439, 814, 527, 1766, 382, 14711, 6075, 512, 755, 721, 928, 1463, 8698, 1214, 11, 2872, 3644, 997, 286, 11414, 286, 935, 9803, 459, 4553, 2872, 11, 21973, 304, 79640, 449, 4972, 15671, 439, 814, 527, 1766, 627, 286, 11414, 286, 2007, 8698, 284, 659, 10549, 17396, 3644, 933, 286, 4972, 17061, 284, 2290, 198, 286, 369, 3330, 3644, 304, 2134, 1214, 5069, 58, 16, 1145, 659, 5183, 58, 16, 22953, 310, 2849, 11, 5614, 284, 659, 1462, 2071, 15678, 8203, 17061, 16138, 8698, 53585, 3644, 1145, 4972, 17061, 11, 2872, 3644, 11, 3330, 3644, 340, 310, 422, 5614, 512, 394, 2007, 8698, 53585, 3644, 60, 284, 2849, 198, 310, 4972, 17061, 284, 2849, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 707, 9803, 459, 4553, 2872, 11, 21973, 304, 79640, 449, 4972, 15671, 439, 814, 527, 1766, 382, 14711, 6075, 512, 755, 721, 928, 1463, 8698, 1214, 11, 2872, 3644, 997, 286, 11414, 286, 935, 9803, 459, 4553, 2872, 11, 21973, 304, 79640, 449, 4972, 15671, 439, 814, 527, 1766, 627, 286, 11414, 286, 2007, 8698, 284, 659, 10549, 17396, 3644, 933, 286, 4972, 17061, 284, 2290, 198, 286, 369, 3330, 3644, 304, 2134, 1214, 5069, 58, 16, 1145, 659, 5183, 58, 16, 22953, 310, 2849, 11, 5614, 284, 659, 1462, 2071, 15678, 8203, 17061, 16138, 8698, 53585, 3644, 1145, 4972, 17061, 11, 2872, 3644, 11, 3330, 3644, 340, 310, 422, 5614, 512, 394, 2007, 8698, 53585, 3644, 60, 284, 2849, 198, 310, 4972, 17061, 284, 2849, 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 ]
watson-developer-cloud/python-sdk
ibm_watson/speech_to_text_v1.py
Grammars._to_dict
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'grammars') and self.grammars is not None: _dict['grammars'] = [x._to_dict() for x in self.grammars] return _dict
python
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'grammars') and self.grammars is not None: _dict['grammars'] = [x._to_dict() for x in self.grammars] return _dict
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'grammars'", ")", "and", "self", ".", "grammars", "is", "not", "None", ":", "_dict", "[", "'grammars'", "]", "=", "[", "x", ".", "_to_dict", "(", ")", "for", "x", "in", "self", ".", "grammars", "]", "return", "_dict" ]
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/speech_to_text_v1.py#L3846-L3851
<|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 json dictionary representing this model. ### Response: def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'grammars') and self.grammars is not None: _dict['grammars'] = [x._to_dict() for x in self.grammars] return _dict <|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, 3024, 11240, 14393, 420, 1646, 382, 14711, 6075, 512, 755, 721, 998, 5356, 1214, 997, 286, 4304, 5715, 264, 3024, 11240, 14393, 420, 1646, 14781, 286, 721, 8644, 284, 5731, 286, 422, 32156, 1214, 11, 364, 1549, 96026, 873, 323, 659, 13, 1549, 96026, 374, 539, 2290, 512, 310, 721, 8644, 681, 1549, 96026, 663, 284, 510, 87, 1462, 998, 5356, 368, 369, 865, 304, 659, 13, 1549, 96026, 933, 286, 471, 721, 8644, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 3024, 11240, 14393, 420, 1646, 382, 14711, 6075, 512, 755, 721, 998, 5356, 1214, 997, 286, 4304, 5715, 264, 3024, 11240, 14393, 420, 1646, 14781, 286, 721, 8644, 284, 5731, 286, 422, 32156, 1214, 11, 364, 1549, 96026, 873, 323, 659, 13, 1549, 96026, 374, 539, 2290, 512, 310, 721, 8644, 681, 1549, 96026, 663, 284, 510, 87, 1462, 998, 5356, 368, 369, 865, 304, 659, 13, 1549, 96026, 933, 286, 471, 721, 8644, 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 ]
ssato/python-anyconfig
src/anyconfig/backend/ini.py
_load
def _load(stream, container, sep=_SEP, dkey=DEFAULTSECT, **kwargs): """ :param stream: File or file-like object provides ini-style conf :param container: any callable to make container :param sep: Seprator string :param dkey: Default section name :return: Dict or dict-like object represents config values """ (kwargs_1, psr) = _make_parser(**kwargs) if IS_PYTHON_3: psr.read_file(stream, **kwargs_1) else: psr.readfp(stream, **kwargs_1) cnf = container() kwargs["sep"] = sep defaults = psr.defaults() if defaults: cnf[dkey] = container(_parsed_items(iteritems(defaults), **kwargs)) for sect in psr.sections(): cnf[sect] = container(_parsed_items(psr.items(sect), **kwargs)) return cnf
python
def _load(stream, container, sep=_SEP, dkey=DEFAULTSECT, **kwargs): """ :param stream: File or file-like object provides ini-style conf :param container: any callable to make container :param sep: Seprator string :param dkey: Default section name :return: Dict or dict-like object represents config values """ (kwargs_1, psr) = _make_parser(**kwargs) if IS_PYTHON_3: psr.read_file(stream, **kwargs_1) else: psr.readfp(stream, **kwargs_1) cnf = container() kwargs["sep"] = sep defaults = psr.defaults() if defaults: cnf[dkey] = container(_parsed_items(iteritems(defaults), **kwargs)) for sect in psr.sections(): cnf[sect] = container(_parsed_items(psr.items(sect), **kwargs)) return cnf
[ "def", "_load", "(", "stream", ",", "container", ",", "sep", "=", "_SEP", ",", "dkey", "=", "DEFAULTSECT", ",", "*", "*", "kwargs", ")", ":", "(", "kwargs_1", ",", "psr", ")", "=", "_make_parser", "(", "*", "*", "kwargs", ")", "if", "IS_PYTHON_3", ":", "psr", ".", "read_file", "(", "stream", ",", "*", "*", "kwargs_1", ")", "else", ":", "psr", ".", "readfp", "(", "stream", ",", "*", "*", "kwargs_1", ")", "cnf", "=", "container", "(", ")", "kwargs", "[", "\"sep\"", "]", "=", "sep", "defaults", "=", "psr", ".", "defaults", "(", ")", "if", "defaults", ":", "cnf", "[", "dkey", "]", "=", "container", "(", "_parsed_items", "(", "iteritems", "(", "defaults", ")", ",", "*", "*", "kwargs", ")", ")", "for", "sect", "in", "psr", ".", "sections", "(", ")", ":", "cnf", "[", "sect", "]", "=", "container", "(", "_parsed_items", "(", "psr", ".", "items", "(", "sect", ")", ",", "*", "*", "kwargs", ")", ")", "return", "cnf" ]
:param stream: File or file-like object provides ini-style conf :param container: any callable to make container :param sep: Seprator string :param dkey: Default section name :return: Dict or dict-like object represents config values
[ ":", "param", "stream", ":", "File", "or", "file", "-", "like", "object", "provides", "ini", "-", "style", "conf", ":", "param", "container", ":", "any", "callable", "to", "make", "container", ":", "param", "sep", ":", "Seprator", "string", ":", "param", "dkey", ":", "Default", "section", "name" ]
train
https://github.com/ssato/python-anyconfig/blob/f2f4fb8d8e232aadea866c202e1dd7a5967e2877/src/anyconfig/backend/ini.py#L124-L149
<|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: :param stream: File or file-like object provides ini-style conf :param container: any callable to make container :param sep: Seprator string :param dkey: Default section name :return: Dict or dict-like object represents config values ### Response: def _load(stream, container, sep=_SEP, dkey=DEFAULTSECT, **kwargs): """ :param stream: File or file-like object provides ini-style conf :param container: any callable to make container :param sep: Seprator string :param dkey: Default section name :return: Dict or dict-like object represents config values """ (kwargs_1, psr) = _make_parser(**kwargs) if IS_PYTHON_3: psr.read_file(stream, **kwargs_1) else: psr.readfp(stream, **kwargs_1) cnf = container() kwargs["sep"] = sep defaults = psr.defaults() if defaults: cnf[dkey] = container(_parsed_items(iteritems(defaults), **kwargs)) for sect in psr.sections(): cnf[sect] = container(_parsed_items(psr.items(sect), **kwargs)) return cnf <|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, 68416, 4365, 25, 2958, 477, 1052, 12970, 1665, 5825, 17225, 11549, 2389, 198, 262, 551, 913, 5593, 25, 904, 42022, 311, 1304, 5593, 198, 262, 551, 913, 21693, 25, 1369, 652, 859, 925, 198, 262, 551, 913, 294, 798, 25, 8058, 3857, 836, 271, 262, 551, 693, 25, 30226, 477, 6587, 12970, 1665, 11105, 2242, 2819, 271, 14711, 6075, 512, 755, 721, 1096, 21217, 11, 5593, 11, 21693, 21574, 82476, 11, 294, 798, 28, 17733, 937, 1182, 11, 3146, 9872, 997, 262, 3270, 262, 551, 913, 4365, 25, 2958, 477, 1052, 12970, 1665, 5825, 17225, 11549, 2389, 198, 262, 551, 913, 5593, 25, 904, 42022, 311, 1304, 5593, 198, 262, 551, 913, 21693, 25, 1369, 652, 859, 925, 198, 262, 551, 913, 294, 798, 25, 8058, 3857, 836, 271, 262, 551, 693, 25, 30226, 477, 6587, 12970, 1665, 11105, 2242, 2819, 198, 262, 3270, 262, 320, 9872, 62, 16, 11, 4831, 81, 8, 284, 721, 7072, 19024, 22551, 9872, 340, 262, 422, 3507, 79637, 42599, 62, 18, 512, 286, 4831, 81, 4217, 2517, 21217, 11, 3146, 9872, 62, 16, 340, 262, 775, 512, 286, 4831, 81, 4217, 11089, 21217, 11, 3146, 9872, 62, 16, 696, 262, 13979, 69, 284, 5593, 746, 262, 16901, 1204, 29136, 1365, 284, 21693, 271, 262, 17088, 284, 4831, 81, 45044, 746, 262, 422, 17088, 512, 286, 13979, 69, 22142, 798, 60, 284, 5593, 2551, 42130, 12408, 28169, 3699, 19515, 82, 705, 3146, 9872, 4489, 262, 369, 31237, 304, 4831, 81, 73272, 4019, 286, 13979, 69, 58, 9885, 60, 284, 5593, 2551, 42130, 12408, 1319, 15444, 9812, 7, 9885, 705, 3146, 9872, 4489, 262, 471, 13979, 69, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 68416, 4365, 25, 2958, 477, 1052, 12970, 1665, 5825, 17225, 11549, 2389, 198, 262, 551, 913, 5593, 25, 904, 42022, 311, 1304, 5593, 198, 262, 551, 913, 21693, 25, 1369, 652, 859, 925, 198, 262, 551, 913, 294, 798, 25, 8058, 3857, 836, 271, 262, 551, 693, 25, 30226, 477, 6587, 12970, 1665, 11105, 2242, 2819, 271, 14711, 6075, 512, 755, 721, 1096, 21217, 11, 5593, 11, 21693, 21574, 82476, 11, 294, 798, 28, 17733, 937, 1182, 11, 3146, 9872, 997, 262, 3270, 262, 551, 913, 4365, 25, 2958, 477, 1052, 12970, 1665, 5825, 17225, 11549, 2389, 198, 262, 551, 913, 5593, 25, 904, 42022, 311, 1304, 5593, 198, 262, 551, 913, 21693, 25, 1369, 652, 859, 925, 198, 262, 551, 913, 294, 798, 25, 8058, 3857, 836, 271, 262, 551, 693, 25, 30226, 477, 6587, 12970, 1665, 11105, 2242, 2819, 198, 262, 3270, 262, 320, 9872, 62, 16, 11, 4831, 81, 8, 284, 721, 7072, 19024, 22551, 9872, 340, 262, 422, 3507, 79637, 42599, 62, 18, 512, 286, 4831, 81, 4217, 2517, 21217, 11, 3146, 9872, 62, 16, 340, 262, 775, 512, 286, 4831, 81, 4217, 11089, 21217, 11, 3146, 9872, 62, 16, 696, 262, 13979, 69, 284, 5593, 746, 262, 16901, 1204, 29136, 1365, 284, 21693, 271, 262, 17088, 284, 4831, 81, 45044, 746, 262, 422, 17088, 512, 286, 13979, 69, 22142, 798, 60, 284, 5593, 2551, 42130, 12408, 28169, 3699, 19515, 82, 705, 3146, 9872, 4489, 262, 369, 31237, 304, 4831, 81, 73272, 4019, 286, 13979, 69, 58, 9885, 60, 284, 5593, 2551, 42130, 12408, 1319, 15444, 9812, 7, 9885, 705, 3146, 9872, 4489, 262, 471, 13979, 69, 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 ]
konstantinstadler/country_converter
country_converter/country_converter.py
CountryConverter.get_correspondance_dict
def get_correspondance_dict(self, classA, classB, restrict=None, replace_numeric=True): """ Returns a correspondance between classification A and B as dict Parameters ---------- classA: str Valid classification (column name of data) classB: str Valid classification (column name of data). restrict: boolean vector of size cc.data, optional where cc is the name of the CountryConverter instance. Used to restrict the data sheet if necessary. E.g. to convert to countries which were OECD members before 1970 use cc.get_correspondance_dict('ISO3', 'OECD', restrict=cc.data.OECD < 1970) replace_numeric: boolean, optional If True (default) replace numeric values with the column header. This can be used if get a correspondance to, for example, 'OECD' instead of to the OECD membership years. Set to False if the actual numbers are required (as for UNcode). Returns ------- dict with keys: based on classA items: list of correspoding entries in classB or None """ result = {nn: None for nn in self.data[classA].values} if restrict is None: df = self.data.copy() else: df = self.data[restrict].copy() if replace_numeric and df[classB].dtype.kind in 'bifc': df.loc[~df[classB].isnull(), classB] = classB df.loc[df[classB].isnull(), classB] = None result.update(df.groupby(classA) .aggregate(lambda x: list(x.unique())) .to_dict()[classB]) return result
python
def get_correspondance_dict(self, classA, classB, restrict=None, replace_numeric=True): """ Returns a correspondance between classification A and B as dict Parameters ---------- classA: str Valid classification (column name of data) classB: str Valid classification (column name of data). restrict: boolean vector of size cc.data, optional where cc is the name of the CountryConverter instance. Used to restrict the data sheet if necessary. E.g. to convert to countries which were OECD members before 1970 use cc.get_correspondance_dict('ISO3', 'OECD', restrict=cc.data.OECD < 1970) replace_numeric: boolean, optional If True (default) replace numeric values with the column header. This can be used if get a correspondance to, for example, 'OECD' instead of to the OECD membership years. Set to False if the actual numbers are required (as for UNcode). Returns ------- dict with keys: based on classA items: list of correspoding entries in classB or None """ result = {nn: None for nn in self.data[classA].values} if restrict is None: df = self.data.copy() else: df = self.data[restrict].copy() if replace_numeric and df[classB].dtype.kind in 'bifc': df.loc[~df[classB].isnull(), classB] = classB df.loc[df[classB].isnull(), classB] = None result.update(df.groupby(classA) .aggregate(lambda x: list(x.unique())) .to_dict()[classB]) return result
[ "def", "get_correspondance_dict", "(", "self", ",", "classA", ",", "classB", ",", "restrict", "=", "None", ",", "replace_numeric", "=", "True", ")", ":", "result", "=", "{", "nn", ":", "None", "for", "nn", "in", "self", ".", "data", "[", "classA", "]", ".", "values", "}", "if", "restrict", "is", "None", ":", "df", "=", "self", ".", "data", ".", "copy", "(", ")", "else", ":", "df", "=", "self", ".", "data", "[", "restrict", "]", ".", "copy", "(", ")", "if", "replace_numeric", "and", "df", "[", "classB", "]", ".", "dtype", ".", "kind", "in", "'bifc'", ":", "df", ".", "loc", "[", "~", "df", "[", "classB", "]", ".", "isnull", "(", ")", ",", "classB", "]", "=", "classB", "df", ".", "loc", "[", "df", "[", "classB", "]", ".", "isnull", "(", ")", ",", "classB", "]", "=", "None", "result", ".", "update", "(", "df", ".", "groupby", "(", "classA", ")", ".", "aggregate", "(", "lambda", "x", ":", "list", "(", "x", ".", "unique", "(", ")", ")", ")", ".", "to_dict", "(", ")", "[", "classB", "]", ")", "return", "result" ]
Returns a correspondance between classification A and B as dict Parameters ---------- classA: str Valid classification (column name of data) classB: str Valid classification (column name of data). restrict: boolean vector of size cc.data, optional where cc is the name of the CountryConverter instance. Used to restrict the data sheet if necessary. E.g. to convert to countries which were OECD members before 1970 use cc.get_correspondance_dict('ISO3', 'OECD', restrict=cc.data.OECD < 1970) replace_numeric: boolean, optional If True (default) replace numeric values with the column header. This can be used if get a correspondance to, for example, 'OECD' instead of to the OECD membership years. Set to False if the actual numbers are required (as for UNcode). Returns ------- dict with keys: based on classA items: list of correspoding entries in classB or None
[ "Returns", "a", "correspondance", "between", "classification", "A", "and", "B", "as", "dict" ]
train
https://github.com/konstantinstadler/country_converter/blob/b78622dfa6700480df632fe061d6837b96f31b71/country_converter/country_converter.py#L691-L740
<|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 correspondance between classification A and B as dict Parameters ---------- classA: str Valid classification (column name of data) classB: str Valid classification (column name of data). restrict: boolean vector of size cc.data, optional where cc is the name of the CountryConverter instance. Used to restrict the data sheet if necessary. E.g. to convert to countries which were OECD members before 1970 use cc.get_correspondance_dict('ISO3', 'OECD', restrict=cc.data.OECD < 1970) replace_numeric: boolean, optional If True (default) replace numeric values with the column header. This can be used if get a correspondance to, for example, 'OECD' instead of to the OECD membership years. Set to False if the actual numbers are required (as for UNcode). Returns ------- dict with keys: based on classA items: list of correspoding entries in classB or None ### Response: def get_correspondance_dict(self, classA, classB, restrict=None, replace_numeric=True): """ Returns a correspondance between classification A and B as dict Parameters ---------- classA: str Valid classification (column name of data) classB: str Valid classification (column name of data). restrict: boolean vector of size cc.data, optional where cc is the name of the CountryConverter instance. Used to restrict the data sheet if necessary. E.g. to convert to countries which were OECD members before 1970 use cc.get_correspondance_dict('ISO3', 'OECD', restrict=cc.data.OECD < 1970) replace_numeric: boolean, optional If True (default) replace numeric values with the column header. This can be used if get a correspondance to, for example, 'OECD' instead of to the OECD membership years. Set to False if the actual numbers are required (as for UNcode). Returns ------- dict with keys: based on classA items: list of correspoding entries in classB or None """ result = {nn: None for nn in self.data[classA].values} if restrict is None: df = self.data.copy() else: df = self.data[restrict].copy() if replace_numeric and df[classB].dtype.kind in 'bifc': df.loc[~df[classB].isnull(), classB] = classB df.loc[df[classB].isnull(), classB] = None result.update(df.groupby(classA) .aggregate(lambda x: list(x.unique())) .to_dict()[classB]) 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, 16851, 264, 8024, 685, 1990, 24790, 362, 323, 426, 439, 6587, 271, 286, 13831, 198, 286, 44889, 271, 286, 538, 32, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 696, 286, 538, 33, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 3677, 286, 9067, 25, 2777, 4724, 315, 1404, 12810, 2245, 11, 10309, 198, 310, 1405, 12810, 374, 279, 836, 315, 279, 14438, 15267, 2937, 13, 220, 12477, 311, 198, 310, 9067, 279, 828, 11071, 422, 5995, 13, 220, 469, 1326, 13, 311, 5625, 311, 5961, 198, 310, 902, 1051, 79517, 3697, 1603, 220, 4468, 15, 1005, 198, 310, 12810, 673, 15076, 6961, 685, 5356, 493, 25141, 18, 518, 364, 53965, 6620, 518, 9067, 28, 641, 2245, 8548, 36, 6620, 78665, 310, 220, 4468, 15, 696, 286, 8454, 30518, 25, 2777, 11, 10309, 198, 310, 1442, 3082, 320, 2309, 8, 8454, 25031, 2819, 449, 279, 3330, 4342, 627, 310, 1115, 649, 387, 1511, 422, 636, 264, 8024, 685, 311, 11, 369, 3187, 11, 364, 53965, 6620, 1270, 310, 4619, 315, 311, 279, 79517, 16250, 1667, 13, 2638, 311, 3641, 422, 279, 5150, 198, 310, 5219, 527, 2631, 320, 300, 369, 6781, 1889, 3677, 286, 5295, 198, 286, 39707, 286, 6587, 449, 198, 310, 7039, 25, 3196, 389, 538, 32, 198, 310, 3673, 25, 1160, 315, 1867, 18744, 3785, 10925, 304, 538, 33, 477, 2290, 271, 14711, 6075, 512, 755, 636, 15076, 6961, 685, 5356, 1214, 11, 538, 32, 11, 538, 33, 345, 1408, 9067, 5980, 345, 1408, 8454, 30518, 3702, 997, 286, 4304, 5295, 264, 8024, 685, 1990, 24790, 362, 323, 426, 439, 6587, 271, 286, 13831, 198, 286, 44889, 271, 286, 538, 32, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 696, 286, 538, 33, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 3677, 286, 9067, 25, 2777, 4724, 315, 1404, 12810, 2245, 11, 10309, 198, 310, 1405, 12810, 374, 279, 836, 315, 279, 14438, 15267, 2937, 13, 220, 12477, 311, 198, 310, 9067, 279, 828, 11071, 422, 5995, 13, 220, 469, 1326, 13, 311, 5625, 311, 5961, 198, 310, 902, 1051, 79517, 3697, 1603, 220, 4468, 15, 1005, 198, 310, 12810, 673, 15076, 6961, 685, 5356, 493, 25141, 18, 518, 364, 53965, 6620, 518, 9067, 28, 641, 2245, 8548, 36, 6620, 78665, 310, 220, 4468, 15, 696, 286, 8454, 30518, 25, 2777, 11, 10309, 198, 310, 1442, 3082, 320, 2309, 8, 8454, 25031, 2819, 449, 279, 3330, 4342, 627, 310, 1115, 649, 387, 1511, 422, 636, 264, 8024, 685, 311, 11, 369, 3187, 11, 364, 53965, 6620, 1270, 310, 4619, 315, 311, 279, 79517, 16250, 1667, 13, 2638, 311, 3641, 422, 279, 5150, 198, 310, 5219, 527, 2631, 320, 300, 369, 6781, 1889, 3677, 286, 5295, 198, 286, 39707, 286, 6587, 449, 198, 310, 7039, 25, 3196, 389, 538 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 8024, 685, 1990, 24790, 362, 323, 426, 439, 6587, 271, 286, 13831, 198, 286, 44889, 271, 286, 538, 32, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 696, 286, 538, 33, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 3677, 286, 9067, 25, 2777, 4724, 315, 1404, 12810, 2245, 11, 10309, 198, 310, 1405, 12810, 374, 279, 836, 315, 279, 14438, 15267, 2937, 13, 220, 12477, 311, 198, 310, 9067, 279, 828, 11071, 422, 5995, 13, 220, 469, 1326, 13, 311, 5625, 311, 5961, 198, 310, 902, 1051, 79517, 3697, 1603, 220, 4468, 15, 1005, 198, 310, 12810, 673, 15076, 6961, 685, 5356, 493, 25141, 18, 518, 364, 53965, 6620, 518, 9067, 28, 641, 2245, 8548, 36, 6620, 78665, 310, 220, 4468, 15, 696, 286, 8454, 30518, 25, 2777, 11, 10309, 198, 310, 1442, 3082, 320, 2309, 8, 8454, 25031, 2819, 449, 279, 3330, 4342, 627, 310, 1115, 649, 387, 1511, 422, 636, 264, 8024, 685, 311, 11, 369, 3187, 11, 364, 53965, 6620, 1270, 310, 4619, 315, 311, 279, 79517, 16250, 1667, 13, 2638, 311, 3641, 422, 279, 5150, 198, 310, 5219, 527, 2631, 320, 300, 369, 6781, 1889, 3677, 286, 5295, 198, 286, 39707, 286, 6587, 449, 198, 310, 7039, 25, 3196, 389, 538, 32, 198, 310, 3673, 25, 1160, 315, 1867, 18744, 3785, 10925, 304, 538, 33, 477, 2290, 271, 14711, 6075, 512, 755, 636, 15076, 6961, 685, 5356, 1214, 11, 538, 32, 11, 538, 33, 345, 1408, 9067, 5980, 345, 1408, 8454, 30518, 3702, 997, 286, 4304, 5295, 264, 8024, 685, 1990, 24790, 362, 323, 426, 439, 6587, 271, 286, 13831, 198, 286, 44889, 271, 286, 538, 32, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 696, 286, 538, 33, 25, 610, 198, 310, 7974, 24790, 320, 6361, 836, 315, 828, 3677, 286, 9067, 25, 2777, 4724, 315, 1404, 12810, 2245, 11, 10309, 198, 310, 1405, 12810, 374, 279, 836, 315, 279, 14438, 15267, 2937, 13, 220, 12477, 311, 198, 310, 9067, 279, 828, 11071, 422, 5995, 13, 220, 469, 1326, 13, 311, 5625, 311, 5961, 198, 310, 902, 1051, 79517, 3697, 1603, 220, 4468, 15, 1005, 198, 310, 12810, 673, 15076, 6961, 685, 5356, 493, 25141, 18, 518, 364, 53965, 6620, 518, 9067, 28, 641, 2245, 8548, 36, 6620, 78665, 310, 220, 4468, 15, 696, 286, 8454, 30518, 25, 2777, 11, 10309, 198, 310, 1442, 3082, 320, 2309, 8, 8454, 25031, 2819, 449, 279, 3330, 4342, 627, 310, 1115, 649, 387, 1511, 422, 636, 264, 8024, 685, 311, 11, 369, 3187, 11, 364, 53965, 6620, 1270, 310, 4619, 315, 311, 279, 79517, 16250, 1667, 13, 2638, 311, 3641, 422, 279, 5150, 198, 310, 5219, 527, 2631, 320, 300, 369, 6781, 1889, 3677, 286, 5295, 198, 286, 39707, 286, 6587, 449, 198, 310, 7039, 25, 3196, 389, 538 ]
mattbierner/blotre-py
blotre.py
create_disposable
def create_disposable(clientInfo, config = {}): """ Create a new disposable client. """ response = requests.put( _format_url( _extend(DEFAULT_CONFIG, config), OAUTH2_ROOT + 'disposable'), json = clientInfo) if response.status_code != 200: return None else: body = response.json() return Blotre({ 'client_id': body['id'], 'client_secret': body['secret'], 'code': body['code'] }, config = config)
python
def create_disposable(clientInfo, config = {}): """ Create a new disposable client. """ response = requests.put( _format_url( _extend(DEFAULT_CONFIG, config), OAUTH2_ROOT + 'disposable'), json = clientInfo) if response.status_code != 200: return None else: body = response.json() return Blotre({ 'client_id': body['id'], 'client_secret': body['secret'], 'code': body['code'] }, config = config)
[ "def", "create_disposable", "(", "clientInfo", ",", "config", "=", "{", "}", ")", ":", "response", "=", "requests", ".", "put", "(", "_format_url", "(", "_extend", "(", "DEFAULT_CONFIG", ",", "config", ")", ",", "OAUTH2_ROOT", "+", "'disposable'", ")", ",", "json", "=", "clientInfo", ")", "if", "response", ".", "status_code", "!=", "200", ":", "return", "None", "else", ":", "body", "=", "response", ".", "json", "(", ")", "return", "Blotre", "(", "{", "'client_id'", ":", "body", "[", "'id'", "]", ",", "'client_secret'", ":", "body", "[", "'secret'", "]", ",", "'code'", ":", "body", "[", "'code'", "]", "}", ",", "config", "=", "config", ")" ]
Create a new disposable client.
[ "Create", "a", "new", "disposable", "client", "." ]
train
https://github.com/mattbierner/blotre-py/blob/c98228d1159bc651aad546e442b0acbf97b1e043/blotre.py#L328-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: Create a new disposable client. ### Response: def create_disposable(clientInfo, config = {}): """ Create a new disposable client. """ response = requests.put( _format_url( _extend(DEFAULT_CONFIG, config), OAUTH2_ROOT + 'disposable'), json = clientInfo) if response.status_code != 200: return None else: body = response.json() return Blotre({ 'client_id': body['id'], 'client_secret': body['secret'], 'code': body['code'] }, config = 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, 4110, 264, 502, 44890, 3016, 382, 14711, 6075, 512, 755, 1893, 10135, 17877, 13097, 1767, 11, 2242, 284, 4792, 997, 262, 3270, 262, 4324, 264, 502, 44890, 3016, 627, 262, 3270, 262, 2077, 284, 7540, 3681, 1021, 286, 721, 2293, 2975, 1021, 310, 721, 26103, 44275, 12853, 11, 2242, 705, 720, 310, 507, 27792, 17, 16594, 489, 364, 4338, 17877, 3379, 286, 3024, 284, 3016, 1767, 340, 1084, 262, 422, 2077, 4397, 4229, 976, 220, 1049, 512, 286, 471, 2290, 198, 262, 775, 512, 286, 2547, 284, 2077, 4421, 368, 720, 286, 471, 2563, 52262, 2313, 310, 364, 3045, 851, 1232, 2547, 681, 307, 4479, 310, 364, 3045, 22729, 1232, 2547, 681, 21107, 4479, 310, 364, 1889, 1232, 2547, 681, 1889, 4532, 286, 2529, 2242, 284, 2242, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 502, 44890, 3016, 382, 14711, 6075, 512, 755, 1893, 10135, 17877, 13097, 1767, 11, 2242, 284, 4792, 997, 262, 3270, 262, 4324, 264, 502, 44890, 3016, 627, 262, 3270, 262, 2077, 284, 7540, 3681, 1021, 286, 721, 2293, 2975, 1021, 310, 721, 26103, 44275, 12853, 11, 2242, 705, 720, 310, 507, 27792, 17, 16594, 489, 364, 4338, 17877, 3379, 286, 3024, 284, 3016, 1767, 340, 1084, 262, 422, 2077, 4397, 4229, 976, 220, 1049, 512, 286, 471, 2290, 198, 262, 775, 512, 286, 2547, 284, 2077, 4421, 368, 720, 286, 471, 2563, 52262, 2313, 310, 364, 3045, 851, 1232, 2547, 681, 307, 4479, 310, 364, 3045, 22729, 1232, 2547, 681, 21107, 4479, 310, 364, 1889, 1232, 2547, 681, 1889, 4532, 286, 2529, 2242, 284, 2242, 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 ]
juju/charm-helpers
charmhelpers/contrib/database/mysql.py
MySQLHelper.execute
def execute(self, sql): """Execute arbitary SQL against the database.""" cursor = self.connection.cursor() try: cursor.execute(sql) finally: cursor.close()
python
def execute(self, sql): """Execute arbitary SQL against the database.""" cursor = self.connection.cursor() try: cursor.execute(sql) finally: cursor.close()
[ "def", "execute", "(", "self", ",", "sql", ")", ":", "cursor", "=", "self", ".", "connection", ".", "cursor", "(", ")", "try", ":", "cursor", ".", "execute", "(", "sql", ")", "finally", ":", "cursor", ".", "close", "(", ")" ]
Execute arbitary SQL against the database.
[ "Execute", "arbitary", "SQL", "against", "the", "database", "." ]
train
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/database/mysql.py#L160-L166
<|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: Execute arbitary SQL against the database. ### Response: def execute(self, sql): """Execute arbitary SQL against the database.""" cursor = self.connection.cursor() try: cursor.execute(sql) finally: cursor.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, 17617, 17114, 661, 8029, 2403, 279, 4729, 382, 14711, 6075, 512, 755, 9203, 1214, 11, 5822, 997, 286, 4304, 17617, 17114, 661, 8029, 2403, 279, 4729, 14781, 286, 8291, 284, 659, 20928, 21361, 746, 286, 1456, 512, 310, 8291, 7925, 13449, 340, 286, 5616, 512, 310, 8291, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 17617, 17114, 661, 8029, 2403, 279, 4729, 382, 14711, 6075, 512, 755, 9203, 1214, 11, 5822, 997, 286, 4304, 17617, 17114, 661, 8029, 2403, 279, 4729, 14781, 286, 8291, 284, 659, 20928, 21361, 746, 286, 1456, 512, 310, 8291, 7925, 13449, 340, 286, 5616, 512, 310, 8291, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
dslackw/slpkg
slpkg/status_deps.py
DependenciesStatus.show
def show(self): """Show dependencies status """ self.data() print("") self.msg.template(78) print("| {0}{1}{2}".format("Dependencies", " " * 20, "Packages")) self.msg.template(78) for key, value in self.dmap.iteritems(): print(" {0}{1}{2}{3}{4}".format( self.green, key, self.endc, " " * (32-len(key)), ", ".join(value))) self.summary() if self.image: Graph(self.image).dependencies(self.dmap)
python
def show(self): """Show dependencies status """ self.data() print("") self.msg.template(78) print("| {0}{1}{2}".format("Dependencies", " " * 20, "Packages")) self.msg.template(78) for key, value in self.dmap.iteritems(): print(" {0}{1}{2}{3}{4}".format( self.green, key, self.endc, " " * (32-len(key)), ", ".join(value))) self.summary() if self.image: Graph(self.image).dependencies(self.dmap)
[ "def", "show", "(", "self", ")", ":", "self", ".", "data", "(", ")", "print", "(", "\"\"", ")", "self", ".", "msg", ".", "template", "(", "78", ")", "print", "(", "\"| {0}{1}{2}\"", ".", "format", "(", "\"Dependencies\"", ",", "\" \"", "*", "20", ",", "\"Packages\"", ")", ")", "self", ".", "msg", ".", "template", "(", "78", ")", "for", "key", ",", "value", "in", "self", ".", "dmap", ".", "iteritems", "(", ")", ":", "print", "(", "\" {0}{1}{2}{3}{4}\"", ".", "format", "(", "self", ".", "green", ",", "key", ",", "self", ".", "endc", ",", "\" \"", "*", "(", "32", "-", "len", "(", "key", ")", ")", ",", "\", \"", ".", "join", "(", "value", ")", ")", ")", "self", ".", "summary", "(", ")", "if", "self", ".", "image", ":", "Graph", "(", "self", ".", "image", ")", ".", "dependencies", "(", "self", ".", "dmap", ")" ]
Show dependencies status
[ "Show", "dependencies", "status" ]
train
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/status_deps.py#L84-L98
<|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: Show dependencies status ### Response: def show(self): """Show dependencies status """ self.data() print("") self.msg.template(78) print("| {0}{1}{2}".format("Dependencies", " " * 20, "Packages")) self.msg.template(78) for key, value in self.dmap.iteritems(): print(" {0}{1}{2}{3}{4}".format( self.green, key, self.endc, " " * (32-len(key)), ", ".join(value))) self.summary() if self.image: Graph(self.image).dependencies(self.dmap) <|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, 7968, 20113, 2704, 271, 14711, 6075, 512, 755, 1501, 1214, 997, 286, 4304, 7968, 20113, 2704, 198, 286, 3270, 286, 659, 2245, 746, 286, 1194, 32864, 286, 659, 15488, 21657, 7, 2495, 340, 286, 1194, 39647, 314, 15, 15523, 16, 15523, 17, 22664, 2293, 446, 49403, 498, 330, 330, 353, 220, 508, 11, 330, 70613, 5572, 286, 659, 15488, 21657, 7, 2495, 340, 286, 369, 1401, 11, 907, 304, 659, 962, 2235, 58542, 4019, 310, 1194, 446, 220, 314, 15, 15523, 16, 15523, 17, 15523, 18, 15523, 19, 22664, 2293, 1021, 394, 659, 30054, 11, 1401, 11, 659, 5183, 66, 11, 330, 330, 353, 320, 843, 86657, 4962, 7110, 394, 3755, 6058, 6115, 3764, 6054, 286, 659, 36441, 746, 286, 422, 659, 7502, 512, 310, 12441, 1214, 7502, 570, 55374, 1214, 962, 2235, 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, 128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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, 7968, 20113, 2704, 271, 14711, 6075, 512, 755, 1501, 1214, 997, 286, 4304, 7968, 20113, 2704, 198, 286, 3270, 286, 659, 2245, 746, 286, 1194, 32864, 286, 659, 15488, 21657, 7, 2495, 340, 286, 1194, 39647, 314, 15, 15523, 16, 15523, 17, 22664, 2293, 446, 49403, 498, 330, 330, 353, 220, 508, 11, 330, 70613, 5572, 286, 659, 15488, 21657, 7, 2495, 340, 286, 369, 1401, 11, 907, 304, 659, 962, 2235, 58542, 4019, 310, 1194, 446, 220, 314, 15, 15523, 16, 15523, 17, 15523, 18, 15523, 19, 22664, 2293, 1021, 394, 659, 30054, 11, 1401, 11, 659, 5183, 66, 11, 330, 330, 353, 320, 843, 86657, 4962, 7110, 394, 3755, 6058, 6115, 3764, 6054, 286, 659, 36441, 746, 286, 422, 659, 7502, 512, 310, 12441, 1214, 7502, 570, 55374, 1214, 962, 2235, 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 ]
pyviz/holoviews
holoviews/core/spaces.py
HoloMap.split_overlays
def split_overlays(self): "Deprecated method to split overlays inside the HoloMap." if util.config.future_deprecations: self.param.warning("split_overlays is deprecated and is now " "a private method.") return self._split_overlays()
python
def split_overlays(self): "Deprecated method to split overlays inside the HoloMap." if util.config.future_deprecations: self.param.warning("split_overlays is deprecated and is now " "a private method.") return self._split_overlays()
[ "def", "split_overlays", "(", "self", ")", ":", "if", "util", ".", "config", ".", "future_deprecations", ":", "self", ".", "param", ".", "warning", "(", "\"split_overlays is deprecated and is now \"", "\"a private method.\"", ")", "return", "self", ".", "_split_overlays", "(", ")" ]
Deprecated method to split overlays inside the HoloMap.
[ "Deprecated", "method", "to", "split", "overlays", "inside", "the", "HoloMap", "." ]
train
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/spaces.py#L144-L149
<|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: Deprecated method to split overlays inside the HoloMap. ### Response: def split_overlays(self): "Deprecated method to split overlays inside the HoloMap." if util.config.future_deprecations: self.param.warning("split_overlays is deprecated and is now " "a private method.") return self._split_overlays() <|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, 52444, 1749, 311, 6859, 97972, 4871, 279, 473, 10216, 2276, 382, 14711, 6075, 512, 755, 6859, 15793, 64459, 1214, 997, 286, 330, 52444, 1749, 311, 6859, 97972, 4871, 279, 473, 10216, 2276, 10246, 286, 422, 4186, 5539, 98793, 2310, 10872, 811, 512, 310, 659, 6772, 29936, 446, 7105, 15793, 64459, 374, 32690, 323, 374, 1457, 6360, 7714, 330, 64, 879, 1749, 13352, 286, 471, 659, 1462, 7105, 15793, 64459, 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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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 ]
[ 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, 52444, 1749, 311, 6859, 97972, 4871, 279, 473, 10216, 2276, 382, 14711, 6075, 512, 755, 6859, 15793, 64459, 1214, 997, 286, 330, 52444, 1749, 311, 6859, 97972, 4871, 279, 473, 10216, 2276, 10246, 286, 422, 4186, 5539, 98793, 2310, 10872, 811, 512, 310, 659, 6772, 29936, 446, 7105, 15793, 64459, 374, 32690, 323, 374, 1457, 6360, 7714, 330, 64, 879, 1749, 13352, 286, 471, 659, 1462, 7105, 15793, 64459, 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 ]
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_spu
def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, ctypes.c_int, MediaPlayer) return f(p_mi)
python
def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, ctypes.c_int, MediaPlayer) return f(p_mi)
[ "def", "libvlc_video_get_spu", "(", "p_mi", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_spu'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_spu'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ")", "return", "f", "(", "p_mi", ")" ]
Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none.
[ "Get", "current", "video", "subtitle", "." ]
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5696-L5704
<|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 current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ### Response: def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, ctypes.c_int, MediaPlayer) return f(p_mi) <|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, 1510, 2835, 32835, 627, 262, 571, 913, 281, 87113, 25, 279, 3772, 2851, 627, 262, 571, 693, 25, 279, 2835, 32835, 4183, 11, 477, 482, 16, 422, 7000, 382, 14711, 6075, 512, 755, 3127, 99504, 20402, 3138, 646, 5701, 1319, 87113, 997, 262, 11712, 1991, 1510, 2835, 32835, 627, 262, 571, 913, 281, 87113, 25, 279, 3772, 2851, 627, 262, 571, 693, 25, 279, 2835, 32835, 4183, 11, 477, 482, 16, 422, 7000, 627, 262, 11414, 262, 282, 284, 721, 34, 22124, 673, 493, 2808, 99504, 20402, 3138, 646, 5701, 518, 2290, 8, 477, 3120, 286, 721, 34, 1723, 493, 2808, 99504, 20402, 3138, 646, 5701, 518, 1819, 16, 60664, 705, 2290, 345, 504, 49319, 522, 4132, 11, 72110, 340, 262, 471, 282, 1319, 87113, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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 2835, 32835, 627, 262, 571, 913, 281, 87113, 25, 279, 3772, 2851, 627, 262, 571, 693, 25, 279, 2835, 32835, 4183, 11, 477, 482, 16, 422, 7000, 382, 14711, 6075, 512, 755, 3127, 99504, 20402, 3138, 646, 5701, 1319, 87113, 997, 262, 11712, 1991, 1510, 2835, 32835, 627, 262, 571, 913, 281, 87113, 25, 279, 3772, 2851, 627, 262, 571, 693, 25, 279, 2835, 32835, 4183, 11, 477, 482, 16, 422, 7000, 627, 262, 11414, 262, 282, 284, 721, 34, 22124, 673, 493, 2808, 99504, 20402, 3138, 646, 5701, 518, 2290, 8, 477, 3120, 286, 721, 34, 1723, 493, 2808, 99504, 20402, 3138, 646, 5701, 518, 1819, 16, 60664, 705, 2290, 345, 504, 49319, 522, 4132, 11, 72110, 340, 262, 471, 282, 1319, 87113, 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 ]
rckclmbr/pyportify
pyportify/pkcs1/primes.py
is_prime
def is_prime(n, rnd=default_pseudo_random, k=DEFAULT_ITERATION, algorithm=None): '''Test if n is a prime number m - the integer to test rnd - the random number generator to use for the probalistic primality algorithms, k - the number of iterations to use for the probabilistic primality algorithms, algorithm - the primality algorithm to use, default is Miller-Rabin. The gmpy implementation is used if gmpy is installed. Return value: True is n seems prime, False otherwise. ''' if algorithm is None: algorithm = PRIME_ALGO if algorithm == 'gmpy-miller-rabin': if not gmpy: raise NotImplementedError return gmpy.is_prime(n, k) elif algorithm == 'miller-rabin': # miller rabin probability of primality is 1/4**k return miller_rabin(n, k, rnd=rnd) elif algorithm == 'solovay-strassen': # for jacobi it's 1/2**k return randomized_primality_testing(n, rnd=rnd, k=k*2) else: raise NotImplementedError
python
def is_prime(n, rnd=default_pseudo_random, k=DEFAULT_ITERATION, algorithm=None): '''Test if n is a prime number m - the integer to test rnd - the random number generator to use for the probalistic primality algorithms, k - the number of iterations to use for the probabilistic primality algorithms, algorithm - the primality algorithm to use, default is Miller-Rabin. The gmpy implementation is used if gmpy is installed. Return value: True is n seems prime, False otherwise. ''' if algorithm is None: algorithm = PRIME_ALGO if algorithm == 'gmpy-miller-rabin': if not gmpy: raise NotImplementedError return gmpy.is_prime(n, k) elif algorithm == 'miller-rabin': # miller rabin probability of primality is 1/4**k return miller_rabin(n, k, rnd=rnd) elif algorithm == 'solovay-strassen': # for jacobi it's 1/2**k return randomized_primality_testing(n, rnd=rnd, k=k*2) else: raise NotImplementedError
[ "def", "is_prime", "(", "n", ",", "rnd", "=", "default_pseudo_random", ",", "k", "=", "DEFAULT_ITERATION", ",", "algorithm", "=", "None", ")", ":", "if", "algorithm", "is", "None", ":", "algorithm", "=", "PRIME_ALGO", "if", "algorithm", "==", "'gmpy-miller-rabin'", ":", "if", "not", "gmpy", ":", "raise", "NotImplementedError", "return", "gmpy", ".", "is_prime", "(", "n", ",", "k", ")", "elif", "algorithm", "==", "'miller-rabin'", ":", "# miller rabin probability of primality is 1/4**k", "return", "miller_rabin", "(", "n", ",", "k", ",", "rnd", "=", "rnd", ")", "elif", "algorithm", "==", "'solovay-strassen'", ":", "# for jacobi it's 1/2**k", "return", "randomized_primality_testing", "(", "n", ",", "rnd", "=", "rnd", ",", "k", "=", "k", "*", "2", ")", "else", ":", "raise", "NotImplementedError" ]
Test if n is a prime number m - the integer to test rnd - the random number generator to use for the probalistic primality algorithms, k - the number of iterations to use for the probabilistic primality algorithms, algorithm - the primality algorithm to use, default is Miller-Rabin. The gmpy implementation is used if gmpy is installed. Return value: True is n seems prime, False otherwise.
[ "Test", "if", "n", "is", "a", "prime", "number" ]
train
https://github.com/rckclmbr/pyportify/blob/696a1caad8a47b191f3bec44cc8fc3c437779512/pyportify/pkcs1/primes.py#L19-L47
<|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: Test if n is a prime number m - the integer to test rnd - the random number generator to use for the probalistic primality algorithms, k - the number of iterations to use for the probabilistic primality algorithms, algorithm - the primality algorithm to use, default is Miller-Rabin. The gmpy implementation is used if gmpy is installed. Return value: True is n seems prime, False otherwise. ### Response: def is_prime(n, rnd=default_pseudo_random, k=DEFAULT_ITERATION, algorithm=None): '''Test if n is a prime number m - the integer to test rnd - the random number generator to use for the probalistic primality algorithms, k - the number of iterations to use for the probabilistic primality algorithms, algorithm - the primality algorithm to use, default is Miller-Rabin. The gmpy implementation is used if gmpy is installed. Return value: True is n seems prime, False otherwise. ''' if algorithm is None: algorithm = PRIME_ALGO if algorithm == 'gmpy-miller-rabin': if not gmpy: raise NotImplementedError return gmpy.is_prime(n, k) elif algorithm == 'miller-rabin': # miller rabin probability of primality is 1/4**k return miller_rabin(n, k, rnd=rnd) elif algorithm == 'solovay-strassen': # for jacobi it's 1/2**k return randomized_primality_testing(n, rnd=rnd, k=k*2) else: raise NotImplementedError <|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, 2323, 422, 308, 374, 264, 10461, 1396, 271, 996, 296, 482, 279, 7698, 311, 1296, 198, 996, 38293, 482, 279, 4288, 1396, 14143, 311, 1005, 369, 279, 3650, 278, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 597, 482, 279, 1396, 315, 26771, 311, 1005, 369, 279, 85193, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 12384, 482, 279, 9036, 2786, 12384, 311, 1005, 11, 1670, 374, 17472, 11151, 9068, 13, 578, 198, 996, 342, 1331, 88, 8292, 374, 1511, 422, 342, 1331, 88, 374, 10487, 382, 996, 3494, 907, 25, 3082, 374, 308, 5084, 10461, 11, 3641, 6062, 382, 14711, 6075, 512, 755, 374, 39317, 1471, 11, 38293, 93728, 623, 22719, 23471, 11, 597, 28, 17733, 52447, 3579, 345, 1835, 12384, 5980, 997, 262, 11712, 2323, 422, 308, 374, 264, 10461, 1396, 271, 996, 296, 482, 279, 7698, 311, 1296, 198, 996, 38293, 482, 279, 4288, 1396, 14143, 311, 1005, 369, 279, 3650, 278, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 597, 482, 279, 1396, 315, 26771, 311, 1005, 369, 279, 85193, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 12384, 482, 279, 9036, 2786, 12384, 311, 1005, 11, 1670, 374, 17472, 11151, 9068, 13, 578, 198, 996, 342, 1331, 88, 8292, 374, 1511, 422, 342, 1331, 88, 374, 10487, 382, 996, 3494, 907, 25, 3082, 374, 308, 5084, 10461, 11, 3641, 6062, 627, 262, 45832, 262, 422, 12384, 374, 2290, 512, 286, 12384, 284, 8743, 5778, 9089, 15881, 198, 262, 422, 12384, 624, 364, 70, 1331, 88, 1474, 15610, 3880, 9068, 3730, 286, 422, 539, 342, 1331, 88, 512, 310, 4933, 39299, 198, 286, 471, 342, 1331, 88, 2124, 39317, 1471, 11, 597, 340, 262, 4508, 12384, 624, 364, 76, 15610, 3880, 9068, 3730, 286, 674, 2606, 261, 436, 9068, 19463, 315, 9036, 2786, 374, 220, 16, 14, 19, 334, 74, 198, 286, 471, 2606, 261, 1745, 9068, 1471, 11, 597, 11, 38293, 32220, 303, 340, 262, 4508, 12384, 624, 364, 39298, 869, 352, 42728, 28376, 3730, 286, 674, 369, 60943, 18843, 433, 596, 220, 16, 14, 17, 334, 74, 198, 286, 471, 47341, 88519, 2786, 72062, 1471, 11, 38293, 32220, 303, 11, 597, 46257, 9, 17, 340, 262, 775, 512, 286, 4933, 39299, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 2323, 422, 308, 374, 264, 10461, 1396, 271, 996, 296, 482, 279, 7698, 311, 1296, 198, 996, 38293, 482, 279, 4288, 1396, 14143, 311, 1005, 369, 279, 3650, 278, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 597, 482, 279, 1396, 315, 26771, 311, 1005, 369, 279, 85193, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 12384, 482, 279, 9036, 2786, 12384, 311, 1005, 11, 1670, 374, 17472, 11151, 9068, 13, 578, 198, 996, 342, 1331, 88, 8292, 374, 1511, 422, 342, 1331, 88, 374, 10487, 382, 996, 3494, 907, 25, 3082, 374, 308, 5084, 10461, 11, 3641, 6062, 382, 14711, 6075, 512, 755, 374, 39317, 1471, 11, 38293, 93728, 623, 22719, 23471, 11, 597, 28, 17733, 52447, 3579, 345, 1835, 12384, 5980, 997, 262, 11712, 2323, 422, 308, 374, 264, 10461, 1396, 271, 996, 296, 482, 279, 7698, 311, 1296, 198, 996, 38293, 482, 279, 4288, 1396, 14143, 311, 1005, 369, 279, 3650, 278, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 597, 482, 279, 1396, 315, 26771, 311, 1005, 369, 279, 85193, 4633, 9036, 2786, 198, 996, 26249, 345, 996, 12384, 482, 279, 9036, 2786, 12384, 311, 1005, 11, 1670, 374, 17472, 11151, 9068, 13, 578, 198, 996, 342, 1331, 88, 8292, 374, 1511, 422, 342, 1331, 88, 374, 10487, 382, 996, 3494, 907, 25, 3082, 374, 308, 5084, 10461, 11, 3641, 6062, 627, 262, 45832, 262, 422, 12384, 374, 2290, 512, 286, 12384, 284, 8743, 5778, 9089, 15881, 198, 262, 422, 12384, 624, 364, 70, 1331, 88, 1474, 15610, 3880, 9068, 3730, 286, 422, 539, 342, 1331, 88, 512, 310, 4933, 39299, 198, 286, 471, 342, 1331, 88, 2124, 39317, 1471, 11, 597, 340, 262, 4508, 12384, 624, 364, 76, 15610, 3880, 9068, 3730, 286, 674, 2606, 261, 436, 9068, 19463, 315, 9036, 2786, 374, 220, 16, 14, 19, 334, 74, 198, 286, 471, 2606, 261, 1745, 9068, 1471, 11, 597, 11, 38293, 32220, 303, 340, 262, 4508, 12384, 624, 364, 39298, 869, 352, 42728, 28376, 3730, 286, 674, 369, 60943, 18843, 433, 596, 220, 16, 14, 17, 334, 74, 198, 286, 471, 47341, 88519, 2786, 72062, 1471, 11, 38293, 32220, 303, 11, 597, 46257, 9, 17, 340, 262, 775, 512, 286, 4933, 39299, 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 ]
quadrismegistus/prosodic
prosodic/entity.py
entity.ents
def ents(self,cls="Word",flattenList=True): """Returns a list of entities of the classname specified the second argument. For instance. to call a Word-object's ents('Phoneme') would return a list of the word's Phoneme objects sequentially. This method recursively searches the self-object's children for the type of object specified.""" ents = [] """ print 'getting entities',self.classname() if self.classname() == cls: return [self] else: for child in self.children: if type(child)==type([]): if flattenList: ents+=child[0].ents(cls=cls,flattenList=flattenList) else: ents_list2ndlevel=[] for chld in child: if chld: ents_list2ndlevel+=chld.ents(cls=cls,flattenList=flattenList) ents+=[ents_list2ndlevel] else: if child: ents += child.ents(cls=cls,flattenList=flattenList) """ #print 'getting entities',self.classname() if self.classname() == cls: return [self] else: for child in self.children: #print child,child.classname() if child.classname()=='WordToken': if cls=='WordToken': ents+=[child] elif not child.children: pass elif cls=='Word': if flattenList: ents+=[child.children[0]] else: ents+=[child.children] else: if child: ents += child.children[0].ents(cls=cls,flattenList=flattenList) else: if child: ents += child.ents(cls=cls,flattenList=flattenList) return ents
python
def ents(self,cls="Word",flattenList=True): """Returns a list of entities of the classname specified the second argument. For instance. to call a Word-object's ents('Phoneme') would return a list of the word's Phoneme objects sequentially. This method recursively searches the self-object's children for the type of object specified.""" ents = [] """ print 'getting entities',self.classname() if self.classname() == cls: return [self] else: for child in self.children: if type(child)==type([]): if flattenList: ents+=child[0].ents(cls=cls,flattenList=flattenList) else: ents_list2ndlevel=[] for chld in child: if chld: ents_list2ndlevel+=chld.ents(cls=cls,flattenList=flattenList) ents+=[ents_list2ndlevel] else: if child: ents += child.ents(cls=cls,flattenList=flattenList) """ #print 'getting entities',self.classname() if self.classname() == cls: return [self] else: for child in self.children: #print child,child.classname() if child.classname()=='WordToken': if cls=='WordToken': ents+=[child] elif not child.children: pass elif cls=='Word': if flattenList: ents+=[child.children[0]] else: ents+=[child.children] else: if child: ents += child.children[0].ents(cls=cls,flattenList=flattenList) else: if child: ents += child.ents(cls=cls,flattenList=flattenList) return ents
[ "def", "ents", "(", "self", ",", "cls", "=", "\"Word\"", ",", "flattenList", "=", "True", ")", ":", "ents", "=", "[", "]", "\"\"\"\n\t\tprint 'getting entities',self.classname()\n\t\tif self.classname() == cls:\n\t\t\treturn [self]\n\t\telse:\n\t\t\tfor child in self.children:\n\t\t\t\tif type(child)==type([]):\n\t\t\t\t\tif flattenList:\n\t\t\t\t\t\tents+=child[0].ents(cls=cls,flattenList=flattenList)\n\t\t\t\t\telse:\n\t\t\t\t\t\tents_list2ndlevel=[]\n\t\t\t\t\t\tfor chld in child:\n\t\t\t\t\t\t\tif chld:\n\t\t\t\t\t\t\t\tents_list2ndlevel+=chld.ents(cls=cls,flattenList=flattenList)\n\t\t\t\t\t\tents+=[ents_list2ndlevel]\n\n\t\t\t\telse:\n\t\t\t\t\tif child:\n\t\t\t\t\t\tents += child.ents(cls=cls,flattenList=flattenList)\n\t\t\"\"\"", "#print 'getting entities',self.classname()", "if", "self", ".", "classname", "(", ")", "==", "cls", ":", "return", "[", "self", "]", "else", ":", "for", "child", "in", "self", ".", "children", ":", "#print child,child.classname()", "if", "child", ".", "classname", "(", ")", "==", "'WordToken'", ":", "if", "cls", "==", "'WordToken'", ":", "ents", "+=", "[", "child", "]", "elif", "not", "child", ".", "children", ":", "pass", "elif", "cls", "==", "'Word'", ":", "if", "flattenList", ":", "ents", "+=", "[", "child", ".", "children", "[", "0", "]", "]", "else", ":", "ents", "+=", "[", "child", ".", "children", "]", "else", ":", "if", "child", ":", "ents", "+=", "child", ".", "children", "[", "0", "]", ".", "ents", "(", "cls", "=", "cls", ",", "flattenList", "=", "flattenList", ")", "else", ":", "if", "child", ":", "ents", "+=", "child", ".", "ents", "(", "cls", "=", "cls", ",", "flattenList", "=", "flattenList", ")", "return", "ents" ]
Returns a list of entities of the classname specified the second argument. For instance. to call a Word-object's ents('Phoneme') would return a list of the word's Phoneme objects sequentially. This method recursively searches the self-object's children for the type of object specified.
[ "Returns", "a", "list", "of", "entities", "of", "the", "classname", "specified", "the", "second", "argument", ".", "For", "instance", ".", "to", "call", "a", "Word", "-", "object", "s", "ents", "(", "Phoneme", ")", "would", "return", "a", "list", "of", "the", "word", "s", "Phoneme", "objects", "sequentially", ".", "This", "method", "recursively", "searches", "the", "self", "-", "object", "s", "children", "for", "the", "type", "of", "object", "specified", "." ]
train
https://github.com/quadrismegistus/prosodic/blob/8af66ed9be40c922d03a0b09bc11c87d2061b618/prosodic/entity.py#L274-L324
<|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 entities of the classname specified the second argument. For instance. to call a Word-object's ents('Phoneme') would return a list of the word's Phoneme objects sequentially. This method recursively searches the self-object's children for the type of object specified. ### Response: def ents(self,cls="Word",flattenList=True): """Returns a list of entities of the classname specified the second argument. For instance. to call a Word-object's ents('Phoneme') would return a list of the word's Phoneme objects sequentially. This method recursively searches the self-object's children for the type of object specified.""" ents = [] """ print 'getting entities',self.classname() if self.classname() == cls: return [self] else: for child in self.children: if type(child)==type([]): if flattenList: ents+=child[0].ents(cls=cls,flattenList=flattenList) else: ents_list2ndlevel=[] for chld in child: if chld: ents_list2ndlevel+=chld.ents(cls=cls,flattenList=flattenList) ents+=[ents_list2ndlevel] else: if child: ents += child.ents(cls=cls,flattenList=flattenList) """ #print 'getting entities',self.classname() if self.classname() == cls: return [self] else: for child in self.children: #print child,child.classname() if child.classname()=='WordToken': if cls=='WordToken': ents+=[child] elif not child.children: pass elif cls=='Word': if flattenList: ents+=[child.children[0]] else: ents+=[child.children] else: if child: ents += child.children[0].ents(cls=cls,flattenList=flattenList) else: if child: ents += child.ents(cls=cls,flattenList=flattenList) return ents <|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, 15086, 315, 279, 71750, 5300, 279, 2132, 5811, 627, 197, 197, 2520, 2937, 13, 311, 1650, 264, 9506, 41532, 596, 37952, 493, 3438, 263, 3981, 873, 1053, 471, 264, 1160, 315, 279, 3492, 596, 71424, 3981, 6302, 95659, 627, 197, 41065, 1749, 53947, 27573, 279, 659, 41532, 596, 2911, 369, 279, 955, 315, 1665, 5300, 382, 14711, 6075, 512, 755, 37952, 1214, 11, 18565, 429, 11116, 498, 48166, 861, 3702, 997, 197, 197, 12885, 16851, 264, 1160, 315, 15086, 315, 279, 71750, 5300, 279, 2132, 5811, 627, 197, 197, 2520, 2937, 13, 311, 1650, 264, 9506, 41532, 596, 37952, 493, 3438, 263, 3981, 873, 1053, 471, 264, 1160, 315, 279, 3492, 596, 71424, 3981, 6302, 95659, 627, 197, 41065, 1749, 53947, 27573, 279, 659, 41532, 596, 2911, 369, 279, 955, 315, 1665, 5300, 30284, 197, 197, 812, 284, 4260, 197, 197, 7275, 197, 7045, 364, 51210, 15086, 518, 726, 3150, 609, 746, 197, 748, 659, 3150, 609, 368, 624, 13082, 512, 298, 862, 510, 726, 933, 197, 2525, 512, 298, 2066, 1716, 304, 659, 13664, 512, 573, 748, 955, 18272, 15708, 1337, 10779, 997, 465, 748, 46443, 861, 512, 1164, 197, 812, 8664, 3124, 58, 15, 948, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 465, 2525, 512, 1164, 197, 812, 2062, 17, 303, 3374, 28283, 1164, 2066, 523, 509, 304, 1716, 512, 1696, 748, 523, 509, 512, 2750, 197, 812, 2062, 17, 303, 3374, 8664, 331, 509, 13, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 1164, 197, 812, 10, 5941, 812, 2062, 17, 303, 3374, 2595, 573, 2525, 512, 465, 748, 1716, 512, 1164, 197, 812, 1447, 1716, 13, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 197, 197, 7275, 197, 197, 24588, 364, 51210, 15086, 518, 726, 3150, 609, 746, 197, 748, 659, 3150, 609, 368, 624, 13082, 512, 298, 862, 510, 726, 933, 197, 2525, 512, 298, 2066, 1716, 304, 659, 13664, 512, 573, 197, 24588, 1716, 11, 3124, 3150, 609, 746, 573, 748, 1716, 3150, 609, 368, 9461, 11116, 3404, 3730, 465, 748, 13082, 9461, 11116, 3404, 3730, 1164, 197, 812, 10, 5941, 3124, 933, 465, 23560, 539, 1716, 13664, 512, 1164, 42531, 198, 465, 23560, 13082, 9461, 11116, 3730, 1164, 748, 46443, 861, 512, 1696, 197, 812, 10, 5941, 3124, 13664, 58, 15, 14623, 1164, 2525, 512, 1696, 197, 812, 10, 5941, 3124, 13664, 933, 465, 2525, 512, 1164, 748, 1716, 512, 1696, 197, 812, 1447, 1716, 13664, 58, 15, 948, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 573, 2525, 512, 465, 748, 1716, 512, 1164, 197, 812, 1447, 1716, 13, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 3707, 197, 862, 37952, 198, 27, 91, 8862, 728, 428, 91, 29, 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,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 15086, 315, 279, 71750, 5300, 279, 2132, 5811, 627, 197, 197, 2520, 2937, 13, 311, 1650, 264, 9506, 41532, 596, 37952, 493, 3438, 263, 3981, 873, 1053, 471, 264, 1160, 315, 279, 3492, 596, 71424, 3981, 6302, 95659, 627, 197, 41065, 1749, 53947, 27573, 279, 659, 41532, 596, 2911, 369, 279, 955, 315, 1665, 5300, 382, 14711, 6075, 512, 755, 37952, 1214, 11, 18565, 429, 11116, 498, 48166, 861, 3702, 997, 197, 197, 12885, 16851, 264, 1160, 315, 15086, 315, 279, 71750, 5300, 279, 2132, 5811, 627, 197, 197, 2520, 2937, 13, 311, 1650, 264, 9506, 41532, 596, 37952, 493, 3438, 263, 3981, 873, 1053, 471, 264, 1160, 315, 279, 3492, 596, 71424, 3981, 6302, 95659, 627, 197, 41065, 1749, 53947, 27573, 279, 659, 41532, 596, 2911, 369, 279, 955, 315, 1665, 5300, 30284, 197, 197, 812, 284, 4260, 197, 197, 7275, 197, 7045, 364, 51210, 15086, 518, 726, 3150, 609, 746, 197, 748, 659, 3150, 609, 368, 624, 13082, 512, 298, 862, 510, 726, 933, 197, 2525, 512, 298, 2066, 1716, 304, 659, 13664, 512, 573, 748, 955, 18272, 15708, 1337, 10779, 997, 465, 748, 46443, 861, 512, 1164, 197, 812, 8664, 3124, 58, 15, 948, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 465, 2525, 512, 1164, 197, 812, 2062, 17, 303, 3374, 28283, 1164, 2066, 523, 509, 304, 1716, 512, 1696, 748, 523, 509, 512, 2750, 197, 812, 2062, 17, 303, 3374, 8664, 331, 509, 13, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 1164, 197, 812, 10, 5941, 812, 2062, 17, 303, 3374, 2595, 573, 2525, 512, 465, 748, 1716, 512, 1164, 197, 812, 1447, 1716, 13, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 197, 197, 7275, 197, 197, 24588, 364, 51210, 15086, 518, 726, 3150, 609, 746, 197, 748, 659, 3150, 609, 368, 624, 13082, 512, 298, 862, 510, 726, 933, 197, 2525, 512, 298, 2066, 1716, 304, 659, 13664, 512, 573, 197, 24588, 1716, 11, 3124, 3150, 609, 746, 573, 748, 1716, 3150, 609, 368, 9461, 11116, 3404, 3730, 465, 748, 13082, 9461, 11116, 3404, 3730, 1164, 197, 812, 10, 5941, 3124, 933, 465, 23560, 539, 1716, 13664, 512, 1164, 42531, 198, 465, 23560, 13082, 9461, 11116, 3730, 1164, 748, 46443, 861, 512, 1696, 197, 812, 10, 5941, 3124, 13664, 58, 15, 14623, 1164, 2525, 512, 1696, 197, 812, 10, 5941, 3124, 13664, 933, 465, 2525, 512, 1164, 748, 1716, 512, 1696, 197, 812, 1447, 1716, 13664, 58, 15, 948, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 340, 573, 2525, 512, 465, 748, 1716, 512, 1164, 197, 812, 1447, 1716, 13, 812, 21024, 28, 18565, 11, 48166, 861, 28, 48166, 861, 3707, 197, 862, 37952, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
google/python-gflags
gflags/flagvalues.py
FlagValues._ParseArgs
def _ParseArgs(self, args, known_only): """Helper function to do the main argument parsing. This function goes through args and does the bulk of the flag parsing. It will find the corresponding flag in our flag dictionary, and call its .parse() method on the flag value. Args: args: List of strings with the arguments to parse. known_only: parse and remove known flags, return rest in unparsed_args Returns: A tuple with the following: unknown_flags: List of (flag name, arg) for flags we don't know about. unparsed_args: List of arguments we did not parse. undefok: Set of flags that were given via --undefok. Raises: Error: on any parsing error. ValueError: on flag value parsing error. """ unknown_flags, unparsed_args, undefok = [], [], set() flag_dict = self.FlagDict() args = iter(args) for arg in args: value = None def GetValue(): # pylint: disable=cell-var-from-loop try: return next(args) if value is None else value except StopIteration: raise exceptions.Error('Missing value for flag ' + arg) if not arg.startswith('-'): # A non-argument: default is break, GNU is skip. unparsed_args.append(arg) if self.IsGnuGetOpt(): continue else: break if arg == '--': if known_only: unparsed_args.append(arg) break if '=' in arg: name, value = arg.lstrip('-').split('=', 1) else: name, value = arg.lstrip('-'), None if not name: # The argument is all dashes (including one dash). unparsed_args.append(arg) if self.IsGnuGetOpt(): continue else: break # --undefok is a special case. if name == 'undefok': if known_only: unparsed_args.append(arg) value = GetValue() undefok.update(v.strip() for v in value.split(',')) undefok.update('no' + v.strip() for v in value.split(',')) continue flag = flag_dict.get(name) if flag: value = (flag.boolean and value is None) or GetValue() elif name.startswith('no') and len(name) > 2: # Boolean flags can take the form of --noflag, with no value. noflag = flag_dict.get(name[2:]) if noflag and noflag.boolean: if value is not None: raise ValueError(arg + ' does not take an argument') flag = noflag value = False if flag: flag.parse(value) flag.using_default_value = False elif known_only: unparsed_args.append(arg) else: unknown_flags.append((name, arg)) unparsed_args.extend(args) return unknown_flags, unparsed_args, undefok
python
def _ParseArgs(self, args, known_only): """Helper function to do the main argument parsing. This function goes through args and does the bulk of the flag parsing. It will find the corresponding flag in our flag dictionary, and call its .parse() method on the flag value. Args: args: List of strings with the arguments to parse. known_only: parse and remove known flags, return rest in unparsed_args Returns: A tuple with the following: unknown_flags: List of (flag name, arg) for flags we don't know about. unparsed_args: List of arguments we did not parse. undefok: Set of flags that were given via --undefok. Raises: Error: on any parsing error. ValueError: on flag value parsing error. """ unknown_flags, unparsed_args, undefok = [], [], set() flag_dict = self.FlagDict() args = iter(args) for arg in args: value = None def GetValue(): # pylint: disable=cell-var-from-loop try: return next(args) if value is None else value except StopIteration: raise exceptions.Error('Missing value for flag ' + arg) if not arg.startswith('-'): # A non-argument: default is break, GNU is skip. unparsed_args.append(arg) if self.IsGnuGetOpt(): continue else: break if arg == '--': if known_only: unparsed_args.append(arg) break if '=' in arg: name, value = arg.lstrip('-').split('=', 1) else: name, value = arg.lstrip('-'), None if not name: # The argument is all dashes (including one dash). unparsed_args.append(arg) if self.IsGnuGetOpt(): continue else: break # --undefok is a special case. if name == 'undefok': if known_only: unparsed_args.append(arg) value = GetValue() undefok.update(v.strip() for v in value.split(',')) undefok.update('no' + v.strip() for v in value.split(',')) continue flag = flag_dict.get(name) if flag: value = (flag.boolean and value is None) or GetValue() elif name.startswith('no') and len(name) > 2: # Boolean flags can take the form of --noflag, with no value. noflag = flag_dict.get(name[2:]) if noflag and noflag.boolean: if value is not None: raise ValueError(arg + ' does not take an argument') flag = noflag value = False if flag: flag.parse(value) flag.using_default_value = False elif known_only: unparsed_args.append(arg) else: unknown_flags.append((name, arg)) unparsed_args.extend(args) return unknown_flags, unparsed_args, undefok
[ "def", "_ParseArgs", "(", "self", ",", "args", ",", "known_only", ")", ":", "unknown_flags", ",", "unparsed_args", ",", "undefok", "=", "[", "]", ",", "[", "]", ",", "set", "(", ")", "flag_dict", "=", "self", ".", "FlagDict", "(", ")", "args", "=", "iter", "(", "args", ")", "for", "arg", "in", "args", ":", "value", "=", "None", "def", "GetValue", "(", ")", ":", "# pylint: disable=cell-var-from-loop", "try", ":", "return", "next", "(", "args", ")", "if", "value", "is", "None", "else", "value", "except", "StopIteration", ":", "raise", "exceptions", ".", "Error", "(", "'Missing value for flag '", "+", "arg", ")", "if", "not", "arg", ".", "startswith", "(", "'-'", ")", ":", "# A non-argument: default is break, GNU is skip.", "unparsed_args", ".", "append", "(", "arg", ")", "if", "self", ".", "IsGnuGetOpt", "(", ")", ":", "continue", "else", ":", "break", "if", "arg", "==", "'--'", ":", "if", "known_only", ":", "unparsed_args", ".", "append", "(", "arg", ")", "break", "if", "'='", "in", "arg", ":", "name", ",", "value", "=", "arg", ".", "lstrip", "(", "'-'", ")", ".", "split", "(", "'='", ",", "1", ")", "else", ":", "name", ",", "value", "=", "arg", ".", "lstrip", "(", "'-'", ")", ",", "None", "if", "not", "name", ":", "# The argument is all dashes (including one dash).", "unparsed_args", ".", "append", "(", "arg", ")", "if", "self", ".", "IsGnuGetOpt", "(", ")", ":", "continue", "else", ":", "break", "# --undefok is a special case.", "if", "name", "==", "'undefok'", ":", "if", "known_only", ":", "unparsed_args", ".", "append", "(", "arg", ")", "value", "=", "GetValue", "(", ")", "undefok", ".", "update", "(", "v", ".", "strip", "(", ")", "for", "v", "in", "value", ".", "split", "(", "','", ")", ")", "undefok", ".", "update", "(", "'no'", "+", "v", ".", "strip", "(", ")", "for", "v", "in", "value", ".", "split", "(", "','", ")", ")", "continue", "flag", "=", "flag_dict", ".", "get", "(", "name", ")", "if", "flag", ":", "value", "=", "(", "flag", ".", "boolean", "and", "value", "is", "None", ")", "or", "GetValue", "(", ")", "elif", "name", ".", "startswith", "(", "'no'", ")", "and", "len", "(", "name", ")", ">", "2", ":", "# Boolean flags can take the form of --noflag, with no value.", "noflag", "=", "flag_dict", ".", "get", "(", "name", "[", "2", ":", "]", ")", "if", "noflag", "and", "noflag", ".", "boolean", ":", "if", "value", "is", "not", "None", ":", "raise", "ValueError", "(", "arg", "+", "' does not take an argument'", ")", "flag", "=", "noflag", "value", "=", "False", "if", "flag", ":", "flag", ".", "parse", "(", "value", ")", "flag", ".", "using_default_value", "=", "False", "elif", "known_only", ":", "unparsed_args", ".", "append", "(", "arg", ")", "else", ":", "unknown_flags", ".", "append", "(", "(", "name", ",", "arg", ")", ")", "unparsed_args", ".", "extend", "(", "args", ")", "return", "unknown_flags", ",", "unparsed_args", ",", "undefok" ]
Helper function to do the main argument parsing. This function goes through args and does the bulk of the flag parsing. It will find the corresponding flag in our flag dictionary, and call its .parse() method on the flag value. Args: args: List of strings with the arguments to parse. known_only: parse and remove known flags, return rest in unparsed_args Returns: A tuple with the following: unknown_flags: List of (flag name, arg) for flags we don't know about. unparsed_args: List of arguments we did not parse. undefok: Set of flags that were given via --undefok. Raises: Error: on any parsing error. ValueError: on flag value parsing error.
[ "Helper", "function", "to", "do", "the", "main", "argument", "parsing", "." ]
train
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L714-L806
<|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 do the main argument parsing. This function goes through args and does the bulk of the flag parsing. It will find the corresponding flag in our flag dictionary, and call its .parse() method on the flag value. Args: args: List of strings with the arguments to parse. known_only: parse and remove known flags, return rest in unparsed_args Returns: A tuple with the following: unknown_flags: List of (flag name, arg) for flags we don't know about. unparsed_args: List of arguments we did not parse. undefok: Set of flags that were given via --undefok. Raises: Error: on any parsing error. ValueError: on flag value parsing error. ### Response: def _ParseArgs(self, args, known_only): """Helper function to do the main argument parsing. This function goes through args and does the bulk of the flag parsing. It will find the corresponding flag in our flag dictionary, and call its .parse() method on the flag value. Args: args: List of strings with the arguments to parse. known_only: parse and remove known flags, return rest in unparsed_args Returns: A tuple with the following: unknown_flags: List of (flag name, arg) for flags we don't know about. unparsed_args: List of arguments we did not parse. undefok: Set of flags that were given via --undefok. Raises: Error: on any parsing error. ValueError: on flag value parsing error. """ unknown_flags, unparsed_args, undefok = [], [], set() flag_dict = self.FlagDict() args = iter(args) for arg in args: value = None def GetValue(): # pylint: disable=cell-var-from-loop try: return next(args) if value is None else value except StopIteration: raise exceptions.Error('Missing value for flag ' + arg) if not arg.startswith('-'): # A non-argument: default is break, GNU is skip. unparsed_args.append(arg) if self.IsGnuGetOpt(): continue else: break if arg == '--': if known_only: unparsed_args.append(arg) break if '=' in arg: name, value = arg.lstrip('-').split('=', 1) else: name, value = arg.lstrip('-'), None if not name: # The argument is all dashes (including one dash). unparsed_args.append(arg) if self.IsGnuGetOpt(): continue else: break # --undefok is a special case. if name == 'undefok': if known_only: unparsed_args.append(arg) value = GetValue() undefok.update(v.strip() for v in value.split(',')) undefok.update('no' + v.strip() for v in value.split(',')) continue flag = flag_dict.get(name) if flag: value = (flag.boolean and value is None) or GetValue() elif name.startswith('no') and len(name) > 2: # Boolean flags can take the form of --noflag, with no value. noflag = flag_dict.get(name[2:]) if noflag and noflag.boolean: if value is not None: raise ValueError(arg + ' does not take an argument') flag = noflag value = False if flag: flag.parse(value) flag.using_default_value = False elif known_only: unparsed_args.append(arg) else: unknown_flags.append((name, arg)) unparsed_args.extend(args) return unknown_flags, unparsed_args, undefok <|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, 5628, 734, 311, 656, 279, 1925, 5811, 23115, 382, 262, 1115, 734, 5900, 1555, 2897, 323, 1587, 279, 20155, 315, 279, 5292, 23115, 627, 262, 1102, 690, 1505, 279, 12435, 5292, 304, 1057, 5292, 11240, 11, 323, 1650, 1202, 198, 262, 662, 6534, 368, 1749, 389, 279, 5292, 907, 382, 262, 18161, 512, 415, 2897, 25, 1796, 315, 9246, 449, 279, 6105, 311, 4820, 627, 415, 3967, 18917, 25, 4820, 323, 4148, 3967, 8202, 11, 471, 2800, 304, 22355, 18604, 8550, 271, 262, 5295, 512, 415, 362, 14743, 449, 279, 2768, 512, 286, 9987, 14462, 25, 1796, 315, 320, 10104, 836, 11, 1417, 8, 369, 8202, 584, 1541, 956, 1440, 922, 627, 286, 22355, 18604, 8550, 25, 1796, 315, 6105, 584, 1550, 539, 4820, 627, 286, 32244, 564, 25, 2638, 315, 8202, 430, 1051, 2728, 4669, 1198, 16527, 564, 382, 262, 61411, 512, 996, 4703, 25, 389, 904, 23115, 1493, 627, 996, 15764, 25, 389, 5292, 907, 23115, 1493, 382, 14711, 6075, 512, 755, 721, 14802, 4209, 1214, 11, 2897, 11, 3967, 18917, 997, 262, 4304, 5628, 734, 311, 656, 279, 1925, 5811, 23115, 382, 262, 1115, 734, 5900, 1555, 2897, 323, 1587, 279, 20155, 315, 279, 5292, 23115, 627, 262, 1102, 690, 1505, 279, 12435, 5292, 304, 1057, 5292, 11240, 11, 323, 1650, 1202, 198, 262, 662, 6534, 368, 1749, 389, 279, 5292, 907, 382, 262, 18161, 512, 415, 2897, 25, 1796, 315, 9246, 449, 279, 6105, 311, 4820, 627, 415, 3967, 18917, 25, 4820, 323, 4148, 3967, 8202, 11, 471, 2800, 304, 22355, 18604, 8550, 271, 262, 5295, 512, 415, 362, 14743, 449, 279, 2768, 512, 286, 9987, 14462, 25, 1796, 315, 320, 10104, 836, 11, 1417, 8, 369, 8202, 584, 1541, 956, 1440, 922, 627, 286, 22355, 18604, 8550, 25, 1796, 315, 6105, 584, 1550, 539, 4820, 627, 286, 32244, 564, 25, 2638, 315, 8202, 430, 1051, 2728, 4669, 1198, 16527, 564, 382, 262, 61411, 512, 996, 4703, 25, 389, 904, 23115, 1493, 627, 996, 15764, 25, 389, 5292, 907, 23115, 1493, 627, 262, 3270, 262, 9987, 14462, 11, 22355, 18604, 8550, 11, 32244, 564, 284, 10277, 10277, 743, 2892, 262, 5292, 5356, 284, 659, 82011, 13755, 746, 262, 2897, 284, 5480, 7506, 340, 262, 369, 1417, 304, 2897, 512, 415, 907, 284, 2290, 271, 415, 711, 70021, 4019, 286, 674, 51471, 25, 11404, 28, 5997, 86515, 39151, 61766, 198, 286, 1456, 512, 692, 471, 1828, 7506, 8, 422, 907, 374, 2290, 775, 907, 198, 286, 3734, 14549, 54201, 512, 692, 4933, 20157, 6270, 493, 26136, 907, 369, 5292, 364, 489, 1417, 696, 415, 422, 539, 1417, 27249, 14996, 11290, 286, 674, 362, 2536, 12, 14819, 25, 1670, 374, 1464, 11, 4348, 374, 10936, 627, 286, 22355, 18604, 8550, 2102, 9590, 340, 286, 422, 659, 4607, 38, 9110, 1991, 22078, 4019, 692, 3136, 198, 286, 775, 512, 692, 1464, 271 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 5628, 734, 311, 656, 279, 1925, 5811, 23115, 382, 262, 1115, 734, 5900, 1555, 2897, 323, 1587, 279, 20155, 315, 279, 5292, 23115, 627, 262, 1102, 690, 1505, 279, 12435, 5292, 304, 1057, 5292, 11240, 11, 323, 1650, 1202, 198, 262, 662, 6534, 368, 1749, 389, 279, 5292, 907, 382, 262, 18161, 512, 415, 2897, 25, 1796, 315, 9246, 449, 279, 6105, 311, 4820, 627, 415, 3967, 18917, 25, 4820, 323, 4148, 3967, 8202, 11, 471, 2800, 304, 22355, 18604, 8550, 271, 262, 5295, 512, 415, 362, 14743, 449, 279, 2768, 512, 286, 9987, 14462, 25, 1796, 315, 320, 10104, 836, 11, 1417, 8, 369, 8202, 584, 1541, 956, 1440, 922, 627, 286, 22355, 18604, 8550, 25, 1796, 315, 6105, 584, 1550, 539, 4820, 627, 286, 32244, 564, 25, 2638, 315, 8202, 430, 1051, 2728, 4669, 1198, 16527, 564, 382, 262, 61411, 512, 996, 4703, 25, 389, 904, 23115, 1493, 627, 996, 15764, 25, 389, 5292, 907, 23115, 1493, 382, 14711, 6075, 512, 755, 721, 14802, 4209, 1214, 11, 2897, 11, 3967, 18917, 997, 262, 4304, 5628, 734, 311, 656, 279, 1925, 5811, 23115, 382, 262, 1115, 734, 5900, 1555, 2897, 323, 1587, 279, 20155, 315, 279, 5292, 23115, 627, 262, 1102, 690, 1505, 279, 12435, 5292, 304, 1057, 5292, 11240, 11, 323, 1650, 1202, 198, 262, 662, 6534, 368, 1749, 389, 279, 5292, 907, 382, 262, 18161, 512, 415, 2897, 25, 1796, 315, 9246, 449, 279, 6105, 311, 4820, 627, 415, 3967, 18917, 25, 4820, 323, 4148, 3967, 8202, 11, 471, 2800, 304, 22355, 18604, 8550, 271, 262, 5295, 512, 415, 362, 14743, 449, 279, 2768, 512, 286, 9987, 14462, 25, 1796, 315, 320, 10104, 836, 11, 1417, 8, 369, 8202, 584, 1541, 956, 1440, 922, 627, 286, 22355, 18604, 8550, 25, 1796, 315, 6105, 584, 1550, 539, 4820, 627, 286, 32244, 564, 25, 2638, 315, 8202, 430, 1051, 2728, 4669, 1198, 16527, 564, 382, 262, 61411, 512, 996, 4703, 25, 389, 904, 23115, 1493, 627, 996, 15764, 25, 389, 5292, 907, 23115, 1493, 627, 262, 3270, 262, 9987, 14462, 11, 22355, 18604, 8550, 11, 32244, 564, 284, 10277, 10277, 743, 2892, 262, 5292, 5356, 284, 659, 82011, 13755, 746, 262, 2897, 284, 5480, 7506, 340, 262, 369, 1417, 304, 2897, 512, 415, 907, 284, 2290, 271, 415, 711, 70021, 4019, 286, 674, 51471, 25, 11404, 28, 5997, 86515, 39151, 61766, 198, 286, 1456, 512, 692, 471, 1828, 7506, 8, 422, 907, 374, 2290, 775, 907, 198, 286, 3734, 14549, 54201, 512, 692, 4933, 20157, 6270, 493, 26136, 907, 369, 5292, 364, 489, 1417, 696, 415, 422, 539, 1417, 27249, 14996, 11290, 286, 674, 362, 2536, 12, 14819, 25, 1670, 374, 1464, 11, 4348, 374, 10936, 627, 286, 22355, 18604, 8550, 2102, 9590, 340, 286, 422, 659, 4607, 38, 9110, 1991, 22078, 4019, 692, 3136, 198, 286, 775, 512, 692, 1464, 271 ]
lago-project/lago
lago/templates.py
TemplateStore.get_path
def get_path(self, temp_ver): """ Get the path of the given version in this store Args: temp_ver TemplateVersion: version to look for Returns: str: The path to the template version inside the store Raises: RuntimeError: if the template is not in the store """ if temp_ver not in self: raise RuntimeError( 'Template: {} not present'.format(temp_ver.name) ) return self._prefixed(temp_ver.name)
python
def get_path(self, temp_ver): """ Get the path of the given version in this store Args: temp_ver TemplateVersion: version to look for Returns: str: The path to the template version inside the store Raises: RuntimeError: if the template is not in the store """ if temp_ver not in self: raise RuntimeError( 'Template: {} not present'.format(temp_ver.name) ) return self._prefixed(temp_ver.name)
[ "def", "get_path", "(", "self", ",", "temp_ver", ")", ":", "if", "temp_ver", "not", "in", "self", ":", "raise", "RuntimeError", "(", "'Template: {} not present'", ".", "format", "(", "temp_ver", ".", "name", ")", ")", "return", "self", ".", "_prefixed", "(", "temp_ver", ".", "name", ")" ]
Get the path of the given version in this store Args: temp_ver TemplateVersion: version to look for Returns: str: The path to the template version inside the store Raises: RuntimeError: if the template is not in the store
[ "Get", "the", "path", "of", "the", "given", "version", "in", "this", "store" ]
train
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/templates.py#L605-L622
<|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 the path of the given version in this store Args: temp_ver TemplateVersion: version to look for Returns: str: The path to the template version inside the store Raises: RuntimeError: if the template is not in the store ### Response: def get_path(self, temp_ver): """ Get the path of the given version in this store Args: temp_ver TemplateVersion: version to look for Returns: str: The path to the template version inside the store Raises: RuntimeError: if the template is not in the store """ if temp_ver not in self: raise RuntimeError( 'Template: {} not present'.format(temp_ver.name) ) return self._prefixed(temp_ver.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, 1991, 279, 1853, 315, 279, 2728, 2373, 304, 420, 3637, 271, 286, 18161, 512, 310, 2798, 27133, 14692, 5755, 25, 2373, 311, 1427, 369, 271, 286, 5295, 512, 310, 610, 25, 578, 1853, 311, 279, 3896, 2373, 4871, 279, 3637, 271, 286, 61411, 512, 310, 45643, 25, 422, 279, 3896, 374, 539, 304, 279, 3637, 271, 14711, 6075, 512, 755, 636, 2703, 1214, 11, 2798, 27133, 997, 286, 3270, 286, 2175, 279, 1853, 315, 279, 2728, 2373, 304, 420, 3637, 271, 286, 18161, 512, 310, 2798, 27133, 14692, 5755, 25, 2373, 311, 1427, 369, 271, 286, 5295, 512, 310, 610, 25, 578, 1853, 311, 279, 3896, 2373, 4871, 279, 3637, 271, 286, 61411, 512, 310, 45643, 25, 422, 279, 3896, 374, 539, 304, 279, 3637, 198, 286, 3270, 286, 422, 2798, 27133, 539, 304, 659, 512, 310, 4933, 45643, 1021, 394, 364, 7423, 25, 4792, 539, 3118, 4527, 2293, 9957, 27133, 2710, 340, 310, 1763, 286, 471, 659, 1462, 31652, 3366, 9957, 27133, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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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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 ]
[ 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, 279, 1853, 315, 279, 2728, 2373, 304, 420, 3637, 271, 286, 18161, 512, 310, 2798, 27133, 14692, 5755, 25, 2373, 311, 1427, 369, 271, 286, 5295, 512, 310, 610, 25, 578, 1853, 311, 279, 3896, 2373, 4871, 279, 3637, 271, 286, 61411, 512, 310, 45643, 25, 422, 279, 3896, 374, 539, 304, 279, 3637, 271, 14711, 6075, 512, 755, 636, 2703, 1214, 11, 2798, 27133, 997, 286, 3270, 286, 2175, 279, 1853, 315, 279, 2728, 2373, 304, 420, 3637, 271, 286, 18161, 512, 310, 2798, 27133, 14692, 5755, 25, 2373, 311, 1427, 369, 271, 286, 5295, 512, 310, 610, 25, 578, 1853, 311, 279, 3896, 2373, 4871, 279, 3637, 271, 286, 61411, 512, 310, 45643, 25, 422, 279, 3896, 374, 539, 304, 279, 3637, 198, 286, 3270, 286, 422, 2798, 27133, 539, 304, 659, 512, 310, 4933, 45643, 1021, 394, 364, 7423, 25, 4792, 539, 3118, 4527, 2293, 9957, 27133, 2710, 340, 310, 1763, 286, 471, 659, 1462, 31652, 3366, 9957, 27133, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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/backrefs
tools/unipropgen.py
gen_properties
def gen_properties(output, ascii_props=False, append=False): """Generate the property table and dump it to the provided file.""" files = { 'gc': os.path.join(output, 'generalcategory.py'), 'blk': os.path.join(output, 'block.py'), 'sc': os.path.join(output, 'script.py'), 'bc': os.path.join(output, 'bidiclass.py'), 'binary': os.path.join(output, 'binary.py'), 'posix': os.path.join(output, 'posix.py'), 'age': os.path.join(output, 'age.py'), 'ea': os.path.join(output, 'eastasianwidth.py'), 'gcb': os.path.join(output, 'graphemeclusterbreak.py'), 'lb': os.path.join(output, 'linebreak.py'), 'sb': os.path.join(output, 'sentencebreak.py'), 'wb': os.path.join(output, 'wordbreak.py'), 'hst': os.path.join(output, 'hangulsyllabletype.py'), 'dt': os.path.join(output, 'decompositiontype.py'), 'jt': os.path.join(output, 'joiningtype.py'), 'jg': os.path.join(output, 'joininggroup.py'), 'nt': os.path.join(output, 'numerictype.py'), 'nv': os.path.join(output, 'numericvalue.py'), 'ccc': os.path.join(output, 'canonicalcombiningclass.py'), 'qc': os.path.join(output, 'quickcheck.py'), 'alias': os.path.join(output, 'alias.py') } files['scx'] = os.path.join(output, 'scriptextensions.py') files['insc'] = os.path.join(output, 'indicsyllabiccategory.py') if PY34: files['bpt'] = os.path.join(output, 'bidipairedbrackettype.py') if PY35: files['inpc'] = os.path.join(output, 'indicpositionalcategory.py') else: files['inmc'] = os.path.join(output, 'indicmatracategory.py') if PY37: files['vo'] = os.path.join(output, 'verticalorientation.py') prefix = "ascii" if ascii_props else 'unicode' # `L&` or `Lc` won't be found in the table, # so initialize 'c' at the start. `&` will have to be converted to 'c' # before sending it through. categories = [ 'generalcategory', 'script', 'block', 'bidiclass', 'eastasianwidth', 'linebreak', 'hangulsyllabletype', 'wordbreak', 'sentencebreak', 'graphemeclusterbreak', 'decompositiontype', 'joiningtype', 'joininggroup', 'numerictype', 'numericvalue', 'canonicalcombiningclass', 'age' ] categories.append('scriptextensions') categories.append('indicsyllabiccategory') if PY34: categories.append('bidipairedbrackettype') if PY35: categories.append('indicpositionalcategory') else: categories.append('indicmatracategory') if PY37: categories.append('verticalorientation') if ascii_props: print('=========Ascii Tables=========') else: print('========Unicode Tables========') print('Building: General Category') max_range = ASCII_RANGE if ascii_props else UNICODE_RANGE all_chars = ALL_ASCII if ascii_props else ALL_CHARS table = {'l': {'c': []}} itable = {'l': {}} with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, 'UnicodeData.txt'), 'r', 'utf-8') as uf: for line in uf: data = line.strip().split(';') if data: i = int(data[0], 16) if i > max_range[1]: continue p = data[2].lower() if p[0] not in table: table[p[0]] = {} itable[p[0]] = {} if p[1] not in table[p[0]]: table[p[0]][p[1]] = [] table[p[0]][p[1]].append(i) # Add LC which is a combo of Ll, Lu, and Lt if p[0] == 'l' and p[1] in ('l', 'u', 't'): table['l']['c'].append(i) # Create inverse of each category for k1, v1 in table.items(): inverse_category = set() for k2, v2 in v1.items(): s = set(v2) inverse_category |= s itable[k1]['^'] = list(all_chars - inverse_category) # Generate Unicode blocks print('Building: Blocks') gen_blocks(files['blk'], ascii_props, append, prefix) # Generate Unicode scripts print('Building: Scripts & Script Extensions') gen_scripts( 'Scripts.txt', 'ScriptExtensions.txt', 'scripts', 'script_extensions', files['sc'], files['scx'], notexplicit='zzzz', ascii_props=ascii_props, append=append, prefix=prefix ) # Generate Unicode bidi classes print('Building: Bidi Classes') gen_bidi(files['bc'], ascii_props, append, prefix) if PY34: print('Building: Bidi Paired Bracket Type') gen_enum( 'BidiBrackets.txt', 'bidi_paired_bracket_type', files['bpt'], notexplicit='n', field=2, ascii_props=ascii_props, append=append, prefix=prefix ) # Generate Unicode binary print('Building: Binary') binary = gen_binary(table, files['binary'], ascii_props, append, prefix) # Generate posix table and write out to file. print('Building: Posix') gen_posix(files['posix'], is_bytes=ascii_props, append=append, prefix=prefix) print('Building: Age') gen_age(files['age'], ascii_props, append, prefix) print('Building: East Asian Width') gen_enum( 'EastAsianWidth.txt', 'east_asian_width', files['ea'], notexplicit='n', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Grapheme Cluster Break') gen_enum( 'GraphemeBreakProperty.txt', 'grapheme_cluster_break', files['gcb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Line Break') gen_enum( 'LineBreak.txt', 'line_break', files['lb'], notexplicit='unknown', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Sentence Break') gen_enum( 'SentenceBreakProperty.txt', 'sentence_break', files['sb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Word Break') gen_enum( 'WordBreakProperty.txt', 'word_break', files['wb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) if PY35: print('Building: Indic Positional Category') gen_enum( 'IndicPositionalCategory.txt', 'indic_positional_category', files['inpc'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) else: print('Building: Indic Matra Category') gen_enum( 'IndicMatraCategory.txt', 'indic_matra_category', files['inmc'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Indic Syllabic Category') gen_enum( 'IndicSyllabicCategory.txt', 'indic_syllabic_category', files['insc'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Hangul Syllable Type') gen_enum( 'HangulSyllableType.txt', 'hangul_syllable_type', files['hst'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Decomposition Type') gen_enum( 'DerivedDecompositionType.txt', 'decomposition_type', files['dt'], notexplicit='none', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Joining Type') gen_enum( 'DerivedJoiningType.txt', 'joining_type', files['jt'], notexplicit='u', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Joining Group') gen_enum( 'DerivedJoiningGroup.txt', 'joining_group', files['jg'], notexplicit='nonjoining', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Numeric Type') gen_enum( 'DerivedNumericType.txt', 'numeric_type', files['nt'], notexplicit='none', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Numeric Value') gen_enum( 'DerivedNumericValues.txt', 'numeric_values', files['nv'], field=3, notexplicit='nan', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Canonical Combining Class') gen_ccc(files['ccc'], ascii_props, append, prefix) print('Building: NF* Quick Check') categories.extend(gen_nf_quick_check(files['qc'], ascii_props, append, prefix)) if PY37: print('Building: Vertical Orientation') gen_enum( 'VerticalOrientation.txt', 'vertical_orientation', files['vo'], notexplicit='R', ascii_props=ascii_props, append=append, prefix=prefix ) if not ascii_props: print('Building: Aliases') gen_alias(categories, binary, files['alias'], ascii_props, append, prefix) # Convert char values to string ranges. char2range(table, is_bytes=ascii_props) char2range(itable, is_bytes=ascii_props, invert=False) for k1, v1 in itable.items(): table[k1]['^'] = v1['^'] with codecs.open(files['gc'], 'a' if append else 'w', 'utf-8') as f: if not append: f.write(HEADER) # Write out the Unicode properties f.write('%s_properties = {\n' % prefix) count = len(table) - 1 i = 0 for k1, v1 in sorted(table.items()): f.write(' "%s": {\n' % k1) count2 = len(v1) - 1 j = 0 for k2, v2 in sorted(v1.items()): f.write(' "%s": "%s"' % (k2, v2)) if j == count2: f.write('\n }') else: f.write(',\n') j += 1 if i == count: f.write('\n}\n') else: f.write(',\n') i += 1 if not append: with codecs.open(os.path.join(output, '__init__.py'), 'w') as f: f.write(HEADER) for x in sorted(files): f.write('from .%s import * # noqa\n' % os.path.basename(files[x])[:-3])
python
def gen_properties(output, ascii_props=False, append=False): """Generate the property table and dump it to the provided file.""" files = { 'gc': os.path.join(output, 'generalcategory.py'), 'blk': os.path.join(output, 'block.py'), 'sc': os.path.join(output, 'script.py'), 'bc': os.path.join(output, 'bidiclass.py'), 'binary': os.path.join(output, 'binary.py'), 'posix': os.path.join(output, 'posix.py'), 'age': os.path.join(output, 'age.py'), 'ea': os.path.join(output, 'eastasianwidth.py'), 'gcb': os.path.join(output, 'graphemeclusterbreak.py'), 'lb': os.path.join(output, 'linebreak.py'), 'sb': os.path.join(output, 'sentencebreak.py'), 'wb': os.path.join(output, 'wordbreak.py'), 'hst': os.path.join(output, 'hangulsyllabletype.py'), 'dt': os.path.join(output, 'decompositiontype.py'), 'jt': os.path.join(output, 'joiningtype.py'), 'jg': os.path.join(output, 'joininggroup.py'), 'nt': os.path.join(output, 'numerictype.py'), 'nv': os.path.join(output, 'numericvalue.py'), 'ccc': os.path.join(output, 'canonicalcombiningclass.py'), 'qc': os.path.join(output, 'quickcheck.py'), 'alias': os.path.join(output, 'alias.py') } files['scx'] = os.path.join(output, 'scriptextensions.py') files['insc'] = os.path.join(output, 'indicsyllabiccategory.py') if PY34: files['bpt'] = os.path.join(output, 'bidipairedbrackettype.py') if PY35: files['inpc'] = os.path.join(output, 'indicpositionalcategory.py') else: files['inmc'] = os.path.join(output, 'indicmatracategory.py') if PY37: files['vo'] = os.path.join(output, 'verticalorientation.py') prefix = "ascii" if ascii_props else 'unicode' # `L&` or `Lc` won't be found in the table, # so initialize 'c' at the start. `&` will have to be converted to 'c' # before sending it through. categories = [ 'generalcategory', 'script', 'block', 'bidiclass', 'eastasianwidth', 'linebreak', 'hangulsyllabletype', 'wordbreak', 'sentencebreak', 'graphemeclusterbreak', 'decompositiontype', 'joiningtype', 'joininggroup', 'numerictype', 'numericvalue', 'canonicalcombiningclass', 'age' ] categories.append('scriptextensions') categories.append('indicsyllabiccategory') if PY34: categories.append('bidipairedbrackettype') if PY35: categories.append('indicpositionalcategory') else: categories.append('indicmatracategory') if PY37: categories.append('verticalorientation') if ascii_props: print('=========Ascii Tables=========') else: print('========Unicode Tables========') print('Building: General Category') max_range = ASCII_RANGE if ascii_props else UNICODE_RANGE all_chars = ALL_ASCII if ascii_props else ALL_CHARS table = {'l': {'c': []}} itable = {'l': {}} with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, 'UnicodeData.txt'), 'r', 'utf-8') as uf: for line in uf: data = line.strip().split(';') if data: i = int(data[0], 16) if i > max_range[1]: continue p = data[2].lower() if p[0] not in table: table[p[0]] = {} itable[p[0]] = {} if p[1] not in table[p[0]]: table[p[0]][p[1]] = [] table[p[0]][p[1]].append(i) # Add LC which is a combo of Ll, Lu, and Lt if p[0] == 'l' and p[1] in ('l', 'u', 't'): table['l']['c'].append(i) # Create inverse of each category for k1, v1 in table.items(): inverse_category = set() for k2, v2 in v1.items(): s = set(v2) inverse_category |= s itable[k1]['^'] = list(all_chars - inverse_category) # Generate Unicode blocks print('Building: Blocks') gen_blocks(files['blk'], ascii_props, append, prefix) # Generate Unicode scripts print('Building: Scripts & Script Extensions') gen_scripts( 'Scripts.txt', 'ScriptExtensions.txt', 'scripts', 'script_extensions', files['sc'], files['scx'], notexplicit='zzzz', ascii_props=ascii_props, append=append, prefix=prefix ) # Generate Unicode bidi classes print('Building: Bidi Classes') gen_bidi(files['bc'], ascii_props, append, prefix) if PY34: print('Building: Bidi Paired Bracket Type') gen_enum( 'BidiBrackets.txt', 'bidi_paired_bracket_type', files['bpt'], notexplicit='n', field=2, ascii_props=ascii_props, append=append, prefix=prefix ) # Generate Unicode binary print('Building: Binary') binary = gen_binary(table, files['binary'], ascii_props, append, prefix) # Generate posix table and write out to file. print('Building: Posix') gen_posix(files['posix'], is_bytes=ascii_props, append=append, prefix=prefix) print('Building: Age') gen_age(files['age'], ascii_props, append, prefix) print('Building: East Asian Width') gen_enum( 'EastAsianWidth.txt', 'east_asian_width', files['ea'], notexplicit='n', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Grapheme Cluster Break') gen_enum( 'GraphemeBreakProperty.txt', 'grapheme_cluster_break', files['gcb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Line Break') gen_enum( 'LineBreak.txt', 'line_break', files['lb'], notexplicit='unknown', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Sentence Break') gen_enum( 'SentenceBreakProperty.txt', 'sentence_break', files['sb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Word Break') gen_enum( 'WordBreakProperty.txt', 'word_break', files['wb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) if PY35: print('Building: Indic Positional Category') gen_enum( 'IndicPositionalCategory.txt', 'indic_positional_category', files['inpc'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) else: print('Building: Indic Matra Category') gen_enum( 'IndicMatraCategory.txt', 'indic_matra_category', files['inmc'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Indic Syllabic Category') gen_enum( 'IndicSyllabicCategory.txt', 'indic_syllabic_category', files['insc'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Hangul Syllable Type') gen_enum( 'HangulSyllableType.txt', 'hangul_syllable_type', files['hst'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Decomposition Type') gen_enum( 'DerivedDecompositionType.txt', 'decomposition_type', files['dt'], notexplicit='none', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Joining Type') gen_enum( 'DerivedJoiningType.txt', 'joining_type', files['jt'], notexplicit='u', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Joining Group') gen_enum( 'DerivedJoiningGroup.txt', 'joining_group', files['jg'], notexplicit='nonjoining', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Numeric Type') gen_enum( 'DerivedNumericType.txt', 'numeric_type', files['nt'], notexplicit='none', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Numeric Value') gen_enum( 'DerivedNumericValues.txt', 'numeric_values', files['nv'], field=3, notexplicit='nan', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Canonical Combining Class') gen_ccc(files['ccc'], ascii_props, append, prefix) print('Building: NF* Quick Check') categories.extend(gen_nf_quick_check(files['qc'], ascii_props, append, prefix)) if PY37: print('Building: Vertical Orientation') gen_enum( 'VerticalOrientation.txt', 'vertical_orientation', files['vo'], notexplicit='R', ascii_props=ascii_props, append=append, prefix=prefix ) if not ascii_props: print('Building: Aliases') gen_alias(categories, binary, files['alias'], ascii_props, append, prefix) # Convert char values to string ranges. char2range(table, is_bytes=ascii_props) char2range(itable, is_bytes=ascii_props, invert=False) for k1, v1 in itable.items(): table[k1]['^'] = v1['^'] with codecs.open(files['gc'], 'a' if append else 'w', 'utf-8') as f: if not append: f.write(HEADER) # Write out the Unicode properties f.write('%s_properties = {\n' % prefix) count = len(table) - 1 i = 0 for k1, v1 in sorted(table.items()): f.write(' "%s": {\n' % k1) count2 = len(v1) - 1 j = 0 for k2, v2 in sorted(v1.items()): f.write(' "%s": "%s"' % (k2, v2)) if j == count2: f.write('\n }') else: f.write(',\n') j += 1 if i == count: f.write('\n}\n') else: f.write(',\n') i += 1 if not append: with codecs.open(os.path.join(output, '__init__.py'), 'w') as f: f.write(HEADER) for x in sorted(files): f.write('from .%s import * # noqa\n' % os.path.basename(files[x])[:-3])
[ "def", "gen_properties", "(", "output", ",", "ascii_props", "=", "False", ",", "append", "=", "False", ")", ":", "files", "=", "{", "'gc'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'generalcategory.py'", ")", ",", "'blk'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'block.py'", ")", ",", "'sc'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'script.py'", ")", ",", "'bc'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'bidiclass.py'", ")", ",", "'binary'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'binary.py'", ")", ",", "'posix'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'posix.py'", ")", ",", "'age'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'age.py'", ")", ",", "'ea'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'eastasianwidth.py'", ")", ",", "'gcb'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'graphemeclusterbreak.py'", ")", ",", "'lb'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'linebreak.py'", ")", ",", "'sb'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'sentencebreak.py'", ")", ",", "'wb'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'wordbreak.py'", ")", ",", "'hst'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'hangulsyllabletype.py'", ")", ",", "'dt'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'decompositiontype.py'", ")", ",", "'jt'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'joiningtype.py'", ")", ",", "'jg'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'joininggroup.py'", ")", ",", "'nt'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'numerictype.py'", ")", ",", "'nv'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'numericvalue.py'", ")", ",", "'ccc'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'canonicalcombiningclass.py'", ")", ",", "'qc'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'quickcheck.py'", ")", ",", "'alias'", ":", "os", ".", "path", ".", "join", "(", "output", ",", "'alias.py'", ")", "}", "files", "[", "'scx'", "]", "=", "os", ".", "path", ".", "join", "(", "output", ",", "'scriptextensions.py'", ")", "files", "[", "'insc'", "]", "=", "os", ".", "path", ".", "join", "(", "output", ",", "'indicsyllabiccategory.py'", ")", "if", "PY34", ":", "files", "[", "'bpt'", "]", "=", "os", ".", "path", ".", "join", "(", "output", ",", "'bidipairedbrackettype.py'", ")", "if", "PY35", ":", "files", "[", "'inpc'", "]", "=", "os", ".", "path", ".", "join", "(", "output", ",", "'indicpositionalcategory.py'", ")", "else", ":", "files", "[", "'inmc'", "]", "=", "os", ".", "path", ".", "join", "(", "output", ",", "'indicmatracategory.py'", ")", "if", "PY37", ":", "files", "[", "'vo'", "]", "=", "os", ".", "path", ".", "join", "(", "output", ",", "'verticalorientation.py'", ")", "prefix", "=", "\"ascii\"", "if", "ascii_props", "else", "'unicode'", "# `L&` or `Lc` won't be found in the table,", "# so initialize 'c' at the start. `&` will have to be converted to 'c'", "# before sending it through.", "categories", "=", "[", "'generalcategory'", ",", "'script'", ",", "'block'", ",", "'bidiclass'", ",", "'eastasianwidth'", ",", "'linebreak'", ",", "'hangulsyllabletype'", ",", "'wordbreak'", ",", "'sentencebreak'", ",", "'graphemeclusterbreak'", ",", "'decompositiontype'", ",", "'joiningtype'", ",", "'joininggroup'", ",", "'numerictype'", ",", "'numericvalue'", ",", "'canonicalcombiningclass'", ",", "'age'", "]", "categories", ".", "append", "(", "'scriptextensions'", ")", "categories", ".", "append", "(", "'indicsyllabiccategory'", ")", "if", "PY34", ":", "categories", ".", "append", "(", "'bidipairedbrackettype'", ")", "if", "PY35", ":", "categories", ".", "append", "(", "'indicpositionalcategory'", ")", "else", ":", "categories", ".", "append", "(", "'indicmatracategory'", ")", "if", "PY37", ":", "categories", ".", "append", "(", "'verticalorientation'", ")", "if", "ascii_props", ":", "print", "(", "'=========Ascii Tables========='", ")", "else", ":", "print", "(", "'========Unicode Tables========'", ")", "print", "(", "'Building: General Category'", ")", "max_range", "=", "ASCII_RANGE", "if", "ascii_props", "else", "UNICODE_RANGE", "all_chars", "=", "ALL_ASCII", "if", "ascii_props", "else", "ALL_CHARS", "table", "=", "{", "'l'", ":", "{", "'c'", ":", "[", "]", "}", "}", "itable", "=", "{", "'l'", ":", "{", "}", "}", "with", "codecs", ".", "open", "(", "os", ".", "path", ".", "join", "(", "HOME", ",", "'unicodedata'", ",", "UNIVERSION", ",", "'UnicodeData.txt'", ")", ",", "'r'", ",", "'utf-8'", ")", "as", "uf", ":", "for", "line", "in", "uf", ":", "data", "=", "line", ".", "strip", "(", ")", ".", "split", "(", "';'", ")", "if", "data", ":", "i", "=", "int", "(", "data", "[", "0", "]", ",", "16", ")", "if", "i", ">", "max_range", "[", "1", "]", ":", "continue", "p", "=", "data", "[", "2", "]", ".", "lower", "(", ")", "if", "p", "[", "0", "]", "not", "in", "table", ":", "table", "[", "p", "[", "0", "]", "]", "=", "{", "}", "itable", "[", "p", "[", "0", "]", "]", "=", "{", "}", "if", "p", "[", "1", "]", "not", "in", "table", "[", "p", "[", "0", "]", "]", ":", "table", "[", "p", "[", "0", "]", "]", "[", "p", "[", "1", "]", "]", "=", "[", "]", "table", "[", "p", "[", "0", "]", "]", "[", "p", "[", "1", "]", "]", ".", "append", "(", "i", ")", "# Add LC which is a combo of Ll, Lu, and Lt", "if", "p", "[", "0", "]", "==", "'l'", "and", "p", "[", "1", "]", "in", "(", "'l'", ",", "'u'", ",", "'t'", ")", ":", "table", "[", "'l'", "]", "[", "'c'", "]", ".", "append", "(", "i", ")", "# Create inverse of each category", "for", "k1", ",", "v1", "in", "table", ".", "items", "(", ")", ":", "inverse_category", "=", "set", "(", ")", "for", "k2", ",", "v2", "in", "v1", ".", "items", "(", ")", ":", "s", "=", "set", "(", "v2", ")", "inverse_category", "|=", "s", "itable", "[", "k1", "]", "[", "'^'", "]", "=", "list", "(", "all_chars", "-", "inverse_category", ")", "# Generate Unicode blocks", "print", "(", "'Building: Blocks'", ")", "gen_blocks", "(", "files", "[", "'blk'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", "# Generate Unicode scripts", "print", "(", "'Building: Scripts & Script Extensions'", ")", "gen_scripts", "(", "'Scripts.txt'", ",", "'ScriptExtensions.txt'", ",", "'scripts'", ",", "'script_extensions'", ",", "files", "[", "'sc'", "]", ",", "files", "[", "'scx'", "]", ",", "notexplicit", "=", "'zzzz'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "# Generate Unicode bidi classes", "print", "(", "'Building: Bidi Classes'", ")", "gen_bidi", "(", "files", "[", "'bc'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", "if", "PY34", ":", "print", "(", "'Building: Bidi Paired Bracket Type'", ")", "gen_enum", "(", "'BidiBrackets.txt'", ",", "'bidi_paired_bracket_type'", ",", "files", "[", "'bpt'", "]", ",", "notexplicit", "=", "'n'", ",", "field", "=", "2", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "# Generate Unicode binary", "print", "(", "'Building: Binary'", ")", "binary", "=", "gen_binary", "(", "table", ",", "files", "[", "'binary'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", "# Generate posix table and write out to file.", "print", "(", "'Building: Posix'", ")", "gen_posix", "(", "files", "[", "'posix'", "]", ",", "is_bytes", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Age'", ")", "gen_age", "(", "files", "[", "'age'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", "print", "(", "'Building: East Asian Width'", ")", "gen_enum", "(", "'EastAsianWidth.txt'", ",", "'east_asian_width'", ",", "files", "[", "'ea'", "]", ",", "notexplicit", "=", "'n'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Grapheme Cluster Break'", ")", "gen_enum", "(", "'GraphemeBreakProperty.txt'", ",", "'grapheme_cluster_break'", ",", "files", "[", "'gcb'", "]", ",", "notexplicit", "=", "'other'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Line Break'", ")", "gen_enum", "(", "'LineBreak.txt'", ",", "'line_break'", ",", "files", "[", "'lb'", "]", ",", "notexplicit", "=", "'unknown'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Sentence Break'", ")", "gen_enum", "(", "'SentenceBreakProperty.txt'", ",", "'sentence_break'", ",", "files", "[", "'sb'", "]", ",", "notexplicit", "=", "'other'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Word Break'", ")", "gen_enum", "(", "'WordBreakProperty.txt'", ",", "'word_break'", ",", "files", "[", "'wb'", "]", ",", "notexplicit", "=", "'other'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "if", "PY35", ":", "print", "(", "'Building: Indic Positional Category'", ")", "gen_enum", "(", "'IndicPositionalCategory.txt'", ",", "'indic_positional_category'", ",", "files", "[", "'inpc'", "]", ",", "notexplicit", "=", "'na'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "else", ":", "print", "(", "'Building: Indic Matra Category'", ")", "gen_enum", "(", "'IndicMatraCategory.txt'", ",", "'indic_matra_category'", ",", "files", "[", "'inmc'", "]", ",", "notexplicit", "=", "'na'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Indic Syllabic Category'", ")", "gen_enum", "(", "'IndicSyllabicCategory.txt'", ",", "'indic_syllabic_category'", ",", "files", "[", "'insc'", "]", ",", "notexplicit", "=", "'other'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Hangul Syllable Type'", ")", "gen_enum", "(", "'HangulSyllableType.txt'", ",", "'hangul_syllable_type'", ",", "files", "[", "'hst'", "]", ",", "notexplicit", "=", "'na'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Decomposition Type'", ")", "gen_enum", "(", "'DerivedDecompositionType.txt'", ",", "'decomposition_type'", ",", "files", "[", "'dt'", "]", ",", "notexplicit", "=", "'none'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Joining Type'", ")", "gen_enum", "(", "'DerivedJoiningType.txt'", ",", "'joining_type'", ",", "files", "[", "'jt'", "]", ",", "notexplicit", "=", "'u'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Joining Group'", ")", "gen_enum", "(", "'DerivedJoiningGroup.txt'", ",", "'joining_group'", ",", "files", "[", "'jg'", "]", ",", "notexplicit", "=", "'nonjoining'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Numeric Type'", ")", "gen_enum", "(", "'DerivedNumericType.txt'", ",", "'numeric_type'", ",", "files", "[", "'nt'", "]", ",", "notexplicit", "=", "'none'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Numeric Value'", ")", "gen_enum", "(", "'DerivedNumericValues.txt'", ",", "'numeric_values'", ",", "files", "[", "'nv'", "]", ",", "field", "=", "3", ",", "notexplicit", "=", "'nan'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "print", "(", "'Building: Canonical Combining Class'", ")", "gen_ccc", "(", "files", "[", "'ccc'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", "print", "(", "'Building: NF* Quick Check'", ")", "categories", ".", "extend", "(", "gen_nf_quick_check", "(", "files", "[", "'qc'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", ")", "if", "PY37", ":", "print", "(", "'Building: Vertical Orientation'", ")", "gen_enum", "(", "'VerticalOrientation.txt'", ",", "'vertical_orientation'", ",", "files", "[", "'vo'", "]", ",", "notexplicit", "=", "'R'", ",", "ascii_props", "=", "ascii_props", ",", "append", "=", "append", ",", "prefix", "=", "prefix", ")", "if", "not", "ascii_props", ":", "print", "(", "'Building: Aliases'", ")", "gen_alias", "(", "categories", ",", "binary", ",", "files", "[", "'alias'", "]", ",", "ascii_props", ",", "append", ",", "prefix", ")", "# Convert char values to string ranges.", "char2range", "(", "table", ",", "is_bytes", "=", "ascii_props", ")", "char2range", "(", "itable", ",", "is_bytes", "=", "ascii_props", ",", "invert", "=", "False", ")", "for", "k1", ",", "v1", "in", "itable", ".", "items", "(", ")", ":", "table", "[", "k1", "]", "[", "'^'", "]", "=", "v1", "[", "'^'", "]", "with", "codecs", ".", "open", "(", "files", "[", "'gc'", "]", ",", "'a'", "if", "append", "else", "'w'", ",", "'utf-8'", ")", "as", "f", ":", "if", "not", "append", ":", "f", ".", "write", "(", "HEADER", ")", "# Write out the Unicode properties", "f", ".", "write", "(", "'%s_properties = {\\n'", "%", "prefix", ")", "count", "=", "len", "(", "table", ")", "-", "1", "i", "=", "0", "for", "k1", ",", "v1", "in", "sorted", "(", "table", ".", "items", "(", ")", ")", ":", "f", ".", "write", "(", "' \"%s\": {\\n'", "%", "k1", ")", "count2", "=", "len", "(", "v1", ")", "-", "1", "j", "=", "0", "for", "k2", ",", "v2", "in", "sorted", "(", "v1", ".", "items", "(", ")", ")", ":", "f", ".", "write", "(", "' \"%s\": \"%s\"'", "%", "(", "k2", ",", "v2", ")", ")", "if", "j", "==", "count2", ":", "f", ".", "write", "(", "'\\n }'", ")", "else", ":", "f", ".", "write", "(", "',\\n'", ")", "j", "+=", "1", "if", "i", "==", "count", ":", "f", ".", "write", "(", "'\\n}\\n'", ")", "else", ":", "f", ".", "write", "(", "',\\n'", ")", "i", "+=", "1", "if", "not", "append", ":", "with", "codecs", ".", "open", "(", "os", ".", "path", ".", "join", "(", "output", ",", "'__init__.py'", ")", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "HEADER", ")", "for", "x", "in", "sorted", "(", "files", ")", ":", "f", ".", "write", "(", "'from .%s import * # noqa\\n'", "%", "os", ".", "path", ".", "basename", "(", "files", "[", "x", "]", ")", "[", ":", "-", "3", "]", ")" ]
Generate the property table and dump it to the provided file.
[ "Generate", "the", "property", "table", "and", "dump", "it", "to", "the", "provided", "file", "." ]
train
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/tools/unipropgen.py#L948-L1212
<|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 the property table and dump it to the provided file. ### Response: def gen_properties(output, ascii_props=False, append=False): """Generate the property table and dump it to the provided file.""" files = { 'gc': os.path.join(output, 'generalcategory.py'), 'blk': os.path.join(output, 'block.py'), 'sc': os.path.join(output, 'script.py'), 'bc': os.path.join(output, 'bidiclass.py'), 'binary': os.path.join(output, 'binary.py'), 'posix': os.path.join(output, 'posix.py'), 'age': os.path.join(output, 'age.py'), 'ea': os.path.join(output, 'eastasianwidth.py'), 'gcb': os.path.join(output, 'graphemeclusterbreak.py'), 'lb': os.path.join(output, 'linebreak.py'), 'sb': os.path.join(output, 'sentencebreak.py'), 'wb': os.path.join(output, 'wordbreak.py'), 'hst': os.path.join(output, 'hangulsyllabletype.py'), 'dt': os.path.join(output, 'decompositiontype.py'), 'jt': os.path.join(output, 'joiningtype.py'), 'jg': os.path.join(output, 'joininggroup.py'), 'nt': os.path.join(output, 'numerictype.py'), 'nv': os.path.join(output, 'numericvalue.py'), 'ccc': os.path.join(output, 'canonicalcombiningclass.py'), 'qc': os.path.join(output, 'quickcheck.py'), 'alias': os.path.join(output, 'alias.py') } files['scx'] = os.path.join(output, 'scriptextensions.py') files['insc'] = os.path.join(output, 'indicsyllabiccategory.py') if PY34: files['bpt'] = os.path.join(output, 'bidipairedbrackettype.py') if PY35: files['inpc'] = os.path.join(output, 'indicpositionalcategory.py') else: files['inmc'] = os.path.join(output, 'indicmatracategory.py') if PY37: files['vo'] = os.path.join(output, 'verticalorientation.py') prefix = "ascii" if ascii_props else 'unicode' # `L&` or `Lc` won't be found in the table, # so initialize 'c' at the start. `&` will have to be converted to 'c' # before sending it through. categories = [ 'generalcategory', 'script', 'block', 'bidiclass', 'eastasianwidth', 'linebreak', 'hangulsyllabletype', 'wordbreak', 'sentencebreak', 'graphemeclusterbreak', 'decompositiontype', 'joiningtype', 'joininggroup', 'numerictype', 'numericvalue', 'canonicalcombiningclass', 'age' ] categories.append('scriptextensions') categories.append('indicsyllabiccategory') if PY34: categories.append('bidipairedbrackettype') if PY35: categories.append('indicpositionalcategory') else: categories.append('indicmatracategory') if PY37: categories.append('verticalorientation') if ascii_props: print('=========Ascii Tables=========') else: print('========Unicode Tables========') print('Building: General Category') max_range = ASCII_RANGE if ascii_props else UNICODE_RANGE all_chars = ALL_ASCII if ascii_props else ALL_CHARS table = {'l': {'c': []}} itable = {'l': {}} with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, 'UnicodeData.txt'), 'r', 'utf-8') as uf: for line in uf: data = line.strip().split(';') if data: i = int(data[0], 16) if i > max_range[1]: continue p = data[2].lower() if p[0] not in table: table[p[0]] = {} itable[p[0]] = {} if p[1] not in table[p[0]]: table[p[0]][p[1]] = [] table[p[0]][p[1]].append(i) # Add LC which is a combo of Ll, Lu, and Lt if p[0] == 'l' and p[1] in ('l', 'u', 't'): table['l']['c'].append(i) # Create inverse of each category for k1, v1 in table.items(): inverse_category = set() for k2, v2 in v1.items(): s = set(v2) inverse_category |= s itable[k1]['^'] = list(all_chars - inverse_category) # Generate Unicode blocks print('Building: Blocks') gen_blocks(files['blk'], ascii_props, append, prefix) # Generate Unicode scripts print('Building: Scripts & Script Extensions') gen_scripts( 'Scripts.txt', 'ScriptExtensions.txt', 'scripts', 'script_extensions', files['sc'], files['scx'], notexplicit='zzzz', ascii_props=ascii_props, append=append, prefix=prefix ) # Generate Unicode bidi classes print('Building: Bidi Classes') gen_bidi(files['bc'], ascii_props, append, prefix) if PY34: print('Building: Bidi Paired Bracket Type') gen_enum( 'BidiBrackets.txt', 'bidi_paired_bracket_type', files['bpt'], notexplicit='n', field=2, ascii_props=ascii_props, append=append, prefix=prefix ) # Generate Unicode binary print('Building: Binary') binary = gen_binary(table, files['binary'], ascii_props, append, prefix) # Generate posix table and write out to file. print('Building: Posix') gen_posix(files['posix'], is_bytes=ascii_props, append=append, prefix=prefix) print('Building: Age') gen_age(files['age'], ascii_props, append, prefix) print('Building: East Asian Width') gen_enum( 'EastAsianWidth.txt', 'east_asian_width', files['ea'], notexplicit='n', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Grapheme Cluster Break') gen_enum( 'GraphemeBreakProperty.txt', 'grapheme_cluster_break', files['gcb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Line Break') gen_enum( 'LineBreak.txt', 'line_break', files['lb'], notexplicit='unknown', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Sentence Break') gen_enum( 'SentenceBreakProperty.txt', 'sentence_break', files['sb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Word Break') gen_enum( 'WordBreakProperty.txt', 'word_break', files['wb'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) if PY35: print('Building: Indic Positional Category') gen_enum( 'IndicPositionalCategory.txt', 'indic_positional_category', files['inpc'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) else: print('Building: Indic Matra Category') gen_enum( 'IndicMatraCategory.txt', 'indic_matra_category', files['inmc'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Indic Syllabic Category') gen_enum( 'IndicSyllabicCategory.txt', 'indic_syllabic_category', files['insc'], notexplicit='other', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Hangul Syllable Type') gen_enum( 'HangulSyllableType.txt', 'hangul_syllable_type', files['hst'], notexplicit='na', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Decomposition Type') gen_enum( 'DerivedDecompositionType.txt', 'decomposition_type', files['dt'], notexplicit='none', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Joining Type') gen_enum( 'DerivedJoiningType.txt', 'joining_type', files['jt'], notexplicit='u', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Joining Group') gen_enum( 'DerivedJoiningGroup.txt', 'joining_group', files['jg'], notexplicit='nonjoining', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Numeric Type') gen_enum( 'DerivedNumericType.txt', 'numeric_type', files['nt'], notexplicit='none', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Numeric Value') gen_enum( 'DerivedNumericValues.txt', 'numeric_values', files['nv'], field=3, notexplicit='nan', ascii_props=ascii_props, append=append, prefix=prefix ) print('Building: Canonical Combining Class') gen_ccc(files['ccc'], ascii_props, append, prefix) print('Building: NF* Quick Check') categories.extend(gen_nf_quick_check(files['qc'], ascii_props, append, prefix)) if PY37: print('Building: Vertical Orientation') gen_enum( 'VerticalOrientation.txt', 'vertical_orientation', files['vo'], notexplicit='R', ascii_props=ascii_props, append=append, prefix=prefix ) if not ascii_props: print('Building: Aliases') gen_alias(categories, binary, files['alias'], ascii_props, append, prefix) # Convert char values to string ranges. char2range(table, is_bytes=ascii_props) char2range(itable, is_bytes=ascii_props, invert=False) for k1, v1 in itable.items(): table[k1]['^'] = v1['^'] with codecs.open(files['gc'], 'a' if append else 'w', 'utf-8') as f: if not append: f.write(HEADER) # Write out the Unicode properties f.write('%s_properties = {\n' % prefix) count = len(table) - 1 i = 0 for k1, v1 in sorted(table.items()): f.write(' "%s": {\n' % k1) count2 = len(v1) - 1 j = 0 for k2, v2 in sorted(v1.items()): f.write(' "%s": "%s"' % (k2, v2)) if j == count2: f.write('\n }') else: f.write(',\n') j += 1 if i == count: f.write('\n}\n') else: f.write(',\n') i += 1 if not append: with codecs.open(os.path.join(output, '__init__.py'), 'w') as f: f.write(HEADER) for x in sorted(files): f.write('from .%s import * # noqa\n' % os.path.basename(files[x])[:-3]) <|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, 279, 3424, 2007, 323, 10488, 433, 311, 279, 3984, 1052, 382, 14711, 6075, 512, 755, 4173, 26216, 11304, 11, 48220, 45935, 5725, 11, 8911, 5725, 997, 262, 4304, 32215, 279, 3424, 2007, 323, 10488, 433, 311, 279, 3984, 1052, 30284, 262, 3626, 284, 341, 286, 364, 21325, 1232, 2709, 3960, 5563, 11304, 11, 364, 25615, 5588, 7345, 3379, 286, 364, 36089, 1232, 2709, 3960, 5563, 11304, 11, 364, 4677, 7345, 3379, 286, 364, 2445, 1232, 2709, 3960, 5563, 11304, 11, 364, 2334, 7345, 3379, 286, 364, 9081, 1232, 2709, 3960, 5563, 11304, 11, 364, 21301, 70603, 7345, 3379, 286, 364, 26978, 1232, 2709, 3960, 5563, 11304, 11, 364, 26978, 7345, 3379, 286, 364, 81904, 1232, 2709, 3960, 5563, 11304, 11, 364, 81904, 7345, 3379, 286, 364, 425, 1232, 2709, 3960, 5563, 11304, 11, 364, 425, 7345, 3379, 286, 364, 12791, 1232, 2709, 3960, 5563, 11304, 11, 364, 61601, 300, 1122, 3175, 7345, 3379, 286, 364, 70, 7369, 1232, 2709, 3960, 5563, 11304, 11, 364, 4539, 3981, 19386, 9137, 7345, 3379, 286, 364, 21807, 1232, 2709, 3960, 5563, 11304, 11, 364, 1074, 9137, 7345, 3379, 286, 364, 17319, 1232, 2709, 3960, 5563, 11304, 11, 364, 52989, 9137, 7345, 3379, 286, 364, 20824, 1232, 2709, 3960, 5563, 11304, 11, 364, 1178, 9137, 7345, 3379, 286, 364, 71, 267, 1232, 2709, 3960, 5563, 11304, 11, 364, 21313, 14630, 25734, 481, 1337, 7345, 3379, 286, 364, 8207, 1232, 2709, 3960, 5563, 11304, 11, 364, 451, 77907, 1337, 7345, 3379, 286, 364, 58305, 1232, 2709, 3960, 5563, 11304, 11, 364, 66305, 1337, 7345, 3379, 286, 364, 73, 70, 1232, 2709, 3960, 5563, 11304, 11, 364, 66305, 4166, 7345, 3379, 286, 364, 406, 1232, 2709, 3960, 5563, 11304, 11, 364, 76696, 858, 500, 7345, 3379, 286, 364, 38041, 1232, 2709, 3960, 5563, 11304, 11, 364, 20173, 970, 7345, 3379, 286, 364, 38154, 1232, 2709, 3960, 5563, 11304, 11, 364, 79042, 22631, 5859, 1058, 7345, 3379, 286, 364, 60933, 1232, 2709, 3960, 5563, 11304, 11, 364, 28863, 2071, 7345, 3379, 286, 364, 15305, 1232, 2709, 3960, 5563, 11304, 11, 364, 15305, 7345, 1329, 262, 557, 262, 3626, 681, 2445, 87, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 2334, 28709, 7345, 1329, 262, 3626, 681, 1354, 66, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 485, 1233, 25734, 69391, 5588, 7345, 1329, 262, 422, 43860, 1958, 512, 286, 3626, 681, 65, 418, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 21301, 575, 25260, 1347, 5827, 1337, 7345, 1329, 262, 422, 43860, 1758, 512, 286, 3626, 681, 258, 4080, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 86184, 981, 3079, 5588, 7345, 1329, 262, 775, 512, 286, 3626, 681, 258, 13183, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 86184, 8637, 20554, 2074, 7345, 1329, 262, 422, 43860, 1806, 512, 286, 3626, 681, 3415, 663, 284, 2709, 3960, 5563, 11304 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 279, 3424, 2007, 323, 10488, 433, 311, 279, 3984, 1052, 382, 14711, 6075, 512, 755, 4173, 26216, 11304, 11, 48220, 45935, 5725, 11, 8911, 5725, 997, 262, 4304, 32215, 279, 3424, 2007, 323, 10488, 433, 311, 279, 3984, 1052, 30284, 262, 3626, 284, 341, 286, 364, 21325, 1232, 2709, 3960, 5563, 11304, 11, 364, 25615, 5588, 7345, 3379, 286, 364, 36089, 1232, 2709, 3960, 5563, 11304, 11, 364, 4677, 7345, 3379, 286, 364, 2445, 1232, 2709, 3960, 5563, 11304, 11, 364, 2334, 7345, 3379, 286, 364, 9081, 1232, 2709, 3960, 5563, 11304, 11, 364, 21301, 70603, 7345, 3379, 286, 364, 26978, 1232, 2709, 3960, 5563, 11304, 11, 364, 26978, 7345, 3379, 286, 364, 81904, 1232, 2709, 3960, 5563, 11304, 11, 364, 81904, 7345, 3379, 286, 364, 425, 1232, 2709, 3960, 5563, 11304, 11, 364, 425, 7345, 3379, 286, 364, 12791, 1232, 2709, 3960, 5563, 11304, 11, 364, 61601, 300, 1122, 3175, 7345, 3379, 286, 364, 70, 7369, 1232, 2709, 3960, 5563, 11304, 11, 364, 4539, 3981, 19386, 9137, 7345, 3379, 286, 364, 21807, 1232, 2709, 3960, 5563, 11304, 11, 364, 1074, 9137, 7345, 3379, 286, 364, 17319, 1232, 2709, 3960, 5563, 11304, 11, 364, 52989, 9137, 7345, 3379, 286, 364, 20824, 1232, 2709, 3960, 5563, 11304, 11, 364, 1178, 9137, 7345, 3379, 286, 364, 71, 267, 1232, 2709, 3960, 5563, 11304, 11, 364, 21313, 14630, 25734, 481, 1337, 7345, 3379, 286, 364, 8207, 1232, 2709, 3960, 5563, 11304, 11, 364, 451, 77907, 1337, 7345, 3379, 286, 364, 58305, 1232, 2709, 3960, 5563, 11304, 11, 364, 66305, 1337, 7345, 3379, 286, 364, 73, 70, 1232, 2709, 3960, 5563, 11304, 11, 364, 66305, 4166, 7345, 3379, 286, 364, 406, 1232, 2709, 3960, 5563, 11304, 11, 364, 76696, 858, 500, 7345, 3379, 286, 364, 38041, 1232, 2709, 3960, 5563, 11304, 11, 364, 20173, 970, 7345, 3379, 286, 364, 38154, 1232, 2709, 3960, 5563, 11304, 11, 364, 79042, 22631, 5859, 1058, 7345, 3379, 286, 364, 60933, 1232, 2709, 3960, 5563, 11304, 11, 364, 28863, 2071, 7345, 3379, 286, 364, 15305, 1232, 2709, 3960, 5563, 11304, 11, 364, 15305, 7345, 1329, 262, 557, 262, 3626, 681, 2445, 87, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 2334, 28709, 7345, 1329, 262, 3626, 681, 1354, 66, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 485, 1233, 25734, 69391, 5588, 7345, 1329, 262, 422, 43860, 1958, 512, 286, 3626, 681, 65, 418, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 21301, 575, 25260, 1347, 5827, 1337, 7345, 1329, 262, 422, 43860, 1758, 512, 286, 3626, 681, 258, 4080, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 86184, 981, 3079, 5588, 7345, 1329, 262, 775, 512, 286, 3626, 681, 258, 13183, 663, 284, 2709, 3960, 5563, 11304, 11, 364, 86184, 8637, 20554, 2074, 7345, 1329, 262, 422, 43860, 1806, 512, 286, 3626, 681, 3415, 663, 284, 2709, 3960, 5563, 11304 ]
basho/riak-python-client
riak/client/multi.py
multiput
def multiput(client, objs, **options): """Executes a parallel-store across multiple threads. Returns a list containing booleans or :class:`~riak.riak_object.RiakObject` If a ``pool`` option is included, the request will use the given worker pool and not a transient :class:`~riak.client.multi.MultiPutPool`. This option will be passed by the client if the ``multiput_pool_size`` option was set on client initialization. :param client: the client to use :type client: :class:`RiakClient <riak.client.RiakClient>` :param objs: the objects to store in parallel :type objs: list of `RiakObject <riak.riak_object.RiakObject>` or `TsObject <riak.ts_object.TsObject>` :param options: request options to :meth:`RiakClient.put <riak.client.RiakClient.put>` :type options: dict :rtype: list """ transient_pool = False outq = Queue() if 'pool' in options: pool = options['pool'] del options['pool'] else: pool = MultiPutPool() transient_pool = True try: pool.start() for obj in objs: task = PutTask(client, outq, obj, options) pool.enq(task) results = [] for _ in range(len(objs)): if pool.stopped(): raise RuntimeError( 'Multi-put operation interrupted by pool ' 'stopping!') results.append(outq.get()) outq.task_done() finally: if transient_pool: pool.stop() return results
python
def multiput(client, objs, **options): """Executes a parallel-store across multiple threads. Returns a list containing booleans or :class:`~riak.riak_object.RiakObject` If a ``pool`` option is included, the request will use the given worker pool and not a transient :class:`~riak.client.multi.MultiPutPool`. This option will be passed by the client if the ``multiput_pool_size`` option was set on client initialization. :param client: the client to use :type client: :class:`RiakClient <riak.client.RiakClient>` :param objs: the objects to store in parallel :type objs: list of `RiakObject <riak.riak_object.RiakObject>` or `TsObject <riak.ts_object.TsObject>` :param options: request options to :meth:`RiakClient.put <riak.client.RiakClient.put>` :type options: dict :rtype: list """ transient_pool = False outq = Queue() if 'pool' in options: pool = options['pool'] del options['pool'] else: pool = MultiPutPool() transient_pool = True try: pool.start() for obj in objs: task = PutTask(client, outq, obj, options) pool.enq(task) results = [] for _ in range(len(objs)): if pool.stopped(): raise RuntimeError( 'Multi-put operation interrupted by pool ' 'stopping!') results.append(outq.get()) outq.task_done() finally: if transient_pool: pool.stop() return results
[ "def", "multiput", "(", "client", ",", "objs", ",", "*", "*", "options", ")", ":", "transient_pool", "=", "False", "outq", "=", "Queue", "(", ")", "if", "'pool'", "in", "options", ":", "pool", "=", "options", "[", "'pool'", "]", "del", "options", "[", "'pool'", "]", "else", ":", "pool", "=", "MultiPutPool", "(", ")", "transient_pool", "=", "True", "try", ":", "pool", ".", "start", "(", ")", "for", "obj", "in", "objs", ":", "task", "=", "PutTask", "(", "client", ",", "outq", ",", "obj", ",", "options", ")", "pool", ".", "enq", "(", "task", ")", "results", "=", "[", "]", "for", "_", "in", "range", "(", "len", "(", "objs", ")", ")", ":", "if", "pool", ".", "stopped", "(", ")", ":", "raise", "RuntimeError", "(", "'Multi-put operation interrupted by pool '", "'stopping!'", ")", "results", ".", "append", "(", "outq", ".", "get", "(", ")", ")", "outq", ".", "task_done", "(", ")", "finally", ":", "if", "transient_pool", ":", "pool", ".", "stop", "(", ")", "return", "results" ]
Executes a parallel-store across multiple threads. Returns a list containing booleans or :class:`~riak.riak_object.RiakObject` If a ``pool`` option is included, the request will use the given worker pool and not a transient :class:`~riak.client.multi.MultiPutPool`. This option will be passed by the client if the ``multiput_pool_size`` option was set on client initialization. :param client: the client to use :type client: :class:`RiakClient <riak.client.RiakClient>` :param objs: the objects to store in parallel :type objs: list of `RiakObject <riak.riak_object.RiakObject>` or `TsObject <riak.ts_object.TsObject>` :param options: request options to :meth:`RiakClient.put <riak.client.RiakClient.put>` :type options: dict :rtype: list
[ "Executes", "a", "parallel", "-", "store", "across", "multiple", "threads", ".", "Returns", "a", "list", "containing", "booleans", "or", ":", "class", ":", "~riak", ".", "riak_object", ".", "RiakObject" ]
train
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/client/multi.py#L277-L324
<|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: Executes a parallel-store across multiple threads. Returns a list containing booleans or :class:`~riak.riak_object.RiakObject` If a ``pool`` option is included, the request will use the given worker pool and not a transient :class:`~riak.client.multi.MultiPutPool`. This option will be passed by the client if the ``multiput_pool_size`` option was set on client initialization. :param client: the client to use :type client: :class:`RiakClient <riak.client.RiakClient>` :param objs: the objects to store in parallel :type objs: list of `RiakObject <riak.riak_object.RiakObject>` or `TsObject <riak.ts_object.TsObject>` :param options: request options to :meth:`RiakClient.put <riak.client.RiakClient.put>` :type options: dict :rtype: list ### Response: def multiput(client, objs, **options): """Executes a parallel-store across multiple threads. Returns a list containing booleans or :class:`~riak.riak_object.RiakObject` If a ``pool`` option is included, the request will use the given worker pool and not a transient :class:`~riak.client.multi.MultiPutPool`. This option will be passed by the client if the ``multiput_pool_size`` option was set on client initialization. :param client: the client to use :type client: :class:`RiakClient <riak.client.RiakClient>` :param objs: the objects to store in parallel :type objs: list of `RiakObject <riak.riak_object.RiakObject>` or `TsObject <riak.ts_object.TsObject>` :param options: request options to :meth:`RiakClient.put <riak.client.RiakClient.put>` :type options: dict :rtype: list """ transient_pool = False outq = Queue() if 'pool' in options: pool = options['pool'] del options['pool'] else: pool = MultiPutPool() transient_pool = True try: pool.start() for obj in objs: task = PutTask(client, outq, obj, options) pool.enq(task) results = [] for _ in range(len(objs)): if pool.stopped(): raise RuntimeError( 'Multi-put operation interrupted by pool ' 'stopping!') results.append(outq.get()) outq.task_done() finally: if transient_pool: pool.stop() 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, 10427, 2142, 264, 15638, 34352, 4028, 5361, 14906, 13, 5295, 264, 1160, 198, 262, 8649, 712, 98099, 477, 551, 1058, 78902, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 19884, 262, 1442, 264, 10103, 10497, 14196, 3072, 374, 5343, 11, 279, 1715, 690, 1005, 279, 2728, 12128, 198, 262, 7463, 323, 539, 264, 41658, 551, 1058, 78902, 462, 587, 6718, 52251, 58806, 19648, 10774, 29687, 1115, 198, 262, 3072, 690, 387, 5946, 555, 279, 3016, 422, 279, 10103, 79076, 332, 16084, 2424, 85374, 262, 3072, 574, 743, 389, 3016, 17923, 382, 262, 551, 913, 3016, 25, 279, 3016, 311, 1005, 198, 262, 551, 1337, 3016, 25, 551, 1058, 19258, 49, 72, 587, 3032, 366, 462, 587, 6718, 2056, 72, 587, 3032, 54822, 262, 551, 913, 54037, 25, 279, 6302, 311, 3637, 304, 15638, 198, 262, 551, 1337, 54037, 25, 1160, 315, 1595, 49, 72, 587, 1211, 366, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 44726, 477, 198, 394, 1595, 53893, 1211, 366, 462, 587, 21991, 5427, 844, 82, 1211, 54822, 262, 551, 913, 2671, 25, 1715, 2671, 311, 198, 286, 551, 69991, 19258, 49, 72, 587, 3032, 3681, 366, 462, 587, 6718, 2056, 72, 587, 3032, 3681, 54822, 262, 551, 1337, 2671, 25, 6587, 198, 262, 551, 33613, 25, 1160, 271, 14711, 6075, 512, 755, 12842, 332, 13097, 11, 54037, 11, 3146, 2945, 997, 262, 4304, 10427, 2142, 264, 15638, 34352, 4028, 5361, 14906, 13, 5295, 264, 1160, 198, 262, 8649, 712, 98099, 477, 551, 1058, 78902, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 19884, 262, 1442, 264, 10103, 10497, 14196, 3072, 374, 5343, 11, 279, 1715, 690, 1005, 279, 2728, 12128, 198, 262, 7463, 323, 539, 264, 41658, 551, 1058, 78902, 462, 587, 6718, 52251, 58806, 19648, 10774, 29687, 1115, 198, 262, 3072, 690, 387, 5946, 555, 279, 3016, 422, 279, 10103, 79076, 332, 16084, 2424, 85374, 262, 3072, 574, 743, 389, 3016, 17923, 382, 262, 551, 913, 3016, 25, 279, 3016, 311, 1005, 198, 262, 551, 1337, 3016, 25, 551, 1058, 19258, 49, 72, 587, 3032, 366, 462, 587, 6718, 2056, 72, 587, 3032, 54822, 262, 551, 913, 54037, 25, 279, 6302, 311, 3637, 304, 15638, 198, 262, 551, 1337, 54037, 25, 1160, 315, 1595, 49, 72, 587, 1211, 366, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 44726, 477, 198, 394, 1595, 53893, 1211, 366, 462, 587, 21991, 5427, 844, 82, 1211, 54822, 262, 551, 913, 2671, 25, 1715, 2671, 311, 198, 286, 551, 69991, 19258, 49, 72, 587, 3032, 3681, 366, 462, 587, 6718, 2056, 72, 587, 3032, 3681, 54822, 262, 551, 1337, 2671, 25, 6587, 198, 262, 551, 33613, 25, 1160, 198, 262, 3270, 262, 41658, 16084, 284, 3641, 198, 262, 704, 80, 284, 19267, 2892, 262, 422, 364, 10497, 6, 304, 2671, 512, 286, 7463, 284, 2671 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 10427, 2142, 264, 15638, 34352, 4028, 5361, 14906, 13, 5295, 264, 1160, 198, 262, 8649, 712, 98099, 477, 551, 1058, 78902, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 19884, 262, 1442, 264, 10103, 10497, 14196, 3072, 374, 5343, 11, 279, 1715, 690, 1005, 279, 2728, 12128, 198, 262, 7463, 323, 539, 264, 41658, 551, 1058, 78902, 462, 587, 6718, 52251, 58806, 19648, 10774, 29687, 1115, 198, 262, 3072, 690, 387, 5946, 555, 279, 3016, 422, 279, 10103, 79076, 332, 16084, 2424, 85374, 262, 3072, 574, 743, 389, 3016, 17923, 382, 262, 551, 913, 3016, 25, 279, 3016, 311, 1005, 198, 262, 551, 1337, 3016, 25, 551, 1058, 19258, 49, 72, 587, 3032, 366, 462, 587, 6718, 2056, 72, 587, 3032, 54822, 262, 551, 913, 54037, 25, 279, 6302, 311, 3637, 304, 15638, 198, 262, 551, 1337, 54037, 25, 1160, 315, 1595, 49, 72, 587, 1211, 366, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 44726, 477, 198, 394, 1595, 53893, 1211, 366, 462, 587, 21991, 5427, 844, 82, 1211, 54822, 262, 551, 913, 2671, 25, 1715, 2671, 311, 198, 286, 551, 69991, 19258, 49, 72, 587, 3032, 3681, 366, 462, 587, 6718, 2056, 72, 587, 3032, 3681, 54822, 262, 551, 1337, 2671, 25, 6587, 198, 262, 551, 33613, 25, 1160, 271, 14711, 6075, 512, 755, 12842, 332, 13097, 11, 54037, 11, 3146, 2945, 997, 262, 4304, 10427, 2142, 264, 15638, 34352, 4028, 5361, 14906, 13, 5295, 264, 1160, 198, 262, 8649, 712, 98099, 477, 551, 1058, 78902, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 19884, 262, 1442, 264, 10103, 10497, 14196, 3072, 374, 5343, 11, 279, 1715, 690, 1005, 279, 2728, 12128, 198, 262, 7463, 323, 539, 264, 41658, 551, 1058, 78902, 462, 587, 6718, 52251, 58806, 19648, 10774, 29687, 1115, 198, 262, 3072, 690, 387, 5946, 555, 279, 3016, 422, 279, 10103, 79076, 332, 16084, 2424, 85374, 262, 3072, 574, 743, 389, 3016, 17923, 382, 262, 551, 913, 3016, 25, 279, 3016, 311, 1005, 198, 262, 551, 1337, 3016, 25, 551, 1058, 19258, 49, 72, 587, 3032, 366, 462, 587, 6718, 2056, 72, 587, 3032, 54822, 262, 551, 913, 54037, 25, 279, 6302, 311, 3637, 304, 15638, 198, 262, 551, 1337, 54037, 25, 1160, 315, 1595, 49, 72, 587, 1211, 366, 462, 587, 13, 462, 587, 5427, 2056, 72, 587, 1211, 44726, 477, 198, 394, 1595, 53893, 1211, 366, 462, 587, 21991, 5427, 844, 82, 1211, 54822, 262, 551, 913, 2671, 25, 1715, 2671, 311, 198, 286, 551, 69991, 19258, 49, 72, 587, 3032, 3681, 366, 462, 587, 6718, 2056, 72, 587, 3032, 3681, 54822, 262, 551, 1337, 2671, 25, 6587, 198, 262, 551, 33613, 25, 1160, 198, 262, 3270, 262, 41658, 16084, 284, 3641, 198, 262, 704, 80, 284, 19267, 2892, 262, 422, 364, 10497, 6, 304, 2671, 512, 286, 7463, 284, 2671 ]
PythonCharmers/python-future
src/future/backports/http/cookies.py
BaseCookie.js_output
def js_output(self, attrs=None): """Return a string suitable for JavaScript.""" result = [] items = sorted(self.items()) for key, value in items: result.append(value.js_output(attrs)) return _nulljoin(result)
python
def js_output(self, attrs=None): """Return a string suitable for JavaScript.""" result = [] items = sorted(self.items()) for key, value in items: result.append(value.js_output(attrs)) return _nulljoin(result)
[ "def", "js_output", "(", "self", ",", "attrs", "=", "None", ")", ":", "result", "=", "[", "]", "items", "=", "sorted", "(", "self", ".", "items", "(", ")", ")", "for", "key", ",", "value", "in", "items", ":", "result", ".", "append", "(", "value", ".", "js_output", "(", "attrs", ")", ")", "return", "_nulljoin", "(", "result", ")" ]
Return a string suitable for JavaScript.
[ "Return", "a", "string", "suitable", "for", "JavaScript", "." ]
train
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/http/cookies.py#L528-L534
<|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 string suitable for JavaScript. ### Response: def js_output(self, attrs=None): """Return a string suitable for JavaScript.""" result = [] items = sorted(self.items()) for key, value in items: result.append(value.js_output(attrs)) return _nulljoin(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, 5715, 264, 925, 14791, 369, 13210, 382, 14711, 6075, 512, 755, 7139, 7800, 1214, 11, 16602, 5980, 997, 286, 4304, 5715, 264, 925, 14791, 369, 13210, 14781, 286, 1121, 284, 4260, 286, 3673, 284, 10839, 1214, 9812, 2455, 286, 369, 1401, 11, 907, 304, 3673, 512, 310, 1121, 2102, 3764, 2927, 7800, 40939, 1192, 286, 471, 721, 2994, 6115, 4556, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 925, 14791, 369, 13210, 382, 14711, 6075, 512, 755, 7139, 7800, 1214, 11, 16602, 5980, 997, 286, 4304, 5715, 264, 925, 14791, 369, 13210, 14781, 286, 1121, 284, 4260, 286, 3673, 284, 10839, 1214, 9812, 2455, 286, 369, 1401, 11, 907, 304, 3673, 512, 310, 1121, 2102, 3764, 2927, 7800, 40939, 1192, 286, 471, 721, 2994, 6115, 4556, 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 ]
pantsbuild/pants
src/python/pants/backend/project_info/tasks/export.py
ExportTask._exclude_id
def _exclude_id(jar): """Create a string identifier for the Exclude key. :param Exclude jar: key for an excluded jar :returns: String representing the key as a maven coordinate """ return '{0}:{1}'.format(jar.org, jar.name) if jar.name else jar.org
python
def _exclude_id(jar): """Create a string identifier for the Exclude key. :param Exclude jar: key for an excluded jar :returns: String representing the key as a maven coordinate """ return '{0}:{1}'.format(jar.org, jar.name) if jar.name else jar.org
[ "def", "_exclude_id", "(", "jar", ")", ":", "return", "'{0}:{1}'", ".", "format", "(", "jar", ".", "org", ",", "jar", ".", "name", ")", "if", "jar", ".", "name", "else", "jar", ".", "org" ]
Create a string identifier for the Exclude key. :param Exclude jar: key for an excluded jar :returns: String representing the key as a maven coordinate
[ "Create", "a", "string", "identifier", "for", "the", "Exclude", "key", ".", ":", "param", "Exclude", "jar", ":", "key", "for", "an", "excluded", "jar", ":", "returns", ":", "String", "representing", "the", "key", "as", "a", "maven", "coordinate" ]
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/project_info/tasks/export.py#L96-L101
<|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 string identifier for the Exclude key. :param Exclude jar: key for an excluded jar :returns: String representing the key as a maven coordinate ### Response: def _exclude_id(jar): """Create a string identifier for the Exclude key. :param Exclude jar: key for an excluded jar :returns: String representing the key as a maven coordinate """ return '{0}:{1}'.format(jar.org, jar.name) if jar.name else jar.org <|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, 925, 13110, 369, 279, 99577, 1401, 627, 262, 551, 913, 99577, 30695, 25, 1401, 369, 459, 28544, 30695, 198, 262, 551, 4310, 25, 935, 14393, 279, 1401, 439, 264, 296, 5389, 16580, 271, 14711, 6075, 512, 755, 721, 33513, 851, 3406, 277, 997, 262, 4304, 4110, 264, 925, 13110, 369, 279, 99577, 1401, 627, 262, 551, 913, 99577, 30695, 25, 1401, 369, 459, 28544, 30695, 198, 262, 551, 4310, 25, 935, 14393, 279, 1401, 439, 264, 296, 5389, 16580, 198, 262, 3270, 262, 471, 11834, 15, 59246, 16, 24398, 2293, 3406, 277, 2726, 11, 30695, 2710, 8, 422, 30695, 2710, 775, 30695, 2726, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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193, 304, 6498, 382, 14711, 5546, 512, 4110, 264, 925, 13110, 369, 279, 99577, 1401, 627, 262, 551, 913, 99577, 30695, 25, 1401, 369, 459, 28544, 30695, 198, 262, 551, 4310, 25, 935, 14393, 279, 1401, 439, 264, 296, 5389, 16580, 271, 14711, 6075, 512, 755, 721, 33513, 851, 3406, 277, 997, 262, 4304, 4110, 264, 925, 13110, 369, 279, 99577, 1401, 627, 262, 551, 913, 99577, 30695, 25, 1401, 369, 459, 28544, 30695, 198, 262, 551, 4310, 25, 935, 14393, 279, 1401, 439, 264, 296, 5389, 16580, 198, 262, 3270, 262, 471, 11834, 15, 59246, 16, 24398, 2293, 3406, 277, 2726, 11, 30695, 2710, 8, 422, 30695, 2710, 775, 30695, 2726, 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 ]
ZELLMECHANIK-DRESDEN/dclab
dclab/rtdc_dataset/fmt_hdf5.py
RTDC_HDF5.parse_config
def parse_config(h5path): """Parse the RT-DC configuration of an hdf5 file""" with h5py.File(h5path, mode="r") as fh5: h5attrs = dict(fh5.attrs) # Convert byte strings to unicode strings # https://github.com/h5py/h5py/issues/379 for key in h5attrs: if isinstance(h5attrs[key], bytes): h5attrs[key] = h5attrs[key].decode("utf-8") config = Configuration() for key in h5attrs: section, pname = key.split(":") if pname not in dfn.config_funcs[section]: # Add the value as a string but issue a warning config[section][pname] = h5attrs[key] msg = "Unknown key '{}' in section [{}]!".format( pname, section) warnings.warn(msg, UnknownKeyWarning) else: typ = dfn.config_funcs[section][pname] config[section][pname] = typ(h5attrs[key]) return config
python
def parse_config(h5path): """Parse the RT-DC configuration of an hdf5 file""" with h5py.File(h5path, mode="r") as fh5: h5attrs = dict(fh5.attrs) # Convert byte strings to unicode strings # https://github.com/h5py/h5py/issues/379 for key in h5attrs: if isinstance(h5attrs[key], bytes): h5attrs[key] = h5attrs[key].decode("utf-8") config = Configuration() for key in h5attrs: section, pname = key.split(":") if pname not in dfn.config_funcs[section]: # Add the value as a string but issue a warning config[section][pname] = h5attrs[key] msg = "Unknown key '{}' in section [{}]!".format( pname, section) warnings.warn(msg, UnknownKeyWarning) else: typ = dfn.config_funcs[section][pname] config[section][pname] = typ(h5attrs[key]) return config
[ "def", "parse_config", "(", "h5path", ")", ":", "with", "h5py", ".", "File", "(", "h5path", ",", "mode", "=", "\"r\"", ")", "as", "fh5", ":", "h5attrs", "=", "dict", "(", "fh5", ".", "attrs", ")", "# Convert byte strings to unicode strings", "# https://github.com/h5py/h5py/issues/379", "for", "key", "in", "h5attrs", ":", "if", "isinstance", "(", "h5attrs", "[", "key", "]", ",", "bytes", ")", ":", "h5attrs", "[", "key", "]", "=", "h5attrs", "[", "key", "]", ".", "decode", "(", "\"utf-8\"", ")", "config", "=", "Configuration", "(", ")", "for", "key", "in", "h5attrs", ":", "section", ",", "pname", "=", "key", ".", "split", "(", "\":\"", ")", "if", "pname", "not", "in", "dfn", ".", "config_funcs", "[", "section", "]", ":", "# Add the value as a string but issue a warning", "config", "[", "section", "]", "[", "pname", "]", "=", "h5attrs", "[", "key", "]", "msg", "=", "\"Unknown key '{}' in section [{}]!\"", ".", "format", "(", "pname", ",", "section", ")", "warnings", ".", "warn", "(", "msg", ",", "UnknownKeyWarning", ")", "else", ":", "typ", "=", "dfn", ".", "config_funcs", "[", "section", "]", "[", "pname", "]", "config", "[", "section", "]", "[", "pname", "]", "=", "typ", "(", "h5attrs", "[", "key", "]", ")", "return", "config" ]
Parse the RT-DC configuration of an hdf5 file
[ "Parse", "the", "RT", "-", "DC", "configuration", "of", "an", "hdf5", "file" ]
train
https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/79002c4356e7020c2ba73ab0a3819c9abd4affec/dclab/rtdc_dataset/fmt_hdf5.py#L144-L167
<|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 RT-DC configuration of an hdf5 file ### Response: def parse_config(h5path): """Parse the RT-DC configuration of an hdf5 file""" with h5py.File(h5path, mode="r") as fh5: h5attrs = dict(fh5.attrs) # Convert byte strings to unicode strings # https://github.com/h5py/h5py/issues/379 for key in h5attrs: if isinstance(h5attrs[key], bytes): h5attrs[key] = h5attrs[key].decode("utf-8") config = Configuration() for key in h5attrs: section, pname = key.split(":") if pname not in dfn.config_funcs[section]: # Add the value as a string but issue a warning config[section][pname] = h5attrs[key] msg = "Unknown key '{}' in section [{}]!".format( pname, section) warnings.warn(msg, UnknownKeyWarning) else: typ = dfn.config_funcs[section][pname] config[section][pname] = typ(h5attrs[key]) return 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, 14802, 279, 10860, 12, 5744, 6683, 315, 459, 98145, 20, 1052, 271, 14711, 6075, 512, 755, 4820, 5445, 3283, 20, 2398, 997, 286, 4304, 14802, 279, 10860, 12, 5744, 6683, 315, 459, 98145, 20, 1052, 7275, 286, 449, 305, 20, 3368, 8744, 3283, 20, 2398, 11, 3941, 429, 81, 909, 439, 37175, 20, 512, 310, 305, 20, 21101, 284, 6587, 90248, 20, 46596, 696, 286, 674, 7316, 5027, 9246, 311, 27169, 9246, 198, 286, 674, 3788, 1129, 5316, 916, 7682, 20, 3368, 7682, 20, 3368, 39845, 14, 19867, 198, 286, 369, 1401, 304, 305, 20, 21101, 512, 310, 422, 11656, 3283, 20, 21101, 8320, 1145, 5943, 997, 394, 305, 20, 21101, 8320, 60, 284, 305, 20, 21101, 8320, 948, 18696, 446, 4867, 12, 23, 5240, 286, 2242, 284, 12499, 746, 286, 369, 1401, 304, 305, 20, 21101, 512, 310, 3857, 11, 66046, 284, 1401, 5402, 19427, 1158, 310, 422, 66046, 539, 304, 6907, 77, 5539, 65224, 90497, 10556, 394, 674, 2758, 279, 907, 439, 264, 925, 719, 4360, 264, 10163, 198, 394, 2242, 90497, 1483, 83762, 60, 284, 305, 20, 21101, 8320, 933, 394, 3835, 284, 330, 14109, 1401, 70522, 304, 3857, 510, 79234, 94093, 2293, 1021, 504, 66046, 11, 3857, 340, 394, 19530, 22123, 8282, 11, 22435, 1622, 12358, 340, 310, 775, 512, 394, 3666, 284, 6907, 77, 5539, 65224, 90497, 1483, 83762, 933, 394, 2242, 90497, 1483, 83762, 60, 284, 3666, 3283, 20, 21101, 8320, 2608, 286, 471, 2242, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 14802, 279, 10860, 12, 5744, 6683, 315, 459, 98145, 20, 1052, 271, 14711, 6075, 512, 755, 4820, 5445, 3283, 20, 2398, 997, 286, 4304, 14802, 279, 10860, 12, 5744, 6683, 315, 459, 98145, 20, 1052, 7275, 286, 449, 305, 20, 3368, 8744, 3283, 20, 2398, 11, 3941, 429, 81, 909, 439, 37175, 20, 512, 310, 305, 20, 21101, 284, 6587, 90248, 20, 46596, 696, 286, 674, 7316, 5027, 9246, 311, 27169, 9246, 198, 286, 674, 3788, 1129, 5316, 916, 7682, 20, 3368, 7682, 20, 3368, 39845, 14, 19867, 198, 286, 369, 1401, 304, 305, 20, 21101, 512, 310, 422, 11656, 3283, 20, 21101, 8320, 1145, 5943, 997, 394, 305, 20, 21101, 8320, 60, 284, 305, 20, 21101, 8320, 948, 18696, 446, 4867, 12, 23, 5240, 286, 2242, 284, 12499, 746, 286, 369, 1401, 304, 305, 20, 21101, 512, 310, 3857, 11, 66046, 284, 1401, 5402, 19427, 1158, 310, 422, 66046, 539, 304, 6907, 77, 5539, 65224, 90497, 10556, 394, 674, 2758, 279, 907, 439, 264, 925, 719, 4360, 264, 10163, 198, 394, 2242, 90497, 1483, 83762, 60, 284, 305, 20, 21101, 8320, 933, 394, 3835, 284, 330, 14109, 1401, 70522, 304, 3857, 510, 79234, 94093, 2293, 1021, 504, 66046, 11, 3857, 340, 394, 19530, 22123, 8282, 11, 22435, 1622, 12358, 340, 310, 775, 512, 394, 3666, 284, 6907, 77, 5539, 65224, 90497, 1483, 83762, 933, 394, 2242, 90497, 1483, 83762, 60, 284, 3666, 3283, 20, 21101, 8320, 2608, 286, 471, 2242, 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 ]
joshua-stone/DerPyBooru
derpibooru/search.py
Search.watched
def watched(self, option): """ Set whether to filter by a user's watchlist. Options available are user.ONLY, user.NOT, and None; default is None. """ params = join_params(self.parameters, {"watched": option}) return self.__class__(**params)
python
def watched(self, option): """ Set whether to filter by a user's watchlist. Options available are user.ONLY, user.NOT, and None; default is None. """ params = join_params(self.parameters, {"watched": option}) return self.__class__(**params)
[ "def", "watched", "(", "self", ",", "option", ")", ":", "params", "=", "join_params", "(", "self", ".", "parameters", ",", "{", "\"watched\"", ":", "option", "}", ")", "return", "self", ".", "__class__", "(", "*", "*", "params", ")" ]
Set whether to filter by a user's watchlist. Options available are user.ONLY, user.NOT, and None; default is None.
[ "Set", "whether", "to", "filter", "by", "a", "user", "s", "watchlist", ".", "Options", "available", "are", "user", ".", "ONLY", "user", ".", "NOT", "and", "None", ";", "default", "is", "None", "." ]
train
https://github.com/joshua-stone/DerPyBooru/blob/75aec19488042ba89115ff002b4d696ad87fb03f/derpibooru/search.py#L183-L190
<|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: Set whether to filter by a user's watchlist. Options available are user.ONLY, user.NOT, and None; default is None. ### Response: def watched(self, option): """ Set whether to filter by a user's watchlist. Options available are user.ONLY, user.NOT, and None; default is None. """ params = join_params(self.parameters, {"watched": option}) return self.__class__(**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, 1681, 3508, 311, 4141, 555, 264, 1217, 596, 3821, 1638, 13, 14908, 2561, 527, 198, 262, 1217, 13, 32192, 11, 1217, 41520, 11, 323, 2290, 26, 1670, 374, 2290, 382, 14711, 6075, 512, 755, 15746, 1214, 11, 3072, 997, 262, 3270, 262, 2638, 3508, 311, 4141, 555, 264, 1217, 596, 3821, 1638, 13, 14908, 2561, 527, 198, 262, 1217, 13, 32192, 11, 1217, 41520, 11, 323, 2290, 26, 1670, 374, 2290, 627, 262, 3270, 262, 3712, 284, 5249, 6887, 1214, 28427, 11, 5324, 14658, 291, 794, 3072, 9000, 262, 471, 659, 4952, 1058, 3889, 334, 3603, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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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, 1681, 3508, 311, 4141, 555, 264, 1217, 596, 3821, 1638, 13, 14908, 2561, 527, 198, 262, 1217, 13, 32192, 11, 1217, 41520, 11, 323, 2290, 26, 1670, 374, 2290, 382, 14711, 6075, 512, 755, 15746, 1214, 11, 3072, 997, 262, 3270, 262, 2638, 3508, 311, 4141, 555, 264, 1217, 596, 3821, 1638, 13, 14908, 2561, 527, 198, 262, 1217, 13, 32192, 11, 1217, 41520, 11, 323, 2290, 26, 1670, 374, 2290, 627, 262, 3270, 262, 3712, 284, 5249, 6887, 1214, 28427, 11, 5324, 14658, 291, 794, 3072, 9000, 262, 471, 659, 4952, 1058, 3889, 334, 3603, 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 ]
brutus/wdiffhtml
wdiffhtml/__init__.py
wdiff
def wdiff( settings, wrap_with_html=False, fold_breaks=False, hard_breaks=False ): """ Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<ins>` and `<del>` tags are allowed to span line breaks If *hard_breaks* is set, line breaks are replaced with `<br />` tags. """ diff = generate_wdiff(settings.org_file, settings.new_file, fold_breaks) if wrap_with_html: return wrap_content(diff, settings, hard_breaks) else: return diff
python
def wdiff( settings, wrap_with_html=False, fold_breaks=False, hard_breaks=False ): """ Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<ins>` and `<del>` tags are allowed to span line breaks If *hard_breaks* is set, line breaks are replaced with `<br />` tags. """ diff = generate_wdiff(settings.org_file, settings.new_file, fold_breaks) if wrap_with_html: return wrap_content(diff, settings, hard_breaks) else: return diff
[ "def", "wdiff", "(", "settings", ",", "wrap_with_html", "=", "False", ",", "fold_breaks", "=", "False", ",", "hard_breaks", "=", "False", ")", ":", "diff", "=", "generate_wdiff", "(", "settings", ".", "org_file", ",", "settings", ".", "new_file", ",", "fold_breaks", ")", "if", "wrap_with_html", ":", "return", "wrap_content", "(", "diff", ",", "settings", ",", "hard_breaks", ")", "else", ":", "return", "diff" ]
Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<ins>` and `<del>` tags are allowed to span line breaks If *hard_breaks* is set, line breaks are replaced with `<br />` tags.
[ "Returns", "the", "results", "of", "wdiff", "in", "a", "HTML", "compatible", "format", "." ]
train
https://github.com/brutus/wdiffhtml/blob/e97b524a7945f7a626e33ec141343120c524d9fa/wdiffhtml/__init__.py#L62-L83
<|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 the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<ins>` and `<del>` tags are allowed to span line breaks If *hard_breaks* is set, line breaks are replaced with `<br />` tags. ### Response: def wdiff( settings, wrap_with_html=False, fold_breaks=False, hard_breaks=False ): """ Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<ins>` and `<del>` tags are allowed to span line breaks If *hard_breaks* is set, line breaks are replaced with `<br />` tags. """ diff = generate_wdiff(settings.org_file, settings.new_file, fold_breaks) if wrap_with_html: return wrap_content(diff, settings, hard_breaks) else: return diff <|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, 279, 3135, 315, 1595, 6511, 3168, 63, 304, 264, 9492, 18641, 3645, 382, 220, 44240, 264, 551, 18565, 19258, 6648, 28098, 63, 1665, 382, 220, 1442, 353, 10305, 6753, 9759, 9, 374, 743, 11, 279, 353, 13798, 9, 374, 6052, 304, 264, 2539, 9492, 2246, 198, 220, 6070, 382, 220, 1442, 353, 20557, 40594, 82, 9, 374, 743, 11, 31686, 1354, 44726, 323, 31686, 9783, 44726, 9681, 527, 5535, 311, 9575, 1584, 198, 220, 18808, 271, 220, 1442, 353, 19221, 40594, 82, 9, 374, 743, 11, 1584, 18808, 527, 12860, 449, 31686, 1347, 6338, 63, 9681, 382, 14711, 6075, 512, 755, 289, 13798, 1021, 220, 5110, 11, 15411, 6753, 9759, 5725, 11, 11816, 40594, 82, 5725, 11, 2653, 40594, 82, 5725, 198, 997, 220, 3270, 220, 5295, 279, 3135, 315, 1595, 6511, 3168, 63, 304, 264, 9492, 18641, 3645, 382, 220, 44240, 264, 551, 18565, 19258, 6648, 28098, 63, 1665, 382, 220, 1442, 353, 10305, 6753, 9759, 9, 374, 743, 11, 279, 353, 13798, 9, 374, 6052, 304, 264, 2539, 9492, 2246, 198, 220, 6070, 382, 220, 1442, 353, 20557, 40594, 82, 9, 374, 743, 11, 31686, 1354, 44726, 323, 31686, 9783, 44726, 9681, 527, 5535, 311, 9575, 1584, 198, 220, 18808, 271, 220, 1442, 353, 19221, 40594, 82, 9, 374, 743, 11, 1584, 18808, 527, 12860, 449, 31686, 1347, 6338, 63, 9681, 382, 220, 3270, 220, 3722, 284, 7068, 1704, 13798, 24258, 2726, 2517, 11, 5110, 4721, 2517, 11, 11816, 40594, 82, 340, 220, 422, 15411, 6753, 9759, 512, 262, 471, 15411, 7647, 38224, 11, 5110, 11, 2653, 40594, 82, 340, 220, 775, 512, 262, 471, 3722, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 279, 3135, 315, 1595, 6511, 3168, 63, 304, 264, 9492, 18641, 3645, 382, 220, 44240, 264, 551, 18565, 19258, 6648, 28098, 63, 1665, 382, 220, 1442, 353, 10305, 6753, 9759, 9, 374, 743, 11, 279, 353, 13798, 9, 374, 6052, 304, 264, 2539, 9492, 2246, 198, 220, 6070, 382, 220, 1442, 353, 20557, 40594, 82, 9, 374, 743, 11, 31686, 1354, 44726, 323, 31686, 9783, 44726, 9681, 527, 5535, 311, 9575, 1584, 198, 220, 18808, 271, 220, 1442, 353, 19221, 40594, 82, 9, 374, 743, 11, 1584, 18808, 527, 12860, 449, 31686, 1347, 6338, 63, 9681, 382, 14711, 6075, 512, 755, 289, 13798, 1021, 220, 5110, 11, 15411, 6753, 9759, 5725, 11, 11816, 40594, 82, 5725, 11, 2653, 40594, 82, 5725, 198, 997, 220, 3270, 220, 5295, 279, 3135, 315, 1595, 6511, 3168, 63, 304, 264, 9492, 18641, 3645, 382, 220, 44240, 264, 551, 18565, 19258, 6648, 28098, 63, 1665, 382, 220, 1442, 353, 10305, 6753, 9759, 9, 374, 743, 11, 279, 353, 13798, 9, 374, 6052, 304, 264, 2539, 9492, 2246, 198, 220, 6070, 382, 220, 1442, 353, 20557, 40594, 82, 9, 374, 743, 11, 31686, 1354, 44726, 323, 31686, 9783, 44726, 9681, 527, 5535, 311, 9575, 1584, 198, 220, 18808, 271, 220, 1442, 353, 19221, 40594, 82, 9, 374, 743, 11, 1584, 18808, 527, 12860, 449, 31686, 1347, 6338, 63, 9681, 382, 220, 3270, 220, 3722, 284, 7068, 1704, 13798, 24258, 2726, 2517, 11, 5110, 4721, 2517, 11, 11816, 40594, 82, 340, 220, 422, 15411, 6753, 9759, 512, 262, 471, 15411, 7647, 38224, 11, 5110, 11, 2653, 40594, 82, 340, 220, 775, 512, 262, 471, 3722, 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 ]
ngmarchant/oasis
oasis/input_verification.py
verify_identifiers
def verify_identifiers(identifiers, n_items): """Ensure that identifiers has a compatible length and that its elements are unique""" if identifiers is None: return identifiers identifiers = np.array(identifiers, copy=False) # Check length for consistency if len(identifiers) != n_items: raise ValueError("identifiers has inconsistent dimension.") # Check that identifiers are unique if len(np.unique(identifiers)) != n_items: raise ValueError("identifiers contains duplicate values.") return identifiers
python
def verify_identifiers(identifiers, n_items): """Ensure that identifiers has a compatible length and that its elements are unique""" if identifiers is None: return identifiers identifiers = np.array(identifiers, copy=False) # Check length for consistency if len(identifiers) != n_items: raise ValueError("identifiers has inconsistent dimension.") # Check that identifiers are unique if len(np.unique(identifiers)) != n_items: raise ValueError("identifiers contains duplicate values.") return identifiers
[ "def", "verify_identifiers", "(", "identifiers", ",", "n_items", ")", ":", "if", "identifiers", "is", "None", ":", "return", "identifiers", "identifiers", "=", "np", ".", "array", "(", "identifiers", ",", "copy", "=", "False", ")", "# Check length for consistency", "if", "len", "(", "identifiers", ")", "!=", "n_items", ":", "raise", "ValueError", "(", "\"identifiers has inconsistent dimension.\"", ")", "# Check that identifiers are unique", "if", "len", "(", "np", ".", "unique", "(", "identifiers", ")", ")", "!=", "n_items", ":", "raise", "ValueError", "(", "\"identifiers contains duplicate values.\"", ")", "return", "identifiers" ]
Ensure that identifiers has a compatible length and that its elements are unique
[ "Ensure", "that", "identifiers", "has", "a", "compatible", "length", "and", "that", "its", "elements", "are", "unique" ]
train
https://github.com/ngmarchant/oasis/blob/28a037a8924b85ae97db8a93960a910a219d6a4a/oasis/input_verification.py#L91-L107
<|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 that identifiers has a compatible length and that its elements are unique ### Response: def verify_identifiers(identifiers, n_items): """Ensure that identifiers has a compatible length and that its elements are unique""" if identifiers is None: return identifiers identifiers = np.array(identifiers, copy=False) # Check length for consistency if len(identifiers) != n_items: raise ValueError("identifiers has inconsistent dimension.") # Check that identifiers are unique if len(np.unique(identifiers)) != n_items: raise ValueError("identifiers contains duplicate values.") return identifiers <|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, 430, 48316, 706, 264, 18641, 3160, 323, 430, 1202, 5540, 198, 262, 527, 5016, 271, 14711, 6075, 512, 755, 10356, 39499, 12099, 96370, 12099, 11, 308, 12408, 997, 262, 4304, 65539, 430, 48316, 706, 264, 18641, 3160, 323, 430, 1202, 5540, 198, 262, 527, 5016, 7275, 262, 422, 48316, 374, 2290, 512, 286, 471, 48316, 271, 262, 48316, 284, 2660, 7382, 96370, 12099, 11, 3048, 5725, 696, 262, 674, 4343, 3160, 369, 29237, 198, 262, 422, 2479, 96370, 12099, 8, 976, 308, 12408, 512, 286, 4933, 15764, 446, 1748, 12099, 706, 40240, 13167, 32325, 262, 674, 4343, 430, 48316, 527, 5016, 198, 262, 422, 2479, 10101, 36618, 96370, 12099, 595, 976, 308, 12408, 512, 286, 4933, 15764, 446, 1748, 12099, 5727, 23329, 2819, 32325, 262, 471, 48316, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 65539, 430, 48316, 706, 264, 18641, 3160, 323, 430, 1202, 5540, 198, 262, 527, 5016, 271, 14711, 6075, 512, 755, 10356, 39499, 12099, 96370, 12099, 11, 308, 12408, 997, 262, 4304, 65539, 430, 48316, 706, 264, 18641, 3160, 323, 430, 1202, 5540, 198, 262, 527, 5016, 7275, 262, 422, 48316, 374, 2290, 512, 286, 471, 48316, 271, 262, 48316, 284, 2660, 7382, 96370, 12099, 11, 3048, 5725, 696, 262, 674, 4343, 3160, 369, 29237, 198, 262, 422, 2479, 96370, 12099, 8, 976, 308, 12408, 512, 286, 4933, 15764, 446, 1748, 12099, 706, 40240, 13167, 32325, 262, 674, 4343, 430, 48316, 527, 5016, 198, 262, 422, 2479, 10101, 36618, 96370, 12099, 595, 976, 308, 12408, 512, 286, 4933, 15764, 446, 1748, 12099, 5727, 23329, 2819, 32325, 262, 471, 48316, 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 ]
zetaops/zengine
zengine/messaging/views.py
search_unit
def search_unit(current): """ Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { 'results': [('name', 'key'), ], 'status': 'OK', 'code': 200 } """ current.output = { 'results': [], 'status': 'OK', 'code': 201 } for user in UnitModel(current).objects.search_on(*settings.MESSAGING_UNIT_SEARCH_FIELDS, contains=current.input['query']): current.output['results'].append((user.name, user.key))
python
def search_unit(current): """ Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { 'results': [('name', 'key'), ], 'status': 'OK', 'code': 200 } """ current.output = { 'results': [], 'status': 'OK', 'code': 201 } for user in UnitModel(current).objects.search_on(*settings.MESSAGING_UNIT_SEARCH_FIELDS, contains=current.input['query']): current.output['results'].append((user.name, user.key))
[ "def", "search_unit", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'results'", ":", "[", "]", ",", "'status'", ":", "'OK'", ",", "'code'", ":", "201", "}", "for", "user", "in", "UnitModel", "(", "current", ")", ".", "objects", ".", "search_on", "(", "*", "settings", ".", "MESSAGING_UNIT_SEARCH_FIELDS", ",", "contains", "=", "current", ".", "input", "[", "'query'", "]", ")", ":", "current", ".", "output", "[", "'results'", "]", ".", "append", "(", "(", "user", ".", "name", ",", "user", ".", "key", ")", ")" ]
Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { 'results': [('name', 'key'), ], 'status': 'OK', 'code': 200 }
[ "Search", "on", "units", "for", "subscribing", "it", "s", "users", "to", "a", "channel" ]
train
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L566-L592
<|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: Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { 'results': [('name', 'key'), ], 'status': 'OK', 'code': 200 } ### Response: def search_unit(current): """ Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { 'results': [('name', 'key'), ], 'status': 'OK', 'code': 200 } """ current.output = { 'results': [], 'status': 'OK', 'code': 201 } for user in UnitModel(current).objects.search_on(*settings.MESSAGING_UNIT_SEARCH_FIELDS, contains=current.input['query']): current.output['results'].append((user.name, user.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, 6014, 389, 8316, 369, 40885, 433, 596, 3932, 311, 264, 5613, 271, 286, 5354, 2082, 9612, 487, 10344, 271, 310, 674, 220, 1715, 512, 394, 341, 394, 364, 1068, 10192, 62, 89, 3806, 10947, 15176, 756, 394, 364, 1663, 1232, 925, 345, 394, 557, 310, 674, 220, 2077, 512, 394, 341, 394, 364, 8234, 1232, 52228, 609, 518, 364, 798, 4670, 3291, 394, 364, 2899, 1232, 364, 4012, 756, 394, 364, 1889, 1232, 220, 1049, 198, 394, 557, 14711, 6075, 512, 755, 2778, 15176, 8937, 997, 262, 3270, 286, 7694, 389, 8316, 369, 40885, 433, 596, 3932, 311, 264, 5613, 271, 286, 5354, 2082, 9612, 487, 10344, 271, 310, 674, 220, 1715, 512, 394, 341, 394, 364, 1068, 10192, 62, 89, 3806, 10947, 15176, 756, 394, 364, 1663, 1232, 925, 345, 394, 557, 310, 674, 220, 2077, 512, 394, 341, 394, 364, 8234, 1232, 52228, 609, 518, 364, 798, 4670, 3291, 394, 364, 2899, 1232, 364, 4012, 756, 394, 364, 1889, 1232, 220, 1049, 198, 394, 457, 262, 3270, 262, 1510, 13718, 284, 341, 286, 364, 8234, 1232, 10450, 286, 364, 2899, 1232, 364, 4012, 756, 286, 364, 1889, 1232, 220, 679, 198, 262, 457, 262, 369, 1217, 304, 8113, 1747, 8937, 570, 19761, 9472, 4570, 4163, 6648, 1345, 10201, 80706, 32818, 34808, 54099, 345, 25343, 5727, 73023, 10252, 681, 1663, 55802, 286, 1510, 13718, 681, 8234, 7352, 5200, 1209, 882, 2710, 11, 1217, 4840, 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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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 ]
[ 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, 6014, 389, 8316, 369, 40885, 433, 596, 3932, 311, 264, 5613, 271, 286, 5354, 2082, 9612, 487, 10344, 271, 310, 674, 220, 1715, 512, 394, 341, 394, 364, 1068, 10192, 62, 89, 3806, 10947, 15176, 756, 394, 364, 1663, 1232, 925, 345, 394, 557, 310, 674, 220, 2077, 512, 394, 341, 394, 364, 8234, 1232, 52228, 609, 518, 364, 798, 4670, 3291, 394, 364, 2899, 1232, 364, 4012, 756, 394, 364, 1889, 1232, 220, 1049, 198, 394, 557, 14711, 6075, 512, 755, 2778, 15176, 8937, 997, 262, 3270, 286, 7694, 389, 8316, 369, 40885, 433, 596, 3932, 311, 264, 5613, 271, 286, 5354, 2082, 9612, 487, 10344, 271, 310, 674, 220, 1715, 512, 394, 341, 394, 364, 1068, 10192, 62, 89, 3806, 10947, 15176, 756, 394, 364, 1663, 1232, 925, 345, 394, 557, 310, 674, 220, 2077, 512, 394, 341, 394, 364, 8234, 1232, 52228, 609, 518, 364, 798, 4670, 3291, 394, 364, 2899, 1232, 364, 4012, 756, 394, 364, 1889, 1232, 220, 1049, 198, 394, 457, 262, 3270, 262, 1510, 13718, 284, 341, 286, 364, 8234, 1232, 10450, 286, 364, 2899, 1232, 364, 4012, 756, 286, 364, 1889, 1232, 220, 679, 198, 262, 457, 262, 369, 1217, 304, 8113, 1747, 8937, 570, 19761, 9472, 4570, 4163, 6648, 1345, 10201, 80706, 32818, 34808, 54099, 345, 25343, 5727, 73023, 10252, 681, 1663, 55802, 286, 1510, 13718, 681, 8234, 7352, 5200, 1209, 882, 2710, 11, 1217, 4840, 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 ]
python-odin/odinweb
odinweb/containers.py
ApiContainer.operation
def operation(self, path, methods=Method.GET, resource=None, tags=None, summary=None, middleware=None): # type: (UrlPath, Union[Method, Tuple[Method]], Type[Resource], Tags, str, list) -> Operation """ :param path: A sub path that can be used as a action. :param methods: HTTP method(s) this function responses to. :param resource: Specify the resource that this function encodes/decodes, default is the one specified on the ResourceAPI instance. :param tags: Tags to be applied to operation :param summary: Summary of the what method does (for documentation) :param middleware: List of additional middleware """ def inner(callback): operation = Operation(callback, path, methods, resource, tags, summary, middleware) self.containers.append(operation) return operation return inner
python
def operation(self, path, methods=Method.GET, resource=None, tags=None, summary=None, middleware=None): # type: (UrlPath, Union[Method, Tuple[Method]], Type[Resource], Tags, str, list) -> Operation """ :param path: A sub path that can be used as a action. :param methods: HTTP method(s) this function responses to. :param resource: Specify the resource that this function encodes/decodes, default is the one specified on the ResourceAPI instance. :param tags: Tags to be applied to operation :param summary: Summary of the what method does (for documentation) :param middleware: List of additional middleware """ def inner(callback): operation = Operation(callback, path, methods, resource, tags, summary, middleware) self.containers.append(operation) return operation return inner
[ "def", "operation", "(", "self", ",", "path", ",", "methods", "=", "Method", ".", "GET", ",", "resource", "=", "None", ",", "tags", "=", "None", ",", "summary", "=", "None", ",", "middleware", "=", "None", ")", ":", "# type: (UrlPath, Union[Method, Tuple[Method]], Type[Resource], Tags, str, list) -> Operation", "def", "inner", "(", "callback", ")", ":", "operation", "=", "Operation", "(", "callback", ",", "path", ",", "methods", ",", "resource", ",", "tags", ",", "summary", ",", "middleware", ")", "self", ".", "containers", ".", "append", "(", "operation", ")", "return", "operation", "return", "inner" ]
:param path: A sub path that can be used as a action. :param methods: HTTP method(s) this function responses to. :param resource: Specify the resource that this function encodes/decodes, default is the one specified on the ResourceAPI instance. :param tags: Tags to be applied to operation :param summary: Summary of the what method does (for documentation) :param middleware: List of additional middleware
[ ":", "param", "path", ":", "A", "sub", "path", "that", "can", "be", "used", "as", "a", "action", ".", ":", "param", "methods", ":", "HTTP", "method", "(", "s", ")", "this", "function", "responses", "to", ".", ":", "param", "resource", ":", "Specify", "the", "resource", "that", "this", "function", "encodes", "/", "decodes", "default", "is", "the", "one", "specified", "on", "the", "ResourceAPI", "instance", ".", ":", "param", "tags", ":", "Tags", "to", "be", "applied", "to", "operation", ":", "param", "summary", ":", "Summary", "of", "the", "what", "method", "does", "(", "for", "documentation", ")", ":", "param", "middleware", ":", "List", "of", "additional", "middleware" ]
train
https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L175-L191
<|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: :param path: A sub path that can be used as a action. :param methods: HTTP method(s) this function responses to. :param resource: Specify the resource that this function encodes/decodes, default is the one specified on the ResourceAPI instance. :param tags: Tags to be applied to operation :param summary: Summary of the what method does (for documentation) :param middleware: List of additional middleware ### Response: def operation(self, path, methods=Method.GET, resource=None, tags=None, summary=None, middleware=None): # type: (UrlPath, Union[Method, Tuple[Method]], Type[Resource], Tags, str, list) -> Operation """ :param path: A sub path that can be used as a action. :param methods: HTTP method(s) this function responses to. :param resource: Specify the resource that this function encodes/decodes, default is the one specified on the ResourceAPI instance. :param tags: Tags to be applied to operation :param summary: Summary of the what method does (for documentation) :param middleware: List of additional middleware """ def inner(callback): operation = Operation(callback, path, methods, resource, tags, summary, middleware) self.containers.append(operation) return operation return inner <|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, 68416, 1853, 25, 362, 1207, 1853, 430, 649, 387, 1511, 439, 264, 1957, 627, 286, 551, 913, 5528, 25, 10339, 1749, 1161, 8, 420, 734, 14847, 311, 627, 286, 551, 913, 5211, 25, 48495, 279, 5211, 430, 420, 734, 3289, 2601, 14, 8332, 2601, 345, 310, 1670, 374, 279, 832, 5300, 389, 279, 12027, 7227, 2937, 627, 286, 551, 913, 9681, 25, 28783, 311, 387, 9435, 311, 5784, 198, 286, 551, 913, 12399, 25, 22241, 315, 279, 1148, 1749, 1587, 320, 2000, 9904, 340, 286, 551, 913, 30779, 25, 1796, 315, 5217, 30779, 271, 14711, 6075, 512, 755, 5784, 1214, 11, 1853, 11, 5528, 28, 3607, 17866, 11, 5211, 5980, 11, 9681, 5980, 11, 12399, 5980, 11, 30779, 5980, 997, 286, 674, 955, 25, 320, 2934, 1858, 11, 9323, 58, 3607, 11, 25645, 58, 3607, 21128, 4078, 58, 4888, 1145, 28783, 11, 610, 11, 1160, 8, 1492, 17145, 198, 286, 3270, 286, 551, 913, 1853, 25, 362, 1207, 1853, 430, 649, 387, 1511, 439, 264, 1957, 627, 286, 551, 913, 5528, 25, 10339, 1749, 1161, 8, 420, 734, 14847, 311, 627, 286, 551, 913, 5211, 25, 48495, 279, 5211, 430, 420, 734, 3289, 2601, 14, 8332, 2601, 345, 310, 1670, 374, 279, 832, 5300, 389, 279, 12027, 7227, 2937, 627, 286, 551, 913, 9681, 25, 28783, 311, 387, 9435, 311, 5784, 198, 286, 551, 913, 12399, 25, 22241, 315, 279, 1148, 1749, 1587, 320, 2000, 9904, 340, 286, 551, 913, 30779, 25, 1796, 315, 5217, 30779, 271, 286, 3270, 286, 711, 9358, 24885, 997, 310, 5784, 284, 17145, 24885, 11, 1853, 11, 5528, 11, 5211, 11, 9681, 11, 12399, 11, 30779, 340, 310, 659, 5458, 21211, 2102, 53447, 340, 310, 471, 5784, 198, 286, 471, 9358, 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 ]
[ 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, 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, 68416, 1853, 25, 362, 1207, 1853, 430, 649, 387, 1511, 439, 264, 1957, 627, 286, 551, 913, 5528, 25, 10339, 1749, 1161, 8, 420, 734, 14847, 311, 627, 286, 551, 913, 5211, 25, 48495, 279, 5211, 430, 420, 734, 3289, 2601, 14, 8332, 2601, 345, 310, 1670, 374, 279, 832, 5300, 389, 279, 12027, 7227, 2937, 627, 286, 551, 913, 9681, 25, 28783, 311, 387, 9435, 311, 5784, 198, 286, 551, 913, 12399, 25, 22241, 315, 279, 1148, 1749, 1587, 320, 2000, 9904, 340, 286, 551, 913, 30779, 25, 1796, 315, 5217, 30779, 271, 14711, 6075, 512, 755, 5784, 1214, 11, 1853, 11, 5528, 28, 3607, 17866, 11, 5211, 5980, 11, 9681, 5980, 11, 12399, 5980, 11, 30779, 5980, 997, 286, 674, 955, 25, 320, 2934, 1858, 11, 9323, 58, 3607, 11, 25645, 58, 3607, 21128, 4078, 58, 4888, 1145, 28783, 11, 610, 11, 1160, 8, 1492, 17145, 198, 286, 3270, 286, 551, 913, 1853, 25, 362, 1207, 1853, 430, 649, 387, 1511, 439, 264, 1957, 627, 286, 551, 913, 5528, 25, 10339, 1749, 1161, 8, 420, 734, 14847, 311, 627, 286, 551, 913, 5211, 25, 48495, 279, 5211, 430, 420, 734, 3289, 2601, 14, 8332, 2601, 345, 310, 1670, 374, 279, 832, 5300, 389, 279, 12027, 7227, 2937, 627, 286, 551, 913, 9681, 25, 28783, 311, 387, 9435, 311, 5784, 198, 286, 551, 913, 12399, 25, 22241, 315, 279, 1148, 1749, 1587, 320, 2000, 9904, 340, 286, 551, 913, 30779, 25, 1796, 315, 5217, 30779, 271, 286, 3270, 286, 711, 9358, 24885, 997, 310, 5784, 284, 17145, 24885, 11, 1853, 11, 5528, 11, 5211, 11, 9681, 11, 12399, 11, 30779, 340, 310, 659, 5458, 21211, 2102, 53447, 340, 310, 471, 5784, 198, 286, 471, 9358, 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 ]
google/grr
grr/server/grr_response_server/export.py
ArtifactFilesDownloaderResultConverter.GetExportedResult
def GetExportedResult(self, original_result, converter, metadata=None, token=None): """Converts original result via given converter..""" exported_results = list( converter.Convert( metadata or ExportedMetadata(), original_result, token=token)) if not exported_results: raise ExportError("Got 0 exported result when a single one " "was expected.") if len(exported_results) > 1: raise ExportError("Got > 1 exported results when a single " "one was expected, seems like a logical bug.") return exported_results[0]
python
def GetExportedResult(self, original_result, converter, metadata=None, token=None): """Converts original result via given converter..""" exported_results = list( converter.Convert( metadata or ExportedMetadata(), original_result, token=token)) if not exported_results: raise ExportError("Got 0 exported result when a single one " "was expected.") if len(exported_results) > 1: raise ExportError("Got > 1 exported results when a single " "one was expected, seems like a logical bug.") return exported_results[0]
[ "def", "GetExportedResult", "(", "self", ",", "original_result", ",", "converter", ",", "metadata", "=", "None", ",", "token", "=", "None", ")", ":", "exported_results", "=", "list", "(", "converter", ".", "Convert", "(", "metadata", "or", "ExportedMetadata", "(", ")", ",", "original_result", ",", "token", "=", "token", ")", ")", "if", "not", "exported_results", ":", "raise", "ExportError", "(", "\"Got 0 exported result when a single one \"", "\"was expected.\"", ")", "if", "len", "(", "exported_results", ")", ">", "1", ":", "raise", "ExportError", "(", "\"Got > 1 exported results when a single \"", "\"one was expected, seems like a logical bug.\"", ")", "return", "exported_results", "[", "0", "]" ]
Converts original result via given converter..
[ "Converts", "original", "result", "via", "given", "converter", ".." ]
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L1366-L1385
<|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: Converts original result via given converter.. ### Response: def GetExportedResult(self, original_result, converter, metadata=None, token=None): """Converts original result via given converter..""" exported_results = list( converter.Convert( metadata or ExportedMetadata(), original_result, token=token)) if not exported_results: raise ExportError("Got 0 exported result when a single one " "was expected.") if len(exported_results) > 1: raise ExportError("Got > 1 exported results when a single " "one was expected, seems like a logical bug.") return exported_results[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, 12281, 82, 4113, 1121, 4669, 2728, 28157, 15882, 14711, 6075, 512, 755, 2175, 17321, 291, 2122, 1214, 345, 667, 4113, 5400, 345, 667, 28157, 345, 667, 11408, 5980, 345, 667, 4037, 5980, 997, 262, 4304, 12281, 82, 4113, 1121, 4669, 2728, 28157, 497, 15425, 262, 35990, 13888, 284, 1160, 1021, 286, 28157, 37279, 1021, 310, 11408, 477, 22981, 291, 14952, 1535, 4113, 5400, 11, 4037, 28, 5963, 4489, 262, 422, 539, 35990, 13888, 512, 415, 4933, 22981, 1480, 446, 33562, 220, 15, 35990, 1121, 994, 264, 3254, 832, 6360, 667, 330, 16514, 3685, 32325, 262, 422, 2479, 7, 1562, 291, 13888, 8, 871, 220, 16, 512, 415, 4933, 22981, 1480, 446, 33562, 871, 220, 16, 35990, 3135, 994, 264, 3254, 6360, 667, 330, 606, 574, 3685, 11, 5084, 1093, 264, 20406, 10077, 32325, 262, 471, 35990, 13888, 58, 15, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 82, 4113, 1121, 4669, 2728, 28157, 15882, 14711, 6075, 512, 755, 2175, 17321, 291, 2122, 1214, 345, 667, 4113, 5400, 345, 667, 28157, 345, 667, 11408, 5980, 345, 667, 4037, 5980, 997, 262, 4304, 12281, 82, 4113, 1121, 4669, 2728, 28157, 497, 15425, 262, 35990, 13888, 284, 1160, 1021, 286, 28157, 37279, 1021, 310, 11408, 477, 22981, 291, 14952, 1535, 4113, 5400, 11, 4037, 28, 5963, 4489, 262, 422, 539, 35990, 13888, 512, 415, 4933, 22981, 1480, 446, 33562, 220, 15, 35990, 1121, 994, 264, 3254, 832, 6360, 667, 330, 16514, 3685, 32325, 262, 422, 2479, 7, 1562, 291, 13888, 8, 871, 220, 16, 512, 415, 4933, 22981, 1480, 446, 33562, 871, 220, 16, 35990, 3135, 994, 264, 3254, 6360, 667, 330, 606, 574, 3685, 11, 5084, 1093, 264, 20406, 10077, 32325, 262, 471, 35990, 13888, 58, 15, 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, 128009, 128009, 128009 ]
merll/docker-fabric
dockerfabric/cli.py
copy_resources
def copy_resources(src_container, src_resources, storage_dir, dst_directories=None, apply_chown=None, apply_chmod=None): """ Copies files and directories from a Docker container. Multiple resources can be copied and additional options are available than in :func:`copy_resource`. Unlike in :func:`copy_resource`, Resources are copied as they are and not compressed to a tarball, and they are left on the remote machine. :param src_container: Container name or id. :type src_container: unicode :param src_resources: Resources, as (file or directory) names to copy. :type src_resources: iterable :param storage_dir: Remote directory to store the copied objects in. :type storage_dir: unicode :param dst_directories: Optional dictionary of destination directories, in the format ``resource: destination``. If not set, resources will be in the same relative structure to one another as inside the container. For setting a common default, use ``*`` as the resource key. :type dst_directories: dict :param apply_chown: Owner to set for the copied resources. Can be a user name or id, group name or id, both in the notation ``user:group``, or as a tuple ``(user, group)``. :type apply_chown: unicode or tuple :param apply_chmod: File system permissions to set for the copied resources. Can be any notation as accepted by `chmod`. :type apply_chmod: unicode """ def _copy_resource(resource): default_dest_path = generic_path if generic_path is not None else resource dest_path = directories.get(resource, default_dest_path).strip(posixpath.sep) head, tail = posixpath.split(dest_path) rel_path = posixpath.join(storage_dir, head) run(mkdir(rel_path, check_if_exists=True)) run('docker cp {0}:{1} {2}'.format(src_container, resource, rel_path), shell=False) directories = dst_directories or {} generic_path = directories.get('*') for res in src_resources: _copy_resource(res) if apply_chmod: run(chmod(apply_chmod, storage_dir)) if apply_chown: sudo(chown(apply_chown, storage_dir))
python
def copy_resources(src_container, src_resources, storage_dir, dst_directories=None, apply_chown=None, apply_chmod=None): """ Copies files and directories from a Docker container. Multiple resources can be copied and additional options are available than in :func:`copy_resource`. Unlike in :func:`copy_resource`, Resources are copied as they are and not compressed to a tarball, and they are left on the remote machine. :param src_container: Container name or id. :type src_container: unicode :param src_resources: Resources, as (file or directory) names to copy. :type src_resources: iterable :param storage_dir: Remote directory to store the copied objects in. :type storage_dir: unicode :param dst_directories: Optional dictionary of destination directories, in the format ``resource: destination``. If not set, resources will be in the same relative structure to one another as inside the container. For setting a common default, use ``*`` as the resource key. :type dst_directories: dict :param apply_chown: Owner to set for the copied resources. Can be a user name or id, group name or id, both in the notation ``user:group``, or as a tuple ``(user, group)``. :type apply_chown: unicode or tuple :param apply_chmod: File system permissions to set for the copied resources. Can be any notation as accepted by `chmod`. :type apply_chmod: unicode """ def _copy_resource(resource): default_dest_path = generic_path if generic_path is not None else resource dest_path = directories.get(resource, default_dest_path).strip(posixpath.sep) head, tail = posixpath.split(dest_path) rel_path = posixpath.join(storage_dir, head) run(mkdir(rel_path, check_if_exists=True)) run('docker cp {0}:{1} {2}'.format(src_container, resource, rel_path), shell=False) directories = dst_directories or {} generic_path = directories.get('*') for res in src_resources: _copy_resource(res) if apply_chmod: run(chmod(apply_chmod, storage_dir)) if apply_chown: sudo(chown(apply_chown, storage_dir))
[ "def", "copy_resources", "(", "src_container", ",", "src_resources", ",", "storage_dir", ",", "dst_directories", "=", "None", ",", "apply_chown", "=", "None", ",", "apply_chmod", "=", "None", ")", ":", "def", "_copy_resource", "(", "resource", ")", ":", "default_dest_path", "=", "generic_path", "if", "generic_path", "is", "not", "None", "else", "resource", "dest_path", "=", "directories", ".", "get", "(", "resource", ",", "default_dest_path", ")", ".", "strip", "(", "posixpath", ".", "sep", ")", "head", ",", "tail", "=", "posixpath", ".", "split", "(", "dest_path", ")", "rel_path", "=", "posixpath", ".", "join", "(", "storage_dir", ",", "head", ")", "run", "(", "mkdir", "(", "rel_path", ",", "check_if_exists", "=", "True", ")", ")", "run", "(", "'docker cp {0}:{1} {2}'", ".", "format", "(", "src_container", ",", "resource", ",", "rel_path", ")", ",", "shell", "=", "False", ")", "directories", "=", "dst_directories", "or", "{", "}", "generic_path", "=", "directories", ".", "get", "(", "'*'", ")", "for", "res", "in", "src_resources", ":", "_copy_resource", "(", "res", ")", "if", "apply_chmod", ":", "run", "(", "chmod", "(", "apply_chmod", ",", "storage_dir", ")", ")", "if", "apply_chown", ":", "sudo", "(", "chown", "(", "apply_chown", ",", "storage_dir", ")", ")" ]
Copies files and directories from a Docker container. Multiple resources can be copied and additional options are available than in :func:`copy_resource`. Unlike in :func:`copy_resource`, Resources are copied as they are and not compressed to a tarball, and they are left on the remote machine. :param src_container: Container name or id. :type src_container: unicode :param src_resources: Resources, as (file or directory) names to copy. :type src_resources: iterable :param storage_dir: Remote directory to store the copied objects in. :type storage_dir: unicode :param dst_directories: Optional dictionary of destination directories, in the format ``resource: destination``. If not set, resources will be in the same relative structure to one another as inside the container. For setting a common default, use ``*`` as the resource key. :type dst_directories: dict :param apply_chown: Owner to set for the copied resources. Can be a user name or id, group name or id, both in the notation ``user:group``, or as a tuple ``(user, group)``. :type apply_chown: unicode or tuple :param apply_chmod: File system permissions to set for the copied resources. Can be any notation as accepted by `chmod`. :type apply_chmod: unicode
[ "Copies", "files", "and", "directories", "from", "a", "Docker", "container", ".", "Multiple", "resources", "can", "be", "copied", "and", "additional", "options", "are", "available", "than", "in", ":", "func", ":", "copy_resource", ".", "Unlike", "in", ":", "func", ":", "copy_resource", "Resources", "are", "copied", "as", "they", "are", "and", "not", "compressed", "to", "a", "tarball", "and", "they", "are", "left", "on", "the", "remote", "machine", "." ]
train
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/cli.py#L324-L362
<|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: Copies files and directories from a Docker container. Multiple resources can be copied and additional options are available than in :func:`copy_resource`. Unlike in :func:`copy_resource`, Resources are copied as they are and not compressed to a tarball, and they are left on the remote machine. :param src_container: Container name or id. :type src_container: unicode :param src_resources: Resources, as (file or directory) names to copy. :type src_resources: iterable :param storage_dir: Remote directory to store the copied objects in. :type storage_dir: unicode :param dst_directories: Optional dictionary of destination directories, in the format ``resource: destination``. If not set, resources will be in the same relative structure to one another as inside the container. For setting a common default, use ``*`` as the resource key. :type dst_directories: dict :param apply_chown: Owner to set for the copied resources. Can be a user name or id, group name or id, both in the notation ``user:group``, or as a tuple ``(user, group)``. :type apply_chown: unicode or tuple :param apply_chmod: File system permissions to set for the copied resources. Can be any notation as accepted by `chmod`. :type apply_chmod: unicode ### Response: def copy_resources(src_container, src_resources, storage_dir, dst_directories=None, apply_chown=None, apply_chmod=None): """ Copies files and directories from a Docker container. Multiple resources can be copied and additional options are available than in :func:`copy_resource`. Unlike in :func:`copy_resource`, Resources are copied as they are and not compressed to a tarball, and they are left on the remote machine. :param src_container: Container name or id. :type src_container: unicode :param src_resources: Resources, as (file or directory) names to copy. :type src_resources: iterable :param storage_dir: Remote directory to store the copied objects in. :type storage_dir: unicode :param dst_directories: Optional dictionary of destination directories, in the format ``resource: destination``. If not set, resources will be in the same relative structure to one another as inside the container. For setting a common default, use ``*`` as the resource key. :type dst_directories: dict :param apply_chown: Owner to set for the copied resources. Can be a user name or id, group name or id, both in the notation ``user:group``, or as a tuple ``(user, group)``. :type apply_chown: unicode or tuple :param apply_chmod: File system permissions to set for the copied resources. Can be any notation as accepted by `chmod`. :type apply_chmod: unicode """ def _copy_resource(resource): default_dest_path = generic_path if generic_path is not None else resource dest_path = directories.get(resource, default_dest_path).strip(posixpath.sep) head, tail = posixpath.split(dest_path) rel_path = posixpath.join(storage_dir, head) run(mkdir(rel_path, check_if_exists=True)) run('docker cp {0}:{1} {2}'.format(src_container, resource, rel_path), shell=False) directories = dst_directories or {} generic_path = directories.get('*') for res in src_resources: _copy_resource(res) if apply_chmod: run(chmod(apply_chmod, storage_dir)) if apply_chown: sudo(chown(apply_chown, storage_dir)) <|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, 57377, 552, 3626, 323, 29725, 505, 264, 41649, 5593, 13, 29911, 5070, 649, 387, 22523, 323, 5217, 2671, 527, 198, 262, 2561, 1109, 304, 551, 2900, 19258, 8728, 18446, 29687, 27140, 304, 551, 2900, 19258, 8728, 18446, 7964, 16607, 527, 22523, 439, 814, 527, 323, 539, 198, 262, 31749, 311, 264, 12460, 4047, 11, 323, 814, 527, 2163, 389, 279, 8870, 5780, 382, 262, 551, 913, 2338, 16226, 25, 9876, 836, 477, 887, 627, 262, 551, 1337, 2338, 16226, 25, 27169, 198, 262, 551, 913, 2338, 36669, 25, 16607, 11, 439, 320, 1213, 477, 6352, 8, 5144, 311, 3048, 627, 262, 551, 1337, 2338, 36669, 25, 51934, 198, 262, 551, 913, 5942, 4432, 25, 21400, 6352, 311, 3637, 279, 22523, 6302, 304, 627, 262, 551, 1337, 5942, 4432, 25, 27169, 198, 262, 551, 913, 10875, 33971, 2490, 25, 12536, 11240, 315, 9284, 29725, 11, 304, 279, 3645, 10103, 9416, 25, 9284, 14196, 13, 1442, 198, 415, 539, 743, 11, 5070, 690, 387, 304, 279, 1890, 8844, 6070, 311, 832, 2500, 439, 4871, 279, 5593, 13, 1789, 6376, 264, 198, 415, 4279, 1670, 11, 1005, 10103, 9, 14196, 439, 279, 5211, 1401, 627, 262, 551, 1337, 10875, 33971, 2490, 25, 6587, 198, 262, 551, 913, 3881, 4231, 785, 25, 26918, 311, 743, 369, 279, 22523, 5070, 13, 3053, 387, 264, 1217, 836, 477, 887, 11, 1912, 836, 477, 887, 11, 2225, 304, 279, 198, 415, 45297, 10103, 882, 25, 4166, 91816, 477, 439, 264, 14743, 40695, 882, 11, 1912, 8, 14196, 627, 262, 551, 1337, 3881, 4231, 785, 25, 27169, 477, 14743, 198, 262, 551, 913, 3881, 4231, 2658, 25, 2958, 1887, 8709, 311, 743, 369, 279, 22523, 5070, 13, 3053, 387, 904, 45297, 439, 11928, 555, 198, 415, 1595, 57374, 19154, 262, 551, 1337, 3881, 4231, 2658, 25, 27169, 271, 14711, 6075, 512, 755, 3048, 36669, 15047, 16226, 11, 2338, 36669, 11, 5942, 4432, 11, 10875, 33971, 2490, 5980, 11, 3881, 4231, 785, 5980, 11, 3881, 4231, 2658, 5980, 997, 262, 3270, 262, 80668, 3626, 323, 29725, 505, 264, 41649, 5593, 13, 29911, 5070, 649, 387, 22523, 323, 5217, 2671, 527, 198, 262, 2561, 1109, 304, 551, 2900, 19258, 8728, 18446, 29687, 27140, 304, 551, 2900, 19258, 8728, 18446, 7964, 16607, 527, 22523, 439, 814, 527, 323, 539, 198, 262, 31749, 311, 264, 12460, 4047, 11, 323, 814, 527, 2163, 389, 279, 8870, 5780, 382, 262, 551, 913, 2338, 16226, 25, 9876, 836, 477, 887, 627, 262, 551, 1337, 2338, 16226, 25, 27169, 198, 262, 551, 913, 2338, 36669, 25, 16607, 11, 439, 320, 1213, 477, 6352, 8, 5144, 311, 3048, 627, 262, 551, 1337, 2338, 36669, 25, 51934, 198, 262, 551, 913, 5942, 4432, 25, 21400, 6352, 311, 3637, 279, 22523, 6302, 304, 627, 262, 551, 1337, 5942, 4432, 25, 27169, 198, 262, 551, 913, 10875, 33971, 2490, 25, 12536, 11240, 315 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 57377, 552, 3626, 323, 29725, 505, 264, 41649, 5593, 13, 29911, 5070, 649, 387, 22523, 323, 5217, 2671, 527, 198, 262, 2561, 1109, 304, 551, 2900, 19258, 8728, 18446, 29687, 27140, 304, 551, 2900, 19258, 8728, 18446, 7964, 16607, 527, 22523, 439, 814, 527, 323, 539, 198, 262, 31749, 311, 264, 12460, 4047, 11, 323, 814, 527, 2163, 389, 279, 8870, 5780, 382, 262, 551, 913, 2338, 16226, 25, 9876, 836, 477, 887, 627, 262, 551, 1337, 2338, 16226, 25, 27169, 198, 262, 551, 913, 2338, 36669, 25, 16607, 11, 439, 320, 1213, 477, 6352, 8, 5144, 311, 3048, 627, 262, 551, 1337, 2338, 36669, 25, 51934, 198, 262, 551, 913, 5942, 4432, 25, 21400, 6352, 311, 3637, 279, 22523, 6302, 304, 627, 262, 551, 1337, 5942, 4432, 25, 27169, 198, 262, 551, 913, 10875, 33971, 2490, 25, 12536, 11240, 315, 9284, 29725, 11, 304, 279, 3645, 10103, 9416, 25, 9284, 14196, 13, 1442, 198, 415, 539, 743, 11, 5070, 690, 387, 304, 279, 1890, 8844, 6070, 311, 832, 2500, 439, 4871, 279, 5593, 13, 1789, 6376, 264, 198, 415, 4279, 1670, 11, 1005, 10103, 9, 14196, 439, 279, 5211, 1401, 627, 262, 551, 1337, 10875, 33971, 2490, 25, 6587, 198, 262, 551, 913, 3881, 4231, 785, 25, 26918, 311, 743, 369, 279, 22523, 5070, 13, 3053, 387, 264, 1217, 836, 477, 887, 11, 1912, 836, 477, 887, 11, 2225, 304, 279, 198, 415, 45297, 10103, 882, 25, 4166, 91816, 477, 439, 264, 14743, 40695, 882, 11, 1912, 8, 14196, 627, 262, 551, 1337, 3881, 4231, 785, 25, 27169, 477, 14743, 198, 262, 551, 913, 3881, 4231, 2658, 25, 2958, 1887, 8709, 311, 743, 369, 279, 22523, 5070, 13, 3053, 387, 904, 45297, 439, 11928, 555, 198, 415, 1595, 57374, 19154, 262, 551, 1337, 3881, 4231, 2658, 25, 27169, 271, 14711, 6075, 512, 755, 3048, 36669, 15047, 16226, 11, 2338, 36669, 11, 5942, 4432, 11, 10875, 33971, 2490, 5980, 11, 3881, 4231, 785, 5980, 11, 3881, 4231, 2658, 5980, 997, 262, 3270, 262, 80668, 3626, 323, 29725, 505, 264, 41649, 5593, 13, 29911, 5070, 649, 387, 22523, 323, 5217, 2671, 527, 198, 262, 2561, 1109, 304, 551, 2900, 19258, 8728, 18446, 29687, 27140, 304, 551, 2900, 19258, 8728, 18446, 7964, 16607, 527, 22523, 439, 814, 527, 323, 539, 198, 262, 31749, 311, 264, 12460, 4047, 11, 323, 814, 527, 2163, 389, 279, 8870, 5780, 382, 262, 551, 913, 2338, 16226, 25, 9876, 836, 477, 887, 627, 262, 551, 1337, 2338, 16226, 25, 27169, 198, 262, 551, 913, 2338, 36669, 25, 16607, 11, 439, 320, 1213, 477, 6352, 8, 5144, 311, 3048, 627, 262, 551, 1337, 2338, 36669, 25, 51934, 198, 262, 551, 913, 5942, 4432, 25, 21400, 6352, 311, 3637, 279, 22523, 6302, 304, 627, 262, 551, 1337, 5942, 4432, 25, 27169, 198, 262, 551, 913, 10875, 33971, 2490, 25, 12536, 11240, 315 ]
treyhunner/django-simple-history
simple_history/models.py
HistoricalRecords.create_history_model
def create_history_model(self, model, inherited): """ Creates a historical model to associate with the model provided. """ attrs = { "__module__": self.module, "_history_excluded_fields": self.excluded_fields, } app_module = "%s.models" % model._meta.app_label if inherited: # inherited use models module attrs["__module__"] = model.__module__ elif model.__module__ != self.module: # registered under different app attrs["__module__"] = self.module elif app_module != self.module: # Abuse an internal API because the app registry is loading. app = apps.app_configs[model._meta.app_label] models_module = app.name attrs["__module__"] = models_module fields = self.copy_fields(model) attrs.update(fields) attrs.update(self.get_extra_fields(model, fields)) # type in python2 wants str as a first argument attrs.update(Meta=type(str("Meta"), (), self.get_meta_options(model))) if self.table_name is not None: attrs["Meta"].db_table = self.table_name # Set as the default then check for overrides name = self.get_history_model_name(model) registered_models[model._meta.db_table] = model return python_2_unicode_compatible(type(str(name), self.bases, attrs))
python
def create_history_model(self, model, inherited): """ Creates a historical model to associate with the model provided. """ attrs = { "__module__": self.module, "_history_excluded_fields": self.excluded_fields, } app_module = "%s.models" % model._meta.app_label if inherited: # inherited use models module attrs["__module__"] = model.__module__ elif model.__module__ != self.module: # registered under different app attrs["__module__"] = self.module elif app_module != self.module: # Abuse an internal API because the app registry is loading. app = apps.app_configs[model._meta.app_label] models_module = app.name attrs["__module__"] = models_module fields = self.copy_fields(model) attrs.update(fields) attrs.update(self.get_extra_fields(model, fields)) # type in python2 wants str as a first argument attrs.update(Meta=type(str("Meta"), (), self.get_meta_options(model))) if self.table_name is not None: attrs["Meta"].db_table = self.table_name # Set as the default then check for overrides name = self.get_history_model_name(model) registered_models[model._meta.db_table] = model return python_2_unicode_compatible(type(str(name), self.bases, attrs))
[ "def", "create_history_model", "(", "self", ",", "model", ",", "inherited", ")", ":", "attrs", "=", "{", "\"__module__\"", ":", "self", ".", "module", ",", "\"_history_excluded_fields\"", ":", "self", ".", "excluded_fields", ",", "}", "app_module", "=", "\"%s.models\"", "%", "model", ".", "_meta", ".", "app_label", "if", "inherited", ":", "# inherited use models module", "attrs", "[", "\"__module__\"", "]", "=", "model", ".", "__module__", "elif", "model", ".", "__module__", "!=", "self", ".", "module", ":", "# registered under different app", "attrs", "[", "\"__module__\"", "]", "=", "self", ".", "module", "elif", "app_module", "!=", "self", ".", "module", ":", "# Abuse an internal API because the app registry is loading.", "app", "=", "apps", ".", "app_configs", "[", "model", ".", "_meta", ".", "app_label", "]", "models_module", "=", "app", ".", "name", "attrs", "[", "\"__module__\"", "]", "=", "models_module", "fields", "=", "self", ".", "copy_fields", "(", "model", ")", "attrs", ".", "update", "(", "fields", ")", "attrs", ".", "update", "(", "self", ".", "get_extra_fields", "(", "model", ",", "fields", ")", ")", "# type in python2 wants str as a first argument", "attrs", ".", "update", "(", "Meta", "=", "type", "(", "str", "(", "\"Meta\"", ")", ",", "(", ")", ",", "self", ".", "get_meta_options", "(", "model", ")", ")", ")", "if", "self", ".", "table_name", "is", "not", "None", ":", "attrs", "[", "\"Meta\"", "]", ".", "db_table", "=", "self", ".", "table_name", "# Set as the default then check for overrides", "name", "=", "self", ".", "get_history_model_name", "(", "model", ")", "registered_models", "[", "model", ".", "_meta", ".", "db_table", "]", "=", "model", "return", "python_2_unicode_compatible", "(", "type", "(", "str", "(", "name", ")", ",", "self", ".", "bases", ",", "attrs", ")", ")" ]
Creates a historical model to associate with the model provided.
[ "Creates", "a", "historical", "model", "to", "associate", "with", "the", "model", "provided", "." ]
train
https://github.com/treyhunner/django-simple-history/blob/85758ecfe608279508a3fb5b71654d3e202eb63d/simple_history/models.py#L193-L228
<|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: Creates a historical model to associate with the model provided. ### Response: def create_history_model(self, model, inherited): """ Creates a historical model to associate with the model provided. """ attrs = { "__module__": self.module, "_history_excluded_fields": self.excluded_fields, } app_module = "%s.models" % model._meta.app_label if inherited: # inherited use models module attrs["__module__"] = model.__module__ elif model.__module__ != self.module: # registered under different app attrs["__module__"] = self.module elif app_module != self.module: # Abuse an internal API because the app registry is loading. app = apps.app_configs[model._meta.app_label] models_module = app.name attrs["__module__"] = models_module fields = self.copy_fields(model) attrs.update(fields) attrs.update(self.get_extra_fields(model, fields)) # type in python2 wants str as a first argument attrs.update(Meta=type(str("Meta"), (), self.get_meta_options(model))) if self.table_name is not None: attrs["Meta"].db_table = self.table_name # Set as the default then check for overrides name = self.get_history_model_name(model) registered_models[model._meta.db_table] = model return python_2_unicode_compatible(type(str(name), self.bases, attrs)) <|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, 55968, 264, 13970, 1646, 311, 22712, 449, 279, 1646, 3984, 382, 14711, 6075, 512, 755, 1893, 20389, 5156, 1214, 11, 1646, 11, 28088, 997, 286, 3270, 286, 15026, 264, 13970, 1646, 311, 22712, 449, 279, 1646, 3984, 627, 286, 3270, 286, 16602, 284, 341, 310, 13568, 4450, 565, 794, 659, 10282, 345, 310, 9177, 19375, 2769, 10391, 12406, 794, 659, 2272, 10391, 12406, 345, 286, 557, 286, 917, 10983, 284, 6090, 82, 8399, 1, 1034, 1646, 1462, 5607, 1632, 6234, 271, 286, 422, 28088, 512, 310, 674, 28088, 1005, 4211, 4793, 198, 310, 16602, 1204, 565, 4450, 565, 1365, 284, 1646, 4952, 4450, 12423, 286, 4508, 1646, 4952, 4450, 565, 976, 659, 10282, 512, 310, 674, 9879, 1234, 2204, 917, 198, 310, 16602, 1204, 565, 4450, 565, 1365, 284, 659, 10282, 198, 286, 4508, 917, 10983, 976, 659, 10282, 512, 310, 674, 46784, 459, 5419, 5446, 1606, 279, 917, 19989, 374, 8441, 627, 310, 917, 284, 10721, 1632, 60250, 81038, 1462, 5607, 1632, 6234, 933, 310, 4211, 10983, 284, 917, 2710, 198, 310, 16602, 1204, 565, 4450, 565, 1365, 284, 4211, 10983, 271, 286, 5151, 284, 659, 12511, 12406, 7790, 340, 286, 16602, 5430, 38801, 340, 286, 16602, 5430, 1214, 673, 32958, 12406, 7790, 11, 5151, 1192, 286, 674, 955, 304, 10344, 17, 6944, 610, 439, 264, 1176, 5811, 198, 286, 16602, 5430, 3269, 1955, 28, 1337, 4293, 446, 12452, 4063, 39204, 659, 673, 13686, 8917, 7790, 6054, 286, 422, 659, 10549, 1292, 374, 539, 2290, 512, 310, 16602, 1204, 12452, 5638, 2042, 5350, 284, 659, 10549, 1292, 271, 286, 674, 2638, 439, 279, 1670, 1243, 1817, 369, 36555, 198, 286, 836, 284, 659, 673, 20389, 5156, 1292, 7790, 696, 286, 9879, 31892, 81038, 1462, 5607, 7221, 5350, 60, 284, 1646, 198, 286, 471, 10344, 62, 17, 55762, 3038, 38179, 5930, 4293, 3232, 705, 659, 960, 2315, 11, 16602, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 55968, 264, 13970, 1646, 311, 22712, 449, 279, 1646, 3984, 382, 14711, 6075, 512, 755, 1893, 20389, 5156, 1214, 11, 1646, 11, 28088, 997, 286, 3270, 286, 15026, 264, 13970, 1646, 311, 22712, 449, 279, 1646, 3984, 627, 286, 3270, 286, 16602, 284, 341, 310, 13568, 4450, 565, 794, 659, 10282, 345, 310, 9177, 19375, 2769, 10391, 12406, 794, 659, 2272, 10391, 12406, 345, 286, 557, 286, 917, 10983, 284, 6090, 82, 8399, 1, 1034, 1646, 1462, 5607, 1632, 6234, 271, 286, 422, 28088, 512, 310, 674, 28088, 1005, 4211, 4793, 198, 310, 16602, 1204, 565, 4450, 565, 1365, 284, 1646, 4952, 4450, 12423, 286, 4508, 1646, 4952, 4450, 565, 976, 659, 10282, 512, 310, 674, 9879, 1234, 2204, 917, 198, 310, 16602, 1204, 565, 4450, 565, 1365, 284, 659, 10282, 198, 286, 4508, 917, 10983, 976, 659, 10282, 512, 310, 674, 46784, 459, 5419, 5446, 1606, 279, 917, 19989, 374, 8441, 627, 310, 917, 284, 10721, 1632, 60250, 81038, 1462, 5607, 1632, 6234, 933, 310, 4211, 10983, 284, 917, 2710, 198, 310, 16602, 1204, 565, 4450, 565, 1365, 284, 4211, 10983, 271, 286, 5151, 284, 659, 12511, 12406, 7790, 340, 286, 16602, 5430, 38801, 340, 286, 16602, 5430, 1214, 673, 32958, 12406, 7790, 11, 5151, 1192, 286, 674, 955, 304, 10344, 17, 6944, 610, 439, 264, 1176, 5811, 198, 286, 16602, 5430, 3269, 1955, 28, 1337, 4293, 446, 12452, 4063, 39204, 659, 673, 13686, 8917, 7790, 6054, 286, 422, 659, 10549, 1292, 374, 539, 2290, 512, 310, 16602, 1204, 12452, 5638, 2042, 5350, 284, 659, 10549, 1292, 271, 286, 674, 2638, 439, 279, 1670, 1243, 1817, 369, 36555, 198, 286, 836, 284, 659, 673, 20389, 5156, 1292, 7790, 696, 286, 9879, 31892, 81038, 1462, 5607, 7221, 5350, 60, 284, 1646, 198, 286, 471, 10344, 62, 17, 55762, 3038, 38179, 5930, 4293, 3232, 705, 659, 960, 2315, 11, 16602, 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 ]
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
SchemaValidCtxtCore.setValidityErrorHandler
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for Schema validation. These will be called back as f(msg,arg) """ libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
python
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for Schema validation. These will be called back as f(msg,arg) """ libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
[ "def", "setValidityErrorHandler", "(", "self", ",", "err_func", ",", "warn_func", ",", "arg", "=", "None", ")", ":", "libxml2mod", ".", "xmlSchemaSetValidErrors", "(", "self", ".", "_o", ",", "err_func", ",", "warn_func", ",", "arg", ")" ]
Register error and warning handlers for Schema validation. These will be called back as f(msg,arg)
[ "Register", "error", "and", "warning", "handlers", "for", "Schema", "validation", ".", "These", "will", "be", "called", "back", "as", "f", "(", "msg", "arg", ")" ]
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L692-L697
<|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: Register error and warning handlers for Schema validation. These will be called back as f(msg,arg) ### Response: def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for Schema validation. These will be called back as f(msg,arg) """ libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg) <|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, 8861, 1493, 323, 10163, 25050, 369, 12824, 10741, 627, 286, 4314, 690, 387, 2663, 1203, 439, 282, 8282, 78365, 696, 14711, 6075, 512, 755, 743, 70638, 67773, 1214, 11, 1886, 9791, 11, 8985, 9791, 11, 1417, 5980, 997, 286, 3270, 286, 8618, 1493, 323, 10163, 25050, 369, 12824, 10741, 627, 286, 4314, 690, 387, 2663, 1203, 439, 282, 8282, 78365, 340, 286, 3270, 286, 3127, 6591, 17, 2658, 9205, 8802, 1681, 4180, 14199, 1214, 1462, 78, 11, 1886, 9791, 11, 8985, 9791, 11, 1417, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 8861, 1493, 323, 10163, 25050, 369, 12824, 10741, 627, 286, 4314, 690, 387, 2663, 1203, 439, 282, 8282, 78365, 696, 14711, 6075, 512, 755, 743, 70638, 67773, 1214, 11, 1886, 9791, 11, 8985, 9791, 11, 1417, 5980, 997, 286, 3270, 286, 8618, 1493, 323, 10163, 25050, 369, 12824, 10741, 627, 286, 4314, 690, 387, 2663, 1203, 439, 282, 8282, 78365, 340, 286, 3270, 286, 3127, 6591, 17, 2658, 9205, 8802, 1681, 4180, 14199, 1214, 1462, 78, 11, 1886, 9791, 11, 8985, 9791, 11, 1417, 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 ]
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.Refresh
def Refresh(self): """Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh() """ self.dirty = False self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session) self.data['changeInfo']['createdDate'] = clc.v2.time_utils.ZuluTSToSeconds(self.data['changeInfo']['createdDate']) self.data['changeInfo']['modifiedDate'] = clc.v2.time_utils.ZuluTSToSeconds(self.data['changeInfo']['modifiedDate'])
python
def Refresh(self): """Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh() """ self.dirty = False self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session) self.data['changeInfo']['createdDate'] = clc.v2.time_utils.ZuluTSToSeconds(self.data['changeInfo']['createdDate']) self.data['changeInfo']['modifiedDate'] = clc.v2.time_utils.ZuluTSToSeconds(self.data['changeInfo']['modifiedDate'])
[ "def", "Refresh", "(", "self", ")", ":", "self", ".", "dirty", "=", "False", "self", ".", "data", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "'groups/%s/%s'", "%", "(", "self", ".", "alias", ",", "self", ".", "id", ")", ",", "session", "=", "self", ".", "session", ")", "self", ".", "data", "[", "'changeInfo'", "]", "[", "'createdDate'", "]", "=", "clc", ".", "v2", ".", "time_utils", ".", "ZuluTSToSeconds", "(", "self", ".", "data", "[", "'changeInfo'", "]", "[", "'createdDate'", "]", ")", "self", ".", "data", "[", "'changeInfo'", "]", "[", "'modifiedDate'", "]", "=", "clc", ".", "v2", ".", "time_utils", ".", "ZuluTSToSeconds", "(", "self", ".", "data", "[", "'changeInfo'", "]", "[", "'modifiedDate'", "]", ")" ]
Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh()
[ "Reloads", "the", "group", "object", "to", "synchronize", "with", "cloud", "representation", "." ]
train
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L152-L163
<|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: Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh() ### Response: def Refresh(self): """Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh() """ self.dirty = False self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session) self.data['changeInfo']['createdDate'] = clc.v2.time_utils.ZuluTSToSeconds(self.data['changeInfo']['createdDate']) self.data['changeInfo']['modifiedDate'] = clc.v2.time_utils.ZuluTSToSeconds(self.data['changeInfo']['modifiedDate']) <|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, 51135, 82, 279, 1912, 1665, 311, 64899, 449, 9624, 13340, 382, 197, 197, 20761, 1206, 66, 3211, 17, 5522, 446, 10196, 12, 4513, 19, 1865, 14909, 2892, 14711, 6075, 512, 755, 30107, 1214, 997, 197, 197, 12885, 51135, 82, 279, 1912, 1665, 311, 64899, 449, 9624, 13340, 382, 197, 197, 20761, 1206, 66, 3211, 17, 5522, 446, 10196, 12, 4513, 19, 1865, 14909, 2892, 197, 197, 15425, 197, 5311, 100085, 284, 3641, 198, 197, 5311, 2245, 284, 1206, 66, 3211, 17, 25967, 28115, 493, 3891, 1882, 17171, 12915, 82, 12915, 82, 6, 1034, 320, 726, 64180, 22280, 1801, 705, 3882, 7822, 10387, 696, 197, 5311, 2245, 681, 3455, 1767, 4274, 7266, 1956, 663, 284, 1206, 66, 3211, 17, 6512, 17758, 13784, 25415, 51, 790, 78, 15703, 1214, 2245, 681, 3455, 1767, 4274, 7266, 1956, 7519, 197, 5311, 2245, 681, 3455, 1767, 4274, 28261, 1956, 663, 284, 1206, 66, 3211, 17, 6512, 17758, 13784, 25415, 51, 790, 78, 15703, 1214, 2245, 681, 3455, 1767, 4274, 28261, 1956, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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711, 5546, 512, 51135, 82, 279, 1912, 1665, 311, 64899, 449, 9624, 13340, 382, 197, 197, 20761, 1206, 66, 3211, 17, 5522, 446, 10196, 12, 4513, 19, 1865, 14909, 2892, 14711, 6075, 512, 755, 30107, 1214, 997, 197, 197, 12885, 51135, 82, 279, 1912, 1665, 311, 64899, 449, 9624, 13340, 382, 197, 197, 20761, 1206, 66, 3211, 17, 5522, 446, 10196, 12, 4513, 19, 1865, 14909, 2892, 197, 197, 15425, 197, 5311, 100085, 284, 3641, 198, 197, 5311, 2245, 284, 1206, 66, 3211, 17, 25967, 28115, 493, 3891, 1882, 17171, 12915, 82, 12915, 82, 6, 1034, 320, 726, 64180, 22280, 1801, 705, 3882, 7822, 10387, 696, 197, 5311, 2245, 681, 3455, 1767, 4274, 7266, 1956, 663, 284, 1206, 66, 3211, 17, 6512, 17758, 13784, 25415, 51, 790, 78, 15703, 1214, 2245, 681, 3455, 1767, 4274, 7266, 1956, 7519, 197, 5311, 2245, 681, 3455, 1767, 4274, 28261, 1956, 663, 284, 1206, 66, 3211, 17, 6512, 17758, 13784, 25415, 51, 790, 78, 15703, 1214, 2245, 681, 3455, 1767, 4274, 28261, 1956, 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 ]
Apitax/Apitax
apitax/api/controllers/migrations/admins_controller.py
driver_status
def driver_status(name): # noqa: E501 """Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response """ if(not hasAccess()): return redirectUnauthorized() driver = LoadedDrivers.getDefaultDriver() body = {"name": str(driver.__class__.__name__)} body.update(driver.serialize()) return Response(status=200, body=body)
python
def driver_status(name): # noqa: E501 """Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response """ if(not hasAccess()): return redirectUnauthorized() driver = LoadedDrivers.getDefaultDriver() body = {"name": str(driver.__class__.__name__)} body.update(driver.serialize()) return Response(status=200, body=body)
[ "def", "driver_status", "(", "name", ")", ":", "# noqa: E501", "if", "(", "not", "hasAccess", "(", ")", ")", ":", "return", "redirectUnauthorized", "(", ")", "driver", "=", "LoadedDrivers", ".", "getDefaultDriver", "(", ")", "body", "=", "{", "\"name\"", ":", "str", "(", "driver", ".", "__class__", ".", "__name__", ")", "}", "body", ".", "update", "(", "driver", ".", "serialize", "(", ")", ")", "return", "Response", "(", "status", "=", "200", ",", "body", "=", "body", ")" ]
Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response
[ "Retrieve", "the", "status", "of", "a", "loaded", "driver" ]
train
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/migrations/admins_controller.py#L34-L50
<|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: Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response ### Response: def driver_status(name): # noqa: E501 """Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response """ if(not hasAccess()): return redirectUnauthorized() driver = LoadedDrivers.getDefaultDriver() body = {"name": str(driver.__class__.__name__)} body.update(driver.serialize()) return Response(status=200, body=body) <|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, 88765, 279, 2704, 315, 264, 6799, 5696, 271, 262, 32662, 279, 2704, 315, 264, 6799, 5696, 674, 46721, 25, 469, 14408, 271, 262, 551, 913, 836, 25, 2175, 2704, 315, 264, 5696, 449, 420, 836, 198, 262, 551, 1337, 836, 25, 610, 271, 262, 551, 33613, 25, 6075, 271, 14711, 6075, 512, 755, 5696, 4878, 3232, 1680, 220, 674, 46721, 25, 469, 14408, 198, 262, 4304, 88765, 279, 2704, 315, 264, 6799, 5696, 271, 262, 32662, 279, 2704, 315, 264, 6799, 5696, 674, 46721, 25, 469, 14408, 271, 262, 551, 913, 836, 25, 2175, 2704, 315, 264, 5696, 449, 420, 836, 198, 262, 551, 1337, 836, 25, 610, 271, 262, 551, 33613, 25, 6075, 198, 262, 3270, 262, 422, 25804, 706, 6182, 34257, 286, 471, 6559, 52281, 2892, 262, 5696, 284, 63739, 89929, 29694, 11603, 746, 262, 2547, 284, 5324, 609, 794, 610, 24994, 4952, 1058, 50480, 609, 565, 10792, 262, 2547, 5430, 24994, 35069, 2455, 262, 471, 6075, 14159, 28, 1049, 11, 2547, 28, 2664, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 88765, 279, 2704, 315, 264, 6799, 5696, 271, 262, 32662, 279, 2704, 315, 264, 6799, 5696, 674, 46721, 25, 469, 14408, 271, 262, 551, 913, 836, 25, 2175, 2704, 315, 264, 5696, 449, 420, 836, 198, 262, 551, 1337, 836, 25, 610, 271, 262, 551, 33613, 25, 6075, 271, 14711, 6075, 512, 755, 5696, 4878, 3232, 1680, 220, 674, 46721, 25, 469, 14408, 198, 262, 4304, 88765, 279, 2704, 315, 264, 6799, 5696, 271, 262, 32662, 279, 2704, 315, 264, 6799, 5696, 674, 46721, 25, 469, 14408, 271, 262, 551, 913, 836, 25, 2175, 2704, 315, 264, 5696, 449, 420, 836, 198, 262, 551, 1337, 836, 25, 610, 271, 262, 551, 33613, 25, 6075, 198, 262, 3270, 262, 422, 25804, 706, 6182, 34257, 286, 471, 6559, 52281, 2892, 262, 5696, 284, 63739, 89929, 29694, 11603, 746, 262, 2547, 284, 5324, 609, 794, 610, 24994, 4952, 1058, 50480, 609, 565, 10792, 262, 2547, 5430, 24994, 35069, 2455, 262, 471, 6075, 14159, 28, 1049, 11, 2547, 28, 2664, 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 ]
PyGithub/PyGithub
github/Repository.py
Repository.create_pull
def create_pull(self, *args, **kwds): """ :calls: `POST /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_ :param title: string :param body: string :param issue: :class:`github.Issue.Issue` :param base: string :param head: string :param maintainer_can_modify: bool :rtype: :class:`github.PullRequest.PullRequest` """ if len(args) + len(kwds) >= 4: return self.__create_pull_1(*args, **kwds) else: return self.__create_pull_2(*args, **kwds)
python
def create_pull(self, *args, **kwds): """ :calls: `POST /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_ :param title: string :param body: string :param issue: :class:`github.Issue.Issue` :param base: string :param head: string :param maintainer_can_modify: bool :rtype: :class:`github.PullRequest.PullRequest` """ if len(args) + len(kwds) >= 4: return self.__create_pull_1(*args, **kwds) else: return self.__create_pull_2(*args, **kwds)
[ "def", "create_pull", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "len", "(", "args", ")", "+", "len", "(", "kwds", ")", ">=", "4", ":", "return", "self", ".", "__create_pull_1", "(", "*", "args", ",", "*", "*", "kwds", ")", "else", ":", "return", "self", ".", "__create_pull_2", "(", "*", "args", ",", "*", "*", "kwds", ")" ]
:calls: `POST /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_ :param title: string :param body: string :param issue: :class:`github.Issue.Issue` :param base: string :param head: string :param maintainer_can_modify: bool :rtype: :class:`github.PullRequest.PullRequest`
[ ":", "calls", ":", "POST", "/", "repos", "/", ":", "owner", "/", ":", "repo", "/", "pulls", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "pulls", ">", "_", ":", "param", "title", ":", "string", ":", "param", "body", ":", "string", ":", "param", "issue", ":", ":", "class", ":", "github", ".", "Issue", ".", "Issue", ":", "param", "base", ":", "string", ":", "param", "head", ":", "string", ":", "param", "maintainer_can_modify", ":", "bool", ":", "rtype", ":", ":", "class", ":", "github", ".", "PullRequest", ".", "PullRequest" ]
train
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/Repository.py#L1167-L1181
<|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: :calls: `POST /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_ :param title: string :param body: string :param issue: :class:`github.Issue.Issue` :param base: string :param head: string :param maintainer_can_modify: bool :rtype: :class:`github.PullRequest.PullRequest` ### Response: def create_pull(self, *args, **kwds): """ :calls: `POST /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_ :param title: string :param body: string :param issue: :class:`github.Issue.Issue` :param base: string :param head: string :param maintainer_can_modify: bool :rtype: :class:`github.PullRequest.PullRequest` """ if len(args) + len(kwds) >= 4: return self.__create_pull_1(*args, **kwds) else: return self.__create_pull_2(*args, **kwds) <|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, 45720, 25, 1595, 3019, 611, 69454, 11567, 8281, 11567, 24373, 4420, 71523, 366, 1277, 1129, 35501, 11267, 916, 5574, 18, 4420, 71523, 44726, 13220, 286, 551, 913, 2316, 25, 925, 198, 286, 551, 913, 2547, 25, 925, 198, 286, 551, 913, 4360, 25, 551, 1058, 19258, 5316, 2506, 84990, 2506, 84990, 4077, 286, 551, 913, 2385, 25, 925, 198, 286, 551, 913, 2010, 25, 925, 198, 286, 551, 913, 5088, 1780, 28521, 58825, 25, 1845, 198, 286, 551, 33613, 25, 551, 1058, 19258, 5316, 98457, 1939, 98457, 1939, 19884, 14711, 6075, 512, 755, 1893, 66793, 1214, 11, 353, 2164, 11, 3146, 29700, 5469, 997, 286, 3270, 286, 551, 45720, 25, 1595, 3019, 611, 69454, 11567, 8281, 11567, 24373, 4420, 71523, 366, 1277, 1129, 35501, 11267, 916, 5574, 18, 4420, 71523, 44726, 13220, 286, 551, 913, 2316, 25, 925, 198, 286, 551, 913, 2547, 25, 925, 198, 286, 551, 913, 4360, 25, 551, 1058, 19258, 5316, 2506, 84990, 2506, 84990, 4077, 286, 551, 913, 2385, 25, 925, 198, 286, 551, 913, 2010, 25, 925, 198, 286, 551, 913, 5088, 1780, 28521, 58825, 25, 1845, 198, 286, 551, 33613, 25, 551, 1058, 19258, 5316, 98457, 1939, 98457, 1939, 4077, 286, 3270, 286, 422, 2479, 7506, 8, 489, 2479, 6097, 86, 5469, 8, 2669, 220, 19, 512, 310, 471, 659, 4952, 3261, 66793, 62, 16, 4163, 2164, 11, 3146, 29700, 5469, 340, 286, 775, 512, 310, 471, 659, 4952, 3261, 66793, 62, 17, 4163, 2164, 11, 3146, 29700, 5469, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 25, 45720, 25, 1595, 3019, 611, 69454, 11567, 8281, 11567, 24373, 4420, 71523, 366, 1277, 1129, 35501, 11267, 916, 5574, 18, 4420, 71523, 44726, 13220, 286, 551, 913, 2316, 25, 925, 198, 286, 551, 913, 2547, 25, 925, 198, 286, 551, 913, 4360, 25, 551, 1058, 19258, 5316, 2506, 84990, 2506, 84990, 4077, 286, 551, 913, 2385, 25, 925, 198, 286, 551, 913, 2010, 25, 925, 198, 286, 551, 913, 5088, 1780, 28521, 58825, 25, 1845, 198, 286, 551, 33613, 25, 551, 1058, 19258, 5316, 98457, 1939, 98457, 1939, 19884, 14711, 6075, 512, 755, 1893, 66793, 1214, 11, 353, 2164, 11, 3146, 29700, 5469, 997, 286, 3270, 286, 551, 45720, 25, 1595, 3019, 611, 69454, 11567, 8281, 11567, 24373, 4420, 71523, 366, 1277, 1129, 35501, 11267, 916, 5574, 18, 4420, 71523, 44726, 13220, 286, 551, 913, 2316, 25, 925, 198, 286, 551, 913, 2547, 25, 925, 198, 286, 551, 913, 4360, 25, 551, 1058, 19258, 5316, 2506, 84990, 2506, 84990, 4077, 286, 551, 913, 2385, 25, 925, 198, 286, 551, 913, 2010, 25, 925, 198, 286, 551, 913, 5088, 1780, 28521, 58825, 25, 1845, 198, 286, 551, 33613, 25, 551, 1058, 19258, 5316, 98457, 1939, 98457, 1939, 4077, 286, 3270, 286, 422, 2479, 7506, 8, 489, 2479, 6097, 86, 5469, 8, 2669, 220, 19, 512, 310, 471, 659, 4952, 3261, 66793, 62, 16, 4163, 2164, 11, 3146, 29700, 5469, 340, 286, 775, 512, 310, 471, 659, 4952, 3261, 66793, 62, 17, 4163, 2164, 11, 3146, 29700, 5469, 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 ]
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.add
def add(self, name, mech, usage='both', init_lifetime=None, accept_lifetime=None, impersonator=None, store=None): """Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike :meth:`acquire`, you cannot pass None desired name or mechanism. If the `impersonator` argument is used, the credentials will impersonate the given name using the impersonator credentials (:requires-ext:`s4u`). If the `store` argument is used, the credentials will be acquired from the given credential store (:requires-ext:`cred_store`). Otherwise, the credentials are acquired from the default store. The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores. Note that the `store` argument is not compatible with the `impersonator` argument. Args: name (Name): the name associated with the credentials mech (OID): the desired :class:`MechType` to be used with the credentials usage (str): the usage for the credentials -- either 'both', 'initiate', or 'accept' init_lifetime (int): the desired initiate lifetime of the credentials, or None for indefinite accept_lifetime (int): the desired accept lifetime of the credentials, or None for indefinite impersonator (Credentials): the credentials to use to impersonate the given name, or None to not acquire normally (:requires-ext:`s4u`) store (dict): the credential store information pointing to the credential store from which to acquire the credentials, or None for the default store (:requires-ext:`cred_store`) Returns: Credentials: the credentials set containing the current credentials and the newly acquired ones. Raises: BadMechanismError BadNameTypeError BadNameError DuplicateCredentialsElementError ExpiredCredentialsError MissingCredentialsError """ if store is not None and impersonator is not None: raise ValueError('You cannot use both the `impersonator` and ' '`store` arguments at the same time') if store is not None: if rcred_cred_store is None: raise NotImplementedError("Your GSSAPI implementation does " "not have support for manipulating " "credential stores") store = _encode_dict(store) res = rcred_cred_store.add_cred_from(store, self, name, mech, usage, init_lifetime, accept_lifetime) elif impersonator is not None: if rcred_s4u is None: raise NotImplementedError("Your GSSAPI implementation does " "not have support for S4U") res = rcred_s4u.add_cred_impersonate_name(self, impersonator, name, mech, usage, init_lifetime, accept_lifetime) else: res = rcreds.add_cred(self, name, mech, usage, init_lifetime, accept_lifetime) return Credentials(res.creds)
python
def add(self, name, mech, usage='both', init_lifetime=None, accept_lifetime=None, impersonator=None, store=None): """Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike :meth:`acquire`, you cannot pass None desired name or mechanism. If the `impersonator` argument is used, the credentials will impersonate the given name using the impersonator credentials (:requires-ext:`s4u`). If the `store` argument is used, the credentials will be acquired from the given credential store (:requires-ext:`cred_store`). Otherwise, the credentials are acquired from the default store. The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores. Note that the `store` argument is not compatible with the `impersonator` argument. Args: name (Name): the name associated with the credentials mech (OID): the desired :class:`MechType` to be used with the credentials usage (str): the usage for the credentials -- either 'both', 'initiate', or 'accept' init_lifetime (int): the desired initiate lifetime of the credentials, or None for indefinite accept_lifetime (int): the desired accept lifetime of the credentials, or None for indefinite impersonator (Credentials): the credentials to use to impersonate the given name, or None to not acquire normally (:requires-ext:`s4u`) store (dict): the credential store information pointing to the credential store from which to acquire the credentials, or None for the default store (:requires-ext:`cred_store`) Returns: Credentials: the credentials set containing the current credentials and the newly acquired ones. Raises: BadMechanismError BadNameTypeError BadNameError DuplicateCredentialsElementError ExpiredCredentialsError MissingCredentialsError """ if store is not None and impersonator is not None: raise ValueError('You cannot use both the `impersonator` and ' '`store` arguments at the same time') if store is not None: if rcred_cred_store is None: raise NotImplementedError("Your GSSAPI implementation does " "not have support for manipulating " "credential stores") store = _encode_dict(store) res = rcred_cred_store.add_cred_from(store, self, name, mech, usage, init_lifetime, accept_lifetime) elif impersonator is not None: if rcred_s4u is None: raise NotImplementedError("Your GSSAPI implementation does " "not have support for S4U") res = rcred_s4u.add_cred_impersonate_name(self, impersonator, name, mech, usage, init_lifetime, accept_lifetime) else: res = rcreds.add_cred(self, name, mech, usage, init_lifetime, accept_lifetime) return Credentials(res.creds)
[ "def", "add", "(", "self", ",", "name", ",", "mech", ",", "usage", "=", "'both'", ",", "init_lifetime", "=", "None", ",", "accept_lifetime", "=", "None", ",", "impersonator", "=", "None", ",", "store", "=", "None", ")", ":", "if", "store", "is", "not", "None", "and", "impersonator", "is", "not", "None", ":", "raise", "ValueError", "(", "'You cannot use both the `impersonator` and '", "'`store` arguments at the same time'", ")", "if", "store", "is", "not", "None", ":", "if", "rcred_cred_store", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI implementation does \"", "\"not have support for manipulating \"", "\"credential stores\"", ")", "store", "=", "_encode_dict", "(", "store", ")", "res", "=", "rcred_cred_store", ".", "add_cred_from", "(", "store", ",", "self", ",", "name", ",", "mech", ",", "usage", ",", "init_lifetime", ",", "accept_lifetime", ")", "elif", "impersonator", "is", "not", "None", ":", "if", "rcred_s4u", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI implementation does \"", "\"not have support for S4U\"", ")", "res", "=", "rcred_s4u", ".", "add_cred_impersonate_name", "(", "self", ",", "impersonator", ",", "name", ",", "mech", ",", "usage", ",", "init_lifetime", ",", "accept_lifetime", ")", "else", ":", "res", "=", "rcreds", ".", "add_cred", "(", "self", ",", "name", ",", "mech", ",", "usage", ",", "init_lifetime", ",", "accept_lifetime", ")", "return", "Credentials", "(", "res", ".", "creds", ")" ]
Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike :meth:`acquire`, you cannot pass None desired name or mechanism. If the `impersonator` argument is used, the credentials will impersonate the given name using the impersonator credentials (:requires-ext:`s4u`). If the `store` argument is used, the credentials will be acquired from the given credential store (:requires-ext:`cred_store`). Otherwise, the credentials are acquired from the default store. The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores. Note that the `store` argument is not compatible with the `impersonator` argument. Args: name (Name): the name associated with the credentials mech (OID): the desired :class:`MechType` to be used with the credentials usage (str): the usage for the credentials -- either 'both', 'initiate', or 'accept' init_lifetime (int): the desired initiate lifetime of the credentials, or None for indefinite accept_lifetime (int): the desired accept lifetime of the credentials, or None for indefinite impersonator (Credentials): the credentials to use to impersonate the given name, or None to not acquire normally (:requires-ext:`s4u`) store (dict): the credential store information pointing to the credential store from which to acquire the credentials, or None for the default store (:requires-ext:`cred_store`) Returns: Credentials: the credentials set containing the current credentials and the newly acquired ones. Raises: BadMechanismError BadNameTypeError BadNameError DuplicateCredentialsElementError ExpiredCredentialsError MissingCredentialsError
[ "Acquire", "more", "credentials", "to", "add", "to", "the", "current", "set" ]
train
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L303-L386
<|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: Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike :meth:`acquire`, you cannot pass None desired name or mechanism. If the `impersonator` argument is used, the credentials will impersonate the given name using the impersonator credentials (:requires-ext:`s4u`). If the `store` argument is used, the credentials will be acquired from the given credential store (:requires-ext:`cred_store`). Otherwise, the credentials are acquired from the default store. The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores. Note that the `store` argument is not compatible with the `impersonator` argument. Args: name (Name): the name associated with the credentials mech (OID): the desired :class:`MechType` to be used with the credentials usage (str): the usage for the credentials -- either 'both', 'initiate', or 'accept' init_lifetime (int): the desired initiate lifetime of the credentials, or None for indefinite accept_lifetime (int): the desired accept lifetime of the credentials, or None for indefinite impersonator (Credentials): the credentials to use to impersonate the given name, or None to not acquire normally (:requires-ext:`s4u`) store (dict): the credential store information pointing to the credential store from which to acquire the credentials, or None for the default store (:requires-ext:`cred_store`) Returns: Credentials: the credentials set containing the current credentials and the newly acquired ones. Raises: BadMechanismError BadNameTypeError BadNameError DuplicateCredentialsElementError ExpiredCredentialsError MissingCredentialsError ### Response: def add(self, name, mech, usage='both', init_lifetime=None, accept_lifetime=None, impersonator=None, store=None): """Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike :meth:`acquire`, you cannot pass None desired name or mechanism. If the `impersonator` argument is used, the credentials will impersonate the given name using the impersonator credentials (:requires-ext:`s4u`). If the `store` argument is used, the credentials will be acquired from the given credential store (:requires-ext:`cred_store`). Otherwise, the credentials are acquired from the default store. The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores. Note that the `store` argument is not compatible with the `impersonator` argument. Args: name (Name): the name associated with the credentials mech (OID): the desired :class:`MechType` to be used with the credentials usage (str): the usage for the credentials -- either 'both', 'initiate', or 'accept' init_lifetime (int): the desired initiate lifetime of the credentials, or None for indefinite accept_lifetime (int): the desired accept lifetime of the credentials, or None for indefinite impersonator (Credentials): the credentials to use to impersonate the given name, or None to not acquire normally (:requires-ext:`s4u`) store (dict): the credential store information pointing to the credential store from which to acquire the credentials, or None for the default store (:requires-ext:`cred_store`) Returns: Credentials: the credentials set containing the current credentials and the newly acquired ones. Raises: BadMechanismError BadNameTypeError BadNameError DuplicateCredentialsElementError ExpiredCredentialsError MissingCredentialsError """ if store is not None and impersonator is not None: raise ValueError('You cannot use both the `impersonator` and ' '`store` arguments at the same time') if store is not None: if rcred_cred_store is None: raise NotImplementedError("Your GSSAPI implementation does " "not have support for manipulating " "credential stores") store = _encode_dict(store) res = rcred_cred_store.add_cred_from(store, self, name, mech, usage, init_lifetime, accept_lifetime) elif impersonator is not None: if rcred_s4u is None: raise NotImplementedError("Your GSSAPI implementation does " "not have support for S4U") res = rcred_s4u.add_cred_impersonate_name(self, impersonator, name, mech, usage, init_lifetime, accept_lifetime) else: res = rcreds.add_cred(self, name, mech, usage, init_lifetime, accept_lifetime) return Credentials(res.creds) <|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, 11916, 999, 810, 16792, 311, 923, 311, 279, 1510, 743, 271, 286, 1115, 1749, 4375, 1093, 551, 69991, 19258, 582, 999, 7964, 3734, 430, 433, 11621, 279, 198, 286, 19426, 16792, 369, 264, 3254, 17383, 311, 264, 3048, 315, 279, 1510, 198, 286, 743, 11, 4619, 315, 6968, 264, 502, 743, 369, 5361, 24717, 627, 286, 27140, 551, 69991, 19258, 582, 999, 7964, 499, 4250, 1522, 2290, 12974, 836, 477, 198, 286, 17383, 382, 286, 1442, 279, 1595, 6802, 1293, 859, 63, 5811, 374, 1511, 11, 279, 16792, 690, 198, 286, 60849, 349, 279, 2728, 836, 1701, 279, 60849, 859, 16792, 198, 286, 30354, 42475, 67203, 19258, 82, 19, 84, 63, 3677, 286, 1442, 279, 1595, 4412, 63, 5811, 374, 1511, 11, 279, 16792, 690, 387, 19426, 198, 286, 505, 279, 2728, 41307, 3637, 30354, 42475, 67203, 19258, 11081, 15153, 63, 4390, 286, 18715, 11, 279, 16792, 527, 19426, 505, 279, 1670, 3637, 382, 286, 578, 41307, 3637, 2038, 374, 264, 11240, 8649, 198, 286, 24717, 19440, 7039, 323, 2819, 22364, 311, 264, 41307, 3637, 198, 286, 477, 10756, 382, 286, 7181, 430, 279, 1595, 4412, 63, 5811, 374, 539, 18641, 449, 279, 198, 286, 1595, 6802, 1293, 859, 63, 5811, 382, 286, 18161, 512, 310, 836, 320, 678, 1680, 279, 836, 5938, 449, 279, 198, 394, 16792, 198, 310, 84596, 320, 30905, 1680, 279, 12974, 551, 1058, 19258, 58167, 941, 63, 311, 387, 1511, 449, 279, 198, 394, 16792, 198, 310, 10648, 320, 496, 1680, 279, 10648, 369, 279, 16792, 1198, 3060, 364, 21704, 756, 394, 364, 2381, 6629, 518, 477, 364, 10543, 1270, 310, 3003, 99927, 320, 396, 1680, 279, 12974, 39201, 19569, 315, 279, 198, 394, 16792, 11, 477, 2290, 369, 81956, 198, 310, 4287, 99927, 320, 396, 1680, 279, 12974, 4287, 19569, 315, 279, 198, 394, 16792, 11, 477, 2290, 369, 81956, 198, 310, 60849, 859, 320, 28123, 1680, 279, 16792, 311, 1005, 311, 60849, 349, 198, 394, 279, 2728, 836, 11, 477, 2290, 311, 539, 21953, 14614, 198, 394, 30354, 42475, 67203, 19258, 82, 19, 84, 25158, 310, 3637, 320, 8644, 1680, 279, 41307, 3637, 2038, 22364, 311, 279, 198, 394, 41307, 3637, 505, 902, 311, 21953, 279, 16792, 345, 394, 477, 2290, 369, 279, 1670, 3637, 30354, 42475, 67203, 19258, 11081, 15153, 63, 696, 286, 5295, 512, 310, 62360, 25, 279, 16792, 743, 8649, 279, 1510, 16792, 198, 394, 323, 279, 13945, 19426, 6305, 382, 286, 61411, 512, 310, 11717, 58167, 68913, 1480, 198, 310, 11717, 678, 81176, 198, 310, 11717, 678, 1480, 198, 310, 72171, 28123, 1726, 1480, 198, 310, 7943, 2757, 28123, 1480, 198, 310, 36364, 28123, 1480, 271, 14711, 6075, 512, 755, 923, 1214, 11, 836, 11, 84596, 11, 10648, 1151, 21704, 756, 310, 3003, 99927, 5980, 11, 4287, 99927, 5980, 11, 60849, 859, 5980, 345, 310, 3637, 5980, 997, 286, 4304, 11916, 999 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 11916, 999, 810, 16792, 311, 923, 311, 279, 1510, 743, 271, 286, 1115, 1749, 4375, 1093, 551, 69991, 19258, 582, 999, 7964, 3734, 430, 433, 11621, 279, 198, 286, 19426, 16792, 369, 264, 3254, 17383, 311, 264, 3048, 315, 279, 1510, 198, 286, 743, 11, 4619, 315, 6968, 264, 502, 743, 369, 5361, 24717, 627, 286, 27140, 551, 69991, 19258, 582, 999, 7964, 499, 4250, 1522, 2290, 12974, 836, 477, 198, 286, 17383, 382, 286, 1442, 279, 1595, 6802, 1293, 859, 63, 5811, 374, 1511, 11, 279, 16792, 690, 198, 286, 60849, 349, 279, 2728, 836, 1701, 279, 60849, 859, 16792, 198, 286, 30354, 42475, 67203, 19258, 82, 19, 84, 63, 3677, 286, 1442, 279, 1595, 4412, 63, 5811, 374, 1511, 11, 279, 16792, 690, 387, 19426, 198, 286, 505, 279, 2728, 41307, 3637, 30354, 42475, 67203, 19258, 11081, 15153, 63, 4390, 286, 18715, 11, 279, 16792, 527, 19426, 505, 279, 1670, 3637, 382, 286, 578, 41307, 3637, 2038, 374, 264, 11240, 8649, 198, 286, 24717, 19440, 7039, 323, 2819, 22364, 311, 264, 41307, 3637, 198, 286, 477, 10756, 382, 286, 7181, 430, 279, 1595, 4412, 63, 5811, 374, 539, 18641, 449, 279, 198, 286, 1595, 6802, 1293, 859, 63, 5811, 382, 286, 18161, 512, 310, 836, 320, 678, 1680, 279, 836, 5938, 449, 279, 198, 394, 16792, 198, 310, 84596, 320, 30905, 1680, 279, 12974, 551, 1058, 19258, 58167, 941, 63, 311, 387, 1511, 449, 279, 198, 394, 16792, 198, 310, 10648, 320, 496, 1680, 279, 10648, 369, 279, 16792, 1198, 3060, 364, 21704, 756, 394, 364, 2381, 6629, 518, 477, 364, 10543, 1270, 310, 3003, 99927, 320, 396, 1680, 279, 12974, 39201, 19569, 315, 279, 198, 394, 16792, 11, 477, 2290, 369, 81956, 198, 310, 4287, 99927, 320, 396, 1680, 279, 12974, 4287, 19569, 315, 279, 198, 394, 16792, 11, 477, 2290, 369, 81956, 198, 310, 60849, 859, 320, 28123, 1680, 279, 16792, 311, 1005, 311, 60849, 349, 198, 394, 279, 2728, 836, 11, 477, 2290, 311, 539, 21953, 14614, 198, 394, 30354, 42475, 67203, 19258, 82, 19, 84, 25158, 310, 3637, 320, 8644, 1680, 279, 41307, 3637, 2038, 22364, 311, 279, 198, 394, 41307, 3637, 505, 902, 311, 21953, 279, 16792, 345, 394, 477, 2290, 369, 279, 1670, 3637, 30354, 42475, 67203, 19258, 11081, 15153, 63, 696, 286, 5295, 512, 310, 62360, 25, 279, 16792, 743, 8649, 279, 1510, 16792, 198, 394, 323, 279, 13945, 19426, 6305, 382, 286, 61411, 512, 310, 11717, 58167, 68913, 1480, 198, 310, 11717, 678, 81176, 198, 310, 11717, 678, 1480, 198, 310, 72171, 28123, 1726, 1480, 198, 310, 7943, 2757, 28123, 1480, 198, 310, 36364, 28123, 1480, 271, 14711, 6075, 512, 755, 923, 1214, 11, 836, 11, 84596, 11, 10648, 1151, 21704, 756, 310, 3003, 99927, 5980, 11, 4287, 99927, 5980, 11, 60849, 859, 5980, 345, 310, 3637, 5980, 997, 286, 4304, 11916, 999 ]
yyuu/botornado
boto/ec2/connection.py
EC2Connection.get_instance_attribute
def get_instance_attribute(self, instance_id, attribute): """ Gets an attribute from an instance. :type instance_id: string :param instance_id: The Amazon id of the instance :type attribute: string :param attribute: The attribute you need information about Valid choices are: * instanceType|kernel|ramdisk|userData| * disableApiTermination| * instanceInitiatedShutdownBehavior| * rootDeviceName|blockDeviceMapping :rtype: :class:`boto.ec2.image.InstanceAttribute` :return: An InstanceAttribute object representing the value of the attribute requested """ params = {'InstanceId' : instance_id} if attribute: params['Attribute'] = attribute return self.get_object('DescribeInstanceAttribute', params, InstanceAttribute, verb='POST')
python
def get_instance_attribute(self, instance_id, attribute): """ Gets an attribute from an instance. :type instance_id: string :param instance_id: The Amazon id of the instance :type attribute: string :param attribute: The attribute you need information about Valid choices are: * instanceType|kernel|ramdisk|userData| * disableApiTermination| * instanceInitiatedShutdownBehavior| * rootDeviceName|blockDeviceMapping :rtype: :class:`boto.ec2.image.InstanceAttribute` :return: An InstanceAttribute object representing the value of the attribute requested """ params = {'InstanceId' : instance_id} if attribute: params['Attribute'] = attribute return self.get_object('DescribeInstanceAttribute', params, InstanceAttribute, verb='POST')
[ "def", "get_instance_attribute", "(", "self", ",", "instance_id", ",", "attribute", ")", ":", "params", "=", "{", "'InstanceId'", ":", "instance_id", "}", "if", "attribute", ":", "params", "[", "'Attribute'", "]", "=", "attribute", "return", "self", ".", "get_object", "(", "'DescribeInstanceAttribute'", ",", "params", ",", "InstanceAttribute", ",", "verb", "=", "'POST'", ")" ]
Gets an attribute from an instance. :type instance_id: string :param instance_id: The Amazon id of the instance :type attribute: string :param attribute: The attribute you need information about Valid choices are: * instanceType|kernel|ramdisk|userData| * disableApiTermination| * instanceInitiatedShutdownBehavior| * rootDeviceName|blockDeviceMapping :rtype: :class:`boto.ec2.image.InstanceAttribute` :return: An InstanceAttribute object representing the value of the attribute requested
[ "Gets", "an", "attribute", "from", "an", "instance", "." ]
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/connection.py#L761-L785
<|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 an attribute from an instance. :type instance_id: string :param instance_id: The Amazon id of the instance :type attribute: string :param attribute: The attribute you need information about Valid choices are: * instanceType|kernel|ramdisk|userData| * disableApiTermination| * instanceInitiatedShutdownBehavior| * rootDeviceName|blockDeviceMapping :rtype: :class:`boto.ec2.image.InstanceAttribute` :return: An InstanceAttribute object representing the value of the attribute requested ### Response: def get_instance_attribute(self, instance_id, attribute): """ Gets an attribute from an instance. :type instance_id: string :param instance_id: The Amazon id of the instance :type attribute: string :param attribute: The attribute you need information about Valid choices are: * instanceType|kernel|ramdisk|userData| * disableApiTermination| * instanceInitiatedShutdownBehavior| * rootDeviceName|blockDeviceMapping :rtype: :class:`boto.ec2.image.InstanceAttribute` :return: An InstanceAttribute object representing the value of the attribute requested """ params = {'InstanceId' : instance_id} if attribute: params['Attribute'] = attribute return self.get_object('DescribeInstanceAttribute', params, InstanceAttribute, verb='POST') <|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, 459, 7180, 505, 459, 2937, 382, 286, 551, 1337, 2937, 851, 25, 925, 198, 286, 551, 913, 2937, 851, 25, 578, 8339, 887, 315, 279, 2937, 271, 286, 551, 1337, 7180, 25, 925, 198, 286, 551, 913, 7180, 25, 578, 7180, 499, 1205, 2038, 922, 198, 3586, 7974, 11709, 527, 1473, 3586, 353, 2937, 941, 91, 24127, 91, 2453, 31596, 91, 43626, 7511, 3586, 353, 11404, 6700, 21902, 33196, 7511, 3586, 353, 2937, 3888, 10234, 63104, 23593, 7511, 3586, 353, 3789, 7130, 678, 91, 4677, 7130, 6950, 271, 286, 551, 33613, 25, 551, 1058, 19258, 65, 2117, 30288, 17, 7502, 12977, 3994, 4077, 286, 551, 693, 25, 1556, 19840, 3994, 1665, 14393, 279, 907, 315, 279, 198, 338, 7180, 11472, 271, 14711, 6075, 512, 755, 636, 12169, 17209, 1214, 11, 2937, 851, 11, 7180, 997, 286, 3270, 286, 10523, 459, 7180, 505, 459, 2937, 382, 286, 551, 1337, 2937, 851, 25, 925, 198, 286, 551, 913, 2937, 851, 25, 578, 8339, 887, 315, 279, 2937, 271, 286, 551, 1337, 7180, 25, 925, 198, 286, 551, 913, 7180, 25, 578, 7180, 499, 1205, 2038, 922, 198, 3586, 7974, 11709, 527, 1473, 3586, 353, 2937, 941, 91, 24127, 91, 2453, 31596, 91, 43626, 7511, 3586, 353, 11404, 6700, 21902, 33196, 7511, 3586, 353, 2937, 3888, 10234, 63104, 23593, 7511, 3586, 353, 3789, 7130, 678, 91, 4677, 7130, 6950, 271, 286, 551, 33613, 25, 551, 1058, 19258, 65, 2117, 30288, 17, 7502, 12977, 3994, 4077, 286, 551, 693, 25, 1556, 19840, 3994, 1665, 14393, 279, 907, 315, 279, 198, 338, 7180, 11472, 198, 286, 3270, 286, 3712, 284, 5473, 67018, 6, 551, 2937, 851, 534, 286, 422, 7180, 512, 310, 3712, 681, 3994, 663, 284, 7180, 198, 286, 471, 659, 673, 5427, 493, 75885, 2584, 3994, 518, 3712, 345, 7714, 19840, 3994, 11, 19120, 1151, 3019, 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,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 459, 7180, 505, 459, 2937, 382, 286, 551, 1337, 2937, 851, 25, 925, 198, 286, 551, 913, 2937, 851, 25, 578, 8339, 887, 315, 279, 2937, 271, 286, 551, 1337, 7180, 25, 925, 198, 286, 551, 913, 7180, 25, 578, 7180, 499, 1205, 2038, 922, 198, 3586, 7974, 11709, 527, 1473, 3586, 353, 2937, 941, 91, 24127, 91, 2453, 31596, 91, 43626, 7511, 3586, 353, 11404, 6700, 21902, 33196, 7511, 3586, 353, 2937, 3888, 10234, 63104, 23593, 7511, 3586, 353, 3789, 7130, 678, 91, 4677, 7130, 6950, 271, 286, 551, 33613, 25, 551, 1058, 19258, 65, 2117, 30288, 17, 7502, 12977, 3994, 4077, 286, 551, 693, 25, 1556, 19840, 3994, 1665, 14393, 279, 907, 315, 279, 198, 338, 7180, 11472, 271, 14711, 6075, 512, 755, 636, 12169, 17209, 1214, 11, 2937, 851, 11, 7180, 997, 286, 3270, 286, 10523, 459, 7180, 505, 459, 2937, 382, 286, 551, 1337, 2937, 851, 25, 925, 198, 286, 551, 913, 2937, 851, 25, 578, 8339, 887, 315, 279, 2937, 271, 286, 551, 1337, 7180, 25, 925, 198, 286, 551, 913, 7180, 25, 578, 7180, 499, 1205, 2038, 922, 198, 3586, 7974, 11709, 527, 1473, 3586, 353, 2937, 941, 91, 24127, 91, 2453, 31596, 91, 43626, 7511, 3586, 353, 11404, 6700, 21902, 33196, 7511, 3586, 353, 2937, 3888, 10234, 63104, 23593, 7511, 3586, 353, 3789, 7130, 678, 91, 4677, 7130, 6950, 271, 286, 551, 33613, 25, 551, 1058, 19258, 65, 2117, 30288, 17, 7502, 12977, 3994, 4077, 286, 551, 693, 25, 1556, 19840, 3994, 1665, 14393, 279, 907, 315, 279, 198, 338, 7180, 11472, 198, 286, 3270, 286, 3712, 284, 5473, 67018, 6, 551, 2937, 851, 534, 286, 422, 7180, 512, 310, 3712, 681, 3994, 663, 284, 7180, 198, 286, 471, 659, 673, 5427, 493, 75885, 2584, 3994, 518, 3712, 345, 7714, 19840, 3994, 11, 19120, 1151, 3019, 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 ]
msuozzo/Aduro
aduro/events.py
UpdateEvent.from_str
def from_str(string): """Generate a `SetFinishedEvent` object from a string """ match = re.match(r'^UPDATE (.+)$', string) if match: parsed_date = dateutil.parser.parse(match.group(1), ignoretz=True) return UpdateEvent(parsed_date) else: raise EventParseError
python
def from_str(string): """Generate a `SetFinishedEvent` object from a string """ match = re.match(r'^UPDATE (.+)$', string) if match: parsed_date = dateutil.parser.parse(match.group(1), ignoretz=True) return UpdateEvent(parsed_date) else: raise EventParseError
[ "def", "from_str", "(", "string", ")", ":", "match", "=", "re", ".", "match", "(", "r'^UPDATE (.+)$'", ",", "string", ")", "if", "match", ":", "parsed_date", "=", "dateutil", ".", "parser", ".", "parse", "(", "match", ".", "group", "(", "1", ")", ",", "ignoretz", "=", "True", ")", "return", "UpdateEvent", "(", "parsed_date", ")", "else", ":", "raise", "EventParseError" ]
Generate a `SetFinishedEvent` object from a string
[ "Generate", "a", "SetFinishedEvent", "object", "from", "a", "string" ]
train
https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/aduro/events.py#L165-L173
<|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 a `SetFinishedEvent` object from a string ### Response: def from_str(string): """Generate a `SetFinishedEvent` object from a string """ match = re.match(r'^UPDATE (.+)$', string) if match: parsed_date = dateutil.parser.parse(match.group(1), ignoretz=True) return UpdateEvent(parsed_date) else: raise EventParseError <|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, 264, 1595, 1681, 25934, 1585, 63, 1665, 505, 264, 925, 271, 14711, 6075, 512, 755, 505, 2966, 3693, 997, 286, 4304, 32215, 264, 1595, 1681, 25934, 1585, 63, 1665, 505, 264, 925, 198, 286, 3270, 286, 2489, 284, 312, 11319, 2666, 20826, 9422, 30565, 10, 15437, 518, 925, 340, 286, 422, 2489, 512, 310, 16051, 4257, 284, 2457, 1338, 26699, 4736, 26473, 6306, 7, 16, 705, 10240, 38692, 3702, 340, 310, 471, 5666, 1585, 49562, 4257, 340, 286, 775, 512, 310, 4933, 3749, 14802, 1480, 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, 128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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 ]
[ 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, 264, 1595, 1681, 25934, 1585, 63, 1665, 505, 264, 925, 271, 14711, 6075, 512, 755, 505, 2966, 3693, 997, 286, 4304, 32215, 264, 1595, 1681, 25934, 1585, 63, 1665, 505, 264, 925, 198, 286, 3270, 286, 2489, 284, 312, 11319, 2666, 20826, 9422, 30565, 10, 15437, 518, 925, 340, 286, 422, 2489, 512, 310, 16051, 4257, 284, 2457, 1338, 26699, 4736, 26473, 6306, 7, 16, 705, 10240, 38692, 3702, 340, 310, 471, 5666, 1585, 49562, 4257, 340, 286, 775, 512, 310, 4933, 3749, 14802, 1480, 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 ]
juju/charm-helpers
charmhelpers/core/host.py
restart_on_change_helper
def restart_on_change_helper(lambda_f, restart_map, stopstart=False, restart_functions=None): """Helper function to perform the restart_on_change function. This is provided for decorators to restart services if files described in the restart_map have changed after an invocation of lambda_f(). @param lambda_f: function to call. @param restart_map: {file: [service, ...]} @param stopstart: whether to stop, start or restart a service @param restart_functions: nonstandard functions to use to restart services {svc: func, ...} @returns result of lambda_f() """ if restart_functions is None: restart_functions = {} checksums = {path: path_hash(path) for path in restart_map} r = lambda_f() # create a list of lists of the services to restart restarts = [restart_map[path] for path in restart_map if path_hash(path) != checksums[path]] # create a flat list of ordered services without duplicates from lists services_list = list(OrderedDict.fromkeys(itertools.chain(*restarts))) if services_list: actions = ('stop', 'start') if stopstart else ('restart',) for service_name in services_list: if service_name in restart_functions: restart_functions[service_name](service_name) else: for action in actions: service(action, service_name) return r
python
def restart_on_change_helper(lambda_f, restart_map, stopstart=False, restart_functions=None): """Helper function to perform the restart_on_change function. This is provided for decorators to restart services if files described in the restart_map have changed after an invocation of lambda_f(). @param lambda_f: function to call. @param restart_map: {file: [service, ...]} @param stopstart: whether to stop, start or restart a service @param restart_functions: nonstandard functions to use to restart services {svc: func, ...} @returns result of lambda_f() """ if restart_functions is None: restart_functions = {} checksums = {path: path_hash(path) for path in restart_map} r = lambda_f() # create a list of lists of the services to restart restarts = [restart_map[path] for path in restart_map if path_hash(path) != checksums[path]] # create a flat list of ordered services without duplicates from lists services_list = list(OrderedDict.fromkeys(itertools.chain(*restarts))) if services_list: actions = ('stop', 'start') if stopstart else ('restart',) for service_name in services_list: if service_name in restart_functions: restart_functions[service_name](service_name) else: for action in actions: service(action, service_name) return r
[ "def", "restart_on_change_helper", "(", "lambda_f", ",", "restart_map", ",", "stopstart", "=", "False", ",", "restart_functions", "=", "None", ")", ":", "if", "restart_functions", "is", "None", ":", "restart_functions", "=", "{", "}", "checksums", "=", "{", "path", ":", "path_hash", "(", "path", ")", "for", "path", "in", "restart_map", "}", "r", "=", "lambda_f", "(", ")", "# create a list of lists of the services to restart", "restarts", "=", "[", "restart_map", "[", "path", "]", "for", "path", "in", "restart_map", "if", "path_hash", "(", "path", ")", "!=", "checksums", "[", "path", "]", "]", "# create a flat list of ordered services without duplicates from lists", "services_list", "=", "list", "(", "OrderedDict", ".", "fromkeys", "(", "itertools", ".", "chain", "(", "*", "restarts", ")", ")", ")", "if", "services_list", ":", "actions", "=", "(", "'stop'", ",", "'start'", ")", "if", "stopstart", "else", "(", "'restart'", ",", ")", "for", "service_name", "in", "services_list", ":", "if", "service_name", "in", "restart_functions", ":", "restart_functions", "[", "service_name", "]", "(", "service_name", ")", "else", ":", "for", "action", "in", "actions", ":", "service", "(", "action", ",", "service_name", ")", "return", "r" ]
Helper function to perform the restart_on_change function. This is provided for decorators to restart services if files described in the restart_map have changed after an invocation of lambda_f(). @param lambda_f: function to call. @param restart_map: {file: [service, ...]} @param stopstart: whether to stop, start or restart a service @param restart_functions: nonstandard functions to use to restart services {svc: func, ...} @returns result of lambda_f()
[ "Helper", "function", "to", "perform", "the", "restart_on_change", "function", "." ]
train
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/host.py#L724-L756
<|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 perform the restart_on_change function. This is provided for decorators to restart services if files described in the restart_map have changed after an invocation of lambda_f(). @param lambda_f: function to call. @param restart_map: {file: [service, ...]} @param stopstart: whether to stop, start or restart a service @param restart_functions: nonstandard functions to use to restart services {svc: func, ...} @returns result of lambda_f() ### Response: def restart_on_change_helper(lambda_f, restart_map, stopstart=False, restart_functions=None): """Helper function to perform the restart_on_change function. This is provided for decorators to restart services if files described in the restart_map have changed after an invocation of lambda_f(). @param lambda_f: function to call. @param restart_map: {file: [service, ...]} @param stopstart: whether to stop, start or restart a service @param restart_functions: nonstandard functions to use to restart services {svc: func, ...} @returns result of lambda_f() """ if restart_functions is None: restart_functions = {} checksums = {path: path_hash(path) for path in restart_map} r = lambda_f() # create a list of lists of the services to restart restarts = [restart_map[path] for path in restart_map if path_hash(path) != checksums[path]] # create a flat list of ordered services without duplicates from lists services_list = list(OrderedDict.fromkeys(itertools.chain(*restarts))) if services_list: actions = ('stop', 'start') if stopstart else ('restart',) for service_name in services_list: if service_name in restart_functions: restart_functions[service_name](service_name) else: for action in actions: service(action, service_name) return r <|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, 5628, 734, 311, 2804, 279, 17460, 4570, 16326, 734, 382, 262, 1115, 374, 3984, 369, 63778, 311, 17460, 3600, 422, 3626, 7633, 198, 262, 304, 279, 17460, 5489, 617, 5614, 1306, 459, 29796, 315, 12741, 766, 368, 382, 262, 571, 913, 12741, 766, 25, 734, 311, 1650, 627, 262, 571, 913, 17460, 5489, 25, 314, 1213, 25, 510, 8095, 11, 2564, 24333, 262, 571, 913, 3009, 2527, 25, 3508, 311, 3009, 11, 1212, 477, 17460, 264, 2532, 198, 262, 571, 913, 17460, 32808, 25, 2536, 20885, 5865, 311, 1005, 311, 17460, 3600, 198, 4700, 314, 59194, 25, 2988, 11, 2564, 534, 262, 571, 4310, 1121, 315, 12741, 766, 2892, 14711, 6075, 512, 755, 17460, 4570, 16326, 10635, 18705, 766, 11, 17460, 5489, 11, 3009, 2527, 5725, 345, 6663, 17460, 32808, 5980, 997, 262, 4304, 5628, 734, 311, 2804, 279, 17460, 4570, 16326, 734, 382, 262, 1115, 374, 3984, 369, 63778, 311, 17460, 3600, 422, 3626, 7633, 198, 262, 304, 279, 17460, 5489, 617, 5614, 1306, 459, 29796, 315, 12741, 766, 368, 382, 262, 571, 913, 12741, 766, 25, 734, 311, 1650, 627, 262, 571, 913, 17460, 5489, 25, 314, 1213, 25, 510, 8095, 11, 2564, 24333, 262, 571, 913, 3009, 2527, 25, 3508, 311, 3009, 11, 1212, 477, 17460, 264, 2532, 198, 262, 571, 913, 17460, 32808, 25, 2536, 20885, 5865, 311, 1005, 311, 17460, 3600, 198, 4700, 314, 59194, 25, 2988, 11, 2564, 534, 262, 571, 4310, 1121, 315, 12741, 766, 746, 262, 3270, 262, 422, 17460, 32808, 374, 2290, 512, 286, 17460, 32808, 284, 5731, 262, 33629, 82, 284, 314, 2398, 25, 1853, 9127, 5698, 8, 369, 1853, 304, 17460, 5489, 534, 262, 436, 284, 12741, 766, 746, 262, 674, 1893, 264, 1160, 315, 11725, 315, 279, 3600, 311, 17460, 198, 262, 17460, 82, 284, 510, 51315, 5489, 63037, 933, 394, 369, 1853, 304, 17460, 5489, 198, 394, 422, 1853, 9127, 5698, 8, 976, 33629, 82, 63037, 14623, 262, 674, 1893, 264, 10269, 1160, 315, 11713, 3600, 2085, 43428, 505, 11725, 198, 262, 3600, 2062, 284, 1160, 40792, 291, 13755, 6521, 10786, 13641, 37416, 53141, 4163, 51315, 82, 6054, 262, 422, 3600, 2062, 512, 286, 6299, 284, 4417, 9684, 518, 364, 2527, 873, 422, 3009, 2527, 775, 4417, 51315, 96910, 286, 369, 2532, 1292, 304, 3600, 2062, 512, 310, 422, 2532, 1292, 304, 17460, 32808, 512, 394, 17460, 32808, 58, 8095, 1292, 9725, 8095, 1292, 340, 310, 775, 512, 394, 369, 1957, 304, 6299, 512, 504, 2532, 15665, 11, 2532, 1292, 340, 262, 471, 436, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
[ 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, 5628, 734, 311, 2804, 279, 17460, 4570, 16326, 734, 382, 262, 1115, 374, 3984, 369, 63778, 311, 17460, 3600, 422, 3626, 7633, 198, 262, 304, 279, 17460, 5489, 617, 5614, 1306, 459, 29796, 315, 12741, 766, 368, 382, 262, 571, 913, 12741, 766, 25, 734, 311, 1650, 627, 262, 571, 913, 17460, 5489, 25, 314, 1213, 25, 510, 8095, 11, 2564, 24333, 262, 571, 913, 3009, 2527, 25, 3508, 311, 3009, 11, 1212, 477, 17460, 264, 2532, 198, 262, 571, 913, 17460, 32808, 25, 2536, 20885, 5865, 311, 1005, 311, 17460, 3600, 198, 4700, 314, 59194, 25, 2988, 11, 2564, 534, 262, 571, 4310, 1121, 315, 12741, 766, 2892, 14711, 6075, 512, 755, 17460, 4570, 16326, 10635, 18705, 766, 11, 17460, 5489, 11, 3009, 2527, 5725, 345, 6663, 17460, 32808, 5980, 997, 262, 4304, 5628, 734, 311, 2804, 279, 17460, 4570, 16326, 734, 382, 262, 1115, 374, 3984, 369, 63778, 311, 17460, 3600, 422, 3626, 7633, 198, 262, 304, 279, 17460, 5489, 617, 5614, 1306, 459, 29796, 315, 12741, 766, 368, 382, 262, 571, 913, 12741, 766, 25, 734, 311, 1650, 627, 262, 571, 913, 17460, 5489, 25, 314, 1213, 25, 510, 8095, 11, 2564, 24333, 262, 571, 913, 3009, 2527, 25, 3508, 311, 3009, 11, 1212, 477, 17460, 264, 2532, 198, 262, 571, 913, 17460, 32808, 25, 2536, 20885, 5865, 311, 1005, 311, 17460, 3600, 198, 4700, 314, 59194, 25, 2988, 11, 2564, 534, 262, 571, 4310, 1121, 315, 12741, 766, 746, 262, 3270, 262, 422, 17460, 32808, 374, 2290, 512, 286, 17460, 32808, 284, 5731, 262, 33629, 82, 284, 314, 2398, 25, 1853, 9127, 5698, 8, 369, 1853, 304, 17460, 5489, 534, 262, 436, 284, 12741, 766, 746, 262, 674, 1893, 264, 1160, 315, 11725, 315, 279, 3600, 311, 17460, 198, 262, 17460, 82, 284, 510, 51315, 5489, 63037, 933, 394, 369, 1853, 304, 17460, 5489, 198, 394, 422, 1853, 9127, 5698, 8, 976, 33629, 82, 63037, 14623, 262, 674, 1893, 264, 10269, 1160, 315, 11713, 3600, 2085, 43428, 505, 11725, 198, 262, 3600, 2062, 284, 1160, 40792, 291, 13755, 6521, 10786, 13641, 37416, 53141, 4163, 51315, 82, 6054, 262, 422, 3600, 2062, 512, 286, 6299, 284, 4417, 9684, 518, 364, 2527, 873, 422, 3009, 2527, 775, 4417, 51315, 96910, 286, 369, 2532, 1292, 304, 3600, 2062, 512, 310, 422, 2532, 1292, 304, 17460, 32808, 512, 394, 17460, 32808, 58, 8095, 1292, 9725, 8095, 1292, 340, 310, 775, 512, 394, 369, 1957, 304, 6299, 512, 504, 2532, 15665, 11, 2532, 1292, 340, 262, 471, 436, 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 ]
BerkeleyAutomation/perception
perception/orthographic_intrinsics.py
OrthographicIntrinsics.save
def save(self, filename): """Save the CameraIntrinsics object to a .intr file. Parameters ---------- filename : :obj:`str` The .intr file to save the object to. Raises ------ ValueError If filename does not have the .intr extension. """ file_root, file_ext = os.path.splitext(filename) if file_ext.lower() != INTR_EXTENSION: raise ValueError('Extension %s not supported for OrhtographicIntrinsics. Must be stored with extension %s' %(file_ext, INTR_EXTENSION)) camera_intr_dict = copy.deepcopy(self.__dict__) f = open(filename, 'w') json.dump(camera_intr_dict, f) f.close()
python
def save(self, filename): """Save the CameraIntrinsics object to a .intr file. Parameters ---------- filename : :obj:`str` The .intr file to save the object to. Raises ------ ValueError If filename does not have the .intr extension. """ file_root, file_ext = os.path.splitext(filename) if file_ext.lower() != INTR_EXTENSION: raise ValueError('Extension %s not supported for OrhtographicIntrinsics. Must be stored with extension %s' %(file_ext, INTR_EXTENSION)) camera_intr_dict = copy.deepcopy(self.__dict__) f = open(filename, 'w') json.dump(camera_intr_dict, f) f.close()
[ "def", "save", "(", "self", ",", "filename", ")", ":", "file_root", ",", "file_ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "file_ext", ".", "lower", "(", ")", "!=", "INTR_EXTENSION", ":", "raise", "ValueError", "(", "'Extension %s not supported for OrhtographicIntrinsics. Must be stored with extension %s'", "%", "(", "file_ext", ",", "INTR_EXTENSION", ")", ")", "camera_intr_dict", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "f", "=", "open", "(", "filename", ",", "'w'", ")", "json", ".", "dump", "(", "camera_intr_dict", ",", "f", ")", "f", ".", "close", "(", ")" ]
Save the CameraIntrinsics object to a .intr file. Parameters ---------- filename : :obj:`str` The .intr file to save the object to. Raises ------ ValueError If filename does not have the .intr extension.
[ "Save", "the", "CameraIntrinsics", "object", "to", "a", ".", "intr", "file", "." ]
train
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L285-L305
<|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: Save the CameraIntrinsics object to a .intr file. Parameters ---------- filename : :obj:`str` The .intr file to save the object to. Raises ------ ValueError If filename does not have the .intr extension. ### Response: def save(self, filename): """Save the CameraIntrinsics object to a .intr file. Parameters ---------- filename : :obj:`str` The .intr file to save the object to. Raises ------ ValueError If filename does not have the .intr extension. """ file_root, file_ext = os.path.splitext(filename) if file_ext.lower() != INTR_EXTENSION: raise ValueError('Extension %s not supported for OrhtographicIntrinsics. Must be stored with extension %s' %(file_ext, INTR_EXTENSION)) camera_intr_dict = copy.deepcopy(self.__dict__) f = open(filename, 'w') json.dump(camera_intr_dict, f) f.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, 8960, 279, 14669, 644, 376, 68202, 1665, 311, 264, 662, 59888, 1052, 382, 286, 13831, 198, 286, 31423, 286, 3986, 551, 551, 2347, 19258, 496, 4077, 310, 578, 662, 59888, 1052, 311, 3665, 279, 1665, 311, 382, 286, 61411, 198, 286, 11556, 7233, 286, 15764, 198, 310, 1442, 3986, 1587, 539, 617, 279, 662, 59888, 9070, 382, 14711, 6075, 512, 755, 3665, 1214, 11, 3986, 997, 286, 4304, 8960, 279, 14669, 644, 376, 68202, 1665, 311, 264, 662, 59888, 1052, 382, 286, 13831, 198, 286, 31423, 286, 3986, 551, 551, 2347, 19258, 496, 4077, 310, 578, 662, 59888, 1052, 311, 3665, 279, 1665, 311, 382, 286, 61411, 198, 286, 11556, 7233, 286, 15764, 198, 310, 1442, 3986, 1587, 539, 617, 279, 662, 59888, 9070, 627, 286, 3270, 286, 1052, 13290, 11, 1052, 10129, 284, 2709, 3960, 67406, 11202, 340, 286, 422, 1052, 10129, 18564, 368, 976, 2006, 2434, 38112, 512, 310, 4933, 15764, 493, 12318, 1034, 82, 539, 7396, 369, 2582, 427, 12968, 644, 376, 68202, 13, 15832, 387, 9967, 449, 9070, 1034, 82, 6, 21921, 1213, 10129, 11, 2006, 2434, 38112, 4489, 286, 6382, 60988, 5356, 284, 3048, 52748, 1214, 4952, 8644, 24010, 286, 282, 284, 1825, 11202, 11, 364, 86, 1329, 286, 3024, 28026, 49146, 60988, 5356, 11, 282, 340, 286, 282, 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, 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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 ]
[ 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, 8960, 279, 14669, 644, 376, 68202, 1665, 311, 264, 662, 59888, 1052, 382, 286, 13831, 198, 286, 31423, 286, 3986, 551, 551, 2347, 19258, 496, 4077, 310, 578, 662, 59888, 1052, 311, 3665, 279, 1665, 311, 382, 286, 61411, 198, 286, 11556, 7233, 286, 15764, 198, 310, 1442, 3986, 1587, 539, 617, 279, 662, 59888, 9070, 382, 14711, 6075, 512, 755, 3665, 1214, 11, 3986, 997, 286, 4304, 8960, 279, 14669, 644, 376, 68202, 1665, 311, 264, 662, 59888, 1052, 382, 286, 13831, 198, 286, 31423, 286, 3986, 551, 551, 2347, 19258, 496, 4077, 310, 578, 662, 59888, 1052, 311, 3665, 279, 1665, 311, 382, 286, 61411, 198, 286, 11556, 7233, 286, 15764, 198, 310, 1442, 3986, 1587, 539, 617, 279, 662, 59888, 9070, 627, 286, 3270, 286, 1052, 13290, 11, 1052, 10129, 284, 2709, 3960, 67406, 11202, 340, 286, 422, 1052, 10129, 18564, 368, 976, 2006, 2434, 38112, 512, 310, 4933, 15764, 493, 12318, 1034, 82, 539, 7396, 369, 2582, 427, 12968, 644, 376, 68202, 13, 15832, 387, 9967, 449, 9070, 1034, 82, 6, 21921, 1213, 10129, 11, 2006, 2434, 38112, 4489, 286, 6382, 60988, 5356, 284, 3048, 52748, 1214, 4952, 8644, 24010, 286, 282, 284, 1825, 11202, 11, 364, 86, 1329, 286, 3024, 28026, 49146, 60988, 5356, 11, 282, 340, 286, 282, 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 ]
dustin/twitty-twister
twittytwister/twitter.py
Twitter.list_friends
def list_friends(self, delegate, user=None, params={}, extra_args=None, page_delegate=None): """Get the list of friends for a user. Calls the delegate with each user object found.""" if user: url = '/statuses/friends/' + user + '.xml' else: url = '/statuses/friends.xml' return self.__get_maybe_paging(url, delegate, params, txml.PagedUserList, extra_args, page_delegate)
python
def list_friends(self, delegate, user=None, params={}, extra_args=None, page_delegate=None): """Get the list of friends for a user. Calls the delegate with each user object found.""" if user: url = '/statuses/friends/' + user + '.xml' else: url = '/statuses/friends.xml' return self.__get_maybe_paging(url, delegate, params, txml.PagedUserList, extra_args, page_delegate)
[ "def", "list_friends", "(", "self", ",", "delegate", ",", "user", "=", "None", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ",", "page_delegate", "=", "None", ")", ":", "if", "user", ":", "url", "=", "'/statuses/friends/'", "+", "user", "+", "'.xml'", "else", ":", "url", "=", "'/statuses/friends.xml'", "return", "self", ".", "__get_maybe_paging", "(", "url", ",", "delegate", ",", "params", ",", "txml", ".", "PagedUserList", ",", "extra_args", ",", "page_delegate", ")" ]
Get the list of friends for a user. Calls the delegate with each user object found.
[ "Get", "the", "list", "of", "friends", "for", "a", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L457-L466
<|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 the list of friends for a user. Calls the delegate with each user object found. ### Response: def list_friends(self, delegate, user=None, params={}, extra_args=None, page_delegate=None): """Get the list of friends for a user. Calls the delegate with each user object found.""" if user: url = '/statuses/friends/' + user + '.xml' else: url = '/statuses/friends.xml' return self.__get_maybe_paging(url, delegate, params, txml.PagedUserList, extra_args, page_delegate) <|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, 279, 1160, 315, 4885, 369, 264, 1217, 382, 286, 41227, 279, 13685, 449, 1855, 1217, 1665, 1766, 382, 14711, 6075, 512, 755, 1160, 76530, 1214, 11, 13685, 11, 1217, 5980, 11, 3712, 68525, 5066, 8550, 5980, 11, 2199, 56412, 5980, 997, 286, 4304, 1991, 279, 1160, 315, 4885, 369, 264, 1217, 382, 286, 41227, 279, 13685, 449, 1855, 1217, 1665, 1766, 14781, 286, 422, 1217, 512, 310, 2576, 284, 3434, 66453, 6801, 12337, 11576, 489, 1217, 489, 6389, 6591, 1270, 286, 775, 512, 310, 2576, 284, 3434, 66453, 6801, 12337, 9205, 3961, 286, 471, 659, 4952, 456, 722, 50891, 623, 4210, 6659, 11, 13685, 11, 3712, 11, 259, 6591, 1087, 3359, 1502, 861, 11, 5066, 8550, 11, 2199, 56412, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 279, 1160, 315, 4885, 369, 264, 1217, 382, 286, 41227, 279, 13685, 449, 1855, 1217, 1665, 1766, 382, 14711, 6075, 512, 755, 1160, 76530, 1214, 11, 13685, 11, 1217, 5980, 11, 3712, 68525, 5066, 8550, 5980, 11, 2199, 56412, 5980, 997, 286, 4304, 1991, 279, 1160, 315, 4885, 369, 264, 1217, 382, 286, 41227, 279, 13685, 449, 1855, 1217, 1665, 1766, 14781, 286, 422, 1217, 512, 310, 2576, 284, 3434, 66453, 6801, 12337, 11576, 489, 1217, 489, 6389, 6591, 1270, 286, 775, 512, 310, 2576, 284, 3434, 66453, 6801, 12337, 9205, 3961, 286, 471, 659, 4952, 456, 722, 50891, 623, 4210, 6659, 11, 13685, 11, 3712, 11, 259, 6591, 1087, 3359, 1502, 861, 11, 5066, 8550, 11, 2199, 56412, 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 ]
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
ModelAdmin.get_templates
def get_templates(self, action='index'): """ Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class. """ app = self.opts.app_label model_name = self.opts.model_name return [ 'wagtailmodeladmin/%s/%s/%s.html' % (app, model_name, action), 'wagtailmodeladmin/%s/%s.html' % (app, action), 'wagtailmodeladmin/%s.html' % (action,), ]
python
def get_templates(self, action='index'): """ Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class. """ app = self.opts.app_label model_name = self.opts.model_name return [ 'wagtailmodeladmin/%s/%s/%s.html' % (app, model_name, action), 'wagtailmodeladmin/%s/%s.html' % (app, action), 'wagtailmodeladmin/%s.html' % (action,), ]
[ "def", "get_templates", "(", "self", ",", "action", "=", "'index'", ")", ":", "app", "=", "self", ".", "opts", ".", "app_label", "model_name", "=", "self", ".", "opts", ".", "model_name", "return", "[", "'wagtailmodeladmin/%s/%s/%s.html'", "%", "(", "app", ",", "model_name", ",", "action", ")", ",", "'wagtailmodeladmin/%s/%s.html'", "%", "(", "app", ",", "action", ")", ",", "'wagtailmodeladmin/%s.html'", "%", "(", "action", ",", ")", ",", "]" ]
Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class.
[ "Utility", "function", "that", "provides", "a", "list", "of", "templates", "to", "try", "for", "a", "given", "view", "when", "the", "template", "isn", "t", "overridden", "by", "one", "of", "the", "template", "attributes", "on", "the", "class", "." ]
train
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L403-L415
<|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: Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class. ### Response: def get_templates(self, action='index'): """ Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template attributes on the class. """ app = self.opts.app_label model_name = self.opts.model_name return [ 'wagtailmodeladmin/%s/%s/%s.html' % (app, model_name, action), 'wagtailmodeladmin/%s/%s.html' % (app, action), 'wagtailmodeladmin/%s.html' % (action,), ] <|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, 19750, 734, 430, 5825, 264, 1160, 315, 20506, 311, 1456, 369, 264, 2728, 198, 286, 1684, 11, 994, 279, 3896, 4536, 956, 52556, 555, 832, 315, 279, 3896, 198, 286, 8365, 389, 279, 538, 382, 14711, 6075, 512, 755, 636, 50626, 1214, 11, 1957, 1151, 1275, 11290, 286, 3270, 286, 26230, 734, 430, 5825, 264, 1160, 315, 20506, 311, 1456, 369, 264, 2728, 198, 286, 1684, 11, 994, 279, 3896, 4536, 956, 52556, 555, 832, 315, 279, 3896, 198, 286, 8365, 389, 279, 538, 627, 286, 3270, 286, 917, 284, 659, 57122, 1632, 6234, 198, 286, 1646, 1292, 284, 659, 57122, 3272, 1292, 198, 286, 471, 2330, 310, 364, 86, 351, 14928, 2590, 2953, 12915, 82, 12915, 82, 12915, 82, 2628, 6, 1034, 320, 680, 11, 1646, 1292, 11, 1957, 1350, 310, 364, 86, 351, 14928, 2590, 2953, 12915, 82, 12915, 82, 2628, 6, 1034, 320, 680, 11, 1957, 1350, 310, 364, 86, 351, 14928, 2590, 2953, 12915, 82, 2628, 6, 1034, 320, 1335, 53538, 286, 5243, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 19750, 734, 430, 5825, 264, 1160, 315, 20506, 311, 1456, 369, 264, 2728, 198, 286, 1684, 11, 994, 279, 3896, 4536, 956, 52556, 555, 832, 315, 279, 3896, 198, 286, 8365, 389, 279, 538, 382, 14711, 6075, 512, 755, 636, 50626, 1214, 11, 1957, 1151, 1275, 11290, 286, 3270, 286, 26230, 734, 430, 5825, 264, 1160, 315, 20506, 311, 1456, 369, 264, 2728, 198, 286, 1684, 11, 994, 279, 3896, 4536, 956, 52556, 555, 832, 315, 279, 3896, 198, 286, 8365, 389, 279, 538, 627, 286, 3270, 286, 917, 284, 659, 57122, 1632, 6234, 198, 286, 1646, 1292, 284, 659, 57122, 3272, 1292, 198, 286, 471, 2330, 310, 364, 86, 351, 14928, 2590, 2953, 12915, 82, 12915, 82, 12915, 82, 2628, 6, 1034, 320, 680, 11, 1646, 1292, 11, 1957, 1350, 310, 364, 86, 351, 14928, 2590, 2953, 12915, 82, 12915, 82, 2628, 6, 1034, 320, 680, 11, 1957, 1350, 310, 364, 86, 351, 14928, 2590, 2953, 12915, 82, 2628, 6, 1034, 320, 1335, 53538, 286, 5243, 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 ]
epfl-lts2/pygsp
pygsp/utils.py
import_classes
def import_classes(names, src, dst): """Import classes in package from their implementation modules.""" for name in names: module = importlib.import_module('pygsp.' + src + '.' + name.lower()) setattr(sys.modules['pygsp.' + dst], name, getattr(module, name))
python
def import_classes(names, src, dst): """Import classes in package from their implementation modules.""" for name in names: module = importlib.import_module('pygsp.' + src + '.' + name.lower()) setattr(sys.modules['pygsp.' + dst], name, getattr(module, name))
[ "def", "import_classes", "(", "names", ",", "src", ",", "dst", ")", ":", "for", "name", "in", "names", ":", "module", "=", "importlib", ".", "import_module", "(", "'pygsp.'", "+", "src", "+", "'.'", "+", "name", ".", "lower", "(", ")", ")", "setattr", "(", "sys", ".", "modules", "[", "'pygsp.'", "+", "dst", "]", ",", "name", ",", "getattr", "(", "module", ",", "name", ")", ")" ]
Import classes in package from their implementation modules.
[ "Import", "classes", "in", "package", "from", "their", "implementation", "modules", "." ]
train
https://github.com/epfl-lts2/pygsp/blob/8ce5bde39206129287375af24fdbcd7edddca8c5/pygsp/utils.py#L355-L359
<|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: Import classes in package from their implementation modules. ### Response: def import_classes(names, src, dst): """Import classes in package from their implementation modules.""" for name in names: module = importlib.import_module('pygsp.' + src + '.' + name.lower()) setattr(sys.modules['pygsp.' + dst], name, getattr(module, 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, 11772, 6989, 304, 6462, 505, 872, 8292, 13761, 382, 14711, 6075, 512, 755, 1179, 17255, 41501, 11, 2338, 11, 10875, 997, 262, 4304, 11772, 6989, 304, 6462, 505, 872, 8292, 13761, 14781, 262, 369, 836, 304, 5144, 512, 286, 4793, 284, 1179, 2808, 35997, 10983, 493, 3368, 70, 2203, 3238, 489, 2338, 489, 25360, 489, 836, 18564, 2455, 286, 62214, 18635, 27904, 681, 3368, 70, 2203, 3238, 489, 10875, 1145, 836, 11, 31097, 19669, 11, 836, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 11772, 6989, 304, 6462, 505, 872, 8292, 13761, 382, 14711, 6075, 512, 755, 1179, 17255, 41501, 11, 2338, 11, 10875, 997, 262, 4304, 11772, 6989, 304, 6462, 505, 872, 8292, 13761, 14781, 262, 369, 836, 304, 5144, 512, 286, 4793, 284, 1179, 2808, 35997, 10983, 493, 3368, 70, 2203, 3238, 489, 2338, 489, 25360, 489, 836, 18564, 2455, 286, 62214, 18635, 27904, 681, 3368, 70, 2203, 3238, 489, 10875, 1145, 836, 11, 31097, 19669, 11, 836, 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 ]
Atomistica/atomistica
src/python/atomistica/analysis.py
stress_invariants
def stress_invariants(s): """Receives a list of stress tensors and returns the three invariants. Return hydrostatic pressure, octahedral shear stress and J3 """ s = np.asarray(s) if s.shape == (6,): s = s.reshape(1,-1) elif s.shape == (3,3): s = s.reshape(1,-1,-1) if len(s.shape) == 3: s = np.transpose([s[:,0,0],s[:,1,1],s[:,2,2], (s[:,0,1]+s[:,1,0])/2, (s[:,1,2]+s[:,2,1])/2, (s[:,2,0]+s[:,0,2])/2]) I1 = s[:,0]+s[:,1]+s[:,2] I2 = s[:,0]*s[:,1]+s[:,1]*s[:,2]+s[:,2]*s[:,0]-s[:,3]**2-s[:,4]**2-s[:,5]**2 I3 = s[:,0]*s[:,1]*s[:,2]+2*s[:,3]*s[:,4]*s[:,5]-s[:,3]**2*s[:,2]-s[:,4]**2*s[:,0]-s[:,5]**2*s[:,1] J2 = I1**2/3-I2 J3 = 2*I1**3/27-I1*I2/3+I3 # Return hydrostatic pressure, octahedral shear stress and J3 return -I1/3, np.sqrt(2*J2/3), J3
python
def stress_invariants(s): """Receives a list of stress tensors and returns the three invariants. Return hydrostatic pressure, octahedral shear stress and J3 """ s = np.asarray(s) if s.shape == (6,): s = s.reshape(1,-1) elif s.shape == (3,3): s = s.reshape(1,-1,-1) if len(s.shape) == 3: s = np.transpose([s[:,0,0],s[:,1,1],s[:,2,2], (s[:,0,1]+s[:,1,0])/2, (s[:,1,2]+s[:,2,1])/2, (s[:,2,0]+s[:,0,2])/2]) I1 = s[:,0]+s[:,1]+s[:,2] I2 = s[:,0]*s[:,1]+s[:,1]*s[:,2]+s[:,2]*s[:,0]-s[:,3]**2-s[:,4]**2-s[:,5]**2 I3 = s[:,0]*s[:,1]*s[:,2]+2*s[:,3]*s[:,4]*s[:,5]-s[:,3]**2*s[:,2]-s[:,4]**2*s[:,0]-s[:,5]**2*s[:,1] J2 = I1**2/3-I2 J3 = 2*I1**3/27-I1*I2/3+I3 # Return hydrostatic pressure, octahedral shear stress and J3 return -I1/3, np.sqrt(2*J2/3), J3
[ "def", "stress_invariants", "(", "s", ")", ":", "s", "=", "np", ".", "asarray", "(", "s", ")", "if", "s", ".", "shape", "==", "(", "6", ",", ")", ":", "s", "=", "s", ".", "reshape", "(", "1", ",", "-", "1", ")", "elif", "s", ".", "shape", "==", "(", "3", ",", "3", ")", ":", "s", "=", "s", ".", "reshape", "(", "1", ",", "-", "1", ",", "-", "1", ")", "if", "len", "(", "s", ".", "shape", ")", "==", "3", ":", "s", "=", "np", ".", "transpose", "(", "[", "s", "[", ":", ",", "0", ",", "0", "]", ",", "s", "[", ":", ",", "1", ",", "1", "]", ",", "s", "[", ":", ",", "2", ",", "2", "]", ",", "(", "s", "[", ":", ",", "0", ",", "1", "]", "+", "s", "[", ":", ",", "1", ",", "0", "]", ")", "/", "2", ",", "(", "s", "[", ":", ",", "1", ",", "2", "]", "+", "s", "[", ":", ",", "2", ",", "1", "]", ")", "/", "2", ",", "(", "s", "[", ":", ",", "2", ",", "0", "]", "+", "s", "[", ":", ",", "0", ",", "2", "]", ")", "/", "2", "]", ")", "I1", "=", "s", "[", ":", ",", "0", "]", "+", "s", "[", ":", ",", "1", "]", "+", "s", "[", ":", ",", "2", "]", "I2", "=", "s", "[", ":", ",", "0", "]", "*", "s", "[", ":", ",", "1", "]", "+", "s", "[", ":", ",", "1", "]", "*", "s", "[", ":", ",", "2", "]", "+", "s", "[", ":", ",", "2", "]", "*", "s", "[", ":", ",", "0", "]", "-", "s", "[", ":", ",", "3", "]", "**", "2", "-", "s", "[", ":", ",", "4", "]", "**", "2", "-", "s", "[", ":", ",", "5", "]", "**", "2", "I3", "=", "s", "[", ":", ",", "0", "]", "*", "s", "[", ":", ",", "1", "]", "*", "s", "[", ":", ",", "2", "]", "+", "2", "*", "s", "[", ":", ",", "3", "]", "*", "s", "[", ":", ",", "4", "]", "*", "s", "[", ":", ",", "5", "]", "-", "s", "[", ":", ",", "3", "]", "**", "2", "*", "s", "[", ":", ",", "2", "]", "-", "s", "[", ":", ",", "4", "]", "**", "2", "*", "s", "[", ":", ",", "0", "]", "-", "s", "[", ":", ",", "5", "]", "**", "2", "*", "s", "[", ":", ",", "1", "]", "J2", "=", "I1", "**", "2", "/", "3", "-", "I2", "J3", "=", "2", "*", "I1", "**", "3", "/", "27", "-", "I1", "*", "I2", "/", "3", "+", "I3", "# Return hydrostatic pressure, octahedral shear stress and J3", "return", "-", "I1", "/", "3", ",", "np", ".", "sqrt", "(", "2", "*", "J2", "/", "3", ")", ",", "J3" ]
Receives a list of stress tensors and returns the three invariants. Return hydrostatic pressure, octahedral shear stress and J3
[ "Receives", "a", "list", "of", "stress", "tensors", "and", "returns", "the", "three", "invariants", ".", "Return", "hydrostatic", "pressure", "octahedral", "shear", "stress", "and", "J3" ]
train
https://github.com/Atomistica/atomistica/blob/5ed79d776c92b91a566be22615bfb304ecc75db7/src/python/atomistica/analysis.py#L181-L203
<|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: Receives a list of stress tensors and returns the three invariants. Return hydrostatic pressure, octahedral shear stress and J3 ### Response: def stress_invariants(s): """Receives a list of stress tensors and returns the three invariants. Return hydrostatic pressure, octahedral shear stress and J3 """ s = np.asarray(s) if s.shape == (6,): s = s.reshape(1,-1) elif s.shape == (3,3): s = s.reshape(1,-1,-1) if len(s.shape) == 3: s = np.transpose([s[:,0,0],s[:,1,1],s[:,2,2], (s[:,0,1]+s[:,1,0])/2, (s[:,1,2]+s[:,2,1])/2, (s[:,2,0]+s[:,0,2])/2]) I1 = s[:,0]+s[:,1]+s[:,2] I2 = s[:,0]*s[:,1]+s[:,1]*s[:,2]+s[:,2]*s[:,0]-s[:,3]**2-s[:,4]**2-s[:,5]**2 I3 = s[:,0]*s[:,1]*s[:,2]+2*s[:,3]*s[:,4]*s[:,5]-s[:,3]**2*s[:,2]-s[:,4]**2*s[:,0]-s[:,5]**2*s[:,1] J2 = I1**2/3-I2 J3 = 2*I1**3/27-I1*I2/3+I3 # Return hydrostatic pressure, octahedral shear stress and J3 return -I1/3, np.sqrt(2*J2/3), J3 <|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, 697, 346, 1924, 264, 1160, 315, 8631, 78187, 323, 4780, 279, 2380, 304, 55711, 627, 996, 3494, 17055, 2020, 7410, 11, 18998, 1494, 36620, 65344, 8631, 323, 622, 18, 271, 14711, 6075, 512, 755, 8631, 1265, 55711, 1161, 997, 262, 4304, 697, 346, 1924, 264, 1160, 315, 8631, 78187, 323, 4780, 279, 2380, 304, 55711, 627, 996, 3494, 17055, 2020, 7410, 11, 18998, 1494, 36620, 65344, 8631, 323, 622, 18, 198, 262, 3270, 262, 274, 284, 2660, 39178, 1161, 340, 262, 422, 274, 7201, 624, 320, 21, 11, 997, 286, 274, 284, 274, 23967, 7, 16, 5106, 16, 340, 262, 4508, 274, 7201, 624, 320, 18, 11, 18, 997, 286, 274, 284, 274, 23967, 7, 16, 5106, 16, 5106, 16, 340, 262, 422, 2479, 1161, 7201, 8, 624, 220, 18, 512, 286, 274, 284, 2660, 36405, 2625, 82, 9821, 15, 11, 15, 1145, 82, 9821, 16, 11, 16, 1145, 82, 9821, 17, 11, 17, 1282, 3586, 320, 82, 9821, 15, 11, 16, 7727, 82, 9821, 16, 11, 15, 40293, 17, 345, 3586, 320, 82, 9821, 16, 11, 17, 7727, 82, 9821, 17, 11, 16, 40293, 17, 345, 3586, 320, 82, 9821, 17, 11, 15, 7727, 82, 9821, 15, 11, 17, 40293, 17, 2608, 262, 358, 16, 284, 274, 9821, 15, 7727, 82, 9821, 16, 7727, 82, 9821, 17, 933, 262, 358, 17, 284, 274, 9821, 15, 8632, 82, 9821, 16, 7727, 82, 9821, 16, 8632, 82, 9821, 17, 7727, 82, 9821, 17, 8632, 82, 9821, 15, 11958, 82, 9821, 18, 79441, 17, 1355, 9821, 19, 79441, 17, 1355, 9821, 20, 79441, 17, 198, 262, 358, 18, 284, 274, 9821, 15, 8632, 82, 9821, 16, 8632, 82, 9821, 17, 7727, 17, 34554, 9821, 18, 8632, 82, 9821, 19, 8632, 82, 9821, 20, 11958, 82, 9821, 18, 79441, 17, 34554, 9821, 17, 11958, 82, 9821, 19, 79441, 17, 34554, 9821, 15, 11958, 82, 9821, 20, 79441, 17, 34554, 9821, 16, 2595, 262, 622, 17, 284, 358, 16, 334, 17, 14, 18, 22197, 17, 198, 262, 622, 18, 284, 220, 17, 90342, 16, 334, 18, 14, 1544, 22197, 16, 90342, 17, 14, 18, 10, 40, 18, 271, 262, 674, 3494, 17055, 2020, 7410, 11, 18998, 1494, 36620, 65344, 8631, 323, 622, 18, 198, 262, 471, 482, 40, 16, 14, 18, 11, 2660, 18540, 7, 17, 9, 41, 17, 14, 18, 705, 622, 18, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 697, 346, 1924, 264, 1160, 315, 8631, 78187, 323, 4780, 279, 2380, 304, 55711, 627, 996, 3494, 17055, 2020, 7410, 11, 18998, 1494, 36620, 65344, 8631, 323, 622, 18, 271, 14711, 6075, 512, 755, 8631, 1265, 55711, 1161, 997, 262, 4304, 697, 346, 1924, 264, 1160, 315, 8631, 78187, 323, 4780, 279, 2380, 304, 55711, 627, 996, 3494, 17055, 2020, 7410, 11, 18998, 1494, 36620, 65344, 8631, 323, 622, 18, 198, 262, 3270, 262, 274, 284, 2660, 39178, 1161, 340, 262, 422, 274, 7201, 624, 320, 21, 11, 997, 286, 274, 284, 274, 23967, 7, 16, 5106, 16, 340, 262, 4508, 274, 7201, 624, 320, 18, 11, 18, 997, 286, 274, 284, 274, 23967, 7, 16, 5106, 16, 5106, 16, 340, 262, 422, 2479, 1161, 7201, 8, 624, 220, 18, 512, 286, 274, 284, 2660, 36405, 2625, 82, 9821, 15, 11, 15, 1145, 82, 9821, 16, 11, 16, 1145, 82, 9821, 17, 11, 17, 1282, 3586, 320, 82, 9821, 15, 11, 16, 7727, 82, 9821, 16, 11, 15, 40293, 17, 345, 3586, 320, 82, 9821, 16, 11, 17, 7727, 82, 9821, 17, 11, 16, 40293, 17, 345, 3586, 320, 82, 9821, 17, 11, 15, 7727, 82, 9821, 15, 11, 17, 40293, 17, 2608, 262, 358, 16, 284, 274, 9821, 15, 7727, 82, 9821, 16, 7727, 82, 9821, 17, 933, 262, 358, 17, 284, 274, 9821, 15, 8632, 82, 9821, 16, 7727, 82, 9821, 16, 8632, 82, 9821, 17, 7727, 82, 9821, 17, 8632, 82, 9821, 15, 11958, 82, 9821, 18, 79441, 17, 1355, 9821, 19, 79441, 17, 1355, 9821, 20, 79441, 17, 198, 262, 358, 18, 284, 274, 9821, 15, 8632, 82, 9821, 16, 8632, 82, 9821, 17, 7727, 17, 34554, 9821, 18, 8632, 82, 9821, 19, 8632, 82, 9821, 20, 11958, 82, 9821, 18, 79441, 17, 34554, 9821, 17, 11958, 82, 9821, 19, 79441, 17, 34554, 9821, 15, 11958, 82, 9821, 20, 79441, 17, 34554, 9821, 16, 2595, 262, 622, 17, 284, 358, 16, 334, 17, 14, 18, 22197, 17, 198, 262, 622, 18, 284, 220, 17, 90342, 16, 334, 18, 14, 1544, 22197, 16, 90342, 17, 14, 18, 10, 40, 18, 271, 262, 674, 3494, 17055, 2020, 7410, 11, 18998, 1494, 36620, 65344, 8631, 323, 622, 18, 198, 262, 471, 482, 40, 16, 14, 18, 11, 2660, 18540, 7, 17, 9, 41, 17, 14, 18, 705, 622, 18, 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 ]
OnroerendErfgoed/oe_utils
oe_utils/__init__.py
conditional_http_tween_factory
def conditional_http_tween_factory(handler, registry): """ Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate. """ settings = registry.settings if hasattr(registry, 'settings') else {} not_cacheble_list = [] if 'not.cachable.list' in settings: not_cacheble_list = settings.get('not.cachable.list').split() def conditional_http_tween(request): response = handler(request) if request.path not in not_cacheble_list: # If the Last-Modified header has been set, we want to enable the # conditional response processing. if response.last_modified is not None: response.conditional_response = True # We want to only enable the conditional machinery if either we # were given an explicit ETag header by the view or we have a # buffered response and can generate the ETag header ourself. if response.etag is not None: response.conditional_response = True elif (isinstance(response.app_iter, Sequence) and len(response.app_iter) == 1) and response.body is not None: response.conditional_response = True response.md5_etag() return response return conditional_http_tween
python
def conditional_http_tween_factory(handler, registry): """ Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate. """ settings = registry.settings if hasattr(registry, 'settings') else {} not_cacheble_list = [] if 'not.cachable.list' in settings: not_cacheble_list = settings.get('not.cachable.list').split() def conditional_http_tween(request): response = handler(request) if request.path not in not_cacheble_list: # If the Last-Modified header has been set, we want to enable the # conditional response processing. if response.last_modified is not None: response.conditional_response = True # We want to only enable the conditional machinery if either we # were given an explicit ETag header by the view or we have a # buffered response and can generate the ETag header ourself. if response.etag is not None: response.conditional_response = True elif (isinstance(response.app_iter, Sequence) and len(response.app_iter) == 1) and response.body is not None: response.conditional_response = True response.md5_etag() return response return conditional_http_tween
[ "def", "conditional_http_tween_factory", "(", "handler", ",", "registry", ")", ":", "settings", "=", "registry", ".", "settings", "if", "hasattr", "(", "registry", ",", "'settings'", ")", "else", "{", "}", "not_cacheble_list", "=", "[", "]", "if", "'not.cachable.list'", "in", "settings", ":", "not_cacheble_list", "=", "settings", ".", "get", "(", "'not.cachable.list'", ")", ".", "split", "(", ")", "def", "conditional_http_tween", "(", "request", ")", ":", "response", "=", "handler", "(", "request", ")", "if", "request", ".", "path", "not", "in", "not_cacheble_list", ":", "# If the Last-Modified header has been set, we want to enable the", "# conditional response processing.", "if", "response", ".", "last_modified", "is", "not", "None", ":", "response", ".", "conditional_response", "=", "True", "# We want to only enable the conditional machinery if either we", "# were given an explicit ETag header by the view or we have a", "# buffered response and can generate the ETag header ourself.", "if", "response", ".", "etag", "is", "not", "None", ":", "response", ".", "conditional_response", "=", "True", "elif", "(", "isinstance", "(", "response", ".", "app_iter", ",", "Sequence", ")", "and", "len", "(", "response", ".", "app_iter", ")", "==", "1", ")", "and", "response", ".", "body", "is", "not", "None", ":", "response", ".", "conditional_response", "=", "True", "response", ".", "md5_etag", "(", ")", "return", "response", "return", "conditional_http_tween" ]
Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate.
[ "Tween", "that", "adds", "ETag", "headers", "and", "tells", "Pyramid", "to", "enable", "conditional", "responses", "where", "appropriate", "." ]
train
https://github.com/OnroerendErfgoed/oe_utils/blob/7b2014bda8ac6bb71b7138eaa06ac17ef3ff4a6d/oe_utils/__init__.py#L5-L37
<|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: Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate. ### Response: def conditional_http_tween_factory(handler, registry): """ Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate. """ settings = registry.settings if hasattr(registry, 'settings') else {} not_cacheble_list = [] if 'not.cachable.list' in settings: not_cacheble_list = settings.get('not.cachable.list').split() def conditional_http_tween(request): response = handler(request) if request.path not in not_cacheble_list: # If the Last-Modified header has been set, we want to enable the # conditional response processing. if response.last_modified is not None: response.conditional_response = True # We want to only enable the conditional machinery if either we # were given an explicit ETag header by the view or we have a # buffered response and can generate the ETag header ourself. if response.etag is not None: response.conditional_response = True elif (isinstance(response.app_iter, Sequence) and len(response.app_iter) == 1) and response.body is not None: response.conditional_response = True response.md5_etag() return response return conditional_http_tween <|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, 65283, 430, 11621, 469, 5786, 7247, 323, 10975, 83495, 311, 7431, 720, 262, 35787, 14847, 1405, 8475, 382, 14711, 6075, 512, 755, 35787, 26975, 530, 1818, 25255, 37614, 11, 19989, 997, 262, 3270, 262, 67435, 430, 11621, 469, 5786, 7247, 323, 10975, 83495, 311, 7431, 720, 262, 35787, 14847, 1405, 8475, 627, 262, 3270, 262, 5110, 284, 19989, 16728, 422, 32156, 18897, 5050, 11, 364, 6648, 873, 775, 5731, 262, 539, 11790, 901, 2062, 284, 4260, 262, 422, 364, 1962, 522, 78383, 6556, 6, 304, 5110, 512, 286, 539, 11790, 901, 2062, 284, 5110, 673, 493, 1962, 522, 78383, 6556, 1861, 7105, 2892, 262, 711, 35787, 26975, 530, 1818, 4980, 997, 286, 2077, 284, 7158, 4980, 696, 286, 422, 1715, 3960, 539, 304, 539, 11790, 901, 2062, 1473, 310, 674, 1442, 279, 8155, 12, 19696, 4342, 706, 1027, 743, 11, 584, 1390, 311, 7431, 279, 198, 310, 674, 35787, 2077, 8863, 627, 310, 422, 2077, 9288, 38849, 374, 539, 2290, 512, 394, 2077, 13, 46468, 9852, 284, 3082, 271, 310, 674, 1226, 1390, 311, 1193, 7431, 279, 35787, 26953, 422, 3060, 584, 198, 310, 674, 1051, 2728, 459, 11720, 469, 5786, 4342, 555, 279, 1684, 477, 584, 617, 264, 198, 310, 674, 54157, 2077, 323, 649, 7068, 279, 469, 5786, 4342, 1057, 726, 627, 310, 422, 2077, 39932, 351, 374, 539, 2290, 512, 394, 2077, 13, 46468, 9852, 284, 3082, 198, 310, 4508, 320, 285, 4956, 5802, 1632, 11985, 11, 29971, 8, 323, 198, 3586, 2479, 5802, 1632, 11985, 8, 624, 220, 16, 8, 323, 2077, 5189, 374, 539, 2290, 512, 394, 2077, 13, 46468, 9852, 284, 3082, 198, 394, 2077, 22030, 20, 46768, 351, 2892, 286, 471, 2077, 271, 262, 471, 35787, 26975, 530, 1818, 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,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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 ]
[ 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, 65283, 430, 11621, 469, 5786, 7247, 323, 10975, 83495, 311, 7431, 720, 262, 35787, 14847, 1405, 8475, 382, 14711, 6075, 512, 755, 35787, 26975, 530, 1818, 25255, 37614, 11, 19989, 997, 262, 3270, 262, 67435, 430, 11621, 469, 5786, 7247, 323, 10975, 83495, 311, 7431, 720, 262, 35787, 14847, 1405, 8475, 627, 262, 3270, 262, 5110, 284, 19989, 16728, 422, 32156, 18897, 5050, 11, 364, 6648, 873, 775, 5731, 262, 539, 11790, 901, 2062, 284, 4260, 262, 422, 364, 1962, 522, 78383, 6556, 6, 304, 5110, 512, 286, 539, 11790, 901, 2062, 284, 5110, 673, 493, 1962, 522, 78383, 6556, 1861, 7105, 2892, 262, 711, 35787, 26975, 530, 1818, 4980, 997, 286, 2077, 284, 7158, 4980, 696, 286, 422, 1715, 3960, 539, 304, 539, 11790, 901, 2062, 1473, 310, 674, 1442, 279, 8155, 12, 19696, 4342, 706, 1027, 743, 11, 584, 1390, 311, 7431, 279, 198, 310, 674, 35787, 2077, 8863, 627, 310, 422, 2077, 9288, 38849, 374, 539, 2290, 512, 394, 2077, 13, 46468, 9852, 284, 3082, 271, 310, 674, 1226, 1390, 311, 1193, 7431, 279, 35787, 26953, 422, 3060, 584, 198, 310, 674, 1051, 2728, 459, 11720, 469, 5786, 4342, 555, 279, 1684, 477, 584, 617, 264, 198, 310, 674, 54157, 2077, 323, 649, 7068, 279, 469, 5786, 4342, 1057, 726, 627, 310, 422, 2077, 39932, 351, 374, 539, 2290, 512, 394, 2077, 13, 46468, 9852, 284, 3082, 198, 310, 4508, 320, 285, 4956, 5802, 1632, 11985, 11, 29971, 8, 323, 198, 3586, 2479, 5802, 1632, 11985, 8, 624, 220, 16, 8, 323, 2077, 5189, 374, 539, 2290, 512, 394, 2077, 13, 46468, 9852, 284, 3082, 198, 394, 2077, 22030, 20, 46768, 351, 2892, 286, 471, 2077, 271, 262, 471, 35787, 26975, 530, 1818, 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 ]
ff0000/scarlet
scarlet/cms/renders.py
ChoicesRender.render
def render(self, request, **kwargs): """ Returns a JSON representation of a objects list page. The json has the following attributes: * **is_paginated** - Is the list paginated. * **results** - A list of objects, where each object has an \ attribute/value for each field in the list. An 'id' attribute \ is always included. * **fields** - An object who's properties are the fields \ in the results list. Each property will have an object with \ the the following attributes: * **name** - The verbose name of the field. * **sortable** - Can this column be sorted. True or False. * **order_type** - What is the current order of this column. The following attributes only appear if the list is paginated: * **count** - If the list is paginated, how many objects \ total are there. * **page** - Current page number. * **next** - The full link to the next page. * **previous** - The full link to the previous page. If the list can be filtered the following attribute is included: * **params** - An object who's properties are the filter options. \ Each property contains an object with the following attributes: * **value** - If the current result list has been filtered by \ this field then value will contain the filter value that was used. * **choices** - If the field is a choice field this will contain \ the options. Example JSON: :: {"count": 1, "fields": { "name": {"sortable": true, "name": "name", "order_type": "asc"} }, "results": [{"id": 12, "name": "Test"}], "next": "", "params": {"name": {"value": null}}, "is_paginated": true, "page": 1, "previous": ""} """ data = { 'is_paginated': kwargs.get('is_paginated') } if data.get('is_paginated'): page = kwargs['page_obj'] next_p = '' previous = '' if page.has_next(): next_p = self.get_different_page(request, page.number + 1) if page.has_previous(): previous = self.get_different_page(request, page.number - 1) data.update({ 'count': page.paginator.count, 'page': page.number, 'next': next_p, 'previous': previous, }) if kwargs.get('filter_form'): exclude = request.GET.getlist('exclude') filter_form = {} form = kwargs.get('filter_form') for name in form.get_search_fields(exclude): k = form[name] obj = {} obj['value'] = k.value() obj['label'] = k.label if hasattr(k.field, 'choices'): obj['choices'] = k.field.choices filter_form[k.name] = obj data['params'] = filter_form adm_list = kwargs['list'] data['fields'] = self.get_fields(adm_list) data['results'] = self.get_object_list(adm_list) return http.HttpResponse(json.dumps(data, cls=DjangoJSONEncoder))
python
def render(self, request, **kwargs): """ Returns a JSON representation of a objects list page. The json has the following attributes: * **is_paginated** - Is the list paginated. * **results** - A list of objects, where each object has an \ attribute/value for each field in the list. An 'id' attribute \ is always included. * **fields** - An object who's properties are the fields \ in the results list. Each property will have an object with \ the the following attributes: * **name** - The verbose name of the field. * **sortable** - Can this column be sorted. True or False. * **order_type** - What is the current order of this column. The following attributes only appear if the list is paginated: * **count** - If the list is paginated, how many objects \ total are there. * **page** - Current page number. * **next** - The full link to the next page. * **previous** - The full link to the previous page. If the list can be filtered the following attribute is included: * **params** - An object who's properties are the filter options. \ Each property contains an object with the following attributes: * **value** - If the current result list has been filtered by \ this field then value will contain the filter value that was used. * **choices** - If the field is a choice field this will contain \ the options. Example JSON: :: {"count": 1, "fields": { "name": {"sortable": true, "name": "name", "order_type": "asc"} }, "results": [{"id": 12, "name": "Test"}], "next": "", "params": {"name": {"value": null}}, "is_paginated": true, "page": 1, "previous": ""} """ data = { 'is_paginated': kwargs.get('is_paginated') } if data.get('is_paginated'): page = kwargs['page_obj'] next_p = '' previous = '' if page.has_next(): next_p = self.get_different_page(request, page.number + 1) if page.has_previous(): previous = self.get_different_page(request, page.number - 1) data.update({ 'count': page.paginator.count, 'page': page.number, 'next': next_p, 'previous': previous, }) if kwargs.get('filter_form'): exclude = request.GET.getlist('exclude') filter_form = {} form = kwargs.get('filter_form') for name in form.get_search_fields(exclude): k = form[name] obj = {} obj['value'] = k.value() obj['label'] = k.label if hasattr(k.field, 'choices'): obj['choices'] = k.field.choices filter_form[k.name] = obj data['params'] = filter_form adm_list = kwargs['list'] data['fields'] = self.get_fields(adm_list) data['results'] = self.get_object_list(adm_list) return http.HttpResponse(json.dumps(data, cls=DjangoJSONEncoder))
[ "def", "render", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'is_paginated'", ":", "kwargs", ".", "get", "(", "'is_paginated'", ")", "}", "if", "data", ".", "get", "(", "'is_paginated'", ")", ":", "page", "=", "kwargs", "[", "'page_obj'", "]", "next_p", "=", "''", "previous", "=", "''", "if", "page", ".", "has_next", "(", ")", ":", "next_p", "=", "self", ".", "get_different_page", "(", "request", ",", "page", ".", "number", "+", "1", ")", "if", "page", ".", "has_previous", "(", ")", ":", "previous", "=", "self", ".", "get_different_page", "(", "request", ",", "page", ".", "number", "-", "1", ")", "data", ".", "update", "(", "{", "'count'", ":", "page", ".", "paginator", ".", "count", ",", "'page'", ":", "page", ".", "number", ",", "'next'", ":", "next_p", ",", "'previous'", ":", "previous", ",", "}", ")", "if", "kwargs", ".", "get", "(", "'filter_form'", ")", ":", "exclude", "=", "request", ".", "GET", ".", "getlist", "(", "'exclude'", ")", "filter_form", "=", "{", "}", "form", "=", "kwargs", ".", "get", "(", "'filter_form'", ")", "for", "name", "in", "form", ".", "get_search_fields", "(", "exclude", ")", ":", "k", "=", "form", "[", "name", "]", "obj", "=", "{", "}", "obj", "[", "'value'", "]", "=", "k", ".", "value", "(", ")", "obj", "[", "'label'", "]", "=", "k", ".", "label", "if", "hasattr", "(", "k", ".", "field", ",", "'choices'", ")", ":", "obj", "[", "'choices'", "]", "=", "k", ".", "field", ".", "choices", "filter_form", "[", "k", ".", "name", "]", "=", "obj", "data", "[", "'params'", "]", "=", "filter_form", "adm_list", "=", "kwargs", "[", "'list'", "]", "data", "[", "'fields'", "]", "=", "self", ".", "get_fields", "(", "adm_list", ")", "data", "[", "'results'", "]", "=", "self", ".", "get_object_list", "(", "adm_list", ")", "return", "http", ".", "HttpResponse", "(", "json", ".", "dumps", "(", "data", ",", "cls", "=", "DjangoJSONEncoder", ")", ")" ]
Returns a JSON representation of a objects list page. The json has the following attributes: * **is_paginated** - Is the list paginated. * **results** - A list of objects, where each object has an \ attribute/value for each field in the list. An 'id' attribute \ is always included. * **fields** - An object who's properties are the fields \ in the results list. Each property will have an object with \ the the following attributes: * **name** - The verbose name of the field. * **sortable** - Can this column be sorted. True or False. * **order_type** - What is the current order of this column. The following attributes only appear if the list is paginated: * **count** - If the list is paginated, how many objects \ total are there. * **page** - Current page number. * **next** - The full link to the next page. * **previous** - The full link to the previous page. If the list can be filtered the following attribute is included: * **params** - An object who's properties are the filter options. \ Each property contains an object with the following attributes: * **value** - If the current result list has been filtered by \ this field then value will contain the filter value that was used. * **choices** - If the field is a choice field this will contain \ the options. Example JSON: :: {"count": 1, "fields": { "name": {"sortable": true, "name": "name", "order_type": "asc"} }, "results": [{"id": 12, "name": "Test"}], "next": "", "params": {"name": {"value": null}}, "is_paginated": true, "page": 1, "previous": ""}
[ "Returns", "a", "JSON", "representation", "of", "a", "objects", "list", "page", ".", "The", "json", "has", "the", "following", "attributes", ":" ]
train
https://github.com/ff0000/scarlet/blob/6c37befd810916a2d7ffff2cdb2dab57bcb6d12e/scarlet/cms/renders.py#L179-L268
<|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 JSON representation of a objects list page. The json has the following attributes: * **is_paginated** - Is the list paginated. * **results** - A list of objects, where each object has an \ attribute/value for each field in the list. An 'id' attribute \ is always included. * **fields** - An object who's properties are the fields \ in the results list. Each property will have an object with \ the the following attributes: * **name** - The verbose name of the field. * **sortable** - Can this column be sorted. True or False. * **order_type** - What is the current order of this column. The following attributes only appear if the list is paginated: * **count** - If the list is paginated, how many objects \ total are there. * **page** - Current page number. * **next** - The full link to the next page. * **previous** - The full link to the previous page. If the list can be filtered the following attribute is included: * **params** - An object who's properties are the filter options. \ Each property contains an object with the following attributes: * **value** - If the current result list has been filtered by \ this field then value will contain the filter value that was used. * **choices** - If the field is a choice field this will contain \ the options. Example JSON: :: {"count": 1, "fields": { "name": {"sortable": true, "name": "name", "order_type": "asc"} }, "results": [{"id": 12, "name": "Test"}], "next": "", "params": {"name": {"value": null}}, "is_paginated": true, "page": 1, "previous": ""} ### Response: def render(self, request, **kwargs): """ Returns a JSON representation of a objects list page. The json has the following attributes: * **is_paginated** - Is the list paginated. * **results** - A list of objects, where each object has an \ attribute/value for each field in the list. An 'id' attribute \ is always included. * **fields** - An object who's properties are the fields \ in the results list. Each property will have an object with \ the the following attributes: * **name** - The verbose name of the field. * **sortable** - Can this column be sorted. True or False. * **order_type** - What is the current order of this column. The following attributes only appear if the list is paginated: * **count** - If the list is paginated, how many objects \ total are there. * **page** - Current page number. * **next** - The full link to the next page. * **previous** - The full link to the previous page. If the list can be filtered the following attribute is included: * **params** - An object who's properties are the filter options. \ Each property contains an object with the following attributes: * **value** - If the current result list has been filtered by \ this field then value will contain the filter value that was used. * **choices** - If the field is a choice field this will contain \ the options. Example JSON: :: {"count": 1, "fields": { "name": {"sortable": true, "name": "name", "order_type": "asc"} }, "results": [{"id": 12, "name": "Test"}], "next": "", "params": {"name": {"value": null}}, "is_paginated": true, "page": 1, "previous": ""} """ data = { 'is_paginated': kwargs.get('is_paginated') } if data.get('is_paginated'): page = kwargs['page_obj'] next_p = '' previous = '' if page.has_next(): next_p = self.get_different_page(request, page.number + 1) if page.has_previous(): previous = self.get_different_page(request, page.number - 1) data.update({ 'count': page.paginator.count, 'page': page.number, 'next': next_p, 'previous': previous, }) if kwargs.get('filter_form'): exclude = request.GET.getlist('exclude') filter_form = {} form = kwargs.get('filter_form') for name in form.get_search_fields(exclude): k = form[name] obj = {} obj['value'] = k.value() obj['label'] = k.label if hasattr(k.field, 'choices'): obj['choices'] = k.field.choices filter_form[k.name] = obj data['params'] = filter_form adm_list = kwargs['list'] data['fields'] = self.get_fields(adm_list) data['results'] = self.get_object_list(adm_list) return http.HttpResponse(json.dumps(data, cls=DjangoJSONEncoder)) <|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, 4823, 13340, 315, 264, 6302, 1160, 2199, 627, 286, 578, 3024, 706, 279, 2768, 8365, 1473, 286, 353, 3146, 285, 52103, 15846, 334, 482, 2209, 279, 1160, 15117, 15846, 627, 286, 353, 3146, 8234, 334, 482, 362, 1160, 315, 6302, 11, 1405, 1855, 1665, 706, 459, 3120, 286, 7180, 58642, 369, 1855, 2115, 304, 279, 1160, 13, 1556, 364, 307, 6, 7180, 3120, 286, 374, 2744, 5343, 627, 286, 353, 3146, 9184, 334, 482, 1556, 1665, 889, 596, 6012, 527, 279, 5151, 3120, 286, 304, 279, 3135, 1160, 13, 9062, 3424, 690, 617, 459, 1665, 449, 3120, 286, 279, 279, 2768, 8365, 512, 310, 353, 3146, 609, 334, 482, 578, 14008, 836, 315, 279, 2115, 627, 310, 353, 3146, 66698, 334, 482, 3053, 420, 3330, 387, 10839, 13, 3082, 477, 3641, 627, 310, 353, 3146, 1382, 1857, 334, 482, 3639, 374, 279, 1510, 2015, 315, 420, 3330, 382, 286, 578, 2768, 8365, 1193, 5101, 422, 279, 1160, 374, 15117, 15846, 1473, 286, 353, 3146, 1868, 334, 482, 1442, 279, 1160, 374, 15117, 15846, 11, 1268, 1690, 6302, 3120, 286, 2860, 527, 1070, 627, 286, 353, 3146, 2964, 334, 482, 9303, 2199, 1396, 627, 286, 353, 3146, 3684, 334, 482, 578, 2539, 2723, 311, 279, 1828, 2199, 627, 286, 353, 3146, 20281, 334, 482, 578, 2539, 2723, 311, 279, 3766, 2199, 382, 286, 1442, 279, 1160, 649, 387, 18797, 279, 2768, 7180, 374, 5343, 1473, 286, 353, 3146, 3603, 334, 482, 1556, 1665, 889, 596, 6012, 527, 279, 4141, 2671, 13, 3120, 310, 9062, 3424, 5727, 459, 1665, 449, 279, 2768, 8365, 512, 310, 353, 3146, 970, 334, 482, 1442, 279, 1510, 1121, 1160, 706, 1027, 18797, 555, 3120, 310, 420, 2115, 1243, 907, 690, 6782, 279, 4141, 907, 430, 574, 1511, 627, 310, 353, 3146, 25825, 334, 482, 1442, 279, 2115, 374, 264, 5873, 2115, 420, 690, 6782, 3120, 310, 279, 2671, 382, 286, 13688, 4823, 1473, 286, 3588, 271, 310, 5324, 1868, 794, 220, 16, 345, 310, 330, 9184, 794, 341, 394, 330, 609, 794, 5324, 66698, 794, 837, 11, 330, 609, 794, 330, 609, 498, 330, 1382, 1857, 794, 330, 5171, 17122, 310, 1173, 310, 330, 8234, 794, 62853, 307, 794, 220, 717, 11, 330, 609, 794, 330, 2323, 9388, 1282, 310, 330, 3684, 794, 8488, 310, 330, 3603, 794, 5324, 609, 794, 5324, 970, 794, 854, 22825, 310, 330, 285, 52103, 15846, 794, 837, 345, 310, 330, 2964, 794, 220, 16, 345, 310, 330, 20281, 794, 1621, 633, 14711, 6075, 512, 755, 3219, 1214, 11, 1715, 11, 3146, 9872, 997, 286, 3270, 286, 5295, 264, 4823, 13340, 315, 264, 6302, 1160, 2199, 627, 286, 578, 3024, 706, 279, 2768, 8365, 1473, 286, 353, 3146, 285, 52103, 15846, 334, 482, 2209, 279, 1160, 15117, 15846, 627, 286, 353, 3146, 8234, 334, 482, 362, 1160, 315, 6302, 11, 1405, 1855 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 4823, 13340, 315, 264, 6302, 1160, 2199, 627, 286, 578, 3024, 706, 279, 2768, 8365, 1473, 286, 353, 3146, 285, 52103, 15846, 334, 482, 2209, 279, 1160, 15117, 15846, 627, 286, 353, 3146, 8234, 334, 482, 362, 1160, 315, 6302, 11, 1405, 1855, 1665, 706, 459, 3120, 286, 7180, 58642, 369, 1855, 2115, 304, 279, 1160, 13, 1556, 364, 307, 6, 7180, 3120, 286, 374, 2744, 5343, 627, 286, 353, 3146, 9184, 334, 482, 1556, 1665, 889, 596, 6012, 527, 279, 5151, 3120, 286, 304, 279, 3135, 1160, 13, 9062, 3424, 690, 617, 459, 1665, 449, 3120, 286, 279, 279, 2768, 8365, 512, 310, 353, 3146, 609, 334, 482, 578, 14008, 836, 315, 279, 2115, 627, 310, 353, 3146, 66698, 334, 482, 3053, 420, 3330, 387, 10839, 13, 3082, 477, 3641, 627, 310, 353, 3146, 1382, 1857, 334, 482, 3639, 374, 279, 1510, 2015, 315, 420, 3330, 382, 286, 578, 2768, 8365, 1193, 5101, 422, 279, 1160, 374, 15117, 15846, 1473, 286, 353, 3146, 1868, 334, 482, 1442, 279, 1160, 374, 15117, 15846, 11, 1268, 1690, 6302, 3120, 286, 2860, 527, 1070, 627, 286, 353, 3146, 2964, 334, 482, 9303, 2199, 1396, 627, 286, 353, 3146, 3684, 334, 482, 578, 2539, 2723, 311, 279, 1828, 2199, 627, 286, 353, 3146, 20281, 334, 482, 578, 2539, 2723, 311, 279, 3766, 2199, 382, 286, 1442, 279, 1160, 649, 387, 18797, 279, 2768, 7180, 374, 5343, 1473, 286, 353, 3146, 3603, 334, 482, 1556, 1665, 889, 596, 6012, 527, 279, 4141, 2671, 13, 3120, 310, 9062, 3424, 5727, 459, 1665, 449, 279, 2768, 8365, 512, 310, 353, 3146, 970, 334, 482, 1442, 279, 1510, 1121, 1160, 706, 1027, 18797, 555, 3120, 310, 420, 2115, 1243, 907, 690, 6782, 279, 4141, 907, 430, 574, 1511, 627, 310, 353, 3146, 25825, 334, 482, 1442, 279, 2115, 374, 264, 5873, 2115, 420, 690, 6782, 3120, 310, 279, 2671, 382, 286, 13688, 4823, 1473, 286, 3588, 271, 310, 5324, 1868, 794, 220, 16, 345, 310, 330, 9184, 794, 341, 394, 330, 609, 794, 5324, 66698, 794, 837, 11, 330, 609, 794, 330, 609, 498, 330, 1382, 1857, 794, 330, 5171, 17122, 310, 1173, 310, 330, 8234, 794, 62853, 307, 794, 220, 717, 11, 330, 609, 794, 330, 2323, 9388, 1282, 310, 330, 3684, 794, 8488, 310, 330, 3603, 794, 5324, 609, 794, 5324, 970, 794, 854, 22825, 310, 330, 285, 52103, 15846, 794, 837, 345, 310, 330, 2964, 794, 220, 16, 345, 310, 330, 20281, 794, 1621, 633, 14711, 6075, 512, 755, 3219, 1214, 11, 1715, 11, 3146, 9872, 997, 286, 3270, 286, 5295, 264, 4823, 13340, 315, 264, 6302, 1160, 2199, 627, 286, 578, 3024, 706, 279, 2768, 8365, 1473, 286, 353, 3146, 285, 52103, 15846, 334, 482, 2209, 279, 1160, 15117, 15846, 627, 286, 353, 3146, 8234, 334, 482, 362, 1160, 315, 6302, 11, 1405, 1855 ]
Erotemic/utool
utool/util_func.py
compose_functions
def compose_functions(*func_list): """ Referenes: https://mathieularose.com/function-composition-in-python/ """ def apply_composition(f, g): def compose(x): return f(g(x)) return compose composed_func = functools.reduce(apply_composition, func_list) return composed_func
python
def compose_functions(*func_list): """ Referenes: https://mathieularose.com/function-composition-in-python/ """ def apply_composition(f, g): def compose(x): return f(g(x)) return compose composed_func = functools.reduce(apply_composition, func_list) return composed_func
[ "def", "compose_functions", "(", "*", "func_list", ")", ":", "def", "apply_composition", "(", "f", ",", "g", ")", ":", "def", "compose", "(", "x", ")", ":", "return", "f", "(", "g", "(", "x", ")", ")", "return", "compose", "composed_func", "=", "functools", ".", "reduce", "(", "apply_composition", ",", "func_list", ")", "return", "composed_func" ]
Referenes: https://mathieularose.com/function-composition-in-python/
[ "Referenes", ":", "https", ":", "//", "mathieularose", ".", "com", "/", "function", "-", "composition", "-", "in", "-", "python", "/" ]
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_func.py#L8-L18
<|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: Referenes: https://mathieularose.com/function-composition-in-python/ ### Response: def compose_functions(*func_list): """ Referenes: https://mathieularose.com/function-composition-in-python/ """ def apply_composition(f, g): def compose(x): return f(g(x)) return compose composed_func = functools.reduce(apply_composition, func_list) return composed_func <|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, 48547, 22383, 512, 286, 3788, 1129, 10590, 648, 1299, 974, 916, 71743, 11733, 3571, 3502, 73029, 8851, 14711, 6075, 512, 755, 31435, 32808, 4163, 2900, 2062, 997, 262, 3270, 262, 29734, 22383, 512, 286, 3788, 1129, 10590, 648, 1299, 974, 916, 71743, 11733, 3571, 3502, 73029, 6018, 262, 3270, 262, 711, 3881, 3038, 3571, 968, 11, 342, 997, 286, 711, 31435, 2120, 997, 310, 471, 282, 3348, 2120, 1192, 286, 471, 31435, 198, 262, 24306, 9791, 284, 57566, 24726, 7, 10492, 3038, 3571, 11, 2988, 2062, 340, 262, 471, 24306, 9791, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 48547, 22383, 512, 286, 3788, 1129, 10590, 648, 1299, 974, 916, 71743, 11733, 3571, 3502, 73029, 8851, 14711, 6075, 512, 755, 31435, 32808, 4163, 2900, 2062, 997, 262, 3270, 262, 29734, 22383, 512, 286, 3788, 1129, 10590, 648, 1299, 974, 916, 71743, 11733, 3571, 3502, 73029, 6018, 262, 3270, 262, 711, 3881, 3038, 3571, 968, 11, 342, 997, 286, 711, 31435, 2120, 997, 310, 471, 282, 3348, 2120, 1192, 286, 471, 31435, 198, 262, 24306, 9791, 284, 57566, 24726, 7, 10492, 3038, 3571, 11, 2988, 2062, 340, 262, 471, 24306, 9791, 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 ]
kgaughan/dbkit
dbkit.py
Context.execute_proc
def execute_proc(self, procname, args): """ Execute a stored procedure, returning a cursor. For internal use only. """ self.logger(procname, args) with self.cursor() as cursor: cursor.callproc(procname, args) return cursor
python
def execute_proc(self, procname, args): """ Execute a stored procedure, returning a cursor. For internal use only. """ self.logger(procname, args) with self.cursor() as cursor: cursor.callproc(procname, args) return cursor
[ "def", "execute_proc", "(", "self", ",", "procname", ",", "args", ")", ":", "self", ".", "logger", "(", "procname", ",", "args", ")", "with", "self", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "callproc", "(", "procname", ",", "args", ")", "return", "cursor" ]
Execute a stored procedure, returning a cursor. For internal use only.
[ "Execute", "a", "stored", "procedure", "returning", "a", "cursor", ".", "For", "internal", "use", "only", "." ]
train
https://github.com/kgaughan/dbkit/blob/2aef6376a60965d7820c91692046f4bcf7d43640/dbkit.py#L208-L216
<|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: Execute a stored procedure, returning a cursor. For internal use only. ### Response: def execute_proc(self, procname, args): """ Execute a stored procedure, returning a cursor. For internal use only. """ self.logger(procname, args) with self.cursor() as cursor: cursor.callproc(procname, args) return cursor <|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, 17617, 264, 9967, 10537, 11, 13758, 264, 8291, 13, 1789, 5419, 1005, 198, 286, 1193, 382, 14711, 6075, 512, 755, 9203, 25440, 1214, 11, 13988, 609, 11, 2897, 997, 286, 3270, 286, 21517, 264, 9967, 10537, 11, 13758, 264, 8291, 13, 1789, 5419, 1005, 198, 286, 1193, 627, 286, 3270, 286, 659, 16465, 62729, 609, 11, 2897, 340, 286, 449, 659, 21361, 368, 439, 8291, 512, 310, 8291, 8692, 16159, 62729, 609, 11, 2897, 340, 310, 471, 8291, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 17617, 264, 9967, 10537, 11, 13758, 264, 8291, 13, 1789, 5419, 1005, 198, 286, 1193, 382, 14711, 6075, 512, 755, 9203, 25440, 1214, 11, 13988, 609, 11, 2897, 997, 286, 3270, 286, 21517, 264, 9967, 10537, 11, 13758, 264, 8291, 13, 1789, 5419, 1005, 198, 286, 1193, 627, 286, 3270, 286, 659, 16465, 62729, 609, 11, 2897, 340, 286, 449, 659, 21361, 368, 439, 8291, 512, 310, 8291, 8692, 16159, 62729, 609, 11, 2897, 340, 310, 471, 8291, 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 ]
geronimp/graftM
graftm/archive.py
Archive._setup_output
def _setup_output(self, path, force): '''Clear the way for an output to be placed at path''' # Allow for special case of output being a pipe if os.path.isdir(path) or os.path.isfile(path): if force: logging.warn("Deleting previous file/directory '%s'" % path) if os.path.isfile(path): os.remove(path) else: shutil.rmtree(path) else: raise Exception("Cowardly refusing to overwrite already existing path at %s" % path)
python
def _setup_output(self, path, force): '''Clear the way for an output to be placed at path''' # Allow for special case of output being a pipe if os.path.isdir(path) or os.path.isfile(path): if force: logging.warn("Deleting previous file/directory '%s'" % path) if os.path.isfile(path): os.remove(path) else: shutil.rmtree(path) else: raise Exception("Cowardly refusing to overwrite already existing path at %s" % path)
[ "def", "_setup_output", "(", "self", ",", "path", ",", "force", ")", ":", "# Allow for special case of output being a pipe", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", "or", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "if", "force", ":", "logging", ".", "warn", "(", "\"Deleting previous file/directory '%s'\"", "%", "path", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "os", ".", "remove", "(", "path", ")", "else", ":", "shutil", ".", "rmtree", "(", "path", ")", "else", ":", "raise", "Exception", "(", "\"Cowardly refusing to overwrite already existing path at %s\"", "%", "path", ")" ]
Clear the way for an output to be placed at path
[ "Clear", "the", "way", "for", "an", "output", "to", "be", "placed", "at", "path" ]
train
https://github.com/geronimp/graftM/blob/c82576517290167f605fd0bc4facd009cee29f48/graftm/archive.py#L95-L106
<|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: Clear the way for an output to be placed at path ### Response: def _setup_output(self, path, force): '''Clear the way for an output to be placed at path''' # Allow for special case of output being a pipe if os.path.isdir(path) or os.path.isfile(path): if force: logging.warn("Deleting previous file/directory '%s'" % path) if os.path.isfile(path): os.remove(path) else: shutil.rmtree(path) else: raise Exception("Cowardly refusing to overwrite already existing path at %s" % path) <|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, 14335, 279, 1648, 369, 459, 2612, 311, 387, 9277, 520, 1853, 271, 14711, 6075, 512, 755, 721, 15543, 7800, 1214, 11, 1853, 11, 5457, 997, 286, 11712, 14335, 279, 1648, 369, 459, 2612, 311, 387, 9277, 520, 1853, 15029, 286, 674, 27628, 369, 3361, 1162, 315, 2612, 1694, 264, 13961, 198, 286, 422, 2709, 3960, 49261, 5698, 8, 477, 2709, 3960, 40047, 5698, 997, 310, 422, 5457, 512, 394, 8558, 22123, 446, 61575, 3766, 1052, 3529, 4863, 7832, 82, 15260, 1034, 1853, 340, 394, 422, 2709, 3960, 40047, 5698, 997, 504, 2709, 4955, 5698, 340, 394, 775, 512, 504, 35060, 82306, 5698, 340, 310, 775, 512, 394, 4933, 4204, 446, 34, 83071, 398, 39089, 311, 33316, 2736, 6484, 1853, 520, 1034, 82, 1, 1034, 1853, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 14335, 279, 1648, 369, 459, 2612, 311, 387, 9277, 520, 1853, 271, 14711, 6075, 512, 755, 721, 15543, 7800, 1214, 11, 1853, 11, 5457, 997, 286, 11712, 14335, 279, 1648, 369, 459, 2612, 311, 387, 9277, 520, 1853, 15029, 286, 674, 27628, 369, 3361, 1162, 315, 2612, 1694, 264, 13961, 198, 286, 422, 2709, 3960, 49261, 5698, 8, 477, 2709, 3960, 40047, 5698, 997, 310, 422, 5457, 512, 394, 8558, 22123, 446, 61575, 3766, 1052, 3529, 4863, 7832, 82, 15260, 1034, 1853, 340, 394, 422, 2709, 3960, 40047, 5698, 997, 504, 2709, 4955, 5698, 340, 394, 775, 512, 504, 35060, 82306, 5698, 340, 310, 775, 512, 394, 4933, 4204, 446, 34, 83071, 398, 39089, 311, 33316, 2736, 6484, 1853, 520, 1034, 82, 1, 1034, 1853, 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 ]
edeposit/edeposit.amqp.antivirus
bin/edeposit_clamd_init.py
update_configuration
def update_configuration(configuration): """ Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration. """ for key, val in REQUIRED_SETTINGS.items(): if val in ["$username", "$groupname"]: val = get_username() configuration = conf_writer.add_or_update(configuration, key, val) return configuration
python
def update_configuration(configuration): """ Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration. """ for key, val in REQUIRED_SETTINGS.items(): if val in ["$username", "$groupname"]: val = get_username() configuration = conf_writer.add_or_update(configuration, key, val) return configuration
[ "def", "update_configuration", "(", "configuration", ")", ":", "for", "key", ",", "val", "in", "REQUIRED_SETTINGS", ".", "items", "(", ")", ":", "if", "val", "in", "[", "\"$username\"", ",", "\"$groupname\"", "]", ":", "val", "=", "get_username", "(", ")", "configuration", "=", "conf_writer", ".", "add_or_update", "(", "configuration", ",", "key", ",", "val", ")", "return", "configuration" ]
Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration.
[ "Set", "all", "configuration", "specified", "in", ":", "attr", ":", "REQUIRED_SETTINGS", "." ]
train
https://github.com/edeposit/edeposit.amqp.antivirus/blob/011b38bbe920819fab99a5891b1e70732321a598/bin/edeposit_clamd_init.py#L199-L215
<|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: Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration. ### Response: def update_configuration(configuration): """ Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration. """ for key, val in REQUIRED_SETTINGS.items(): if val in ["$username", "$groupname"]: val = get_username() configuration = conf_writer.add_or_update(configuration, key, val) return configuration <|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, 1681, 682, 6683, 5300, 304, 551, 3064, 19258, 90915, 35289, 63438, 262, 18161, 512, 286, 6683, 320, 496, 1680, 12499, 1052, 2262, 382, 262, 5295, 512, 286, 610, 25, 16459, 6683, 382, 14711, 6075, 512, 755, 2713, 36826, 49824, 997, 262, 3270, 262, 2638, 682, 6683, 5300, 304, 551, 3064, 19258, 90915, 35289, 63438, 262, 18161, 512, 286, 6683, 320, 496, 1680, 12499, 1052, 2262, 382, 262, 5295, 512, 286, 610, 25, 16459, 6683, 627, 262, 3270, 262, 369, 1401, 11, 1062, 304, 67677, 35289, 9812, 4019, 286, 422, 1062, 304, 4482, 3, 5223, 498, 5312, 4166, 609, 34834, 310, 1062, 284, 636, 22316, 2892, 286, 6683, 284, 2389, 30008, 1388, 8908, 9058, 49824, 11, 1401, 11, 1062, 696, 262, 471, 6683, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 1681, 682, 6683, 5300, 304, 551, 3064, 19258, 90915, 35289, 63438, 262, 18161, 512, 286, 6683, 320, 496, 1680, 12499, 1052, 2262, 382, 262, 5295, 512, 286, 610, 25, 16459, 6683, 382, 14711, 6075, 512, 755, 2713, 36826, 49824, 997, 262, 3270, 262, 2638, 682, 6683, 5300, 304, 551, 3064, 19258, 90915, 35289, 63438, 262, 18161, 512, 286, 6683, 320, 496, 1680, 12499, 1052, 2262, 382, 262, 5295, 512, 286, 610, 25, 16459, 6683, 627, 262, 3270, 262, 369, 1401, 11, 1062, 304, 67677, 35289, 9812, 4019, 286, 422, 1062, 304, 4482, 3, 5223, 498, 5312, 4166, 609, 34834, 310, 1062, 284, 636, 22316, 2892, 286, 6683, 284, 2389, 30008, 1388, 8908, 9058, 49824, 11, 1401, 11, 1062, 696, 262, 471, 6683, 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 ]
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
ActiveMeasurement.overlapsWith
def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEndTime = targetStartTime + datetime.timedelta(days=0, seconds=duration) return (self.startTime <= targetStartTime <= self.endTime) \ or (targetStartTime <= self.startTime <= targetEndTime)
python
def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEndTime = targetStartTime + datetime.timedelta(days=0, seconds=duration) return (self.startTime <= targetStartTime <= self.endTime) \ or (targetStartTime <= self.startTime <= targetEndTime)
[ "def", "overlapsWith", "(", "self", ",", "targetStartTime", ",", "duration", ")", ":", "targetEndTime", "=", "targetStartTime", "+", "datetime", ".", "timedelta", "(", "days", "=", "0", ",", "seconds", "=", "duration", ")", "return", "(", "self", ".", "startTime", "<=", "targetStartTime", "<=", "self", ".", "endTime", ")", "or", "(", "targetStartTime", "<=", "self", ".", "startTime", "<=", "targetEndTime", ")" ]
Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement.
[ "Tests", "if", "the", "given", "times", "overlap", "with", "this", "measurement", ".", ":", "param", "targetStartTime", ":", "the", "target", "start", "time", ".", ":", "param", "duration", ":", "the", "duration", ":", "return", ":", "true", "if", "the", "given", "times", "overlap", "with", "this", "measurement", "." ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L98-L107
<|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: Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. ### Response: def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEndTime = targetStartTime + datetime.timedelta(days=0, seconds=duration) return (self.startTime <= targetStartTime <= self.endTime) \ or (targetStartTime <= self.startTime <= targetEndTime) <|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, 18700, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 627, 286, 551, 913, 2218, 41303, 25, 279, 2218, 1212, 892, 627, 286, 551, 913, 8250, 25, 279, 8250, 198, 286, 551, 693, 25, 837, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 382, 14711, 6075, 512, 755, 77107, 2409, 1214, 11, 2218, 41303, 11, 8250, 997, 286, 3270, 286, 20756, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 627, 286, 551, 913, 2218, 41303, 25, 279, 2218, 1212, 892, 627, 286, 551, 913, 8250, 25, 279, 8250, 198, 286, 551, 693, 25, 837, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 627, 286, 3270, 286, 2218, 56933, 284, 2218, 41303, 489, 9050, 58939, 43695, 28, 15, 11, 6622, 28, 17456, 340, 286, 471, 320, 726, 59876, 2717, 2218, 41303, 2717, 659, 82109, 8, 3120, 2342, 477, 320, 5775, 41303, 2717, 659, 59876, 2717, 2218, 56933, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 18700, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 627, 286, 551, 913, 2218, 41303, 25, 279, 2218, 1212, 892, 627, 286, 551, 913, 8250, 25, 279, 8250, 198, 286, 551, 693, 25, 837, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 382, 14711, 6075, 512, 755, 77107, 2409, 1214, 11, 2218, 41303, 11, 8250, 997, 286, 3270, 286, 20756, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 627, 286, 551, 913, 2218, 41303, 25, 279, 2218, 1212, 892, 627, 286, 551, 913, 8250, 25, 279, 8250, 198, 286, 551, 693, 25, 837, 422, 279, 2728, 3115, 28347, 449, 420, 19179, 627, 286, 3270, 286, 2218, 56933, 284, 2218, 41303, 489, 9050, 58939, 43695, 28, 15, 11, 6622, 28, 17456, 340, 286, 471, 320, 726, 59876, 2717, 2218, 41303, 2717, 659, 82109, 8, 3120, 2342, 477, 320, 5775, 41303, 2717, 659, 59876, 2717, 2218, 56933, 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 ]
OnroerendErfgoed/crabpy
crabpy/gateway/crab.py
check_lazy_load_subadres
def check_lazy_load_subadres(f): ''' Decorator function to lazy load a :class:`Subadres`. ''' def wrapper(*args): subadres = args[0] if ( subadres._metadata is None or subadres.aard_id is None or subadres.huisnummer_id is None ): log.debug('Lazy loading Subadres %d', subadres.id) subadres.check_gateway() s = subadres.gateway.get_subadres_by_id(subadres.id) subadres._metadata = s._metadata subadres.aard_id = s.aard_id subadres.huisnummer_id = s.huisnummer_id return f(*args) return wrapper
python
def check_lazy_load_subadres(f): ''' Decorator function to lazy load a :class:`Subadres`. ''' def wrapper(*args): subadres = args[0] if ( subadres._metadata is None or subadres.aard_id is None or subadres.huisnummer_id is None ): log.debug('Lazy loading Subadres %d', subadres.id) subadres.check_gateway() s = subadres.gateway.get_subadres_by_id(subadres.id) subadres._metadata = s._metadata subadres.aard_id = s.aard_id subadres.huisnummer_id = s.huisnummer_id return f(*args) return wrapper
[ "def", "check_lazy_load_subadres", "(", "f", ")", ":", "def", "wrapper", "(", "*", "args", ")", ":", "subadres", "=", "args", "[", "0", "]", "if", "(", "subadres", ".", "_metadata", "is", "None", "or", "subadres", ".", "aard_id", "is", "None", "or", "subadres", ".", "huisnummer_id", "is", "None", ")", ":", "log", ".", "debug", "(", "'Lazy loading Subadres %d'", ",", "subadres", ".", "id", ")", "subadres", ".", "check_gateway", "(", ")", "s", "=", "subadres", ".", "gateway", ".", "get_subadres_by_id", "(", "subadres", ".", "id", ")", "subadres", ".", "_metadata", "=", "s", ".", "_metadata", "subadres", ".", "aard_id", "=", "s", ".", "aard_id", "subadres", ".", "huisnummer_id", "=", "s", ".", "huisnummer_id", "return", "f", "(", "*", "args", ")", "return", "wrapper" ]
Decorator function to lazy load a :class:`Subadres`.
[ "Decorator", "function", "to", "lazy", "load", "a", ":", "class", ":", "Subadres", "." ]
train
https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2610-L2628
<|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: Decorator function to lazy load a :class:`Subadres`. ### Response: def check_lazy_load_subadres(f): ''' Decorator function to lazy load a :class:`Subadres`. ''' def wrapper(*args): subadres = args[0] if ( subadres._metadata is None or subadres.aard_id is None or subadres.huisnummer_id is None ): log.debug('Lazy loading Subadres %d', subadres.id) subadres.check_gateway() s = subadres.gateway.get_subadres_by_id(subadres.id) subadres._metadata = s._metadata subadres.aard_id = s.aard_id subadres.huisnummer_id = s.huisnummer_id return f(*args) return wrapper <|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, 49051, 734, 311, 16053, 2865, 264, 551, 1058, 19258, 3214, 329, 417, 63438, 14711, 6075, 512, 755, 1817, 50746, 12693, 5341, 329, 417, 968, 997, 262, 11414, 262, 28069, 859, 734, 311, 16053, 2865, 264, 551, 1058, 19258, 3214, 329, 417, 19154, 262, 11414, 262, 711, 13564, 4163, 2164, 997, 286, 1207, 329, 417, 284, 2897, 58, 15, 933, 286, 422, 2456, 310, 1207, 329, 417, 1462, 18103, 374, 2290, 477, 198, 310, 1207, 329, 417, 5973, 569, 851, 374, 2290, 477, 198, 310, 1207, 329, 417, 870, 9425, 69019, 851, 374, 2290, 198, 286, 21711, 310, 1515, 8042, 493, 40866, 8441, 3804, 329, 417, 1034, 67, 518, 1207, 329, 417, 1801, 340, 310, 1207, 329, 417, 9271, 65149, 746, 310, 274, 284, 1207, 329, 417, 81392, 673, 5341, 329, 417, 3795, 851, 10849, 329, 417, 1801, 340, 310, 1207, 329, 417, 1462, 18103, 284, 274, 1462, 18103, 198, 310, 1207, 329, 417, 5973, 569, 851, 284, 274, 5973, 569, 851, 198, 310, 1207, 329, 417, 870, 9425, 69019, 851, 284, 274, 870, 9425, 69019, 851, 198, 286, 471, 282, 4163, 2164, 340, 262, 471, 13564, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 49051, 734, 311, 16053, 2865, 264, 551, 1058, 19258, 3214, 329, 417, 63438, 14711, 6075, 512, 755, 1817, 50746, 12693, 5341, 329, 417, 968, 997, 262, 11414, 262, 28069, 859, 734, 311, 16053, 2865, 264, 551, 1058, 19258, 3214, 329, 417, 19154, 262, 11414, 262, 711, 13564, 4163, 2164, 997, 286, 1207, 329, 417, 284, 2897, 58, 15, 933, 286, 422, 2456, 310, 1207, 329, 417, 1462, 18103, 374, 2290, 477, 198, 310, 1207, 329, 417, 5973, 569, 851, 374, 2290, 477, 198, 310, 1207, 329, 417, 870, 9425, 69019, 851, 374, 2290, 198, 286, 21711, 310, 1515, 8042, 493, 40866, 8441, 3804, 329, 417, 1034, 67, 518, 1207, 329, 417, 1801, 340, 310, 1207, 329, 417, 9271, 65149, 746, 310, 274, 284, 1207, 329, 417, 81392, 673, 5341, 329, 417, 3795, 851, 10849, 329, 417, 1801, 340, 310, 1207, 329, 417, 1462, 18103, 284, 274, 1462, 18103, 198, 310, 1207, 329, 417, 5973, 569, 851, 284, 274, 5973, 569, 851, 198, 310, 1207, 329, 417, 870, 9425, 69019, 851, 284, 274, 870, 9425, 69019, 851, 198, 286, 471, 282, 4163, 2164, 340, 262, 471, 13564, 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 ]
dranjan/python-plyfile
plyfile.py
PlyData.header
def header(self): ''' Provide PLY-formatted metadata for the instance. ''' lines = ['ply'] if self.text: lines.append('format ascii 1.0') else: lines.append('format ' + _byte_order_reverse[self.byte_order] + ' 1.0') # Some information is lost here, since all comments are placed # between the 'format' line and the first element. for c in self.comments: lines.append('comment ' + c) for c in self.obj_info: lines.append('obj_info ' + c) lines.extend(elt.header for elt in self.elements) lines.append('end_header') return '\n'.join(lines)
python
def header(self): ''' Provide PLY-formatted metadata for the instance. ''' lines = ['ply'] if self.text: lines.append('format ascii 1.0') else: lines.append('format ' + _byte_order_reverse[self.byte_order] + ' 1.0') # Some information is lost here, since all comments are placed # between the 'format' line and the first element. for c in self.comments: lines.append('comment ' + c) for c in self.obj_info: lines.append('obj_info ' + c) lines.extend(elt.header for elt in self.elements) lines.append('end_header') return '\n'.join(lines)
[ "def", "header", "(", "self", ")", ":", "lines", "=", "[", "'ply'", "]", "if", "self", ".", "text", ":", "lines", ".", "append", "(", "'format ascii 1.0'", ")", "else", ":", "lines", ".", "append", "(", "'format '", "+", "_byte_order_reverse", "[", "self", ".", "byte_order", "]", "+", "' 1.0'", ")", "# Some information is lost here, since all comments are placed", "# between the 'format' line and the first element.", "for", "c", "in", "self", ".", "comments", ":", "lines", ".", "append", "(", "'comment '", "+", "c", ")", "for", "c", "in", "self", ".", "obj_info", ":", "lines", ".", "append", "(", "'obj_info '", "+", "c", ")", "lines", ".", "extend", "(", "elt", ".", "header", "for", "elt", "in", "self", ".", "elements", ")", "lines", ".", "append", "(", "'end_header'", ")", "return", "'\\n'", ".", "join", "(", "lines", ")" ]
Provide PLY-formatted metadata for the instance.
[ "Provide", "PLY", "-", "formatted", "metadata", "for", "the", "instance", "." ]
train
https://github.com/dranjan/python-plyfile/blob/9f8e8708d3a071229cf292caae7d13264e11c88b/plyfile.py#L417-L441
<|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 PLY-formatted metadata for the instance. ### Response: def header(self): ''' Provide PLY-formatted metadata for the instance. ''' lines = ['ply'] if self.text: lines.append('format ascii 1.0') else: lines.append('format ' + _byte_order_reverse[self.byte_order] + ' 1.0') # Some information is lost here, since all comments are placed # between the 'format' line and the first element. for c in self.comments: lines.append('comment ' + c) for c in self.obj_info: lines.append('obj_info ' + c) lines.extend(elt.header for elt in self.elements) lines.append('end_header') return '\n'.join(lines) <|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, 393, 9109, 8627, 12400, 11408, 369, 279, 2937, 382, 14711, 6075, 512, 755, 4342, 1214, 997, 286, 11414, 286, 40665, 393, 9109, 8627, 12400, 11408, 369, 279, 2937, 382, 286, 11414, 286, 5238, 284, 2570, 2603, 16049, 286, 422, 659, 2858, 512, 310, 5238, 2102, 493, 2293, 48220, 220, 16, 13, 15, 1329, 286, 775, 512, 310, 5238, 2102, 493, 2293, 364, 3694, 5218, 721, 3867, 8028, 44377, 14664, 47872, 8028, 60, 3694, 5218, 364, 220, 16, 13, 15, 4713, 286, 674, 4427, 2038, 374, 5675, 1618, 11, 2533, 682, 6170, 527, 9277, 198, 286, 674, 1990, 279, 364, 2293, 6, 1584, 323, 279, 1176, 2449, 627, 286, 369, 272, 304, 659, 46174, 512, 310, 5238, 2102, 493, 6313, 364, 489, 272, 696, 286, 369, 272, 304, 659, 21926, 3186, 512, 310, 5238, 2102, 493, 2347, 3186, 364, 489, 272, 696, 286, 5238, 16209, 7, 3903, 17531, 369, 55239, 304, 659, 29377, 340, 286, 5238, 2102, 493, 408, 8932, 1329, 286, 471, 5307, 77, 4527, 6115, 34252, 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 ]
[ 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, 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, 393, 9109, 8627, 12400, 11408, 369, 279, 2937, 382, 14711, 6075, 512, 755, 4342, 1214, 997, 286, 11414, 286, 40665, 393, 9109, 8627, 12400, 11408, 369, 279, 2937, 382, 286, 11414, 286, 5238, 284, 2570, 2603, 16049, 286, 422, 659, 2858, 512, 310, 5238, 2102, 493, 2293, 48220, 220, 16, 13, 15, 1329, 286, 775, 512, 310, 5238, 2102, 493, 2293, 364, 3694, 5218, 721, 3867, 8028, 44377, 14664, 47872, 8028, 60, 3694, 5218, 364, 220, 16, 13, 15, 4713, 286, 674, 4427, 2038, 374, 5675, 1618, 11, 2533, 682, 6170, 527, 9277, 198, 286, 674, 1990, 279, 364, 2293, 6, 1584, 323, 279, 1176, 2449, 627, 286, 369, 272, 304, 659, 46174, 512, 310, 5238, 2102, 493, 6313, 364, 489, 272, 696, 286, 369, 272, 304, 659, 21926, 3186, 512, 310, 5238, 2102, 493, 2347, 3186, 364, 489, 272, 696, 286, 5238, 16209, 7, 3903, 17531, 369, 55239, 304, 659, 29377, 340, 286, 5238, 2102, 493, 408, 8932, 1329, 286, 471, 5307, 77, 4527, 6115, 34252, 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 ]
meejah/txtorcon
txtorcon/endpoints.py
get_global_tor_instance
def get_global_tor_instance(reactor, control_port=None, progress_updates=None, _tor_launcher=None): """ Normal users shouldn't need to call this; use TCPHiddenServiceEndpoint::system_tor instead. :return Tor: a 'global to this Python process' instance of Tor. There isn't one of these until the first time this method is called. All calls to this method return the same instance. """ global _global_tor global _global_tor_lock yield _global_tor_lock.acquire() if _tor_launcher is None: # XXX :( mutual dependencies...really get_global_tor_instance # should be in controller.py if it's going to return a Tor # instance. from .controller import launch _tor_launcher = launch try: if _global_tor is None: _global_tor = yield _tor_launcher(reactor, progress_updates=progress_updates) else: config = yield _global_tor.get_config() already_port = config.ControlPort if control_port is not None and control_port != already_port: raise RuntimeError( "ControlPort is already '{}', but you wanted '{}'", already_port, control_port, ) defer.returnValue(_global_tor) finally: _global_tor_lock.release()
python
def get_global_tor_instance(reactor, control_port=None, progress_updates=None, _tor_launcher=None): """ Normal users shouldn't need to call this; use TCPHiddenServiceEndpoint::system_tor instead. :return Tor: a 'global to this Python process' instance of Tor. There isn't one of these until the first time this method is called. All calls to this method return the same instance. """ global _global_tor global _global_tor_lock yield _global_tor_lock.acquire() if _tor_launcher is None: # XXX :( mutual dependencies...really get_global_tor_instance # should be in controller.py if it's going to return a Tor # instance. from .controller import launch _tor_launcher = launch try: if _global_tor is None: _global_tor = yield _tor_launcher(reactor, progress_updates=progress_updates) else: config = yield _global_tor.get_config() already_port = config.ControlPort if control_port is not None and control_port != already_port: raise RuntimeError( "ControlPort is already '{}', but you wanted '{}'", already_port, control_port, ) defer.returnValue(_global_tor) finally: _global_tor_lock.release()
[ "def", "get_global_tor_instance", "(", "reactor", ",", "control_port", "=", "None", ",", "progress_updates", "=", "None", ",", "_tor_launcher", "=", "None", ")", ":", "global", "_global_tor", "global", "_global_tor_lock", "yield", "_global_tor_lock", ".", "acquire", "(", ")", "if", "_tor_launcher", "is", "None", ":", "# XXX :( mutual dependencies...really get_global_tor_instance", "# should be in controller.py if it's going to return a Tor", "# instance.", "from", ".", "controller", "import", "launch", "_tor_launcher", "=", "launch", "try", ":", "if", "_global_tor", "is", "None", ":", "_global_tor", "=", "yield", "_tor_launcher", "(", "reactor", ",", "progress_updates", "=", "progress_updates", ")", "else", ":", "config", "=", "yield", "_global_tor", ".", "get_config", "(", ")", "already_port", "=", "config", ".", "ControlPort", "if", "control_port", "is", "not", "None", "and", "control_port", "!=", "already_port", ":", "raise", "RuntimeError", "(", "\"ControlPort is already '{}', but you wanted '{}'\"", ",", "already_port", ",", "control_port", ",", ")", "defer", ".", "returnValue", "(", "_global_tor", ")", "finally", ":", "_global_tor_lock", ".", "release", "(", ")" ]
Normal users shouldn't need to call this; use TCPHiddenServiceEndpoint::system_tor instead. :return Tor: a 'global to this Python process' instance of Tor. There isn't one of these until the first time this method is called. All calls to this method return the same instance.
[ "Normal", "users", "shouldn", "t", "need", "to", "call", "this", ";", "use", "TCPHiddenServiceEndpoint", "::", "system_tor", "instead", "." ]
train
https://github.com/meejah/txtorcon/blob/14053b95adf0b4bd9dd9c317bece912a26578a93/txtorcon/endpoints.py#L66-L105
<|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: Normal users shouldn't need to call this; use TCPHiddenServiceEndpoint::system_tor instead. :return Tor: a 'global to this Python process' instance of Tor. There isn't one of these until the first time this method is called. All calls to this method return the same instance. ### Response: def get_global_tor_instance(reactor, control_port=None, progress_updates=None, _tor_launcher=None): """ Normal users shouldn't need to call this; use TCPHiddenServiceEndpoint::system_tor instead. :return Tor: a 'global to this Python process' instance of Tor. There isn't one of these until the first time this method is called. All calls to this method return the same instance. """ global _global_tor global _global_tor_lock yield _global_tor_lock.acquire() if _tor_launcher is None: # XXX :( mutual dependencies...really get_global_tor_instance # should be in controller.py if it's going to return a Tor # instance. from .controller import launch _tor_launcher = launch try: if _global_tor is None: _global_tor = yield _tor_launcher(reactor, progress_updates=progress_updates) else: config = yield _global_tor.get_config() already_port = config.ControlPort if control_port is not None and control_port != already_port: raise RuntimeError( "ControlPort is already '{}', but you wanted '{}'", already_port, control_port, ) defer.returnValue(_global_tor) finally: _global_tor_lock.release() <|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, 12484, 3932, 13434, 956, 1205, 311, 1650, 420, 26, 1005, 198, 262, 27754, 17964, 1898, 28480, 487, 9125, 530, 269, 4619, 382, 262, 551, 693, 8611, 25, 264, 364, 9951, 311, 420, 13325, 1920, 6, 2937, 315, 198, 286, 8611, 13, 2684, 4536, 956, 832, 315, 1521, 3156, 279, 1176, 892, 420, 1749, 198, 286, 374, 2663, 13, 2052, 6880, 311, 420, 1749, 471, 279, 1890, 2937, 382, 14711, 6075, 512, 755, 636, 19854, 530, 269, 12169, 7, 3007, 269, 345, 1014, 2585, 8889, 5980, 345, 1014, 5208, 58929, 5980, 345, 1014, 721, 11222, 80377, 5980, 997, 262, 3270, 262, 18944, 3932, 13434, 956, 1205, 311, 1650, 420, 26, 1005, 198, 262, 27754, 17964, 1898, 28480, 487, 9125, 530, 269, 4619, 382, 262, 551, 693, 8611, 25, 264, 364, 9951, 311, 420, 13325, 1920, 6, 2937, 315, 198, 286, 8611, 13, 2684, 4536, 956, 832, 315, 1521, 3156, 279, 1176, 892, 420, 1749, 198, 286, 374, 2663, 13, 2052, 6880, 311, 420, 1749, 471, 279, 1890, 2937, 627, 262, 3270, 262, 3728, 721, 9951, 530, 269, 198, 262, 3728, 721, 9951, 530, 269, 10019, 198, 262, 7692, 721, 9951, 530, 269, 10019, 70727, 2892, 262, 422, 721, 11222, 80377, 374, 2290, 512, 286, 674, 20572, 40624, 27848, 20113, 1131, 54760, 636, 19854, 530, 269, 12169, 198, 286, 674, 1288, 387, 304, 6597, 7345, 422, 433, 596, 2133, 311, 471, 264, 8611, 198, 286, 674, 2937, 627, 286, 505, 662, 7299, 1179, 7195, 198, 286, 721, 11222, 80377, 284, 7195, 271, 262, 1456, 512, 286, 422, 721, 9951, 530, 269, 374, 2290, 512, 310, 721, 9951, 530, 269, 284, 7692, 721, 11222, 80377, 7, 3007, 269, 11, 5208, 58929, 28, 14703, 58929, 696, 286, 775, 512, 310, 2242, 284, 7692, 721, 9951, 530, 269, 673, 5445, 746, 310, 2736, 8889, 284, 2242, 4045, 7229, 198, 310, 422, 2585, 8889, 374, 539, 2290, 323, 2585, 8889, 976, 2736, 8889, 512, 394, 4933, 45643, 1021, 504, 330, 3353, 7229, 374, 2736, 34012, 518, 719, 499, 4934, 34012, 39430, 504, 2736, 8889, 345, 504, 2585, 8889, 345, 394, 5235, 286, 18440, 74550, 2551, 9951, 530, 269, 340, 262, 5616, 512, 286, 721, 9951, 530, 269, 10019, 26642, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 12484, 3932, 13434, 956, 1205, 311, 1650, 420, 26, 1005, 198, 262, 27754, 17964, 1898, 28480, 487, 9125, 530, 269, 4619, 382, 262, 551, 693, 8611, 25, 264, 364, 9951, 311, 420, 13325, 1920, 6, 2937, 315, 198, 286, 8611, 13, 2684, 4536, 956, 832, 315, 1521, 3156, 279, 1176, 892, 420, 1749, 198, 286, 374, 2663, 13, 2052, 6880, 311, 420, 1749, 471, 279, 1890, 2937, 382, 14711, 6075, 512, 755, 636, 19854, 530, 269, 12169, 7, 3007, 269, 345, 1014, 2585, 8889, 5980, 345, 1014, 5208, 58929, 5980, 345, 1014, 721, 11222, 80377, 5980, 997, 262, 3270, 262, 18944, 3932, 13434, 956, 1205, 311, 1650, 420, 26, 1005, 198, 262, 27754, 17964, 1898, 28480, 487, 9125, 530, 269, 4619, 382, 262, 551, 693, 8611, 25, 264, 364, 9951, 311, 420, 13325, 1920, 6, 2937, 315, 198, 286, 8611, 13, 2684, 4536, 956, 832, 315, 1521, 3156, 279, 1176, 892, 420, 1749, 198, 286, 374, 2663, 13, 2052, 6880, 311, 420, 1749, 471, 279, 1890, 2937, 627, 262, 3270, 262, 3728, 721, 9951, 530, 269, 198, 262, 3728, 721, 9951, 530, 269, 10019, 198, 262, 7692, 721, 9951, 530, 269, 10019, 70727, 2892, 262, 422, 721, 11222, 80377, 374, 2290, 512, 286, 674, 20572, 40624, 27848, 20113, 1131, 54760, 636, 19854, 530, 269, 12169, 198, 286, 674, 1288, 387, 304, 6597, 7345, 422, 433, 596, 2133, 311, 471, 264, 8611, 198, 286, 674, 2937, 627, 286, 505, 662, 7299, 1179, 7195, 198, 286, 721, 11222, 80377, 284, 7195, 271, 262, 1456, 512, 286, 422, 721, 9951, 530, 269, 374, 2290, 512, 310, 721, 9951, 530, 269, 284, 7692, 721, 11222, 80377, 7, 3007, 269, 11, 5208, 58929, 28, 14703, 58929, 696, 286, 775, 512, 310, 2242, 284, 7692, 721, 9951, 530, 269, 673, 5445, 746, 310, 2736, 8889, 284, 2242, 4045, 7229, 198, 310, 422, 2585, 8889, 374, 539, 2290, 323, 2585, 8889, 976, 2736, 8889, 512, 394, 4933, 45643, 1021, 504, 330, 3353, 7229, 374, 2736, 34012, 518, 719, 499, 4934, 34012, 39430, 504, 2736, 8889, 345, 504, 2585, 8889, 345, 394, 5235, 286, 18440, 74550, 2551, 9951, 530, 269, 340, 262, 5616, 512, 286, 721, 9951, 530, 269, 10019, 26642, 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 ]
UCSBarchlab/PyRTL
pyrtl/analysis/estimate.py
area_estimation
def area_estimation(tech_in_nm=130, block=None): """ Estimates the total area of the block. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :return: tuple of estimated areas (logic, mem) in terms of mm^2 The estimations are based off of 130nm stdcell designs for the logic, and custom memory blocks from the literature. The results are not fully validated and we do not recommend that this function be used in carrying out science for publication. """ def mem_area_estimate(tech_in_nm, bits, ports, is_rom): # http://www.cs.ucsb.edu/~sherwood/pubs/ICCD-srammodel.pdf # ROM is assumed to be 1/10th of area of SRAM tech_in_um = tech_in_nm / 1000.0 area_estimate = 0.001 * tech_in_um**2.07 * bits**0.9 * ports**0.7 + 0.0048 return area_estimate if not is_rom else area_estimate / 10.0 # Subset of the raw data gathered from yosys, mapping to vsclib 130nm library # Width Adder_Area Mult_Area (area in "tracks" as discussed below) # 8 211 2684 # 16 495 12742 # 32 1110 49319 # 64 2397 199175 # 128 4966 749828 def adder_stdcell_estimate(width): return width * 34.4 - 25.8 def multiplier_stdcell_estimate(width): if width == 1: return 5 elif width == 2: return 39 elif width == 3: return 219 else: return -958 + (150 * width) + (45 * width**2) def stdcell_estimate(net): if net.op in 'w~sc': return 0 elif net.op in '&|n': return 40/8.0 * len(net.args[0]) # 40 lambda elif net.op in '^=<>x': return 80/8.0 * len(net.args[0]) # 80 lambda elif net.op == 'r': return 144/8.0 * len(net.args[0]) # 144 lambda elif net.op in '+-': return adder_stdcell_estimate(len(net.args[0])) elif net.op == '*': return multiplier_stdcell_estimate(len(net.args[0])) elif net.op in 'm@': return 0 # memories handled elsewhere else: raise PyrtlInternalError('Unable to estimate the following net ' 'due to unimplemented op :\n%s' % str(net)) block = working_block(block) # The functions above were gathered and calibrated by mapping # reference designs to an openly available 130nm stdcell library. # http://www.vlsitechnology.org/html/vsc_description.html # http://www.vlsitechnology.org/html/cells/vsclib013/lib_gif_index.html # In a standard cell design, each gate takes up a length of standard "track" # in the chip. The functions above return that length for each of the different # types of functions in the units of "tracks". In the 130nm process used, # 1 lambda is 55nm, and 1 track is 8 lambda. # first, sum up the area of all of the logic elements (including registers) total_tracks = sum(stdcell_estimate(a_net) for a_net in block.logic) total_length_in_nm = total_tracks * 8 * 55 # each track is then 72 lambda tall, and converted from nm2 to mm2 area_in_mm2_for_130nm = (total_length_in_nm * (72 * 55)) / 1e12 # scaling from 130nm to the target tech logic_area = area_in_mm2_for_130nm / (130.0/tech_in_nm)**2 # now sum up the area of the memories mem_area = 0 for mem in set(net.op_param[1] for net in block.logic_subset('@m')): bits, ports, is_rom = _bits_ports_and_isrom_from_memory(mem) mem_area += mem_area_estimate(tech_in_nm, bits, ports, is_rom) return logic_area, mem_area
python
def area_estimation(tech_in_nm=130, block=None): """ Estimates the total area of the block. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :return: tuple of estimated areas (logic, mem) in terms of mm^2 The estimations are based off of 130nm stdcell designs for the logic, and custom memory blocks from the literature. The results are not fully validated and we do not recommend that this function be used in carrying out science for publication. """ def mem_area_estimate(tech_in_nm, bits, ports, is_rom): # http://www.cs.ucsb.edu/~sherwood/pubs/ICCD-srammodel.pdf # ROM is assumed to be 1/10th of area of SRAM tech_in_um = tech_in_nm / 1000.0 area_estimate = 0.001 * tech_in_um**2.07 * bits**0.9 * ports**0.7 + 0.0048 return area_estimate if not is_rom else area_estimate / 10.0 # Subset of the raw data gathered from yosys, mapping to vsclib 130nm library # Width Adder_Area Mult_Area (area in "tracks" as discussed below) # 8 211 2684 # 16 495 12742 # 32 1110 49319 # 64 2397 199175 # 128 4966 749828 def adder_stdcell_estimate(width): return width * 34.4 - 25.8 def multiplier_stdcell_estimate(width): if width == 1: return 5 elif width == 2: return 39 elif width == 3: return 219 else: return -958 + (150 * width) + (45 * width**2) def stdcell_estimate(net): if net.op in 'w~sc': return 0 elif net.op in '&|n': return 40/8.0 * len(net.args[0]) # 40 lambda elif net.op in '^=<>x': return 80/8.0 * len(net.args[0]) # 80 lambda elif net.op == 'r': return 144/8.0 * len(net.args[0]) # 144 lambda elif net.op in '+-': return adder_stdcell_estimate(len(net.args[0])) elif net.op == '*': return multiplier_stdcell_estimate(len(net.args[0])) elif net.op in 'm@': return 0 # memories handled elsewhere else: raise PyrtlInternalError('Unable to estimate the following net ' 'due to unimplemented op :\n%s' % str(net)) block = working_block(block) # The functions above were gathered and calibrated by mapping # reference designs to an openly available 130nm stdcell library. # http://www.vlsitechnology.org/html/vsc_description.html # http://www.vlsitechnology.org/html/cells/vsclib013/lib_gif_index.html # In a standard cell design, each gate takes up a length of standard "track" # in the chip. The functions above return that length for each of the different # types of functions in the units of "tracks". In the 130nm process used, # 1 lambda is 55nm, and 1 track is 8 lambda. # first, sum up the area of all of the logic elements (including registers) total_tracks = sum(stdcell_estimate(a_net) for a_net in block.logic) total_length_in_nm = total_tracks * 8 * 55 # each track is then 72 lambda tall, and converted from nm2 to mm2 area_in_mm2_for_130nm = (total_length_in_nm * (72 * 55)) / 1e12 # scaling from 130nm to the target tech logic_area = area_in_mm2_for_130nm / (130.0/tech_in_nm)**2 # now sum up the area of the memories mem_area = 0 for mem in set(net.op_param[1] for net in block.logic_subset('@m')): bits, ports, is_rom = _bits_ports_and_isrom_from_memory(mem) mem_area += mem_area_estimate(tech_in_nm, bits, ports, is_rom) return logic_area, mem_area
[ "def", "area_estimation", "(", "tech_in_nm", "=", "130", ",", "block", "=", "None", ")", ":", "def", "mem_area_estimate", "(", "tech_in_nm", ",", "bits", ",", "ports", ",", "is_rom", ")", ":", "# http://www.cs.ucsb.edu/~sherwood/pubs/ICCD-srammodel.pdf", "# ROM is assumed to be 1/10th of area of SRAM", "tech_in_um", "=", "tech_in_nm", "/", "1000.0", "area_estimate", "=", "0.001", "*", "tech_in_um", "**", "2.07", "*", "bits", "**", "0.9", "*", "ports", "**", "0.7", "+", "0.0048", "return", "area_estimate", "if", "not", "is_rom", "else", "area_estimate", "/", "10.0", "# Subset of the raw data gathered from yosys, mapping to vsclib 130nm library", "# Width Adder_Area Mult_Area (area in \"tracks\" as discussed below)", "# 8 211 2684", "# 16 495 12742", "# 32 1110 49319", "# 64 2397 199175", "# 128 4966 749828", "def", "adder_stdcell_estimate", "(", "width", ")", ":", "return", "width", "*", "34.4", "-", "25.8", "def", "multiplier_stdcell_estimate", "(", "width", ")", ":", "if", "width", "==", "1", ":", "return", "5", "elif", "width", "==", "2", ":", "return", "39", "elif", "width", "==", "3", ":", "return", "219", "else", ":", "return", "-", "958", "+", "(", "150", "*", "width", ")", "+", "(", "45", "*", "width", "**", "2", ")", "def", "stdcell_estimate", "(", "net", ")", ":", "if", "net", ".", "op", "in", "'w~sc'", ":", "return", "0", "elif", "net", ".", "op", "in", "'&|n'", ":", "return", "40", "/", "8.0", "*", "len", "(", "net", ".", "args", "[", "0", "]", ")", "# 40 lambda", "elif", "net", ".", "op", "in", "'^=<>x'", ":", "return", "80", "/", "8.0", "*", "len", "(", "net", ".", "args", "[", "0", "]", ")", "# 80 lambda", "elif", "net", ".", "op", "==", "'r'", ":", "return", "144", "/", "8.0", "*", "len", "(", "net", ".", "args", "[", "0", "]", ")", "# 144 lambda", "elif", "net", ".", "op", "in", "'+-'", ":", "return", "adder_stdcell_estimate", "(", "len", "(", "net", ".", "args", "[", "0", "]", ")", ")", "elif", "net", ".", "op", "==", "'*'", ":", "return", "multiplier_stdcell_estimate", "(", "len", "(", "net", ".", "args", "[", "0", "]", ")", ")", "elif", "net", ".", "op", "in", "'m@'", ":", "return", "0", "# memories handled elsewhere", "else", ":", "raise", "PyrtlInternalError", "(", "'Unable to estimate the following net '", "'due to unimplemented op :\\n%s'", "%", "str", "(", "net", ")", ")", "block", "=", "working_block", "(", "block", ")", "# The functions above were gathered and calibrated by mapping", "# reference designs to an openly available 130nm stdcell library.", "# http://www.vlsitechnology.org/html/vsc_description.html", "# http://www.vlsitechnology.org/html/cells/vsclib013/lib_gif_index.html", "# In a standard cell design, each gate takes up a length of standard \"track\"", "# in the chip. The functions above return that length for each of the different", "# types of functions in the units of \"tracks\". In the 130nm process used,", "# 1 lambda is 55nm, and 1 track is 8 lambda.", "# first, sum up the area of all of the logic elements (including registers)", "total_tracks", "=", "sum", "(", "stdcell_estimate", "(", "a_net", ")", "for", "a_net", "in", "block", ".", "logic", ")", "total_length_in_nm", "=", "total_tracks", "*", "8", "*", "55", "# each track is then 72 lambda tall, and converted from nm2 to mm2", "area_in_mm2_for_130nm", "=", "(", "total_length_in_nm", "*", "(", "72", "*", "55", ")", ")", "/", "1e12", "# scaling from 130nm to the target tech", "logic_area", "=", "area_in_mm2_for_130nm", "/", "(", "130.0", "/", "tech_in_nm", ")", "**", "2", "# now sum up the area of the memories", "mem_area", "=", "0", "for", "mem", "in", "set", "(", "net", ".", "op_param", "[", "1", "]", "for", "net", "in", "block", ".", "logic_subset", "(", "'@m'", ")", ")", ":", "bits", ",", "ports", ",", "is_rom", "=", "_bits_ports_and_isrom_from_memory", "(", "mem", ")", "mem_area", "+=", "mem_area_estimate", "(", "tech_in_nm", ",", "bits", ",", "ports", ",", "is_rom", ")", "return", "logic_area", ",", "mem_area" ]
Estimates the total area of the block. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :return: tuple of estimated areas (logic, mem) in terms of mm^2 The estimations are based off of 130nm stdcell designs for the logic, and custom memory blocks from the literature. The results are not fully validated and we do not recommend that this function be used in carrying out science for publication.
[ "Estimates", "the", "total", "area", "of", "the", "block", "." ]
train
https://github.com/UCSBarchlab/PyRTL/blob/0988e5c9c10ededd5e1f58d5306603f9edf4b3e2/pyrtl/analysis/estimate.py#L29-L116
<|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: Estimates the total area of the block. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :return: tuple of estimated areas (logic, mem) in terms of mm^2 The estimations are based off of 130nm stdcell designs for the logic, and custom memory blocks from the literature. The results are not fully validated and we do not recommend that this function be used in carrying out science for publication. ### Response: def area_estimation(tech_in_nm=130, block=None): """ Estimates the total area of the block. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :return: tuple of estimated areas (logic, mem) in terms of mm^2 The estimations are based off of 130nm stdcell designs for the logic, and custom memory blocks from the literature. The results are not fully validated and we do not recommend that this function be used in carrying out science for publication. """ def mem_area_estimate(tech_in_nm, bits, ports, is_rom): # http://www.cs.ucsb.edu/~sherwood/pubs/ICCD-srammodel.pdf # ROM is assumed to be 1/10th of area of SRAM tech_in_um = tech_in_nm / 1000.0 area_estimate = 0.001 * tech_in_um**2.07 * bits**0.9 * ports**0.7 + 0.0048 return area_estimate if not is_rom else area_estimate / 10.0 # Subset of the raw data gathered from yosys, mapping to vsclib 130nm library # Width Adder_Area Mult_Area (area in "tracks" as discussed below) # 8 211 2684 # 16 495 12742 # 32 1110 49319 # 64 2397 199175 # 128 4966 749828 def adder_stdcell_estimate(width): return width * 34.4 - 25.8 def multiplier_stdcell_estimate(width): if width == 1: return 5 elif width == 2: return 39 elif width == 3: return 219 else: return -958 + (150 * width) + (45 * width**2) def stdcell_estimate(net): if net.op in 'w~sc': return 0 elif net.op in '&|n': return 40/8.0 * len(net.args[0]) # 40 lambda elif net.op in '^=<>x': return 80/8.0 * len(net.args[0]) # 80 lambda elif net.op == 'r': return 144/8.0 * len(net.args[0]) # 144 lambda elif net.op in '+-': return adder_stdcell_estimate(len(net.args[0])) elif net.op == '*': return multiplier_stdcell_estimate(len(net.args[0])) elif net.op in 'm@': return 0 # memories handled elsewhere else: raise PyrtlInternalError('Unable to estimate the following net ' 'due to unimplemented op :\n%s' % str(net)) block = working_block(block) # The functions above were gathered and calibrated by mapping # reference designs to an openly available 130nm stdcell library. # http://www.vlsitechnology.org/html/vsc_description.html # http://www.vlsitechnology.org/html/cells/vsclib013/lib_gif_index.html # In a standard cell design, each gate takes up a length of standard "track" # in the chip. The functions above return that length for each of the different # types of functions in the units of "tracks". In the 130nm process used, # 1 lambda is 55nm, and 1 track is 8 lambda. # first, sum up the area of all of the logic elements (including registers) total_tracks = sum(stdcell_estimate(a_net) for a_net in block.logic) total_length_in_nm = total_tracks * 8 * 55 # each track is then 72 lambda tall, and converted from nm2 to mm2 area_in_mm2_for_130nm = (total_length_in_nm * (72 * 55)) / 1e12 # scaling from 130nm to the target tech logic_area = area_in_mm2_for_130nm / (130.0/tech_in_nm)**2 # now sum up the area of the memories mem_area = 0 for mem in set(net.op_param[1] for net in block.logic_subset('@m')): bits, ports, is_rom = _bits_ports_and_isrom_from_memory(mem) mem_area += mem_area_estimate(tech_in_nm, bits, ports, is_rom) return logic_area, mem_area <|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, 14101, 48571, 279, 2860, 3158, 315, 279, 2565, 382, 262, 551, 913, 13312, 1265, 58672, 25, 279, 1404, 315, 279, 16622, 5557, 311, 387, 13240, 198, 286, 320, 2000, 3187, 11, 220, 2397, 374, 220, 2397, 20211, 323, 220, 5154, 374, 220, 15, 13, 914, 372, 340, 262, 551, 693, 25, 14743, 315, 13240, 5789, 320, 25205, 11, 1871, 8, 304, 3878, 315, 9653, 61, 17, 271, 262, 578, 15279, 811, 527, 3196, 1022, 315, 220, 5894, 20211, 1487, 5997, 14769, 369, 279, 12496, 11, 323, 198, 262, 2587, 5044, 10215, 505, 279, 17649, 13, 220, 578, 3135, 527, 539, 7373, 33432, 198, 262, 323, 584, 656, 539, 7079, 430, 420, 734, 387, 1511, 304, 15691, 704, 8198, 369, 198, 262, 17009, 382, 14711, 6075, 512, 755, 3158, 19095, 5582, 7, 18261, 1265, 58672, 28, 5894, 11, 2565, 5980, 997, 262, 4304, 95619, 279, 2860, 3158, 315, 279, 2565, 382, 262, 551, 913, 13312, 1265, 58672, 25, 279, 1404, 315, 279, 16622, 5557, 311, 387, 13240, 198, 286, 320, 2000, 3187, 11, 220, 2397, 374, 220, 2397, 20211, 323, 220, 5154, 374, 220, 15, 13, 914, 372, 340, 262, 551, 693, 25, 14743, 315, 13240, 5789, 320, 25205, 11, 1871, 8, 304, 3878, 315, 9653, 61, 17, 271, 262, 578, 15279, 811, 527, 3196, 1022, 315, 220, 5894, 20211, 1487, 5997, 14769, 369, 279, 12496, 11, 323, 198, 262, 2587, 5044, 10215, 505, 279, 17649, 13, 220, 578, 3135, 527, 539, 7373, 33432, 198, 262, 323, 584, 656, 539, 7079, 430, 420, 734, 387, 1511, 304, 15691, 704, 8198, 369, 198, 262, 17009, 627, 262, 12713, 262, 711, 1871, 15380, 79818, 7, 18261, 1265, 58672, 11, 9660, 11, 20946, 11, 374, 82483, 997, 286, 674, 1795, 1129, 2185, 19302, 57434, 17319, 12871, 54896, 90605, 6798, 4420, 16115, 14, 1341, 6620, 1355, 2453, 2590, 16378, 198, 286, 674, 31786, 374, 19655, 311, 387, 220, 16, 14, 605, 339, 315, 3158, 315, 21550, 1428, 198, 286, 13312, 1265, 73163, 284, 13312, 1265, 58672, 611, 220, 1041, 15, 13, 15, 198, 286, 3158, 79818, 284, 220, 15, 13, 4119, 353, 13312, 1265, 73163, 334, 17, 13, 2589, 353, 9660, 334, 15, 13, 24, 353, 20946, 334, 15, 13, 22, 489, 220, 15, 13, 8759, 23, 198, 286, 471, 3158, 79818, 422, 539, 374, 82483, 775, 3158, 79818, 611, 220, 605, 13, 15, 271, 262, 674, 74323, 315, 279, 7257, 828, 20802, 505, 379, 437, 1065, 11, 13021, 311, 6296, 566, 581, 220, 5894, 20211, 6875, 198, 262, 674, 25650, 256, 2758, 261, 1596, 5325, 220, 22950, 1596, 5325, 220, 320, 4903, 304, 330, 50424, 1, 439, 14407, 3770, 340, 262, 674, 220, 23, 996, 220, 11483, 260, 220, 16332, 19, 198, 262, 674, 220, 845, 415, 220, 21038, 260, 220, 6804, 2983, 198, 262, 674, 220, 843, 415, 220, 5037, 15, 286, 220, 22741, 777, 198 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 14101, 48571, 279, 2860, 3158, 315, 279, 2565, 382, 262, 551, 913, 13312, 1265, 58672, 25, 279, 1404, 315, 279, 16622, 5557, 311, 387, 13240, 198, 286, 320, 2000, 3187, 11, 220, 2397, 374, 220, 2397, 20211, 323, 220, 5154, 374, 220, 15, 13, 914, 372, 340, 262, 551, 693, 25, 14743, 315, 13240, 5789, 320, 25205, 11, 1871, 8, 304, 3878, 315, 9653, 61, 17, 271, 262, 578, 15279, 811, 527, 3196, 1022, 315, 220, 5894, 20211, 1487, 5997, 14769, 369, 279, 12496, 11, 323, 198, 262, 2587, 5044, 10215, 505, 279, 17649, 13, 220, 578, 3135, 527, 539, 7373, 33432, 198, 262, 323, 584, 656, 539, 7079, 430, 420, 734, 387, 1511, 304, 15691, 704, 8198, 369, 198, 262, 17009, 382, 14711, 6075, 512, 755, 3158, 19095, 5582, 7, 18261, 1265, 58672, 28, 5894, 11, 2565, 5980, 997, 262, 4304, 95619, 279, 2860, 3158, 315, 279, 2565, 382, 262, 551, 913, 13312, 1265, 58672, 25, 279, 1404, 315, 279, 16622, 5557, 311, 387, 13240, 198, 286, 320, 2000, 3187, 11, 220, 2397, 374, 220, 2397, 20211, 323, 220, 5154, 374, 220, 15, 13, 914, 372, 340, 262, 551, 693, 25, 14743, 315, 13240, 5789, 320, 25205, 11, 1871, 8, 304, 3878, 315, 9653, 61, 17, 271, 262, 578, 15279, 811, 527, 3196, 1022, 315, 220, 5894, 20211, 1487, 5997, 14769, 369, 279, 12496, 11, 323, 198, 262, 2587, 5044, 10215, 505, 279, 17649, 13, 220, 578, 3135, 527, 539, 7373, 33432, 198, 262, 323, 584, 656, 539, 7079, 430, 420, 734, 387, 1511, 304, 15691, 704, 8198, 369, 198, 262, 17009, 627, 262, 12713, 262, 711, 1871, 15380, 79818, 7, 18261, 1265, 58672, 11, 9660, 11, 20946, 11, 374, 82483, 997, 286, 674, 1795, 1129, 2185, 19302, 57434, 17319, 12871, 54896, 90605, 6798, 4420, 16115, 14, 1341, 6620, 1355, 2453, 2590, 16378, 198, 286, 674, 31786, 374, 19655, 311, 387, 220, 16, 14, 605, 339, 315, 3158, 315, 21550, 1428, 198, 286, 13312, 1265, 73163, 284, 13312, 1265, 58672, 611, 220, 1041, 15, 13, 15, 198, 286, 3158, 79818, 284, 220, 15, 13, 4119, 353, 13312, 1265, 73163, 334, 17, 13, 2589, 353, 9660, 334, 15, 13, 24, 353, 20946, 334, 15, 13, 22, 489, 220, 15, 13, 8759, 23, 198, 286, 471, 3158, 79818, 422, 539, 374, 82483, 775, 3158, 79818, 611, 220, 605, 13, 15, 271, 262, 674, 74323, 315, 279, 7257, 828, 20802, 505, 379, 437, 1065, 11, 13021, 311, 6296, 566, 581, 220, 5894, 20211, 6875, 198, 262, 674, 25650, 256, 2758, 261, 1596, 5325, 220, 22950, 1596, 5325, 220, 320, 4903, 304, 330, 50424, 1, 439, 14407, 3770, 340, 262, 674, 220, 23, 996, 220, 11483, 260, 220, 16332, 19, 198, 262, 674, 220, 845, 415, 220, 21038, 260, 220, 6804, 2983, 198, 262, 674, 220, 843, 415, 220, 5037, 15, 286, 220, 22741, 777, 198 ]
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/srtm.py
SRTMTile._avg
def _avg(value1, value2, weight): """Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned. """ if value1 is None: return value2 if value2 is None: return value1 return value2 * weight + value1 * (1 - weight)
python
def _avg(value1, value2, weight): """Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned. """ if value1 is None: return value2 if value2 is None: return value1 return value2 * weight + value1 * (1 - weight)
[ "def", "_avg", "(", "value1", ",", "value2", ",", "weight", ")", ":", "if", "value1", "is", "None", ":", "return", "value2", "if", "value2", "is", "None", ":", "return", "value1", "return", "value2", "*", "weight", "+", "value1", "*", "(", "1", "-", "weight", ")" ]
Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned.
[ "Returns", "the", "weighted", "average", "of", "two", "values", "and", "handles", "the", "case", "where", "one", "value", "is", "None", ".", "If", "both", "values", "are", "None", "None", "is", "returned", "." ]
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/srtm.py#L305-L313
<|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 the weighted average of two values and handles the case where one value is None. If both values are None, None is returned. ### Response: def _avg(value1, value2, weight): """Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned. """ if value1 is None: return value2 if value2 is None: return value1 return value2 * weight + value1 * (1 - weight) <|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, 279, 37924, 5578, 315, 1403, 2819, 323, 13777, 279, 1162, 1405, 198, 310, 832, 907, 374, 2290, 13, 1442, 2225, 2819, 527, 2290, 11, 2290, 374, 6052, 382, 14711, 6075, 512, 755, 721, 14288, 3764, 16, 11, 907, 17, 11, 4785, 997, 286, 4304, 16851, 279, 37924, 5578, 315, 1403, 2819, 323, 13777, 279, 1162, 1405, 198, 310, 832, 907, 374, 2290, 13, 1442, 2225, 2819, 527, 2290, 11, 2290, 374, 6052, 627, 286, 3270, 286, 422, 907, 16, 374, 2290, 512, 310, 471, 907, 17, 198, 286, 422, 907, 17, 374, 2290, 512, 310, 471, 907, 16, 198, 286, 471, 907, 17, 353, 4785, 489, 907, 16, 353, 320, 16, 482, 4785, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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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, 279, 37924, 5578, 315, 1403, 2819, 323, 13777, 279, 1162, 1405, 198, 310, 832, 907, 374, 2290, 13, 1442, 2225, 2819, 527, 2290, 11, 2290, 374, 6052, 382, 14711, 6075, 512, 755, 721, 14288, 3764, 16, 11, 907, 17, 11, 4785, 997, 286, 4304, 16851, 279, 37924, 5578, 315, 1403, 2819, 323, 13777, 279, 1162, 1405, 198, 310, 832, 907, 374, 2290, 13, 1442, 2225, 2819, 527, 2290, 11, 2290, 374, 6052, 627, 286, 3270, 286, 422, 907, 16, 374, 2290, 512, 310, 471, 907, 17, 198, 286, 422, 907, 17, 374, 2290, 512, 310, 471, 907, 16, 198, 286, 471, 907, 17, 353, 4785, 489, 907, 16, 353, 320, 16, 482, 4785, 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 ]
limodou/uliweb
uliweb/lib/werkzeug/contrib/sessions.py
ModificationTrackingDict.copy
def copy(self): """Create a flat copy of the dict.""" missing = object() result = object.__new__(self.__class__) for name in self.__slots__: val = getattr(self, name, missing) if val is not missing: setattr(result, name, val) return result
python
def copy(self): """Create a flat copy of the dict.""" missing = object() result = object.__new__(self.__class__) for name in self.__slots__: val = getattr(self, name, missing) if val is not missing: setattr(result, name, val) return result
[ "def", "copy", "(", "self", ")", ":", "missing", "=", "object", "(", ")", "result", "=", "object", ".", "__new__", "(", "self", ".", "__class__", ")", "for", "name", "in", "self", ".", "__slots__", ":", "val", "=", "getattr", "(", "self", ",", "name", ",", "missing", ")", "if", "val", "is", "not", "missing", ":", "setattr", "(", "result", ",", "name", ",", "val", ")", "return", "result" ]
Create a flat copy of the dict.
[ "Create", "a", "flat", "copy", "of", "the", "dict", "." ]
train
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/lib/werkzeug/contrib/sessions.py#L100-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: Create a flat copy of the dict. ### Response: def copy(self): """Create a flat copy of the dict.""" missing = object() result = object.__new__(self.__class__) for name in self.__slots__: val = getattr(self, name, missing) if val is not missing: setattr(result, name, val) 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, 4110, 264, 10269, 3048, 315, 279, 6587, 382, 14711, 6075, 512, 755, 3048, 1214, 997, 286, 4304, 4110, 264, 10269, 3048, 315, 279, 6587, 14781, 286, 7554, 284, 1665, 746, 286, 1121, 284, 1665, 4952, 943, 3889, 726, 4952, 1058, 24010, 286, 369, 836, 304, 659, 4952, 50867, 565, 512, 310, 1062, 284, 31097, 1214, 11, 836, 11, 7554, 340, 310, 422, 1062, 374, 539, 7554, 512, 394, 62214, 4556, 11, 836, 11, 1062, 340, 286, 471, 1121, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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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, 10269, 3048, 315, 279, 6587, 382, 14711, 6075, 512, 755, 3048, 1214, 997, 286, 4304, 4110, 264, 10269, 3048, 315, 279, 6587, 14781, 286, 7554, 284, 1665, 746, 286, 1121, 284, 1665, 4952, 943, 3889, 726, 4952, 1058, 24010, 286, 369, 836, 304, 659, 4952, 50867, 565, 512, 310, 1062, 284, 31097, 1214, 11, 836, 11, 7554, 340, 310, 422, 1062, 374, 539, 7554, 512, 394, 62214, 4556, 11, 836, 11, 1062, 340, 286, 471, 1121, 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 ]
ambitioninc/newrelic-api
newrelic_api/alert_conditions_infra.py
AlertConditionsInfra.list
def list(self, policy_id, limit=None, offset=None): """ This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :param limit: Max amount of results to return :type offset: string :param offset: Starting record to return :rtype: dict :return: The JSON response of the API, with an additional 'pages' key if there are paginated results :: { "data": [ { "id": "integer", "policy_id": "integer", "type": "string", "name": "string", "enabled": "boolean", "where_clause": "string", "comparison": "string", "filter": "hash", "critical_threshold": "hash", "process_where_clause": "string", "created_at_epoch_millis": "time", "updated_at_epoch_millis": "time" } ], "meta": { "limit": "integer", "offset": "integer", "total": "integer" } } """ filters = [ 'policy_id={0}'.format(policy_id), 'limit={0}'.format(limit) if limit else '50', 'offset={0}'.format(offset) if offset else '0' ] return self._get( url='{0}alerts/conditions'.format(self.URL), headers=self.headers, params=self.build_param_string(filters) )
python
def list(self, policy_id, limit=None, offset=None): """ This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :param limit: Max amount of results to return :type offset: string :param offset: Starting record to return :rtype: dict :return: The JSON response of the API, with an additional 'pages' key if there are paginated results :: { "data": [ { "id": "integer", "policy_id": "integer", "type": "string", "name": "string", "enabled": "boolean", "where_clause": "string", "comparison": "string", "filter": "hash", "critical_threshold": "hash", "process_where_clause": "string", "created_at_epoch_millis": "time", "updated_at_epoch_millis": "time" } ], "meta": { "limit": "integer", "offset": "integer", "total": "integer" } } """ filters = [ 'policy_id={0}'.format(policy_id), 'limit={0}'.format(limit) if limit else '50', 'offset={0}'.format(offset) if offset else '0' ] return self._get( url='{0}alerts/conditions'.format(self.URL), headers=self.headers, params=self.build_param_string(filters) )
[ "def", "list", "(", "self", ",", "policy_id", ",", "limit", "=", "None", ",", "offset", "=", "None", ")", ":", "filters", "=", "[", "'policy_id={0}'", ".", "format", "(", "policy_id", ")", ",", "'limit={0}'", ".", "format", "(", "limit", ")", "if", "limit", "else", "'50'", ",", "'offset={0}'", ".", "format", "(", "offset", ")", "if", "offset", "else", "'0'", "]", "return", "self", ".", "_get", "(", "url", "=", "'{0}alerts/conditions'", ".", "format", "(", "self", ".", "URL", ")", ",", "headers", "=", "self", ".", "headers", ",", "params", "=", "self", ".", "build_param_string", "(", "filters", ")", ")" ]
This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :param limit: Max amount of results to return :type offset: string :param offset: Starting record to return :rtype: dict :return: The JSON response of the API, with an additional 'pages' key if there are paginated results :: { "data": [ { "id": "integer", "policy_id": "integer", "type": "string", "name": "string", "enabled": "boolean", "where_clause": "string", "comparison": "string", "filter": "hash", "critical_threshold": "hash", "process_where_clause": "string", "created_at_epoch_millis": "time", "updated_at_epoch_millis": "time" } ], "meta": { "limit": "integer", "offset": "integer", "total": "integer" } }
[ "This", "API", "endpoint", "returns", "a", "paginated", "list", "of", "alert", "conditions", "for", "infrastucture", "metrics", "associated", "with", "the", "given", "policy_id", "." ]
train
https://github.com/ambitioninc/newrelic-api/blob/07b4430aa6ae61e4704e2928a6e7a24c76f0f424/newrelic_api/alert_conditions_infra.py#L13-L69
<|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 API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :param limit: Max amount of results to return :type offset: string :param offset: Starting record to return :rtype: dict :return: The JSON response of the API, with an additional 'pages' key if there are paginated results :: { "data": [ { "id": "integer", "policy_id": "integer", "type": "string", "name": "string", "enabled": "boolean", "where_clause": "string", "comparison": "string", "filter": "hash", "critical_threshold": "hash", "process_where_clause": "string", "created_at_epoch_millis": "time", "updated_at_epoch_millis": "time" } ], "meta": { "limit": "integer", "offset": "integer", "total": "integer" } } ### Response: def list(self, policy_id, limit=None, offset=None): """ This API endpoint returns a paginated list of alert conditions for infrastucture metrics associated with the given policy_id. :type policy_id: int :param policy_id: Alert policy id :type limit: string :param limit: Max amount of results to return :type offset: string :param offset: Starting record to return :rtype: dict :return: The JSON response of the API, with an additional 'pages' key if there are paginated results :: { "data": [ { "id": "integer", "policy_id": "integer", "type": "string", "name": "string", "enabled": "boolean", "where_clause": "string", "comparison": "string", "filter": "hash", "critical_threshold": "hash", "process_where_clause": "string", "created_at_epoch_millis": "time", "updated_at_epoch_millis": "time" } ], "meta": { "limit": "integer", "offset": "integer", "total": "integer" } } """ filters = [ 'policy_id={0}'.format(policy_id), 'limit={0}'.format(limit) if limit else '50', 'offset={0}'.format(offset) if offset else '0' ] return self._get( url='{0}alerts/conditions'.format(self.URL), headers=self.headers, params=self.build_param_string(filters) ) <|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, 5446, 15233, 4780, 264, 15117, 15846, 1160, 315, 5225, 4787, 369, 25654, 561, 670, 554, 198, 286, 17150, 5938, 449, 279, 2728, 4947, 851, 382, 286, 551, 1337, 4947, 851, 25, 528, 198, 286, 551, 913, 4947, 851, 25, 14302, 4947, 887, 271, 286, 551, 1337, 4017, 25, 925, 198, 286, 551, 913, 4017, 25, 7639, 3392, 315, 3135, 311, 471, 271, 286, 551, 1337, 4445, 25, 925, 198, 286, 551, 913, 4445, 25, 28757, 3335, 311, 471, 271, 286, 551, 33613, 25, 6587, 198, 286, 551, 693, 25, 578, 4823, 2077, 315, 279, 5446, 11, 449, 459, 5217, 364, 11014, 6, 1401, 198, 310, 422, 1070, 527, 15117, 15846, 3135, 271, 286, 3588, 271, 310, 341, 394, 330, 695, 794, 2330, 504, 341, 667, 330, 307, 794, 330, 11924, 761, 667, 330, 35890, 851, 794, 330, 11924, 761, 667, 330, 1337, 794, 330, 928, 761, 667, 330, 609, 794, 330, 928, 761, 667, 330, 16247, 794, 330, 6245, 761, 667, 330, 2940, 58630, 794, 330, 928, 761, 667, 330, 55805, 794, 330, 928, 761, 667, 330, 5428, 794, 330, 8460, 761, 667, 330, 42641, 22616, 794, 330, 8460, 761, 667, 330, 4734, 37914, 58630, 794, 330, 928, 761, 667, 330, 7266, 3837, 21339, 722, 57312, 794, 330, 1712, 761, 667, 330, 12030, 3837, 21339, 722, 57312, 794, 330, 1712, 702, 504, 457, 394, 3291, 394, 330, 5607, 794, 341, 504, 330, 9696, 794, 330, 11924, 761, 504, 330, 3255, 794, 330, 11924, 761, 504, 330, 5143, 794, 330, 11924, 702, 394, 457, 310, 557, 14711, 6075, 512, 755, 1160, 1214, 11, 4947, 851, 11, 4017, 5980, 11, 4445, 5980, 997, 286, 3270, 286, 1115, 5446, 15233, 4780, 264, 15117, 15846, 1160, 315, 5225, 4787, 369, 25654, 561, 670, 554, 198, 286, 17150, 5938, 449, 279, 2728, 4947, 851, 382, 286, 551, 1337, 4947, 851, 25, 528, 198, 286, 551, 913, 4947, 851, 25, 14302, 4947, 887, 271, 286, 551, 1337, 4017, 25, 925, 198, 286, 551, 913, 4017, 25, 7639, 3392, 315, 3135, 311, 471, 271, 286, 551, 1337, 4445, 25, 925, 198, 286, 551, 913, 4445, 25, 28757, 3335, 311, 471, 271, 286, 551, 33613, 25, 6587, 198, 286, 551, 693, 25, 578, 4823, 2077, 315, 279, 5446, 11, 449, 459, 5217, 364, 11014, 6, 1401, 198, 310, 422, 1070, 527, 15117, 15846, 3135, 271, 286, 3588, 271, 310, 341, 394, 330, 695, 794, 2330, 504, 341, 667, 330, 307, 794, 330, 11924, 761, 667, 330, 35890, 851, 794, 330, 11924, 761, 667, 330, 1337, 794, 330, 928, 761, 667, 330, 609, 794, 330, 928, 761, 667, 330, 16247, 794, 330, 6245, 761, 667, 330, 2940, 58630, 794, 330, 928, 761, 667, 330, 55805, 794, 330, 928, 761, 667, 330, 5428, 794, 330, 8460, 761, 667, 330, 42641, 22616, 794, 330, 8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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 ]
[ 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, 5446, 15233, 4780, 264, 15117, 15846, 1160, 315, 5225, 4787, 369, 25654, 561, 670, 554, 198, 286, 17150, 5938, 449, 279, 2728, 4947, 851, 382, 286, 551, 1337, 4947, 851, 25, 528, 198, 286, 551, 913, 4947, 851, 25, 14302, 4947, 887, 271, 286, 551, 1337, 4017, 25, 925, 198, 286, 551, 913, 4017, 25, 7639, 3392, 315, 3135, 311, 471, 271, 286, 551, 1337, 4445, 25, 925, 198, 286, 551, 913, 4445, 25, 28757, 3335, 311, 471, 271, 286, 551, 33613, 25, 6587, 198, 286, 551, 693, 25, 578, 4823, 2077, 315, 279, 5446, 11, 449, 459, 5217, 364, 11014, 6, 1401, 198, 310, 422, 1070, 527, 15117, 15846, 3135, 271, 286, 3588, 271, 310, 341, 394, 330, 695, 794, 2330, 504, 341, 667, 330, 307, 794, 330, 11924, 761, 667, 330, 35890, 851, 794, 330, 11924, 761, 667, 330, 1337, 794, 330, 928, 761, 667, 330, 609, 794, 330, 928, 761, 667, 330, 16247, 794, 330, 6245, 761, 667, 330, 2940, 58630, 794, 330, 928, 761, 667, 330, 55805, 794, 330, 928, 761, 667, 330, 5428, 794, 330, 8460, 761, 667, 330, 42641, 22616, 794, 330, 8460, 761, 667, 330, 4734, 37914, 58630, 794, 330, 928, 761, 667, 330, 7266, 3837, 21339, 722, 57312, 794, 330, 1712, 761, 667, 330, 12030, 3837, 21339, 722, 57312, 794, 330, 1712, 702, 504, 457, 394, 3291, 394, 330, 5607, 794, 341, 504, 330, 9696, 794, 330, 11924, 761, 504, 330, 3255, 794, 330, 11924, 761, 504, 330, 5143, 794, 330, 11924, 702, 394, 457, 310, 557, 14711, 6075, 512, 755, 1160, 1214, 11, 4947, 851, 11, 4017, 5980, 11, 4445, 5980, 997, 286, 3270, 286, 1115, 5446, 15233, 4780, 264, 15117, 15846, 1160, 315, 5225, 4787, 369, 25654, 561, 670, 554, 198, 286, 17150, 5938, 449, 279, 2728, 4947, 851, 382, 286, 551, 1337, 4947, 851, 25, 528, 198, 286, 551, 913, 4947, 851, 25, 14302, 4947, 887, 271, 286, 551, 1337, 4017, 25, 925, 198, 286, 551, 913, 4017, 25, 7639, 3392, 315, 3135, 311, 471, 271, 286, 551, 1337, 4445, 25, 925, 198, 286, 551, 913, 4445, 25, 28757, 3335, 311, 471, 271, 286, 551, 33613, 25, 6587, 198, 286, 551, 693, 25, 578, 4823, 2077, 315, 279, 5446, 11, 449, 459, 5217, 364, 11014, 6, 1401, 198, 310, 422, 1070, 527, 15117, 15846, 3135, 271, 286, 3588, 271, 310, 341, 394, 330, 695, 794, 2330, 504, 341, 667, 330, 307, 794, 330, 11924, 761, 667, 330, 35890, 851, 794, 330, 11924, 761, 667, 330, 1337, 794, 330, 928, 761, 667, 330, 609, 794, 330, 928, 761, 667, 330, 16247, 794, 330, 6245, 761, 667, 330, 2940, 58630, 794, 330, 928, 761, 667, 330, 55805, 794, 330, 928, 761, 667, 330, 5428, 794, 330, 8460, 761, 667, 330, 42641, 22616, 794, 330, 8460, 761, 667, 330, 4734, 37914, 58630, 794, 330 ]
kevinconway/confpy
confpy/core/namespace.py
Namespace.register
def register(self, name, option): """Register a new option with the namespace. Args: name (str): The name to register the option under. option (option.Option): The option object to register. Raises: TypeError: If the option is not an option.Option object. ValueError: If the name is already registered. """ if name in self._options: raise ValueError("Option {0} already exists.".format(name)) if not isinstance(option, opt.Option): raise TypeError("Options must be of type Option.") self._options[name] = option
python
def register(self, name, option): """Register a new option with the namespace. Args: name (str): The name to register the option under. option (option.Option): The option object to register. Raises: TypeError: If the option is not an option.Option object. ValueError: If the name is already registered. """ if name in self._options: raise ValueError("Option {0} already exists.".format(name)) if not isinstance(option, opt.Option): raise TypeError("Options must be of type Option.") self._options[name] = option
[ "def", "register", "(", "self", ",", "name", ",", "option", ")", ":", "if", "name", "in", "self", ".", "_options", ":", "raise", "ValueError", "(", "\"Option {0} already exists.\"", ".", "format", "(", "name", ")", ")", "if", "not", "isinstance", "(", "option", ",", "opt", ".", "Option", ")", ":", "raise", "TypeError", "(", "\"Options must be of type Option.\"", ")", "self", ".", "_options", "[", "name", "]", "=", "option" ]
Register a new option with the namespace. Args: name (str): The name to register the option under. option (option.Option): The option object to register. Raises: TypeError: If the option is not an option.Option object. ValueError: If the name is already registered.
[ "Register", "a", "new", "option", "with", "the", "namespace", ".", "Args", ":", "name", "(", "str", ")", ":", "The", "name", "to", "register", "the", "option", "under", ".", "option", "(", "option", ".", "Option", ")", ":", "The", "option", "object", "to", "register", ".", "Raises", ":", "TypeError", ":", "If", "the", "option", "is", "not", "an", "option", ".", "Option", "object", ".", "ValueError", ":", "If", "the", "name", "is", "already", "registered", "." ]
train
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/core/namespace.py#L81-L100
<|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: Register a new option with the namespace. Args: name (str): The name to register the option under. option (option.Option): The option object to register. Raises: TypeError: If the option is not an option.Option object. ValueError: If the name is already registered. ### Response: def register(self, name, option): """Register a new option with the namespace. Args: name (str): The name to register the option under. option (option.Option): The option object to register. Raises: TypeError: If the option is not an option.Option object. ValueError: If the name is already registered. """ if name in self._options: raise ValueError("Option {0} already exists.".format(name)) if not isinstance(option, opt.Option): raise TypeError("Options must be of type Option.") self._options[name] = option <|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, 8861, 264, 502, 3072, 449, 279, 4573, 18304, 286, 18161, 2904, 310, 836, 320, 496, 1680, 578, 836, 311, 4254, 279, 3072, 1234, 3304, 310, 3072, 320, 2091, 53316, 1680, 578, 3072, 1665, 311, 4254, 18304, 286, 61411, 2904, 310, 26082, 25, 1442, 279, 3072, 374, 539, 459, 3072, 53316, 1665, 3304, 310, 15764, 25, 1442, 279, 836, 374, 2736, 9879, 382, 14711, 6075, 512, 755, 4254, 1214, 11, 836, 11, 3072, 5903, 286, 4304, 8861, 264, 502, 3072, 449, 279, 4573, 18304, 286, 18161, 2904, 310, 836, 320, 496, 1680, 578, 836, 311, 4254, 279, 3072, 1234, 3304, 310, 3072, 320, 2091, 53316, 1680, 578, 3072, 1665, 311, 4254, 18304, 286, 61411, 2904, 310, 26082, 25, 1442, 279, 3072, 374, 539, 459, 3072, 53316, 1665, 3304, 310, 15764, 25, 1442, 279, 836, 374, 2736, 9879, 3304, 286, 26547, 286, 422, 836, 304, 659, 1462, 2945, 33080, 310, 4933, 15764, 446, 5454, 314, 15, 92, 2736, 6866, 38011, 2293, 3232, 32091, 286, 422, 539, 11656, 31731, 11, 3469, 53316, 57102, 310, 4933, 26082, 446, 3883, 2011, 387, 315, 955, 7104, 13, 31318, 286, 659, 1462, 2945, 11174, 60, 284, 3072, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 8861, 264, 502, 3072, 449, 279, 4573, 18304, 286, 18161, 2904, 310, 836, 320, 496, 1680, 578, 836, 311, 4254, 279, 3072, 1234, 3304, 310, 3072, 320, 2091, 53316, 1680, 578, 3072, 1665, 311, 4254, 18304, 286, 61411, 2904, 310, 26082, 25, 1442, 279, 3072, 374, 539, 459, 3072, 53316, 1665, 3304, 310, 15764, 25, 1442, 279, 836, 374, 2736, 9879, 382, 14711, 6075, 512, 755, 4254, 1214, 11, 836, 11, 3072, 5903, 286, 4304, 8861, 264, 502, 3072, 449, 279, 4573, 18304, 286, 18161, 2904, 310, 836, 320, 496, 1680, 578, 836, 311, 4254, 279, 3072, 1234, 3304, 310, 3072, 320, 2091, 53316, 1680, 578, 3072, 1665, 311, 4254, 18304, 286, 61411, 2904, 310, 26082, 25, 1442, 279, 3072, 374, 539, 459, 3072, 53316, 1665, 3304, 310, 15764, 25, 1442, 279, 836, 374, 2736, 9879, 3304, 286, 26547, 286, 422, 836, 304, 659, 1462, 2945, 33080, 310, 4933, 15764, 446, 5454, 314, 15, 92, 2736, 6866, 38011, 2293, 3232, 32091, 286, 422, 539, 11656, 31731, 11, 3469, 53316, 57102, 310, 4933, 26082, 446, 3883, 2011, 387, 315, 955, 7104, 13, 31318, 286, 659, 1462, 2945, 11174, 60, 284, 3072, 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 ]
portfoliome/postpy
postpy/ddl.py
MaterializedView.create
def create(self, no_data=False): """Declare materalized view.""" if self.query: ddl_statement = self.compile_create_as() else: ddl_statement = self.compile_create() if no_data: ddl_statement += '\nWITH NO DATA' return ddl_statement, self.query_values
python
def create(self, no_data=False): """Declare materalized view.""" if self.query: ddl_statement = self.compile_create_as() else: ddl_statement = self.compile_create() if no_data: ddl_statement += '\nWITH NO DATA' return ddl_statement, self.query_values
[ "def", "create", "(", "self", ",", "no_data", "=", "False", ")", ":", "if", "self", ".", "query", ":", "ddl_statement", "=", "self", ".", "compile_create_as", "(", ")", "else", ":", "ddl_statement", "=", "self", ".", "compile_create", "(", ")", "if", "no_data", ":", "ddl_statement", "+=", "'\\nWITH NO DATA'", "return", "ddl_statement", ",", "self", ".", "query_values" ]
Declare materalized view.
[ "Declare", "materalized", "view", "." ]
train
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/ddl.py#L97-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: Declare materalized view. ### Response: def create(self, no_data=False): """Declare materalized view.""" if self.query: ddl_statement = self.compile_create_as() else: ddl_statement = self.compile_create() if no_data: ddl_statement += '\nWITH NO DATA' return ddl_statement, self.query_values <|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, 79555, 296, 19715, 1534, 1684, 382, 14711, 6075, 512, 755, 1893, 1214, 11, 912, 1807, 5725, 997, 286, 4304, 79555, 296, 19715, 1534, 1684, 30284, 286, 422, 659, 4891, 512, 310, 56880, 38504, 284, 659, 19458, 8827, 12162, 746, 286, 775, 512, 310, 56880, 38504, 284, 659, 19458, 8827, 2892, 286, 422, 912, 1807, 512, 310, 56880, 38504, 1447, 5307, 77, 45771, 5782, 14444, 3961, 286, 471, 56880, 38504, 11, 659, 4891, 9324, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 79555, 296, 19715, 1534, 1684, 382, 14711, 6075, 512, 755, 1893, 1214, 11, 912, 1807, 5725, 997, 286, 4304, 79555, 296, 19715, 1534, 1684, 30284, 286, 422, 659, 4891, 512, 310, 56880, 38504, 284, 659, 19458, 8827, 12162, 746, 286, 775, 512, 310, 56880, 38504, 284, 659, 19458, 8827, 2892, 286, 422, 912, 1807, 512, 310, 56880, 38504, 1447, 5307, 77, 45771, 5782, 14444, 3961, 286, 471, 56880, 38504, 11, 659, 4891, 9324, 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 ]
python-odin/odinweb
odinweb/data_structures.py
MultiValueDict.values
def values(self, multi=False): # type: (bool) -> Iterator[Any] """ Yield the last value on every key list. :param multi: If set to `True` the iterator returned will have a pair for each value of each key. Otherwise it will only contain pairs for the lasted added of each key. """ for values in itervalues(self): if multi: for value in values: yield value else: yield values[-1]
python
def values(self, multi=False): # type: (bool) -> Iterator[Any] """ Yield the last value on every key list. :param multi: If set to `True` the iterator returned will have a pair for each value of each key. Otherwise it will only contain pairs for the lasted added of each key. """ for values in itervalues(self): if multi: for value in values: yield value else: yield values[-1]
[ "def", "values", "(", "self", ",", "multi", "=", "False", ")", ":", "# type: (bool) -> Iterator[Any]", "for", "values", "in", "itervalues", "(", "self", ")", ":", "if", "multi", ":", "for", "value", "in", "values", ":", "yield", "value", "else", ":", "yield", "values", "[", "-", "1", "]" ]
Yield the last value on every key list. :param multi: If set to `True` the iterator returned will have a pair for each value of each key. Otherwise it will only contain pairs for the lasted added of each key.
[ "Yield", "the", "last", "value", "on", "every", "key", "list", "." ]
train
https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/data_structures.py#L894-L909
<|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 the last value on every key list. :param multi: If set to `True` the iterator returned will have a pair for each value of each key. Otherwise it will only contain pairs for the lasted added of each key. ### Response: def values(self, multi=False): # type: (bool) -> Iterator[Any] """ Yield the last value on every key list. :param multi: If set to `True` the iterator returned will have a pair for each value of each key. Otherwise it will only contain pairs for the lasted added of each key. """ for values in itervalues(self): if multi: for value in values: yield value else: yield values[-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, 56, 823, 279, 1566, 907, 389, 1475, 1401, 1160, 382, 286, 551, 913, 7447, 25, 1442, 743, 311, 1595, 2575, 63, 279, 15441, 6052, 690, 617, 264, 6857, 198, 2611, 369, 1855, 907, 315, 1855, 1401, 13, 220, 18715, 433, 690, 1193, 198, 2611, 6782, 13840, 369, 279, 36513, 3779, 315, 1855, 1401, 382, 14711, 6075, 512, 755, 2819, 1214, 11, 7447, 5725, 997, 286, 674, 955, 25, 320, 2707, 8, 1492, 23887, 71401, 933, 286, 3270, 286, 78478, 279, 1566, 907, 389, 1475, 1401, 1160, 382, 286, 551, 913, 7447, 25, 1442, 743, 311, 1595, 2575, 63, 279, 15441, 6052, 690, 617, 264, 6857, 198, 2611, 369, 1855, 907, 315, 1855, 1401, 13, 220, 18715, 433, 690, 1193, 198, 2611, 6782, 13840, 369, 279, 36513, 3779, 315, 1855, 1401, 382, 286, 3270, 286, 369, 2819, 304, 433, 6283, 1157, 1214, 997, 310, 422, 7447, 512, 394, 369, 907, 304, 2819, 512, 504, 7692, 907, 198, 310, 775, 512, 394, 7692, 2819, 7764, 16, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 56, 823, 279, 1566, 907, 389, 1475, 1401, 1160, 382, 286, 551, 913, 7447, 25, 1442, 743, 311, 1595, 2575, 63, 279, 15441, 6052, 690, 617, 264, 6857, 198, 2611, 369, 1855, 907, 315, 1855, 1401, 13, 220, 18715, 433, 690, 1193, 198, 2611, 6782, 13840, 369, 279, 36513, 3779, 315, 1855, 1401, 382, 14711, 6075, 512, 755, 2819, 1214, 11, 7447, 5725, 997, 286, 674, 955, 25, 320, 2707, 8, 1492, 23887, 71401, 933, 286, 3270, 286, 78478, 279, 1566, 907, 389, 1475, 1401, 1160, 382, 286, 551, 913, 7447, 25, 1442, 743, 311, 1595, 2575, 63, 279, 15441, 6052, 690, 617, 264, 6857, 198, 2611, 369, 1855, 907, 315, 1855, 1401, 13, 220, 18715, 433, 690, 1193, 198, 2611, 6782, 13840, 369, 279, 36513, 3779, 315, 1855, 1401, 382, 286, 3270, 286, 369, 2819, 304, 433, 6283, 1157, 1214, 997, 310, 422, 7447, 512, 394, 369, 907, 304, 2819, 512, 504, 7692, 907, 198, 310, 775, 512, 394, 7692, 2819, 7764, 16, 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 ]
wooga/play-deliver
playdeliver/inapp_product.py
upload
def upload(client, source_dir): """Upload inappproducts to play store.""" print('') print('upload inappproducs') print('---------------------') products_folder = os.path.join(source_dir, 'products') product_files = filter(os.path.isfile, list_dir_abspath(products_folder)) current_product_skus = map(lambda product: product['sku'], client.list_inappproducts()) print(current_product_skus) for product_file in product_files: with open(product_file) as product_file: product = json.load(product_file) #check if the product is new sku = product['sku'] product['packageName'] = client.package_name print(sku) if sku in current_product_skus: print("update product {0}".format(sku)) client.update_inappproduct(product, sku) else: print("create product {0}".format(sku)) client.insert_inappproduct(product)
python
def upload(client, source_dir): """Upload inappproducts to play store.""" print('') print('upload inappproducs') print('---------------------') products_folder = os.path.join(source_dir, 'products') product_files = filter(os.path.isfile, list_dir_abspath(products_folder)) current_product_skus = map(lambda product: product['sku'], client.list_inappproducts()) print(current_product_skus) for product_file in product_files: with open(product_file) as product_file: product = json.load(product_file) #check if the product is new sku = product['sku'] product['packageName'] = client.package_name print(sku) if sku in current_product_skus: print("update product {0}".format(sku)) client.update_inappproduct(product, sku) else: print("create product {0}".format(sku)) client.insert_inappproduct(product)
[ "def", "upload", "(", "client", ",", "source_dir", ")", ":", "print", "(", "''", ")", "print", "(", "'upload inappproducs'", ")", "print", "(", "'---------------------'", ")", "products_folder", "=", "os", ".", "path", ".", "join", "(", "source_dir", ",", "'products'", ")", "product_files", "=", "filter", "(", "os", ".", "path", ".", "isfile", ",", "list_dir_abspath", "(", "products_folder", ")", ")", "current_product_skus", "=", "map", "(", "lambda", "product", ":", "product", "[", "'sku'", "]", ",", "client", ".", "list_inappproducts", "(", ")", ")", "print", "(", "current_product_skus", ")", "for", "product_file", "in", "product_files", ":", "with", "open", "(", "product_file", ")", "as", "product_file", ":", "product", "=", "json", ".", "load", "(", "product_file", ")", "#check if the product is new", "sku", "=", "product", "[", "'sku'", "]", "product", "[", "'packageName'", "]", "=", "client", ".", "package_name", "print", "(", "sku", ")", "if", "sku", "in", "current_product_skus", ":", "print", "(", "\"update product {0}\"", ".", "format", "(", "sku", ")", ")", "client", ".", "update_inappproduct", "(", "product", ",", "sku", ")", "else", ":", "print", "(", "\"create product {0}\"", ".", "format", "(", "sku", ")", ")", "client", ".", "insert_inappproduct", "(", "product", ")" ]
Upload inappproducts to play store.
[ "Upload", "inappproducts", "to", "play", "store", "." ]
train
https://github.com/wooga/play-deliver/blob/9de0f35376f5342720b3a90bd3ca296b1f3a3f4c/playdeliver/inapp_product.py#L7-L30
<|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: Upload inappproducts to play store. ### Response: def upload(client, source_dir): """Upload inappproducts to play store.""" print('') print('upload inappproducs') print('---------------------') products_folder = os.path.join(source_dir, 'products') product_files = filter(os.path.isfile, list_dir_abspath(products_folder)) current_product_skus = map(lambda product: product['sku'], client.list_inappproducts()) print(current_product_skus) for product_file in product_files: with open(product_file) as product_file: product = json.load(product_file) #check if the product is new sku = product['sku'] product['packageName'] = client.package_name print(sku) if sku in current_product_skus: print("update product {0}".format(sku)) client.update_inappproduct(product, sku) else: print("create product {0}".format(sku)) client.insert_inappproduct(product) <|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, 14165, 304, 391, 604, 299, 1076, 82, 311, 1514, 3637, 382, 14711, 6075, 512, 755, 8298, 13097, 11, 2592, 4432, 997, 262, 4304, 14165, 304, 391, 604, 299, 1076, 82, 311, 1514, 3637, 14781, 262, 1194, 38465, 262, 1194, 493, 6248, 304, 391, 604, 4653, 4942, 1329, 262, 1194, 493, 776, 15431, 4713, 262, 3956, 15626, 284, 2709, 3960, 5563, 12719, 4432, 11, 364, 10354, 1329, 262, 2027, 11171, 284, 4141, 9835, 3960, 40047, 11, 1160, 4432, 23734, 31189, 72055, 15626, 4489, 262, 1510, 10041, 34911, 355, 284, 2472, 18705, 2027, 25, 2027, 681, 41029, 4181, 3016, 6556, 1265, 391, 604, 299, 1076, 82, 2455, 262, 1194, 8937, 10041, 34911, 355, 340, 262, 369, 2027, 2517, 304, 2027, 11171, 512, 286, 449, 1825, 20040, 2517, 8, 439, 2027, 2517, 512, 310, 2027, 284, 3024, 5214, 20040, 2517, 340, 286, 674, 2071, 422, 279, 2027, 374, 502, 198, 286, 53422, 284, 2027, 681, 41029, 4532, 286, 2027, 681, 92163, 663, 284, 3016, 49728, 1292, 198, 286, 1194, 1161, 12407, 340, 286, 422, 53422, 304, 1510, 10041, 34911, 355, 512, 310, 1194, 446, 2443, 2027, 314, 15, 22664, 2293, 1161, 12407, 1192, 310, 3016, 5430, 1265, 391, 604, 299, 1076, 20040, 11, 53422, 340, 286, 775, 512, 310, 1194, 446, 3261, 2027, 314, 15, 22664, 2293, 1161, 12407, 1192, 310, 3016, 7175, 1265, 391, 604, 299, 1076, 20040, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 14165, 304, 391, 604, 299, 1076, 82, 311, 1514, 3637, 382, 14711, 6075, 512, 755, 8298, 13097, 11, 2592, 4432, 997, 262, 4304, 14165, 304, 391, 604, 299, 1076, 82, 311, 1514, 3637, 14781, 262, 1194, 38465, 262, 1194, 493, 6248, 304, 391, 604, 4653, 4942, 1329, 262, 1194, 493, 776, 15431, 4713, 262, 3956, 15626, 284, 2709, 3960, 5563, 12719, 4432, 11, 364, 10354, 1329, 262, 2027, 11171, 284, 4141, 9835, 3960, 40047, 11, 1160, 4432, 23734, 31189, 72055, 15626, 4489, 262, 1510, 10041, 34911, 355, 284, 2472, 18705, 2027, 25, 2027, 681, 41029, 4181, 3016, 6556, 1265, 391, 604, 299, 1076, 82, 2455, 262, 1194, 8937, 10041, 34911, 355, 340, 262, 369, 2027, 2517, 304, 2027, 11171, 512, 286, 449, 1825, 20040, 2517, 8, 439, 2027, 2517, 512, 310, 2027, 284, 3024, 5214, 20040, 2517, 340, 286, 674, 2071, 422, 279, 2027, 374, 502, 198, 286, 53422, 284, 2027, 681, 41029, 4532, 286, 2027, 681, 92163, 663, 284, 3016, 49728, 1292, 198, 286, 1194, 1161, 12407, 340, 286, 422, 53422, 304, 1510, 10041, 34911, 355, 512, 310, 1194, 446, 2443, 2027, 314, 15, 22664, 2293, 1161, 12407, 1192, 310, 3016, 5430, 1265, 391, 604, 299, 1076, 20040, 11, 53422, 340, 286, 775, 512, 310, 1194, 446, 3261, 2027, 314, 15, 22664, 2293, 1161, 12407, 1192, 310, 3016, 7175, 1265, 391, 604, 299, 1076, 20040, 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 ]
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._countEXT
def _countEXT(self,extname="SCI"): """ Count the number of extensions in the file with the given name (``EXTNAME``). """ count=0 #simple fits image if (self._image['PRIMARY'].header["EXTEND"]): for i,hdu in enumerate(self._image): if i > 0: hduExtname = False if 'EXTNAME' in hdu.header: self._image[i].extnum=i self._image[i].extname=hdu.header["EXTNAME"] hduExtname = True if 'EXTVER' in hdu.header: self._image[i].extver=hdu.header["EXTVER"] else: self._image[i].extver = 1 if ((extname is not None) and \ (hduExtname and (hdu.header["EXTNAME"] == extname))) \ or extname is None: count=count+1 return count
python
def _countEXT(self,extname="SCI"): """ Count the number of extensions in the file with the given name (``EXTNAME``). """ count=0 #simple fits image if (self._image['PRIMARY'].header["EXTEND"]): for i,hdu in enumerate(self._image): if i > 0: hduExtname = False if 'EXTNAME' in hdu.header: self._image[i].extnum=i self._image[i].extname=hdu.header["EXTNAME"] hduExtname = True if 'EXTVER' in hdu.header: self._image[i].extver=hdu.header["EXTVER"] else: self._image[i].extver = 1 if ((extname is not None) and \ (hduExtname and (hdu.header["EXTNAME"] == extname))) \ or extname is None: count=count+1 return count
[ "def", "_countEXT", "(", "self", ",", "extname", "=", "\"SCI\"", ")", ":", "count", "=", "0", "#simple fits image", "if", "(", "self", ".", "_image", "[", "'PRIMARY'", "]", ".", "header", "[", "\"EXTEND\"", "]", ")", ":", "for", "i", ",", "hdu", "in", "enumerate", "(", "self", ".", "_image", ")", ":", "if", "i", ">", "0", ":", "hduExtname", "=", "False", "if", "'EXTNAME'", "in", "hdu", ".", "header", ":", "self", ".", "_image", "[", "i", "]", ".", "extnum", "=", "i", "self", ".", "_image", "[", "i", "]", ".", "extname", "=", "hdu", ".", "header", "[", "\"EXTNAME\"", "]", "hduExtname", "=", "True", "if", "'EXTVER'", "in", "hdu", ".", "header", ":", "self", ".", "_image", "[", "i", "]", ".", "extver", "=", "hdu", ".", "header", "[", "\"EXTVER\"", "]", "else", ":", "self", ".", "_image", "[", "i", "]", ".", "extver", "=", "1", "if", "(", "(", "extname", "is", "not", "None", ")", "and", "(", "hduExtname", "and", "(", "hdu", ".", "header", "[", "\"EXTNAME\"", "]", "==", "extname", ")", ")", ")", "or", "extname", "is", "None", ":", "count", "=", "count", "+", "1", "return", "count" ]
Count the number of extensions in the file with the given name (``EXTNAME``).
[ "Count", "the", "number", "of", "extensions", "in", "the", "file", "with", "the", "given", "name", "(", "EXTNAME", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L664-L688
<|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: Count the number of extensions in the file with the given name (``EXTNAME``). ### Response: def _countEXT(self,extname="SCI"): """ Count the number of extensions in the file with the given name (``EXTNAME``). """ count=0 #simple fits image if (self._image['PRIMARY'].header["EXTEND"]): for i,hdu in enumerate(self._image): if i > 0: hduExtname = False if 'EXTNAME' in hdu.header: self._image[i].extnum=i self._image[i].extname=hdu.header["EXTNAME"] hduExtname = True if 'EXTVER' in hdu.header: self._image[i].extver=hdu.header["EXTVER"] else: self._image[i].extver = 1 if ((extname is not None) and \ (hduExtname and (hdu.header["EXTNAME"] == extname))) \ or extname is None: count=count+1 return count <|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, 2568, 279, 1396, 315, 20300, 304, 279, 1052, 449, 279, 2728, 836, 198, 286, 320, 14196, 5841, 7687, 14196, 3677, 14711, 6075, 512, 755, 721, 1868, 5841, 1214, 11, 428, 609, 429, 71679, 15497, 286, 4304, 4605, 279, 1396, 315, 20300, 304, 279, 1052, 449, 279, 2728, 836, 198, 286, 320, 14196, 5841, 7687, 14196, 3677, 286, 3270, 286, 1797, 28, 15, 674, 23796, 18809, 2217, 271, 286, 422, 320, 726, 1462, 1843, 681, 80874, 7352, 2775, 1204, 5841, 4794, 1365, 997, 310, 369, 602, 20393, 1072, 304, 13555, 1214, 1462, 1843, 997, 394, 422, 602, 871, 220, 15, 512, 504, 305, 1072, 6899, 609, 284, 3641, 198, 504, 422, 364, 5841, 7687, 6, 304, 305, 1072, 17531, 512, 667, 659, 1462, 1843, 1004, 948, 428, 2470, 22112, 198, 667, 659, 1462, 1843, 1004, 948, 428, 609, 55213, 1072, 17531, 1204, 5841, 7687, 7171, 667, 305, 1072, 6899, 609, 284, 3082, 198, 504, 422, 364, 5841, 3848, 6, 304, 305, 1072, 17531, 512, 667, 659, 1462, 1843, 1004, 948, 428, 424, 55213, 1072, 17531, 1204, 5841, 3848, 7171, 504, 775, 512, 667, 659, 1462, 1843, 1004, 948, 428, 424, 284, 220, 16, 271, 504, 422, 1819, 428, 609, 374, 539, 2290, 8, 323, 3120, 1014, 320, 71, 1072, 6899, 609, 323, 320, 71, 1072, 17531, 1204, 5841, 7687, 1365, 624, 1327, 609, 7861, 3120, 1014, 477, 1327, 609, 374, 2290, 512, 667, 1797, 75016, 10, 16, 198, 286, 471, 1797, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 2568, 279, 1396, 315, 20300, 304, 279, 1052, 449, 279, 2728, 836, 198, 286, 320, 14196, 5841, 7687, 14196, 3677, 14711, 6075, 512, 755, 721, 1868, 5841, 1214, 11, 428, 609, 429, 71679, 15497, 286, 4304, 4605, 279, 1396, 315, 20300, 304, 279, 1052, 449, 279, 2728, 836, 198, 286, 320, 14196, 5841, 7687, 14196, 3677, 286, 3270, 286, 1797, 28, 15, 674, 23796, 18809, 2217, 271, 286, 422, 320, 726, 1462, 1843, 681, 80874, 7352, 2775, 1204, 5841, 4794, 1365, 997, 310, 369, 602, 20393, 1072, 304, 13555, 1214, 1462, 1843, 997, 394, 422, 602, 871, 220, 15, 512, 504, 305, 1072, 6899, 609, 284, 3641, 198, 504, 422, 364, 5841, 7687, 6, 304, 305, 1072, 17531, 512, 667, 659, 1462, 1843, 1004, 948, 428, 2470, 22112, 198, 667, 659, 1462, 1843, 1004, 948, 428, 609, 55213, 1072, 17531, 1204, 5841, 7687, 7171, 667, 305, 1072, 6899, 609, 284, 3082, 198, 504, 422, 364, 5841, 3848, 6, 304, 305, 1072, 17531, 512, 667, 659, 1462, 1843, 1004, 948, 428, 424, 55213, 1072, 17531, 1204, 5841, 3848, 7171, 504, 775, 512, 667, 659, 1462, 1843, 1004, 948, 428, 424, 284, 220, 16, 271, 504, 422, 1819, 428, 609, 374, 539, 2290, 8, 323, 3120, 1014, 320, 71, 1072, 6899, 609, 323, 320, 71, 1072, 17531, 1204, 5841, 7687, 1365, 624, 1327, 609, 7861, 3120, 1014, 477, 1327, 609, 374, 2290, 512, 667, 1797, 75016, 10, 16, 198, 286, 471, 1797, 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 ]
ev3dev/ev3dev-lang-python
ev3dev2/motor.py
MoveDifferential.on_to_coordinates
def on_to_coordinates(self, speed, x_target_mm, y_target_mm, brake=True, block=True): """ Drive to (`x_target_mm`, `y_target_mm`) coordinates at `speed` """ assert self.odometry_thread_id, "odometry_start() must be called to track robot coordinates" # stop moving self.off(brake='hold') # rotate in place so we are pointed straight at our target x_delta = x_target_mm - self.x_pos_mm y_delta = y_target_mm - self.y_pos_mm angle_target_radians = math.atan2(y_delta, x_delta) angle_target_degrees = math.degrees(angle_target_radians) self.turn_to_angle(speed, angle_target_degrees, brake=True, block=True) # drive in a straight line to the target coordinates distance_mm = math.sqrt(pow(self.x_pos_mm - x_target_mm, 2) + pow(self.y_pos_mm - y_target_mm, 2)) self.on_for_distance(speed, distance_mm, brake, block)
python
def on_to_coordinates(self, speed, x_target_mm, y_target_mm, brake=True, block=True): """ Drive to (`x_target_mm`, `y_target_mm`) coordinates at `speed` """ assert self.odometry_thread_id, "odometry_start() must be called to track robot coordinates" # stop moving self.off(brake='hold') # rotate in place so we are pointed straight at our target x_delta = x_target_mm - self.x_pos_mm y_delta = y_target_mm - self.y_pos_mm angle_target_radians = math.atan2(y_delta, x_delta) angle_target_degrees = math.degrees(angle_target_radians) self.turn_to_angle(speed, angle_target_degrees, brake=True, block=True) # drive in a straight line to the target coordinates distance_mm = math.sqrt(pow(self.x_pos_mm - x_target_mm, 2) + pow(self.y_pos_mm - y_target_mm, 2)) self.on_for_distance(speed, distance_mm, brake, block)
[ "def", "on_to_coordinates", "(", "self", ",", "speed", ",", "x_target_mm", ",", "y_target_mm", ",", "brake", "=", "True", ",", "block", "=", "True", ")", ":", "assert", "self", ".", "odometry_thread_id", ",", "\"odometry_start() must be called to track robot coordinates\"", "# stop moving", "self", ".", "off", "(", "brake", "=", "'hold'", ")", "# rotate in place so we are pointed straight at our target", "x_delta", "=", "x_target_mm", "-", "self", ".", "x_pos_mm", "y_delta", "=", "y_target_mm", "-", "self", ".", "y_pos_mm", "angle_target_radians", "=", "math", ".", "atan2", "(", "y_delta", ",", "x_delta", ")", "angle_target_degrees", "=", "math", ".", "degrees", "(", "angle_target_radians", ")", "self", ".", "turn_to_angle", "(", "speed", ",", "angle_target_degrees", ",", "brake", "=", "True", ",", "block", "=", "True", ")", "# drive in a straight line to the target coordinates", "distance_mm", "=", "math", ".", "sqrt", "(", "pow", "(", "self", ".", "x_pos_mm", "-", "x_target_mm", ",", "2", ")", "+", "pow", "(", "self", ".", "y_pos_mm", "-", "y_target_mm", ",", "2", ")", ")", "self", ".", "on_for_distance", "(", "speed", ",", "distance_mm", ",", "brake", ",", "block", ")" ]
Drive to (`x_target_mm`, `y_target_mm`) coordinates at `speed`
[ "Drive", "to", "(", "x_target_mm", "y_target_mm", ")", "coordinates", "at", "speed" ]
train
https://github.com/ev3dev/ev3dev-lang-python/blob/afc98d35004b533dc161a01f7c966e78607d7c1e/ev3dev2/motor.py#L2349-L2367
<|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: Drive to (`x_target_mm`, `y_target_mm`) coordinates at `speed` ### Response: def on_to_coordinates(self, speed, x_target_mm, y_target_mm, brake=True, block=True): """ Drive to (`x_target_mm`, `y_target_mm`) coordinates at `speed` """ assert self.odometry_thread_id, "odometry_start() must be called to track robot coordinates" # stop moving self.off(brake='hold') # rotate in place so we are pointed straight at our target x_delta = x_target_mm - self.x_pos_mm y_delta = y_target_mm - self.y_pos_mm angle_target_radians = math.atan2(y_delta, x_delta) angle_target_degrees = math.degrees(angle_target_radians) self.turn_to_angle(speed, angle_target_degrees, brake=True, block=True) # drive in a straight line to the target coordinates distance_mm = math.sqrt(pow(self.x_pos_mm - x_target_mm, 2) + pow(self.y_pos_mm - y_target_mm, 2)) self.on_for_distance(speed, distance_mm, brake, block) <|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, 33557, 311, 29754, 87, 11370, 36699, 7964, 1595, 88, 11370, 36699, 33981, 14259, 520, 1595, 20997, 19884, 14711, 6075, 512, 755, 389, 2401, 51184, 1214, 11, 4732, 11, 865, 11370, 36699, 11, 379, 11370, 36699, 11, 35718, 3702, 11, 2565, 3702, 997, 286, 3270, 286, 16542, 311, 29754, 87, 11370, 36699, 7964, 1595, 88, 11370, 36699, 33981, 14259, 520, 1595, 20997, 4077, 286, 3270, 286, 2105, 659, 72699, 7133, 11048, 851, 11, 330, 347, 7133, 5011, 368, 2011, 387, 2663, 311, 3839, 12585, 14259, 1875, 286, 674, 3009, 7366, 198, 286, 659, 38454, 42337, 731, 1151, 6416, 4713, 286, 674, 17348, 304, 2035, 779, 584, 527, 14618, 7833, 520, 1057, 2218, 198, 286, 865, 27808, 284, 865, 11370, 36699, 482, 659, 2036, 6615, 36699, 198, 286, 379, 27808, 284, 379, 11370, 36699, 482, 659, 2441, 6615, 36699, 198, 286, 9392, 11370, 1745, 21398, 284, 7033, 72616, 17, 7166, 27808, 11, 865, 27808, 340, 286, 9392, 11370, 47157, 8016, 284, 7033, 71517, 8016, 30733, 11370, 1745, 21398, 340, 286, 659, 46734, 2401, 22474, 61256, 11, 9392, 11370, 47157, 8016, 11, 35718, 3702, 11, 2565, 3702, 696, 286, 674, 6678, 304, 264, 7833, 1584, 311, 279, 2218, 14259, 198, 286, 6138, 36699, 284, 7033, 18540, 73607, 1214, 2036, 6615, 36699, 482, 865, 11370, 36699, 11, 220, 17, 8, 489, 7019, 1214, 2441, 6615, 36699, 482, 379, 11370, 36699, 11, 220, 17, 1192, 286, 659, 3572, 5595, 20029, 61256, 11, 6138, 36699, 11, 35718, 11, 2565, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 33557, 311, 29754, 87, 11370, 36699, 7964, 1595, 88, 11370, 36699, 33981, 14259, 520, 1595, 20997, 19884, 14711, 6075, 512, 755, 389, 2401, 51184, 1214, 11, 4732, 11, 865, 11370, 36699, 11, 379, 11370, 36699, 11, 35718, 3702, 11, 2565, 3702, 997, 286, 3270, 286, 16542, 311, 29754, 87, 11370, 36699, 7964, 1595, 88, 11370, 36699, 33981, 14259, 520, 1595, 20997, 4077, 286, 3270, 286, 2105, 659, 72699, 7133, 11048, 851, 11, 330, 347, 7133, 5011, 368, 2011, 387, 2663, 311, 3839, 12585, 14259, 1875, 286, 674, 3009, 7366, 198, 286, 659, 38454, 42337, 731, 1151, 6416, 4713, 286, 674, 17348, 304, 2035, 779, 584, 527, 14618, 7833, 520, 1057, 2218, 198, 286, 865, 27808, 284, 865, 11370, 36699, 482, 659, 2036, 6615, 36699, 198, 286, 379, 27808, 284, 379, 11370, 36699, 482, 659, 2441, 6615, 36699, 198, 286, 9392, 11370, 1745, 21398, 284, 7033, 72616, 17, 7166, 27808, 11, 865, 27808, 340, 286, 9392, 11370, 47157, 8016, 284, 7033, 71517, 8016, 30733, 11370, 1745, 21398, 340, 286, 659, 46734, 2401, 22474, 61256, 11, 9392, 11370, 47157, 8016, 11, 35718, 3702, 11, 2565, 3702, 696, 286, 674, 6678, 304, 264, 7833, 1584, 311, 279, 2218, 14259, 198, 286, 6138, 36699, 284, 7033, 18540, 73607, 1214, 2036, 6615, 36699, 482, 865, 11370, 36699, 11, 220, 17, 8, 489, 7019, 1214, 2441, 6615, 36699, 482, 379, 11370, 36699, 11, 220, 17, 1192, 286, 659, 3572, 5595, 20029, 61256, 11, 6138, 36699, 11, 35718, 11, 2565, 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 ]
Asana/python-asana
asana/resources/gen/attachments.py
_Attachments.find_by_id
def find_by_id(self, attachment, params={}, **options): """Returns the full record for a single attachment. Parameters ---------- attachment : {Id} Globally unique identifier for the attachment. [params] : {Object} Parameters for the request """ path = "/attachments/%s" % (attachment) return self.client.get(path, params, **options)
python
def find_by_id(self, attachment, params={}, **options): """Returns the full record for a single attachment. Parameters ---------- attachment : {Id} Globally unique identifier for the attachment. [params] : {Object} Parameters for the request """ path = "/attachments/%s" % (attachment) return self.client.get(path, params, **options)
[ "def", "find_by_id", "(", "self", ",", "attachment", ",", "params", "=", "{", "}", ",", "*", "*", "options", ")", ":", "path", "=", "\"/attachments/%s\"", "%", "(", "attachment", ")", "return", "self", ".", "client", ".", "get", "(", "path", ",", "params", ",", "*", "*", "options", ")" ]
Returns the full record for a single attachment. Parameters ---------- attachment : {Id} Globally unique identifier for the attachment. [params] : {Object} Parameters for the request
[ "Returns", "the", "full", "record", "for", "a", "single", "attachment", "." ]
train
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/gen/attachments.py#L11-L20
<|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 the full record for a single attachment. Parameters ---------- attachment : {Id} Globally unique identifier for the attachment. [params] : {Object} Parameters for the request ### Response: def find_by_id(self, attachment, params={}, **options): """Returns the full record for a single attachment. Parameters ---------- attachment : {Id} Globally unique identifier for the attachment. [params] : {Object} Parameters for the request """ path = "/attachments/%s" % (attachment) return self.client.get(path, params, **options) <|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, 279, 2539, 3335, 369, 264, 3254, 20581, 382, 286, 13831, 198, 286, 31423, 286, 20581, 551, 314, 769, 92, 63388, 750, 5016, 13110, 369, 279, 20581, 627, 286, 510, 3603, 60, 551, 314, 1211, 92, 13831, 369, 279, 1715, 271, 14711, 6075, 512, 755, 1505, 3795, 851, 1214, 11, 20581, 11, 3712, 68525, 3146, 2945, 1680, 720, 286, 4304, 16851, 279, 2539, 3335, 369, 264, 3254, 20581, 382, 286, 13831, 198, 286, 31423, 286, 20581, 551, 314, 769, 92, 63388, 750, 5016, 13110, 369, 279, 20581, 627, 286, 510, 3603, 60, 551, 314, 1211, 92, 13831, 369, 279, 1715, 198, 286, 3270, 286, 1853, 284, 3605, 46978, 12915, 82, 1, 1034, 320, 22751, 340, 286, 471, 659, 6718, 673, 5698, 11, 3712, 11, 3146, 2945, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 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, 279, 2539, 3335, 369, 264, 3254, 20581, 382, 286, 13831, 198, 286, 31423, 286, 20581, 551, 314, 769, 92, 63388, 750, 5016, 13110, 369, 279, 20581, 627, 286, 510, 3603, 60, 551, 314, 1211, 92, 13831, 369, 279, 1715, 271, 14711, 6075, 512, 755, 1505, 3795, 851, 1214, 11, 20581, 11, 3712, 68525, 3146, 2945, 1680, 720, 286, 4304, 16851, 279, 2539, 3335, 369, 264, 3254, 20581, 382, 286, 13831, 198, 286, 31423, 286, 20581, 551, 314, 769, 92, 63388, 750, 5016, 13110, 369, 279, 20581, 627, 286, 510, 3603, 60, 551, 314, 1211, 92, 13831, 369, 279, 1715, 198, 286, 3270, 286, 1853, 284, 3605, 46978, 12915, 82, 1, 1034, 320, 22751, 340, 286, 471, 659, 6718, 673, 5698, 11, 3712, 11, 3146, 2945, 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 ]
ooici/elasticpy
elasticpy/search.py
ElasticSearch.search_simple
def search_simple(self, index,itype, key, search_term): ''' ElasticSearch.search_simple(index,itype,key,search_term) Usage: > es = ElasticSearch() > es.search_simple('twitter','users','name','kim') ''' request = self.session url = 'http://%s:%s/%s/%s/_search?q=%s:%s' % (self.host,self.port,index,itype,key,search_term) response = request.get(url) return response
python
def search_simple(self, index,itype, key, search_term): ''' ElasticSearch.search_simple(index,itype,key,search_term) Usage: > es = ElasticSearch() > es.search_simple('twitter','users','name','kim') ''' request = self.session url = 'http://%s:%s/%s/%s/_search?q=%s:%s' % (self.host,self.port,index,itype,key,search_term) response = request.get(url) return response
[ "def", "search_simple", "(", "self", ",", "index", ",", "itype", ",", "key", ",", "search_term", ")", ":", "request", "=", "self", ".", "session", "url", "=", "'http://%s:%s/%s/%s/_search?q=%s:%s'", "%", "(", "self", ".", "host", ",", "self", ".", "port", ",", "index", ",", "itype", ",", "key", ",", "search_term", ")", "response", "=", "request", ".", "get", "(", "url", ")", "return", "response" ]
ElasticSearch.search_simple(index,itype,key,search_term) Usage: > es = ElasticSearch() > es.search_simple('twitter','users','name','kim')
[ "ElasticSearch", ".", "search_simple", "(", "index", "itype", "key", "search_term", ")", "Usage", ":", ">", "es", "=", "ElasticSearch", "()", ">", "es", ".", "search_simple", "(", "twitter", "users", "name", "kim", ")" ]
train
https://github.com/ooici/elasticpy/blob/ec221800a80c39e80d8c31667c5b138da39219f2/elasticpy/search.py#L112-L123
<|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: ElasticSearch.search_simple(index,itype,key,search_term) Usage: > es = ElasticSearch() > es.search_simple('twitter','users','name','kim') ### Response: def search_simple(self, index,itype, key, search_term): ''' ElasticSearch.search_simple(index,itype,key,search_term) Usage: > es = ElasticSearch() > es.search_simple('twitter','users','name','kim') ''' request = self.session url = 'http://%s:%s/%s/%s/_search?q=%s:%s' % (self.host,self.port,index,itype,key,search_term) response = request.get(url) return response <|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, 36, 52279, 6014, 9472, 31115, 7343, 11, 488, 375, 54724, 11, 1874, 17922, 340, 286, 25585, 512, 286, 871, 1560, 284, 53010, 6014, 746, 286, 871, 1560, 9472, 31115, 493, 15021, 1882, 4312, 1882, 609, 1882, 58993, 4713, 14711, 6075, 512, 755, 2778, 31115, 1214, 11, 1963, 11, 488, 375, 11, 1401, 11, 2778, 17922, 997, 286, 11414, 286, 53010, 6014, 9472, 31115, 7343, 11, 488, 375, 54724, 11, 1874, 17922, 340, 286, 25585, 512, 286, 871, 1560, 284, 53010, 6014, 746, 286, 871, 1560, 9472, 31115, 493, 15021, 1882, 4312, 1882, 609, 1882, 58993, 1329, 286, 11414, 286, 1715, 284, 659, 10387, 198, 286, 2576, 284, 364, 1277, 87891, 82, 7685, 82, 12915, 82, 12915, 82, 20205, 1874, 44882, 8003, 82, 7685, 82, 6, 1034, 320, 726, 18320, 22280, 14940, 41527, 11, 488, 375, 54724, 11, 1874, 17922, 340, 286, 2077, 284, 1715, 673, 6659, 696, 286, 471, 2077, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 36, 52279, 6014, 9472, 31115, 7343, 11, 488, 375, 54724, 11, 1874, 17922, 340, 286, 25585, 512, 286, 871, 1560, 284, 53010, 6014, 746, 286, 871, 1560, 9472, 31115, 493, 15021, 1882, 4312, 1882, 609, 1882, 58993, 4713, 14711, 6075, 512, 755, 2778, 31115, 1214, 11, 1963, 11, 488, 375, 11, 1401, 11, 2778, 17922, 997, 286, 11414, 286, 53010, 6014, 9472, 31115, 7343, 11, 488, 375, 54724, 11, 1874, 17922, 340, 286, 25585, 512, 286, 871, 1560, 284, 53010, 6014, 746, 286, 871, 1560, 9472, 31115, 493, 15021, 1882, 4312, 1882, 609, 1882, 58993, 1329, 286, 11414, 286, 1715, 284, 659, 10387, 198, 286, 2576, 284, 364, 1277, 87891, 82, 7685, 82, 12915, 82, 12915, 82, 20205, 1874, 44882, 8003, 82, 7685, 82, 6, 1034, 320, 726, 18320, 22280, 14940, 41527, 11, 488, 375, 54724, 11, 1874, 17922, 340, 286, 2077, 284, 1715, 673, 6659, 696, 286, 471, 2077, 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 ]
enricobacis/wos
wos/utils.py
doi_to_wos
def doi_to_wos(wosclient, doi): """Convert DOI to WOS identifier.""" results = query(wosclient, 'DO="%s"' % doi, './REC/UID', count=1) return results[0].lstrip('WOS:') if results else None
python
def doi_to_wos(wosclient, doi): """Convert DOI to WOS identifier.""" results = query(wosclient, 'DO="%s"' % doi, './REC/UID', count=1) return results[0].lstrip('WOS:') if results else None
[ "def", "doi_to_wos", "(", "wosclient", ",", "doi", ")", ":", "results", "=", "query", "(", "wosclient", ",", "'DO=\"%s\"'", "%", "doi", ",", "'./REC/UID'", ",", "count", "=", "1", ")", "return", "results", "[", "0", "]", ".", "lstrip", "(", "'WOS:'", ")", "if", "results", "else", "None" ]
Convert DOI to WOS identifier.
[ "Convert", "DOI", "to", "WOS", "identifier", "." ]
train
https://github.com/enricobacis/wos/blob/a51f4d1a983c2c7529caac3e09606a432223630d/wos/utils.py#L34-L37
<|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 DOI to WOS identifier. ### Response: def doi_to_wos(wosclient, doi): """Convert DOI to WOS identifier.""" results = query(wosclient, 'DO="%s"' % doi, './REC/UID', count=1) return results[0].lstrip('WOS:') if results else 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, 12281, 59670, 311, 468, 3204, 13110, 382, 14711, 6075, 512, 755, 36995, 2401, 1704, 437, 3706, 437, 3045, 11, 36995, 997, 262, 4304, 12281, 59670, 311, 468, 3204, 13110, 14781, 262, 3135, 284, 3319, 3706, 437, 3045, 11, 364, 5989, 36320, 82, 21230, 1034, 36995, 11, 2825, 67713, 14, 6599, 518, 1797, 28, 16, 340, 262, 471, 3135, 58, 15, 948, 75, 13406, 493, 54, 3204, 80995, 422, 3135, 775, 2290, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 59670, 311, 468, 3204, 13110, 382, 14711, 6075, 512, 755, 36995, 2401, 1704, 437, 3706, 437, 3045, 11, 36995, 997, 262, 4304, 12281, 59670, 311, 468, 3204, 13110, 14781, 262, 3135, 284, 3319, 3706, 437, 3045, 11, 364, 5989, 36320, 82, 21230, 1034, 36995, 11, 2825, 67713, 14, 6599, 518, 1797, 28, 16, 340, 262, 471, 3135, 58, 15, 948, 75, 13406, 493, 54, 3204, 80995, 422, 3135, 775, 2290, 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 ]
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
FabricBase._delete_dummy_intf_rtr
def _delete_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id): """Function to delete a dummy interface of a router. """ dummy_router_dict = self.get_dummy_router_net(tenant_id) ret = self.delete_os_dummy_rtr_nwk(dummy_router_dict.get('router_id'), dummy_router_dict.get('net_id'), dummy_router_dict.get('subnet_id')) # Release the network DB entry self.delete_network_db(dummy_router_dict.get('net_id')) return ret
python
def _delete_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id): """Function to delete a dummy interface of a router. """ dummy_router_dict = self.get_dummy_router_net(tenant_id) ret = self.delete_os_dummy_rtr_nwk(dummy_router_dict.get('router_id'), dummy_router_dict.get('net_id'), dummy_router_dict.get('subnet_id')) # Release the network DB entry self.delete_network_db(dummy_router_dict.get('net_id')) return ret
[ "def", "_delete_dummy_intf_rtr", "(", "self", ",", "tenant_id", ",", "tenant_name", ",", "rtr_id", ")", ":", "dummy_router_dict", "=", "self", ".", "get_dummy_router_net", "(", "tenant_id", ")", "ret", "=", "self", ".", "delete_os_dummy_rtr_nwk", "(", "dummy_router_dict", ".", "get", "(", "'router_id'", ")", ",", "dummy_router_dict", ".", "get", "(", "'net_id'", ")", ",", "dummy_router_dict", ".", "get", "(", "'subnet_id'", ")", ")", "# Release the network DB entry", "self", ".", "delete_network_db", "(", "dummy_router_dict", ".", "get", "(", "'net_id'", ")", ")", "return", "ret" ]
Function to delete a dummy interface of a router.
[ "Function", "to", "delete", "a", "dummy", "interface", "of", "a", "router", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1074-L1082
<|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 to delete a dummy interface of a router. ### Response: def _delete_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id): """Function to delete a dummy interface of a router. """ dummy_router_dict = self.get_dummy_router_net(tenant_id) ret = self.delete_os_dummy_rtr_nwk(dummy_router_dict.get('router_id'), dummy_router_dict.get('net_id'), dummy_router_dict.get('subnet_id')) # Release the network DB entry self.delete_network_db(dummy_router_dict.get('net_id')) 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, 5263, 311, 3783, 264, 17741, 3834, 315, 264, 9457, 382, 14711, 6075, 512, 755, 721, 4644, 61421, 92390, 1745, 376, 1214, 11, 26305, 851, 11, 26305, 1292, 11, 436, 376, 851, 997, 286, 4304, 5263, 311, 3783, 264, 17741, 3834, 315, 264, 9457, 13, 3270, 286, 17741, 56687, 5356, 284, 659, 673, 61421, 56687, 20301, 1175, 26178, 851, 340, 286, 2160, 284, 659, 7592, 30487, 61421, 1745, 376, 1107, 51622, 84771, 56687, 5356, 673, 493, 10140, 851, 3379, 14600, 17741, 56687, 5356, 673, 493, 4816, 851, 3379, 14600, 17741, 56687, 5356, 673, 493, 89736, 851, 7132, 286, 674, 17836, 279, 4009, 6078, 4441, 198, 286, 659, 7592, 21640, 8856, 84771, 56687, 5356, 673, 493, 4816, 851, 7132, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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, 304, 6498, 382, 14711, 5546, 512, 5263, 311, 3783, 264, 17741, 3834, 315, 264, 9457, 382, 14711, 6075, 512, 755, 721, 4644, 61421, 92390, 1745, 376, 1214, 11, 26305, 851, 11, 26305, 1292, 11, 436, 376, 851, 997, 286, 4304, 5263, 311, 3783, 264, 17741, 3834, 315, 264, 9457, 13, 3270, 286, 17741, 56687, 5356, 284, 659, 673, 61421, 56687, 20301, 1175, 26178, 851, 340, 286, 2160, 284, 659, 7592, 30487, 61421, 1745, 376, 1107, 51622, 84771, 56687, 5356, 673, 493, 10140, 851, 3379, 14600, 17741, 56687, 5356, 673, 493, 4816, 851, 3379, 14600, 17741, 56687, 5356, 673, 493, 89736, 851, 7132, 286, 674, 17836, 279, 4009, 6078, 4441, 198, 286, 659, 7592, 21640, 8856, 84771, 56687, 5356, 673, 493, 4816, 851, 7132, 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 ]
SpamScope/mail-parser
mailparser/utils.py
decode_header_part
def decode_header_part(header): """ Given an raw header returns an decoded header Args: header (string): header to decode Returns: str (Python 3) or unicode (Python 2) """ if not header: return six.text_type() output = six.text_type() try: for d, c in decode_header(header): c = c if c else 'utf-8' output += ported_string(d, c, 'ignore') # Header parsing failed, when header has charset Shift_JIS except (HeaderParseError, UnicodeError): log.error("Failed decoding header part: {}".format(header)) output += header return output
python
def decode_header_part(header): """ Given an raw header returns an decoded header Args: header (string): header to decode Returns: str (Python 3) or unicode (Python 2) """ if not header: return six.text_type() output = six.text_type() try: for d, c in decode_header(header): c = c if c else 'utf-8' output += ported_string(d, c, 'ignore') # Header parsing failed, when header has charset Shift_JIS except (HeaderParseError, UnicodeError): log.error("Failed decoding header part: {}".format(header)) output += header return output
[ "def", "decode_header_part", "(", "header", ")", ":", "if", "not", "header", ":", "return", "six", ".", "text_type", "(", ")", "output", "=", "six", ".", "text_type", "(", ")", "try", ":", "for", "d", ",", "c", "in", "decode_header", "(", "header", ")", ":", "c", "=", "c", "if", "c", "else", "'utf-8'", "output", "+=", "ported_string", "(", "d", ",", "c", ",", "'ignore'", ")", "# Header parsing failed, when header has charset Shift_JIS", "except", "(", "HeaderParseError", ",", "UnicodeError", ")", ":", "log", ".", "error", "(", "\"Failed decoding header part: {}\"", ".", "format", "(", "header", ")", ")", "output", "+=", "header", "return", "output" ]
Given an raw header returns an decoded header Args: header (string): header to decode Returns: str (Python 3) or unicode (Python 2)
[ "Given", "an", "raw", "header", "returns", "an", "decoded", "header" ]
train
https://github.com/SpamScope/mail-parser/blob/814b56d0b803feab9dea04f054b802ce138097e2/mailparser/utils.py#L117-L142
<|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: Given an raw header returns an decoded header Args: header (string): header to decode Returns: str (Python 3) or unicode (Python 2) ### Response: def decode_header_part(header): """ Given an raw header returns an decoded header Args: header (string): header to decode Returns: str (Python 3) or unicode (Python 2) """ if not header: return six.text_type() output = six.text_type() try: for d, c in decode_header(header): c = c if c else 'utf-8' output += ported_string(d, c, 'ignore') # Header parsing failed, when header has charset Shift_JIS except (HeaderParseError, UnicodeError): log.error("Failed decoding header part: {}".format(header)) output += header return output <|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, 22818, 459, 7257, 4342, 4780, 459, 30313, 4342, 271, 262, 18161, 512, 286, 4342, 320, 928, 1680, 4342, 311, 17322, 271, 262, 5295, 512, 286, 610, 320, 31380, 220, 18, 8, 477, 27169, 320, 31380, 220, 17, 696, 14711, 6075, 512, 755, 17322, 8932, 10715, 26615, 997, 262, 3270, 262, 16644, 459, 7257, 4342, 4780, 459, 30313, 4342, 271, 262, 18161, 512, 286, 4342, 320, 928, 1680, 4342, 311, 17322, 271, 262, 5295, 512, 286, 610, 320, 31380, 220, 18, 8, 477, 27169, 320, 31380, 220, 17, 340, 262, 3270, 262, 422, 539, 4342, 512, 286, 471, 4848, 2858, 1857, 2892, 262, 2612, 284, 4848, 2858, 1857, 2892, 262, 1456, 512, 286, 369, 294, 11, 272, 304, 17322, 8932, 26615, 997, 310, 272, 284, 272, 422, 272, 775, 364, 4867, 12, 23, 1270, 310, 2612, 1447, 2700, 291, 3991, 1528, 11, 272, 11, 364, 13431, 4713, 262, 674, 12376, 23115, 4745, 11, 994, 4342, 706, 11878, 27608, 10821, 1669, 198, 262, 3734, 320, 4137, 14802, 1480, 11, 36997, 1480, 997, 286, 1515, 4517, 446, 9595, 48216, 4342, 961, 25, 21532, 2293, 26615, 1192, 286, 2612, 1447, 4342, 271, 262, 471, 2612, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 22818, 459, 7257, 4342, 4780, 459, 30313, 4342, 271, 262, 18161, 512, 286, 4342, 320, 928, 1680, 4342, 311, 17322, 271, 262, 5295, 512, 286, 610, 320, 31380, 220, 18, 8, 477, 27169, 320, 31380, 220, 17, 696, 14711, 6075, 512, 755, 17322, 8932, 10715, 26615, 997, 262, 3270, 262, 16644, 459, 7257, 4342, 4780, 459, 30313, 4342, 271, 262, 18161, 512, 286, 4342, 320, 928, 1680, 4342, 311, 17322, 271, 262, 5295, 512, 286, 610, 320, 31380, 220, 18, 8, 477, 27169, 320, 31380, 220, 17, 340, 262, 3270, 262, 422, 539, 4342, 512, 286, 471, 4848, 2858, 1857, 2892, 262, 2612, 284, 4848, 2858, 1857, 2892, 262, 1456, 512, 286, 369, 294, 11, 272, 304, 17322, 8932, 26615, 997, 310, 272, 284, 272, 422, 272, 775, 364, 4867, 12, 23, 1270, 310, 2612, 1447, 2700, 291, 3991, 1528, 11, 272, 11, 364, 13431, 4713, 262, 674, 12376, 23115, 4745, 11, 994, 4342, 706, 11878, 27608, 10821, 1669, 198, 262, 3734, 320, 4137, 14802, 1480, 11, 36997, 1480, 997, 286, 1515, 4517, 446, 9595, 48216, 4342, 961, 25, 21532, 2293, 26615, 1192, 286, 2612, 1447, 4342, 271, 262, 471, 2612, 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 ]
quantumlib/Cirq
cirq/linalg/tolerance.py
all_near_zero_mod
def all_near_zero_mod(a: Union[float, complex, Iterable[float], np.ndarray], period: float, *, atol: float = 1e-8) -> bool: """Checks if the tensor's elements are all near multiples of the period. Args: a: Tensor of elements that could all be near multiples of the period. period: The period, e.g. 2 pi when working in radians. atol: Absolute tolerance. """ b = (np.asarray(a) + period / 2) % period - period / 2 return np.all(np.less_equal(np.abs(b), atol))
python
def all_near_zero_mod(a: Union[float, complex, Iterable[float], np.ndarray], period: float, *, atol: float = 1e-8) -> bool: """Checks if the tensor's elements are all near multiples of the period. Args: a: Tensor of elements that could all be near multiples of the period. period: The period, e.g. 2 pi when working in radians. atol: Absolute tolerance. """ b = (np.asarray(a) + period / 2) % period - period / 2 return np.all(np.less_equal(np.abs(b), atol))
[ "def", "all_near_zero_mod", "(", "a", ":", "Union", "[", "float", ",", "complex", ",", "Iterable", "[", "float", "]", ",", "np", ".", "ndarray", "]", ",", "period", ":", "float", ",", "*", ",", "atol", ":", "float", "=", "1e-8", ")", "->", "bool", ":", "b", "=", "(", "np", ".", "asarray", "(", "a", ")", "+", "period", "/", "2", ")", "%", "period", "-", "period", "/", "2", "return", "np", ".", "all", "(", "np", ".", "less_equal", "(", "np", ".", "abs", "(", "b", ")", ",", "atol", ")", ")" ]
Checks if the tensor's elements are all near multiples of the period. Args: a: Tensor of elements that could all be near multiples of the period. period: The period, e.g. 2 pi when working in radians. atol: Absolute tolerance.
[ "Checks", "if", "the", "tensor", "s", "elements", "are", "all", "near", "multiples", "of", "the", "period", "." ]
train
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/linalg/tolerance.py#L34-L46
<|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: Checks if the tensor's elements are all near multiples of the period. Args: a: Tensor of elements that could all be near multiples of the period. period: The period, e.g. 2 pi when working in radians. atol: Absolute tolerance. ### Response: def all_near_zero_mod(a: Union[float, complex, Iterable[float], np.ndarray], period: float, *, atol: float = 1e-8) -> bool: """Checks if the tensor's elements are all near multiples of the period. Args: a: Tensor of elements that could all be near multiples of the period. period: The period, e.g. 2 pi when working in radians. atol: Absolute tolerance. """ b = (np.asarray(a) + period / 2) % period - period / 2 return np.all(np.less_equal(np.abs(b), atol)) <|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, 50920, 422, 279, 16000, 596, 5540, 527, 682, 3221, 66160, 315, 279, 4261, 382, 262, 18161, 512, 286, 264, 25, 27127, 315, 5540, 430, 1436, 682, 387, 3221, 66160, 315, 279, 4261, 627, 286, 4261, 25, 578, 4261, 11, 384, 1326, 13, 220, 17, 9115, 994, 3318, 304, 51884, 627, 286, 89755, 25, 49981, 25065, 382, 14711, 6075, 512, 755, 682, 77440, 19920, 7632, 2948, 25, 9323, 96481, 11, 6485, 11, 39116, 96481, 1145, 2660, 36649, 1282, 2611, 4261, 25, 2273, 345, 2611, 75892, 2611, 89755, 25, 2273, 284, 220, 16, 68, 12, 23, 8, 1492, 1845, 512, 262, 4304, 50920, 422, 279, 16000, 596, 5540, 527, 682, 3221, 66160, 315, 279, 4261, 382, 262, 18161, 512, 286, 264, 25, 27127, 315, 5540, 430, 1436, 682, 387, 3221, 66160, 315, 279, 4261, 627, 286, 4261, 25, 578, 4261, 11, 384, 1326, 13, 220, 17, 9115, 994, 3318, 304, 51884, 627, 286, 89755, 25, 49981, 25065, 627, 262, 3270, 262, 293, 284, 320, 6331, 39178, 2948, 8, 489, 4261, 611, 220, 17, 8, 1034, 4261, 482, 4261, 611, 220, 17, 198, 262, 471, 2660, 7825, 10101, 48866, 11735, 10101, 14914, 1921, 705, 89755, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 50920, 422, 279, 16000, 596, 5540, 527, 682, 3221, 66160, 315, 279, 4261, 382, 262, 18161, 512, 286, 264, 25, 27127, 315, 5540, 430, 1436, 682, 387, 3221, 66160, 315, 279, 4261, 627, 286, 4261, 25, 578, 4261, 11, 384, 1326, 13, 220, 17, 9115, 994, 3318, 304, 51884, 627, 286, 89755, 25, 49981, 25065, 382, 14711, 6075, 512, 755, 682, 77440, 19920, 7632, 2948, 25, 9323, 96481, 11, 6485, 11, 39116, 96481, 1145, 2660, 36649, 1282, 2611, 4261, 25, 2273, 345, 2611, 75892, 2611, 89755, 25, 2273, 284, 220, 16, 68, 12, 23, 8, 1492, 1845, 512, 262, 4304, 50920, 422, 279, 16000, 596, 5540, 527, 682, 3221, 66160, 315, 279, 4261, 382, 262, 18161, 512, 286, 264, 25, 27127, 315, 5540, 430, 1436, 682, 387, 3221, 66160, 315, 279, 4261, 627, 286, 4261, 25, 578, 4261, 11, 384, 1326, 13, 220, 17, 9115, 994, 3318, 304, 51884, 627, 286, 89755, 25, 49981, 25065, 627, 262, 3270, 262, 293, 284, 320, 6331, 39178, 2948, 8, 489, 4261, 611, 220, 17, 8, 1034, 4261, 482, 4261, 611, 220, 17, 198, 262, 471, 2660, 7825, 10101, 48866, 11735, 10101, 14914, 1921, 705, 89755, 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 ]
ccxt/ccxt
python/ccxt/base/exchange.py
Exchange.request
def request(self, path, api='public', method='GET', params={}, headers=None, body=None): """Exchange.request is the entry point for all generated methods""" return self.fetch2(path, api, method, params, headers, body)
python
def request(self, path, api='public', method='GET', params={}, headers=None, body=None): """Exchange.request is the entry point for all generated methods""" return self.fetch2(path, api, method, params, headers, body)
[ "def", "request", "(", "self", ",", "path", ",", "api", "=", "'public'", ",", "method", "=", "'GET'", ",", "params", "=", "{", "}", ",", "headers", "=", "None", ",", "body", "=", "None", ")", ":", "return", "self", ".", "fetch2", "(", "path", ",", "api", ",", "method", ",", "params", ",", "headers", ",", "body", ")" ]
Exchange.request is the entry point for all generated methods
[ "Exchange", ".", "request", "is", "the", "entry", "point", "for", "all", "generated", "methods" ]
train
https://github.com/ccxt/ccxt/blob/23062efd7a5892c79b370c9d951c03cf8c0ddf23/python/ccxt/base/exchange.py#L431-L433
<|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: Exchange.request is the entry point for all generated methods ### Response: def request(self, path, api='public', method='GET', params={}, headers=None, body=None): """Exchange.request is the entry point for all generated methods""" return self.fetch2(path, api, method, params, headers, body) <|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, 32664, 8387, 374, 279, 4441, 1486, 369, 682, 8066, 5528, 271, 14711, 6075, 512, 755, 1715, 1214, 11, 1853, 11, 6464, 1151, 898, 518, 1749, 1151, 3891, 518, 3712, 68525, 7247, 5980, 11, 2547, 5980, 997, 286, 4304, 32664, 8387, 374, 279, 4441, 1486, 369, 682, 8066, 5528, 7275, 286, 471, 659, 16512, 17, 5698, 11, 6464, 11, 1749, 11, 3712, 11, 7247, 11, 2547, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 32664, 8387, 374, 279, 4441, 1486, 369, 682, 8066, 5528, 271, 14711, 6075, 512, 755, 1715, 1214, 11, 1853, 11, 6464, 1151, 898, 518, 1749, 1151, 3891, 518, 3712, 68525, 7247, 5980, 11, 2547, 5980, 997, 286, 4304, 32664, 8387, 374, 279, 4441, 1486, 369, 682, 8066, 5528, 7275, 286, 471, 659, 16512, 17, 5698, 11, 6464, 11, 1749, 11, 3712, 11, 7247, 11, 2547, 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 ]
joke2k/faker
faker/providers/ssn/et_EE/__init__.py
checksum
def checksum(digits): """Calculate checksum of Estonian personal identity code. Checksum is calculated with "Modulo 11" method using level I or II scale: Level I scale: 1 2 3 4 5 6 7 8 9 1 Level II scale: 3 4 5 6 7 8 9 1 2 3 The digits of the personal code are multiplied by level I scale and summed; if remainder of modulo 11 of the sum is less than 10, checksum is the remainder. If remainder is 10, then level II scale is used; checksum is remainder if remainder < 10 or 0 if remainder is 10. See also https://et.wikipedia.org/wiki/Isikukood """ sum_mod11 = sum(map(operator.mul, digits, Provider.scale1)) % 11 if sum_mod11 < 10: return sum_mod11 sum_mod11 = sum(map(operator.mul, digits, Provider.scale2)) % 11 return 0 if sum_mod11 == 10 else sum_mod11
python
def checksum(digits): """Calculate checksum of Estonian personal identity code. Checksum is calculated with "Modulo 11" method using level I or II scale: Level I scale: 1 2 3 4 5 6 7 8 9 1 Level II scale: 3 4 5 6 7 8 9 1 2 3 The digits of the personal code are multiplied by level I scale and summed; if remainder of modulo 11 of the sum is less than 10, checksum is the remainder. If remainder is 10, then level II scale is used; checksum is remainder if remainder < 10 or 0 if remainder is 10. See also https://et.wikipedia.org/wiki/Isikukood """ sum_mod11 = sum(map(operator.mul, digits, Provider.scale1)) % 11 if sum_mod11 < 10: return sum_mod11 sum_mod11 = sum(map(operator.mul, digits, Provider.scale2)) % 11 return 0 if sum_mod11 == 10 else sum_mod11
[ "def", "checksum", "(", "digits", ")", ":", "sum_mod11", "=", "sum", "(", "map", "(", "operator", ".", "mul", ",", "digits", ",", "Provider", ".", "scale1", ")", ")", "%", "11", "if", "sum_mod11", "<", "10", ":", "return", "sum_mod11", "sum_mod11", "=", "sum", "(", "map", "(", "operator", ".", "mul", ",", "digits", ",", "Provider", ".", "scale2", ")", ")", "%", "11", "return", "0", "if", "sum_mod11", "==", "10", "else", "sum_mod11" ]
Calculate checksum of Estonian personal identity code. Checksum is calculated with "Modulo 11" method using level I or II scale: Level I scale: 1 2 3 4 5 6 7 8 9 1 Level II scale: 3 4 5 6 7 8 9 1 2 3 The digits of the personal code are multiplied by level I scale and summed; if remainder of modulo 11 of the sum is less than 10, checksum is the remainder. If remainder is 10, then level II scale is used; checksum is remainder if remainder < 10 or 0 if remainder is 10. See also https://et.wikipedia.org/wiki/Isikukood
[ "Calculate", "checksum", "of", "Estonian", "personal", "identity", "code", "." ]
train
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/ssn/et_EE/__init__.py#L9-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: Calculate checksum of Estonian personal identity code. Checksum is calculated with "Modulo 11" method using level I or II scale: Level I scale: 1 2 3 4 5 6 7 8 9 1 Level II scale: 3 4 5 6 7 8 9 1 2 3 The digits of the personal code are multiplied by level I scale and summed; if remainder of modulo 11 of the sum is less than 10, checksum is the remainder. If remainder is 10, then level II scale is used; checksum is remainder if remainder < 10 or 0 if remainder is 10. See also https://et.wikipedia.org/wiki/Isikukood ### Response: def checksum(digits): """Calculate checksum of Estonian personal identity code. Checksum is calculated with "Modulo 11" method using level I or II scale: Level I scale: 1 2 3 4 5 6 7 8 9 1 Level II scale: 3 4 5 6 7 8 9 1 2 3 The digits of the personal code are multiplied by level I scale and summed; if remainder of modulo 11 of the sum is less than 10, checksum is the remainder. If remainder is 10, then level II scale is used; checksum is remainder if remainder < 10 or 0 if remainder is 10. See also https://et.wikipedia.org/wiki/Isikukood """ sum_mod11 = sum(map(operator.mul, digits, Provider.scale1)) % 11 if sum_mod11 < 10: return sum_mod11 sum_mod11 = sum(map(operator.mul, digits, Provider.scale2)) % 11 return 0 if sum_mod11 == 10 else sum_mod11 <|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, 48966, 33629, 315, 54423, 1122, 4443, 9764, 2082, 382, 262, 4343, 1264, 374, 16997, 449, 330, 4559, 8938, 220, 806, 1, 1749, 1701, 2237, 358, 477, 8105, 5569, 512, 262, 9580, 358, 5569, 25, 220, 16, 220, 17, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 198, 262, 9580, 8105, 5569, 25, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 220, 17, 220, 18, 271, 262, 578, 19016, 315, 279, 4443, 2082, 527, 56016, 555, 2237, 358, 5569, 323, 66766, 280, 262, 422, 27410, 315, 60964, 220, 806, 315, 279, 2694, 374, 2753, 1109, 220, 605, 11, 33629, 374, 279, 198, 262, 27410, 627, 262, 1442, 27410, 374, 220, 605, 11, 1243, 2237, 8105, 5569, 374, 1511, 26, 33629, 374, 27410, 422, 198, 262, 27410, 366, 220, 605, 477, 220, 15, 422, 27410, 374, 220, 605, 382, 262, 3580, 1101, 3788, 1129, 295, 34466, 2726, 26583, 14, 3957, 1609, 3178, 1411, 271, 14711, 6075, 512, 755, 33629, 99466, 997, 262, 4304, 48966, 33629, 315, 54423, 1122, 4443, 9764, 2082, 382, 262, 4343, 1264, 374, 16997, 449, 330, 4559, 8938, 220, 806, 1, 1749, 1701, 2237, 358, 477, 8105, 5569, 512, 262, 9580, 358, 5569, 25, 220, 16, 220, 17, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 198, 262, 9580, 8105, 5569, 25, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 220, 17, 220, 18, 271, 262, 578, 19016, 315, 279, 4443, 2082, 527, 56016, 555, 2237, 358, 5569, 323, 66766, 280, 262, 422, 27410, 315, 60964, 220, 806, 315, 279, 2694, 374, 2753, 1109, 220, 605, 11, 33629, 374, 279, 198, 262, 27410, 627, 262, 1442, 27410, 374, 220, 605, 11, 1243, 2237, 8105, 5569, 374, 1511, 26, 33629, 374, 27410, 422, 198, 262, 27410, 366, 220, 605, 477, 220, 15, 422, 27410, 374, 220, 605, 382, 262, 3580, 1101, 3788, 1129, 295, 34466, 2726, 26583, 14, 3957, 1609, 3178, 1411, 198, 262, 3270, 262, 2694, 7632, 806, 284, 2694, 9325, 80191, 54241, 11, 19016, 11, 23766, 17714, 16, 595, 1034, 220, 806, 198, 262, 422, 2694, 7632, 806, 366, 220, 605, 512, 286, 471, 2694, 7632, 806, 198, 262, 2694, 7632, 806, 284, 2694, 9325, 80191, 54241, 11, 19016, 11, 23766, 17714, 17, 595, 1034, 220, 806, 198, 262, 471, 220, 15, 422, 2694, 7632, 806, 624, 220, 605, 775, 2694, 7632, 806, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 48966, 33629, 315, 54423, 1122, 4443, 9764, 2082, 382, 262, 4343, 1264, 374, 16997, 449, 330, 4559, 8938, 220, 806, 1, 1749, 1701, 2237, 358, 477, 8105, 5569, 512, 262, 9580, 358, 5569, 25, 220, 16, 220, 17, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 198, 262, 9580, 8105, 5569, 25, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 220, 17, 220, 18, 271, 262, 578, 19016, 315, 279, 4443, 2082, 527, 56016, 555, 2237, 358, 5569, 323, 66766, 280, 262, 422, 27410, 315, 60964, 220, 806, 315, 279, 2694, 374, 2753, 1109, 220, 605, 11, 33629, 374, 279, 198, 262, 27410, 627, 262, 1442, 27410, 374, 220, 605, 11, 1243, 2237, 8105, 5569, 374, 1511, 26, 33629, 374, 27410, 422, 198, 262, 27410, 366, 220, 605, 477, 220, 15, 422, 27410, 374, 220, 605, 382, 262, 3580, 1101, 3788, 1129, 295, 34466, 2726, 26583, 14, 3957, 1609, 3178, 1411, 271, 14711, 6075, 512, 755, 33629, 99466, 997, 262, 4304, 48966, 33629, 315, 54423, 1122, 4443, 9764, 2082, 382, 262, 4343, 1264, 374, 16997, 449, 330, 4559, 8938, 220, 806, 1, 1749, 1701, 2237, 358, 477, 8105, 5569, 512, 262, 9580, 358, 5569, 25, 220, 16, 220, 17, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 198, 262, 9580, 8105, 5569, 25, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 16, 220, 17, 220, 18, 271, 262, 578, 19016, 315, 279, 4443, 2082, 527, 56016, 555, 2237, 358, 5569, 323, 66766, 280, 262, 422, 27410, 315, 60964, 220, 806, 315, 279, 2694, 374, 2753, 1109, 220, 605, 11, 33629, 374, 279, 198, 262, 27410, 627, 262, 1442, 27410, 374, 220, 605, 11, 1243, 2237, 8105, 5569, 374, 1511, 26, 33629, 374, 27410, 422, 198, 262, 27410, 366, 220, 605, 477, 220, 15, 422, 27410, 374, 220, 605, 382, 262, 3580, 1101, 3788, 1129, 295, 34466, 2726, 26583, 14, 3957, 1609, 3178, 1411, 198, 262, 3270, 262, 2694, 7632, 806, 284, 2694, 9325, 80191, 54241, 11, 19016, 11, 23766, 17714, 16, 595, 1034, 220, 806, 198, 262, 422, 2694, 7632, 806, 366, 220, 605, 512, 286, 471, 2694, 7632, 806, 198, 262, 2694, 7632, 806, 284, 2694, 9325, 80191, 54241, 11, 19016, 11, 23766, 17714, 17, 595, 1034, 220, 806, 198, 262, 471, 220, 15, 422, 2694, 7632, 806, 624, 220, 605, 775, 2694, 7632, 806, 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 ]
neithere/monk
monk/shortcuts.py
one_of
def one_of(choices, first_is_default=False, as_rules=False): """ A wrapper for :class:`Any`. :param as_rules: `bool`. If `False` (by default), each element of `choices` is wrapped in the :class:`Equals` validator so they are interpreted as literals. .. deprecated:: 0.13 Use :class:`Any` instead. """ assert choices if as_rules: None # for coverage else: choices = [Equals(x) for x in choices] return Any(choices, first_is_default=first_is_default)
python
def one_of(choices, first_is_default=False, as_rules=False): """ A wrapper for :class:`Any`. :param as_rules: `bool`. If `False` (by default), each element of `choices` is wrapped in the :class:`Equals` validator so they are interpreted as literals. .. deprecated:: 0.13 Use :class:`Any` instead. """ assert choices if as_rules: None # for coverage else: choices = [Equals(x) for x in choices] return Any(choices, first_is_default=first_is_default)
[ "def", "one_of", "(", "choices", ",", "first_is_default", "=", "False", ",", "as_rules", "=", "False", ")", ":", "assert", "choices", "if", "as_rules", ":", "None", "# for coverage", "else", ":", "choices", "=", "[", "Equals", "(", "x", ")", "for", "x", "in", "choices", "]", "return", "Any", "(", "choices", ",", "first_is_default", "=", "first_is_default", ")" ]
A wrapper for :class:`Any`. :param as_rules: `bool`. If `False` (by default), each element of `choices` is wrapped in the :class:`Equals` validator so they are interpreted as literals. .. deprecated:: 0.13 Use :class:`Any` instead.
[ "A", "wrapper", "for", ":", "class", ":", "Any", "." ]
train
https://github.com/neithere/monk/blob/4b2ee5152b081ac288ce8568422a027b5e7d2b1c/monk/shortcuts.py#L81-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: A wrapper for :class:`Any`. :param as_rules: `bool`. If `False` (by default), each element of `choices` is wrapped in the :class:`Equals` validator so they are interpreted as literals. .. deprecated:: 0.13 Use :class:`Any` instead. ### Response: def one_of(choices, first_is_default=False, as_rules=False): """ A wrapper for :class:`Any`. :param as_rules: `bool`. If `False` (by default), each element of `choices` is wrapped in the :class:`Equals` validator so they are interpreted as literals. .. deprecated:: 0.13 Use :class:`Any` instead. """ assert choices if as_rules: None # for coverage else: choices = [Equals(x) for x in choices] return Any(choices, first_is_default=first_is_default) <|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, 32, 13564, 369, 551, 1058, 19258, 8780, 63438, 262, 551, 913, 439, 22122, 512, 286, 1595, 2707, 29687, 220, 1442, 1595, 4139, 63, 320, 1729, 1670, 705, 1855, 2449, 315, 1595, 25825, 4077, 286, 374, 20037, 304, 279, 551, 1058, 19258, 4413, 63, 23787, 779, 814, 527, 33398, 198, 286, 439, 76375, 382, 262, 5354, 32690, 487, 220, 15, 13, 1032, 271, 996, 5560, 551, 1058, 19258, 8780, 63, 4619, 382, 14711, 6075, 512, 755, 832, 3659, 92383, 11, 1176, 7037, 10198, 5725, 11, 439, 22122, 5725, 997, 262, 3270, 262, 362, 13564, 369, 551, 1058, 19258, 8780, 63438, 262, 551, 913, 439, 22122, 512, 286, 1595, 2707, 29687, 220, 1442, 1595, 4139, 63, 320, 1729, 1670, 705, 1855, 2449, 315, 1595, 25825, 4077, 286, 374, 20037, 304, 279, 551, 1058, 19258, 4413, 63, 23787, 779, 814, 527, 33398, 198, 286, 439, 76375, 382, 262, 5354, 32690, 487, 220, 15, 13, 1032, 271, 996, 5560, 551, 1058, 19258, 8780, 63, 4619, 382, 262, 3270, 262, 2105, 11709, 271, 262, 422, 439, 22122, 512, 286, 2290, 262, 674, 369, 10401, 198, 262, 775, 512, 286, 11709, 284, 510, 4413, 2120, 8, 369, 865, 304, 11709, 2595, 262, 471, 5884, 92383, 11, 1176, 7037, 10198, 28, 3983, 7037, 10198, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 32, 13564, 369, 551, 1058, 19258, 8780, 63438, 262, 551, 913, 439, 22122, 512, 286, 1595, 2707, 29687, 220, 1442, 1595, 4139, 63, 320, 1729, 1670, 705, 1855, 2449, 315, 1595, 25825, 4077, 286, 374, 20037, 304, 279, 551, 1058, 19258, 4413, 63, 23787, 779, 814, 527, 33398, 198, 286, 439, 76375, 382, 262, 5354, 32690, 487, 220, 15, 13, 1032, 271, 996, 5560, 551, 1058, 19258, 8780, 63, 4619, 382, 14711, 6075, 512, 755, 832, 3659, 92383, 11, 1176, 7037, 10198, 5725, 11, 439, 22122, 5725, 997, 262, 3270, 262, 362, 13564, 369, 551, 1058, 19258, 8780, 63438, 262, 551, 913, 439, 22122, 512, 286, 1595, 2707, 29687, 220, 1442, 1595, 4139, 63, 320, 1729, 1670, 705, 1855, 2449, 315, 1595, 25825, 4077, 286, 374, 20037, 304, 279, 551, 1058, 19258, 4413, 63, 23787, 779, 814, 527, 33398, 198, 286, 439, 76375, 382, 262, 5354, 32690, 487, 220, 15, 13, 1032, 271, 996, 5560, 551, 1058, 19258, 8780, 63, 4619, 382, 262, 3270, 262, 2105, 11709, 271, 262, 422, 439, 22122, 512, 286, 2290, 262, 674, 369, 10401, 198, 262, 775, 512, 286, 11709, 284, 510, 4413, 2120, 8, 369, 865, 304, 11709, 2595, 262, 471, 5884, 92383, 11, 1176, 7037, 10198, 28, 3983, 7037, 10198, 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 ]
Alignak-monitoring/alignak
alignak/daterange.py
StandardDaterange.serialize
def serialize(self): """This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http) Here we directly return all attributes :return: json representation of a Daterange :rtype: dict """ return {'day': self.day, 'other': self.other, 'timeranges': [t.serialize() for t in self.timeranges]}
python
def serialize(self): """This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http) Here we directly return all attributes :return: json representation of a Daterange :rtype: dict """ return {'day': self.day, 'other': self.other, 'timeranges': [t.serialize() for t in self.timeranges]}
[ "def", "serialize", "(", "self", ")", ":", "return", "{", "'day'", ":", "self", ".", "day", ",", "'other'", ":", "self", ".", "other", ",", "'timeranges'", ":", "[", "t", ".", "serialize", "(", ")", "for", "t", "in", "self", ".", "timeranges", "]", "}" ]
This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http) Here we directly return all attributes :return: json representation of a Daterange :rtype: dict
[ "This", "function", "serialize", "into", "a", "simple", "dict", "object", ".", "It", "is", "used", "when", "transferring", "data", "to", "other", "daemons", "over", "the", "network", "(", "http", ")" ]
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daterange.py#L769-L779
<|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 serialize into a simple dict object. It is used when transferring data to other daemons over the network (http) Here we directly return all attributes :return: json representation of a Daterange :rtype: dict ### Response: def serialize(self): """This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http) Here we directly return all attributes :return: json representation of a Daterange :rtype: dict """ return {'day': self.day, 'other': self.other, 'timeranges': [t.serialize() for t in self.timeranges]} <|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, 25217, 1139, 264, 4382, 6587, 1665, 627, 286, 1102, 374, 1511, 994, 51051, 828, 311, 1023, 3067, 59396, 927, 279, 4009, 320, 1277, 696, 286, 5810, 584, 6089, 471, 682, 8365, 271, 286, 551, 693, 25, 3024, 13340, 315, 264, 423, 977, 853, 198, 286, 551, 33613, 25, 6587, 271, 14711, 6075, 512, 755, 25217, 1214, 997, 286, 4304, 2028, 734, 25217, 1139, 264, 4382, 6587, 1665, 627, 286, 1102, 374, 1511, 994, 51051, 828, 311, 1023, 3067, 59396, 927, 279, 4009, 320, 1277, 696, 286, 5810, 584, 6089, 471, 682, 8365, 271, 286, 551, 693, 25, 3024, 13340, 315, 264, 423, 977, 853, 198, 286, 551, 33613, 25, 6587, 198, 286, 3270, 286, 471, 5473, 1316, 1232, 659, 27308, 11, 364, 1605, 1232, 659, 48881, 345, 394, 364, 19834, 5637, 1232, 510, 83, 35069, 368, 369, 259, 304, 659, 29851, 5637, 24333, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 25217, 1139, 264, 4382, 6587, 1665, 627, 286, 1102, 374, 1511, 994, 51051, 828, 311, 1023, 3067, 59396, 927, 279, 4009, 320, 1277, 696, 286, 5810, 584, 6089, 471, 682, 8365, 271, 286, 551, 693, 25, 3024, 13340, 315, 264, 423, 977, 853, 198, 286, 551, 33613, 25, 6587, 271, 14711, 6075, 512, 755, 25217, 1214, 997, 286, 4304, 2028, 734, 25217, 1139, 264, 4382, 6587, 1665, 627, 286, 1102, 374, 1511, 994, 51051, 828, 311, 1023, 3067, 59396, 927, 279, 4009, 320, 1277, 696, 286, 5810, 584, 6089, 471, 682, 8365, 271, 286, 551, 693, 25, 3024, 13340, 315, 264, 423, 977, 853, 198, 286, 551, 33613, 25, 6587, 198, 286, 3270, 286, 471, 5473, 1316, 1232, 659, 27308, 11, 364, 1605, 1232, 659, 48881, 345, 394, 364, 19834, 5637, 1232, 510, 83, 35069, 368, 369, 259, 304, 659, 29851, 5637, 24333, 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 ]
mila/pyoo
pyoo.py
SpreadsheetDocument.sheets
def sheets(self): """ Collection of sheets in this document. """ # http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSpreadsheetDocument.html#getSheets try: return self._sheets except AttributeError: target = self._target.getSheets() self._sheets = SpreadsheetCollection(self, target) return self._sheets
python
def sheets(self): """ Collection of sheets in this document. """ # http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSpreadsheetDocument.html#getSheets try: return self._sheets except AttributeError: target = self._target.getSheets() self._sheets = SpreadsheetCollection(self, target) return self._sheets
[ "def", "sheets", "(", "self", ")", ":", "# http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSpreadsheetDocument.html#getSheets", "try", ":", "return", "self", ".", "_sheets", "except", "AttributeError", ":", "target", "=", "self", ".", "_target", ".", "getSheets", "(", ")", "self", ".", "_sheets", "=", "SpreadsheetCollection", "(", "self", ",", "target", ")", "return", "self", ".", "_sheets" ]
Collection of sheets in this document.
[ "Collection", "of", "sheets", "in", "this", "document", "." ]
train
https://github.com/mila/pyoo/blob/1e024999f608c87ea72cd443e39c89eb0ba3cc62/pyoo.py#L1755-L1765
<|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: Collection of sheets in this document. ### Response: def sheets(self): """ Collection of sheets in this document. """ # http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSpreadsheetDocument.html#getSheets try: return self._sheets except AttributeError: target = self._target.getSheets() self._sheets = SpreadsheetCollection(self, target) return self._sheets <|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, 6618, 315, 25112, 304, 420, 2246, 382, 14711, 6075, 512, 755, 25112, 1214, 997, 286, 3270, 286, 11348, 315, 25112, 304, 420, 2246, 627, 286, 3270, 286, 674, 1795, 1129, 2185, 5949, 27614, 2726, 10729, 27057, 11610, 56863, 26149, 2754, 359, 80364, 2754, 3759, 34079, 47586, 15470, 7676, 2628, 49598, 8100, 1441, 198, 286, 1456, 512, 310, 471, 659, 1462, 92537, 198, 286, 3734, 54731, 512, 310, 2218, 284, 659, 1462, 5775, 673, 8100, 1441, 746, 310, 659, 1462, 92537, 284, 99601, 6618, 1214, 11, 2218, 340, 286, 471, 659, 1462, 92537, 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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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 ]
[ 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, 6618, 315, 25112, 304, 420, 2246, 382, 14711, 6075, 512, 755, 25112, 1214, 997, 286, 3270, 286, 11348, 315, 25112, 304, 420, 2246, 627, 286, 3270, 286, 674, 1795, 1129, 2185, 5949, 27614, 2726, 10729, 27057, 11610, 56863, 26149, 2754, 359, 80364, 2754, 3759, 34079, 47586, 15470, 7676, 2628, 49598, 8100, 1441, 198, 286, 1456, 512, 310, 471, 659, 1462, 92537, 198, 286, 3734, 54731, 512, 310, 2218, 284, 659, 1462, 5775, 673, 8100, 1441, 746, 310, 659, 1462, 92537, 284, 99601, 6618, 1214, 11, 2218, 340, 286, 471, 659, 1462, 92537, 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 ]
jaraco/keyrings.alt
keyrings/alt/Windows.py
RegistryKeyring.set_password
def set_password(self, service, username, password): """Write the password to the registry """ # encrypt the password password_encrypted = _win_crypto.encrypt(password.encode('utf-8')) # encode with base64 password_base64 = base64.encodestring(password_encrypted) # encode again to unicode password_saved = password_base64.decode('ascii') # store the password key_name = self._key_for_service(service) hkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_name) winreg.SetValueEx(hkey, username, 0, winreg.REG_SZ, password_saved)
python
def set_password(self, service, username, password): """Write the password to the registry """ # encrypt the password password_encrypted = _win_crypto.encrypt(password.encode('utf-8')) # encode with base64 password_base64 = base64.encodestring(password_encrypted) # encode again to unicode password_saved = password_base64.decode('ascii') # store the password key_name = self._key_for_service(service) hkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_name) winreg.SetValueEx(hkey, username, 0, winreg.REG_SZ, password_saved)
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "# encrypt the password", "password_encrypted", "=", "_win_crypto", ".", "encrypt", "(", "password", ".", "encode", "(", "'utf-8'", ")", ")", "# encode with base64", "password_base64", "=", "base64", ".", "encodestring", "(", "password_encrypted", ")", "# encode again to unicode", "password_saved", "=", "password_base64", ".", "decode", "(", "'ascii'", ")", "# store the password", "key_name", "=", "self", ".", "_key_for_service", "(", "service", ")", "hkey", "=", "winreg", ".", "CreateKey", "(", "winreg", ".", "HKEY_CURRENT_USER", ",", "key_name", ")", "winreg", ".", "SetValueEx", "(", "hkey", ",", "username", ",", "0", ",", "winreg", ".", "REG_SZ", ",", "password_saved", ")" ]
Write the password to the registry
[ "Write", "the", "password", "to", "the", "registry" ]
train
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Windows.py#L103-L116
<|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: Write the password to the registry ### Response: def set_password(self, service, username, password): """Write the password to the registry """ # encrypt the password password_encrypted = _win_crypto.encrypt(password.encode('utf-8')) # encode with base64 password_base64 = base64.encodestring(password_encrypted) # encode again to unicode password_saved = password_base64.decode('ascii') # store the password key_name = self._key_for_service(service) hkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_name) winreg.SetValueEx(hkey, username, 0, winreg.REG_SZ, password_saved) <|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, 8144, 279, 3636, 311, 279, 19989, 271, 14711, 6075, 512, 755, 743, 10330, 1214, 11, 2532, 11, 6059, 11, 3636, 997, 286, 4304, 8144, 279, 3636, 311, 279, 19989, 198, 286, 3270, 286, 674, 30725, 279, 3636, 198, 286, 3636, 14100, 14353, 284, 721, 7678, 79398, 66426, 23608, 17762, 493, 4867, 12, 23, 7132, 286, 674, 16559, 449, 2385, 1227, 198, 286, 3636, 7806, 1227, 284, 2385, 1227, 55544, 347, 66140, 23608, 14100, 14353, 340, 286, 674, 16559, 1578, 311, 27169, 198, 286, 3636, 54809, 284, 3636, 7806, 1227, 16301, 493, 24207, 4713, 286, 674, 3637, 279, 3636, 198, 286, 1401, 1292, 284, 659, 1462, 798, 5595, 12547, 22392, 340, 286, 305, 798, 284, 3243, 1610, 7399, 1622, 37187, 1610, 3924, 4889, 34038, 9285, 11, 1401, 1292, 340, 286, 3243, 1610, 43826, 849, 3283, 798, 11, 6059, 11, 220, 15, 11, 3243, 1610, 95238, 63433, 11, 3636, 54809, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 8144, 279, 3636, 311, 279, 19989, 271, 14711, 6075, 512, 755, 743, 10330, 1214, 11, 2532, 11, 6059, 11, 3636, 997, 286, 4304, 8144, 279, 3636, 311, 279, 19989, 198, 286, 3270, 286, 674, 30725, 279, 3636, 198, 286, 3636, 14100, 14353, 284, 721, 7678, 79398, 66426, 23608, 17762, 493, 4867, 12, 23, 7132, 286, 674, 16559, 449, 2385, 1227, 198, 286, 3636, 7806, 1227, 284, 2385, 1227, 55544, 347, 66140, 23608, 14100, 14353, 340, 286, 674, 16559, 1578, 311, 27169, 198, 286, 3636, 54809, 284, 3636, 7806, 1227, 16301, 493, 24207, 4713, 286, 674, 3637, 279, 3636, 198, 286, 1401, 1292, 284, 659, 1462, 798, 5595, 12547, 22392, 340, 286, 305, 798, 284, 3243, 1610, 7399, 1622, 37187, 1610, 3924, 4889, 34038, 9285, 11, 1401, 1292, 340, 286, 3243, 1610, 43826, 849, 3283, 798, 11, 6059, 11, 220, 15, 11, 3243, 1610, 95238, 63433, 11, 3636, 54809, 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 ]
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolution2dForwardOutputDim
def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launching the actual convolution. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. inputTensorDesc: cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. wDesc: cudnnFilterDescriptor Handle to a previously initialized filter descriptor. Returns ------- n : int Number of output images. c : int Number of output feature maps per image. h : int Height of each output feature map. w : int Width of each output feature map. """ n = ctypes.c_int() c = ctypes.c_int() h = ctypes.c_int() w = ctypes.c_int() status = _libcudnn.cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc, ctypes.byref(n), ctypes.byref(c), ctypes.byref(h), ctypes.byref(w)) cudnnCheckStatus(status) return n.value, c.value, h.value, w.value
python
def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launching the actual convolution. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. inputTensorDesc: cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. wDesc: cudnnFilterDescriptor Handle to a previously initialized filter descriptor. Returns ------- n : int Number of output images. c : int Number of output feature maps per image. h : int Height of each output feature map. w : int Width of each output feature map. """ n = ctypes.c_int() c = ctypes.c_int() h = ctypes.c_int() w = ctypes.c_int() status = _libcudnn.cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc, ctypes.byref(n), ctypes.byref(c), ctypes.byref(h), ctypes.byref(w)) cudnnCheckStatus(status) return n.value, c.value, h.value, w.value
[ "def", "cudnnGetConvolution2dForwardOutputDim", "(", "convDesc", ",", "inputTensorDesc", ",", "wDesc", ")", ":", "n", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", "h", "=", "ctypes", ".", "c_int", "(", ")", "w", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudnn", ".", "cudnnGetConvolution2dForwardOutputDim", "(", "convDesc", ",", "inputTensorDesc", ",", "wDesc", ",", "ctypes", ".", "byref", "(", "n", ")", ",", "ctypes", ".", "byref", "(", "c", ")", ",", "ctypes", ".", "byref", "(", "h", ")", ",", "ctypes", ".", "byref", "(", "w", ")", ")", "cudnnCheckStatus", "(", "status", ")", "return", "n", ".", "value", ",", "c", ".", "value", ",", "h", ".", "value", ",", "w", ".", "value" ]
Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launching the actual convolution. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. inputTensorDesc: cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. wDesc: cudnnFilterDescriptor Handle to a previously initialized filter descriptor. Returns ------- n : int Number of output images. c : int Number of output feature maps per image. h : int Height of each output feature map. w : int Width of each output feature map.
[ "Return", "the", "dimensions", "of", "the", "output", "tensor", "given", "a", "convolution", "descriptor", "." ]
train
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L925-L965
<|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 dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launching the actual convolution. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. inputTensorDesc: cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. wDesc: cudnnFilterDescriptor Handle to a previously initialized filter descriptor. Returns ------- n : int Number of output images. c : int Number of output feature maps per image. h : int Height of each output feature map. w : int Width of each output feature map. ### Response: def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launching the actual convolution. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. inputTensorDesc: cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. wDesc: cudnnFilterDescriptor Handle to a previously initialized filter descriptor. Returns ------- n : int Number of output images. c : int Number of output feature maps per image. h : int Height of each output feature map. w : int Width of each output feature map. """ n = ctypes.c_int() c = ctypes.c_int() h = ctypes.c_int() w = ctypes.c_int() status = _libcudnn.cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc, ctypes.byref(n), ctypes.byref(c), ctypes.byref(h), ctypes.byref(w)) cudnnCheckStatus(status) return n.value, c.value, h.value, w.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, 15696, 315, 279, 2612, 16000, 2728, 264, 56812, 16819, 382, 262, 1115, 734, 4780, 279, 15696, 315, 279, 13239, 220, 19, 35, 16000, 315, 264, 220, 17, 35, 198, 262, 56812, 11, 2728, 279, 56812, 16819, 11, 279, 1988, 16000, 16819, 323, 198, 262, 279, 4141, 16819, 13, 1115, 734, 649, 1520, 311, 6642, 279, 2612, 16000, 323, 22864, 198, 262, 279, 6300, 3392, 315, 5044, 4972, 311, 28818, 279, 5150, 56812, 382, 262, 13831, 198, 262, 31423, 262, 5804, 11312, 551, 79687, 7521, 35992, 3294, 11971, 198, 286, 14078, 311, 264, 8767, 3549, 56812, 16819, 627, 262, 1988, 26404, 11312, 25, 79687, 7521, 26404, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 16000, 16819, 627, 262, 289, 11312, 25, 79687, 7521, 5750, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 4141, 16819, 382, 262, 5295, 198, 262, 39707, 262, 308, 551, 528, 198, 286, 5742, 315, 2612, 5448, 627, 262, 272, 551, 528, 198, 286, 5742, 315, 2612, 4668, 14370, 824, 2217, 627, 262, 305, 551, 528, 198, 286, 22147, 315, 1855, 2612, 4668, 2472, 627, 262, 289, 551, 528, 198, 286, 25650, 315, 1855, 2612, 4668, 2472, 382, 14711, 6075, 512, 755, 79687, 7521, 1991, 35992, 3294, 17, 67, 27014, 5207, 10557, 56095, 11312, 11, 1988, 26404, 11312, 11, 289, 11312, 997, 262, 4304, 702, 262, 3494, 279, 15696, 315, 279, 2612, 16000, 2728, 264, 56812, 16819, 382, 262, 1115, 734, 4780, 279, 15696, 315, 279, 13239, 220, 19, 35, 16000, 315, 264, 220, 17, 35, 198, 262, 56812, 11, 2728, 279, 56812, 16819, 11, 279, 1988, 16000, 16819, 323, 198, 262, 279, 4141, 16819, 13, 1115, 734, 649, 1520, 311, 6642, 279, 2612, 16000, 323, 22864, 198, 262, 279, 6300, 3392, 315, 5044, 4972, 311, 28818, 279, 5150, 56812, 382, 262, 13831, 198, 262, 31423, 262, 5804, 11312, 551, 79687, 7521, 35992, 3294, 11971, 198, 286, 14078, 311, 264, 8767, 3549, 56812, 16819, 627, 262, 1988, 26404, 11312, 25, 79687, 7521, 26404, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 16000, 16819, 627, 262, 289, 11312, 25, 79687, 7521, 5750, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 4141, 16819, 382, 262, 5295, 198, 262, 39707, 262, 308, 551, 528, 198, 286, 5742, 315, 2612, 5448, 627, 262, 272, 551, 528, 198, 286, 5742, 315, 2612, 4668, 14370, 824, 2217, 627, 262, 305, 551, 528, 198, 286, 22147, 315, 1855, 2612, 4668, 2472, 627, 262, 289, 551, 528, 198, 286, 25650, 315, 1855, 2612, 4668, 2472, 627, 262, 3270, 262, 308, 284, 49319, 522, 4132, 746, 262, 272, 284, 49319, 522, 4132, 746, 262, 305, 284, 49319, 522, 4132, 746, 262, 289, 284, 49319, 522, 4132, 2892, 262, 2704, 284, 721, 56676, 664, 7521, 522, 664, 7521, 1991, 35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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, 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, 279, 15696, 315, 279, 2612, 16000, 2728, 264, 56812, 16819, 382, 262, 1115, 734, 4780, 279, 15696, 315, 279, 13239, 220, 19, 35, 16000, 315, 264, 220, 17, 35, 198, 262, 56812, 11, 2728, 279, 56812, 16819, 11, 279, 1988, 16000, 16819, 323, 198, 262, 279, 4141, 16819, 13, 1115, 734, 649, 1520, 311, 6642, 279, 2612, 16000, 323, 22864, 198, 262, 279, 6300, 3392, 315, 5044, 4972, 311, 28818, 279, 5150, 56812, 382, 262, 13831, 198, 262, 31423, 262, 5804, 11312, 551, 79687, 7521, 35992, 3294, 11971, 198, 286, 14078, 311, 264, 8767, 3549, 56812, 16819, 627, 262, 1988, 26404, 11312, 25, 79687, 7521, 26404, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 16000, 16819, 627, 262, 289, 11312, 25, 79687, 7521, 5750, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 4141, 16819, 382, 262, 5295, 198, 262, 39707, 262, 308, 551, 528, 198, 286, 5742, 315, 2612, 5448, 627, 262, 272, 551, 528, 198, 286, 5742, 315, 2612, 4668, 14370, 824, 2217, 627, 262, 305, 551, 528, 198, 286, 22147, 315, 1855, 2612, 4668, 2472, 627, 262, 289, 551, 528, 198, 286, 25650, 315, 1855, 2612, 4668, 2472, 382, 14711, 6075, 512, 755, 79687, 7521, 1991, 35992, 3294, 17, 67, 27014, 5207, 10557, 56095, 11312, 11, 1988, 26404, 11312, 11, 289, 11312, 997, 262, 4304, 702, 262, 3494, 279, 15696, 315, 279, 2612, 16000, 2728, 264, 56812, 16819, 382, 262, 1115, 734, 4780, 279, 15696, 315, 279, 13239, 220, 19, 35, 16000, 315, 264, 220, 17, 35, 198, 262, 56812, 11, 2728, 279, 56812, 16819, 11, 279, 1988, 16000, 16819, 323, 198, 262, 279, 4141, 16819, 13, 1115, 734, 649, 1520, 311, 6642, 279, 2612, 16000, 323, 22864, 198, 262, 279, 6300, 3392, 315, 5044, 4972, 311, 28818, 279, 5150, 56812, 382, 262, 13831, 198, 262, 31423, 262, 5804, 11312, 551, 79687, 7521, 35992, 3294, 11971, 198, 286, 14078, 311, 264, 8767, 3549, 56812, 16819, 627, 262, 1988, 26404, 11312, 25, 79687, 7521, 26404, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 16000, 16819, 627, 262, 289, 11312, 25, 79687, 7521, 5750, 11971, 198, 286, 14078, 311, 264, 8767, 17719, 4141, 16819, 382, 262, 5295, 198, 262, 39707, 262, 308, 551, 528, 198, 286, 5742, 315, 2612, 5448, 627, 262, 272, 551, 528, 198, 286, 5742, 315, 2612, 4668, 14370, 824, 2217, 627, 262, 305, 551, 528, 198, 286, 22147, 315, 1855, 2612, 4668, 2472, 627, 262, 289, 551, 528, 198, 286, 25650, 315, 1855, 2612, 4668, 2472, 627, 262, 3270, 262, 308, 284, 49319, 522, 4132, 746, 262, 272, 284, 49319, 522, 4132, 746, 262, 305, 284, 49319, 522, 4132, 746, 262, 289, 284, 49319, 522, 4132, 2892, 262, 2704, 284, 721, 56676, 664, 7521, 522, 664, 7521, 1991, 35992, 3294, 17, 67, 27014, 5207, 10557, 56095, 11312, 11, 1988, 26404, 11312, 345, 19273, 289, 11312, 11, 49319, 19544 ]
lionheart/django-pyodbc
django_pyodbc/operations.py
DatabaseOperations._switch_tz_offset_sql
def _switch_tz_offset_sql(self, field_name, tzname): """ Returns the SQL that will convert field_name to UTC from tzname. """ field_name = self.quote_name(field_name) if settings.USE_TZ: if pytz is None: from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("This query requires pytz, " "but it isn't installed.") tz = pytz.timezone(tzname) td = tz.utcoffset(datetime.datetime(2000, 1, 1)) def total_seconds(td): if hasattr(td, 'total_seconds'): return td.total_seconds() else: return td.days * 24 * 60 * 60 + td.seconds total_minutes = total_seconds(td) // 60 hours, minutes = divmod(total_minutes, 60) tzoffset = "%+03d:%02d" % (hours, minutes) field_name = "CAST(SWITCHOFFSET(TODATETIMEOFFSET(%s, '+00:00'), '%s') AS DATETIME2)" % (field_name, tzoffset) return field_name
python
def _switch_tz_offset_sql(self, field_name, tzname): """ Returns the SQL that will convert field_name to UTC from tzname. """ field_name = self.quote_name(field_name) if settings.USE_TZ: if pytz is None: from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("This query requires pytz, " "but it isn't installed.") tz = pytz.timezone(tzname) td = tz.utcoffset(datetime.datetime(2000, 1, 1)) def total_seconds(td): if hasattr(td, 'total_seconds'): return td.total_seconds() else: return td.days * 24 * 60 * 60 + td.seconds total_minutes = total_seconds(td) // 60 hours, minutes = divmod(total_minutes, 60) tzoffset = "%+03d:%02d" % (hours, minutes) field_name = "CAST(SWITCHOFFSET(TODATETIMEOFFSET(%s, '+00:00'), '%s') AS DATETIME2)" % (field_name, tzoffset) return field_name
[ "def", "_switch_tz_offset_sql", "(", "self", ",", "field_name", ",", "tzname", ")", ":", "field_name", "=", "self", ".", "quote_name", "(", "field_name", ")", "if", "settings", ".", "USE_TZ", ":", "if", "pytz", "is", "None", ":", "from", "django", ".", "core", ".", "exceptions", "import", "ImproperlyConfigured", "raise", "ImproperlyConfigured", "(", "\"This query requires pytz, \"", "\"but it isn't installed.\"", ")", "tz", "=", "pytz", ".", "timezone", "(", "tzname", ")", "td", "=", "tz", ".", "utcoffset", "(", "datetime", ".", "datetime", "(", "2000", ",", "1", ",", "1", ")", ")", "def", "total_seconds", "(", "td", ")", ":", "if", "hasattr", "(", "td", ",", "'total_seconds'", ")", ":", "return", "td", ".", "total_seconds", "(", ")", "else", ":", "return", "td", ".", "days", "*", "24", "*", "60", "*", "60", "+", "td", ".", "seconds", "total_minutes", "=", "total_seconds", "(", "td", ")", "//", "60", "hours", ",", "minutes", "=", "divmod", "(", "total_minutes", ",", "60", ")", "tzoffset", "=", "\"%+03d:%02d\"", "%", "(", "hours", ",", "minutes", ")", "field_name", "=", "\"CAST(SWITCHOFFSET(TODATETIMEOFFSET(%s, '+00:00'), '%s') AS DATETIME2)\"", "%", "(", "field_name", ",", "tzoffset", ")", "return", "field_name" ]
Returns the SQL that will convert field_name to UTC from tzname.
[ "Returns", "the", "SQL", "that", "will", "convert", "field_name", "to", "UTC", "from", "tzname", "." ]
train
https://github.com/lionheart/django-pyodbc/blob/46adda7b0bfabfa2640f72592c6f6f407f78b363/django_pyodbc/operations.py#L171-L194
<|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 the SQL that will convert field_name to UTC from tzname. ### Response: def _switch_tz_offset_sql(self, field_name, tzname): """ Returns the SQL that will convert field_name to UTC from tzname. """ field_name = self.quote_name(field_name) if settings.USE_TZ: if pytz is None: from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("This query requires pytz, " "but it isn't installed.") tz = pytz.timezone(tzname) td = tz.utcoffset(datetime.datetime(2000, 1, 1)) def total_seconds(td): if hasattr(td, 'total_seconds'): return td.total_seconds() else: return td.days * 24 * 60 * 60 + td.seconds total_minutes = total_seconds(td) // 60 hours, minutes = divmod(total_minutes, 60) tzoffset = "%+03d:%02d" % (hours, minutes) field_name = "CAST(SWITCHOFFSET(TODATETIMEOFFSET(%s, '+00:00'), '%s') AS DATETIME2)" % (field_name, tzoffset) return field_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, 279, 8029, 430, 690, 5625, 2115, 1292, 311, 28503, 505, 43628, 609, 382, 14711, 6075, 512, 755, 721, 17790, 530, 89, 7062, 18554, 1214, 11, 2115, 1292, 11, 43628, 609, 997, 286, 3270, 286, 5295, 279, 8029, 430, 690, 5625, 2115, 1292, 311, 28503, 505, 43628, 609, 627, 286, 3270, 286, 2115, 1292, 284, 659, 62665, 1292, 15944, 1292, 340, 286, 422, 5110, 5368, 937, 1159, 57, 512, 310, 422, 4611, 38692, 374, 2290, 512, 394, 505, 8426, 4976, 26744, 1179, 22728, 716, 398, 2714, 3149, 198, 394, 4933, 22728, 716, 398, 2714, 3149, 446, 2028, 3319, 7612, 4611, 38692, 11, 6360, 14600, 330, 8248, 433, 4536, 956, 10487, 13352, 310, 43628, 284, 4611, 38692, 85011, 1175, 89, 609, 340, 310, 18425, 284, 43628, 63548, 1030, 56440, 46344, 20296, 7, 1049, 15, 11, 220, 16, 11, 220, 16, 4489, 310, 711, 2860, 35925, 62341, 997, 394, 422, 32156, 62341, 11, 364, 5143, 35925, 11290, 504, 471, 18425, 14032, 35925, 746, 394, 775, 512, 504, 471, 18425, 55242, 353, 220, 1187, 353, 220, 1399, 353, 220, 1399, 489, 18425, 57443, 271, 310, 2860, 68755, 284, 2860, 35925, 62341, 8, 443, 220, 1399, 198, 310, 4207, 11, 4520, 284, 3512, 2658, 23689, 68755, 11, 220, 1399, 340, 310, 43628, 3255, 284, 6090, 10, 2839, 67, 7685, 2437, 67, 1, 1034, 320, 31482, 11, 4520, 340, 310, 2115, 1292, 284, 330, 35263, 3844, 54, 26043, 83902, 4233, 2114, 835, 45718, 83902, 15595, 82, 11, 14226, 410, 25, 410, 4670, 7832, 82, 873, 5871, 40462, 45718, 17, 10143, 1034, 320, 2630, 1292, 11, 43628, 3255, 340, 286, 471, 2115, 1292, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 279, 8029, 430, 690, 5625, 2115, 1292, 311, 28503, 505, 43628, 609, 382, 14711, 6075, 512, 755, 721, 17790, 530, 89, 7062, 18554, 1214, 11, 2115, 1292, 11, 43628, 609, 997, 286, 3270, 286, 5295, 279, 8029, 430, 690, 5625, 2115, 1292, 311, 28503, 505, 43628, 609, 627, 286, 3270, 286, 2115, 1292, 284, 659, 62665, 1292, 15944, 1292, 340, 286, 422, 5110, 5368, 937, 1159, 57, 512, 310, 422, 4611, 38692, 374, 2290, 512, 394, 505, 8426, 4976, 26744, 1179, 22728, 716, 398, 2714, 3149, 198, 394, 4933, 22728, 716, 398, 2714, 3149, 446, 2028, 3319, 7612, 4611, 38692, 11, 6360, 14600, 330, 8248, 433, 4536, 956, 10487, 13352, 310, 43628, 284, 4611, 38692, 85011, 1175, 89, 609, 340, 310, 18425, 284, 43628, 63548, 1030, 56440, 46344, 20296, 7, 1049, 15, 11, 220, 16, 11, 220, 16, 4489, 310, 711, 2860, 35925, 62341, 997, 394, 422, 32156, 62341, 11, 364, 5143, 35925, 11290, 504, 471, 18425, 14032, 35925, 746, 394, 775, 512, 504, 471, 18425, 55242, 353, 220, 1187, 353, 220, 1399, 353, 220, 1399, 489, 18425, 57443, 271, 310, 2860, 68755, 284, 2860, 35925, 62341, 8, 443, 220, 1399, 198, 310, 4207, 11, 4520, 284, 3512, 2658, 23689, 68755, 11, 220, 1399, 340, 310, 43628, 3255, 284, 6090, 10, 2839, 67, 7685, 2437, 67, 1, 1034, 320, 31482, 11, 4520, 340, 310, 2115, 1292, 284, 330, 35263, 3844, 54, 26043, 83902, 4233, 2114, 835, 45718, 83902, 15595, 82, 11, 14226, 410, 25, 410, 4670, 7832, 82, 873, 5871, 40462, 45718, 17, 10143, 1034, 320, 2630, 1292, 11, 43628, 3255, 340, 286, 471, 2115, 1292, 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 ]
openid/JWTConnect-Python-CryptoJWT
src/cryptojwt/jwe/jwe_ec.py
JWE_EC.encrypt
def encrypt(self, key=None, iv="", cek="", **kwargs): """ Produces a JWE as defined in RFC7516 using an Elliptic curve key :param key: *Not used>, only there to present the same API as JWE_RSA and JWE_SYM :param iv: Initialization vector :param cek: Content master key :param kwargs: Extra keyword arguments :return: An encrypted JWT """ _msg = as_bytes(self.msg) _args = self._dict try: _args["kid"] = kwargs["kid"] except KeyError: pass if 'params' in kwargs: if 'apu' in kwargs['params']: _args['apu'] = kwargs['params']['apu'] if 'apv' in kwargs['params']: _args['apv'] = kwargs['params']['apv'] if 'epk' in kwargs['params']: _args['epk'] = kwargs['params']['epk'] jwe = JWEnc(**_args) ctxt, tag, cek = super(JWE_EC, self).enc_setup( self["enc"], _msg, auth_data=jwe.b64_encode_header(), key=cek, iv=iv) if 'encrypted_key' in kwargs: return jwe.pack(parts=[kwargs['encrypted_key'], iv, ctxt, tag]) return jwe.pack(parts=[iv, ctxt, tag])
python
def encrypt(self, key=None, iv="", cek="", **kwargs): """ Produces a JWE as defined in RFC7516 using an Elliptic curve key :param key: *Not used>, only there to present the same API as JWE_RSA and JWE_SYM :param iv: Initialization vector :param cek: Content master key :param kwargs: Extra keyword arguments :return: An encrypted JWT """ _msg = as_bytes(self.msg) _args = self._dict try: _args["kid"] = kwargs["kid"] except KeyError: pass if 'params' in kwargs: if 'apu' in kwargs['params']: _args['apu'] = kwargs['params']['apu'] if 'apv' in kwargs['params']: _args['apv'] = kwargs['params']['apv'] if 'epk' in kwargs['params']: _args['epk'] = kwargs['params']['epk'] jwe = JWEnc(**_args) ctxt, tag, cek = super(JWE_EC, self).enc_setup( self["enc"], _msg, auth_data=jwe.b64_encode_header(), key=cek, iv=iv) if 'encrypted_key' in kwargs: return jwe.pack(parts=[kwargs['encrypted_key'], iv, ctxt, tag]) return jwe.pack(parts=[iv, ctxt, tag])
[ "def", "encrypt", "(", "self", ",", "key", "=", "None", ",", "iv", "=", "\"\"", ",", "cek", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "_msg", "=", "as_bytes", "(", "self", ".", "msg", ")", "_args", "=", "self", ".", "_dict", "try", ":", "_args", "[", "\"kid\"", "]", "=", "kwargs", "[", "\"kid\"", "]", "except", "KeyError", ":", "pass", "if", "'params'", "in", "kwargs", ":", "if", "'apu'", "in", "kwargs", "[", "'params'", "]", ":", "_args", "[", "'apu'", "]", "=", "kwargs", "[", "'params'", "]", "[", "'apu'", "]", "if", "'apv'", "in", "kwargs", "[", "'params'", "]", ":", "_args", "[", "'apv'", "]", "=", "kwargs", "[", "'params'", "]", "[", "'apv'", "]", "if", "'epk'", "in", "kwargs", "[", "'params'", "]", ":", "_args", "[", "'epk'", "]", "=", "kwargs", "[", "'params'", "]", "[", "'epk'", "]", "jwe", "=", "JWEnc", "(", "*", "*", "_args", ")", "ctxt", ",", "tag", ",", "cek", "=", "super", "(", "JWE_EC", ",", "self", ")", ".", "enc_setup", "(", "self", "[", "\"enc\"", "]", ",", "_msg", ",", "auth_data", "=", "jwe", ".", "b64_encode_header", "(", ")", ",", "key", "=", "cek", ",", "iv", "=", "iv", ")", "if", "'encrypted_key'", "in", "kwargs", ":", "return", "jwe", ".", "pack", "(", "parts", "=", "[", "kwargs", "[", "'encrypted_key'", "]", ",", "iv", ",", "ctxt", ",", "tag", "]", ")", "return", "jwe", ".", "pack", "(", "parts", "=", "[", "iv", ",", "ctxt", ",", "tag", "]", ")" ]
Produces a JWE as defined in RFC7516 using an Elliptic curve key :param key: *Not used>, only there to present the same API as JWE_RSA and JWE_SYM :param iv: Initialization vector :param cek: Content master key :param kwargs: Extra keyword arguments :return: An encrypted JWT
[ "Produces", "a", "JWE", "as", "defined", "in", "RFC7516", "using", "an", "Elliptic", "curve", "key" ]
train
https://github.com/openid/JWTConnect-Python-CryptoJWT/blob/8863cfbfe77ca885084870b234a66b55bd52930c/src/cryptojwt/jwe/jwe_ec.py#L181-L214
<|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: Produces a JWE as defined in RFC7516 using an Elliptic curve key :param key: *Not used>, only there to present the same API as JWE_RSA and JWE_SYM :param iv: Initialization vector :param cek: Content master key :param kwargs: Extra keyword arguments :return: An encrypted JWT ### Response: def encrypt(self, key=None, iv="", cek="", **kwargs): """ Produces a JWE as defined in RFC7516 using an Elliptic curve key :param key: *Not used>, only there to present the same API as JWE_RSA and JWE_SYM :param iv: Initialization vector :param cek: Content master key :param kwargs: Extra keyword arguments :return: An encrypted JWT """ _msg = as_bytes(self.msg) _args = self._dict try: _args["kid"] = kwargs["kid"] except KeyError: pass if 'params' in kwargs: if 'apu' in kwargs['params']: _args['apu'] = kwargs['params']['apu'] if 'apv' in kwargs['params']: _args['apv'] = kwargs['params']['apv'] if 'epk' in kwargs['params']: _args['epk'] = kwargs['params']['epk'] jwe = JWEnc(**_args) ctxt, tag, cek = super(JWE_EC, self).enc_setup( self["enc"], _msg, auth_data=jwe.b64_encode_header(), key=cek, iv=iv) if 'encrypted_key' in kwargs: return jwe.pack(parts=[kwargs['encrypted_key'], iv, ctxt, tag]) return jwe.pack(parts=[iv, ctxt, tag]) <|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, 50212, 264, 622, 12739, 439, 4613, 304, 40333, 23986, 21, 1701, 459, 13852, 11696, 292, 16029, 1401, 271, 286, 551, 913, 1401, 25, 353, 2688, 1511, 8226, 1193, 1070, 311, 3118, 279, 1890, 5446, 439, 198, 310, 622, 12739, 78094, 323, 622, 12739, 84033, 198, 286, 551, 913, 17967, 25, 40367, 4724, 198, 286, 551, 913, 272, 1247, 25, 9059, 7491, 1401, 198, 286, 551, 913, 16901, 25, 26041, 16570, 6105, 198, 286, 551, 693, 25, 1556, 25461, 48667, 271, 14711, 6075, 512, 755, 30725, 1214, 11, 1401, 5980, 11, 17967, 46563, 272, 1247, 46563, 3146, 9872, 997, 286, 3270, 286, 12311, 1634, 264, 622, 12739, 439, 4613, 304, 40333, 23986, 21, 1701, 459, 13852, 11696, 292, 16029, 1401, 271, 286, 551, 913, 1401, 25, 353, 2688, 1511, 8226, 1193, 1070, 311, 3118, 279, 1890, 5446, 439, 198, 310, 622, 12739, 78094, 323, 622, 12739, 84033, 198, 286, 551, 913, 17967, 25, 40367, 4724, 198, 286, 551, 913, 272, 1247, 25, 9059, 7491, 1401, 198, 286, 551, 913, 16901, 25, 26041, 16570, 6105, 198, 286, 551, 693, 25, 1556, 25461, 48667, 198, 286, 3270, 286, 721, 3316, 284, 439, 12807, 1214, 15488, 696, 286, 721, 2164, 284, 659, 1462, 8644, 198, 286, 1456, 512, 310, 721, 2164, 1204, 64381, 1365, 284, 16901, 1204, 64381, 7171, 286, 3734, 39194, 512, 310, 1522, 271, 286, 422, 364, 3603, 6, 304, 16901, 512, 310, 422, 364, 391, 84, 6, 304, 16901, 681, 3603, 18888, 394, 721, 2164, 681, 391, 84, 663, 284, 16901, 681, 3603, 4274, 391, 84, 4532, 310, 422, 364, 391, 85, 6, 304, 16901, 681, 3603, 18888, 394, 721, 2164, 681, 391, 85, 663, 284, 16901, 681, 3603, 4274, 391, 85, 4532, 310, 422, 364, 752, 74, 6, 304, 16901, 681, 3603, 18888, 394, 721, 2164, 681, 752, 74, 663, 284, 16901, 681, 3603, 4274, 752, 74, 16049, 286, 503, 906, 284, 96576, 7560, 22551, 62, 2164, 340, 286, 60262, 11, 4877, 11, 272, 1247, 284, 2307, 16772, 12739, 70610, 11, 659, 570, 967, 22074, 1021, 310, 659, 1204, 967, 8073, 721, 3316, 11, 4259, 1807, 46712, 906, 960, 1227, 11473, 8932, 1535, 1401, 28, 46800, 345, 310, 17967, 28, 344, 340, 286, 422, 364, 37544, 3173, 6, 304, 16901, 512, 310, 471, 503, 906, 21472, 47315, 5941, 9872, 681, 37544, 3173, 4181, 17967, 11, 60262, 11, 4877, 2608, 286, 471, 503, 906, 21472, 47315, 5941, 344, 11, 60262, 11, 4877, 2608, 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 ]
[ 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 50212, 264, 622, 12739, 439, 4613, 304, 40333, 23986, 21, 1701, 459, 13852, 11696, 292, 16029, 1401, 271, 286, 551, 913, 1401, 25, 353, 2688, 1511, 8226, 1193, 1070, 311, 3118, 279, 1890, 5446, 439, 198, 310, 622, 12739, 78094, 323, 622, 12739, 84033, 198, 286, 551, 913, 17967, 25, 40367, 4724, 198, 286, 551, 913, 272, 1247, 25, 9059, 7491, 1401, 198, 286, 551, 913, 16901, 25, 26041, 16570, 6105, 198, 286, 551, 693, 25, 1556, 25461, 48667, 271, 14711, 6075, 512, 755, 30725, 1214, 11, 1401, 5980, 11, 17967, 46563, 272, 1247, 46563, 3146, 9872, 997, 286, 3270, 286, 12311, 1634, 264, 622, 12739, 439, 4613, 304, 40333, 23986, 21, 1701, 459, 13852, 11696, 292, 16029, 1401, 271, 286, 551, 913, 1401, 25, 353, 2688, 1511, 8226, 1193, 1070, 311, 3118, 279, 1890, 5446, 439, 198, 310, 622, 12739, 78094, 323, 622, 12739, 84033, 198, 286, 551, 913, 17967, 25, 40367, 4724, 198, 286, 551, 913, 272, 1247, 25, 9059, 7491, 1401, 198, 286, 551, 913, 16901, 25, 26041, 16570, 6105, 198, 286, 551, 693, 25, 1556, 25461, 48667, 198, 286, 3270, 286, 721, 3316, 284, 439, 12807, 1214, 15488, 696, 286, 721, 2164, 284, 659, 1462, 8644, 198, 286, 1456, 512, 310, 721, 2164, 1204, 64381, 1365, 284, 16901, 1204, 64381, 7171, 286, 3734, 39194, 512, 310, 1522, 271, 286, 422, 364, 3603, 6, 304, 16901, 512, 310, 422, 364, 391, 84, 6, 304, 16901, 681, 3603, 18888, 394, 721, 2164, 681, 391, 84, 663, 284, 16901, 681, 3603, 4274, 391, 84, 4532, 310, 422, 364, 391, 85, 6, 304, 16901, 681, 3603, 18888, 394, 721, 2164, 681, 391, 85, 663, 284, 16901, 681, 3603, 4274, 391, 85, 4532, 310, 422, 364, 752, 74, 6, 304, 16901, 681, 3603, 18888, 394, 721, 2164, 681, 752, 74, 663, 284, 16901, 681, 3603, 4274, 752, 74, 16049, 286, 503, 906, 284, 96576, 7560, 22551, 62, 2164, 340, 286, 60262, 11, 4877, 11, 272, 1247, 284, 2307, 16772, 12739, 70610, 11, 659, 570, 967, 22074, 1021, 310, 659, 1204, 967, 8073, 721, 3316, 11, 4259, 1807, 46712, 906, 960, 1227, 11473, 8932, 1535, 1401, 28, 46800, 345, 310, 17967, 28, 344, 340, 286, 422, 364, 37544, 3173, 6, 304, 16901, 512, 310, 471, 503, 906, 21472, 47315, 5941, 9872, 681, 37544, 3173, 4181, 17967, 11, 60262, 11, 4877, 2608, 286, 471, 503, 906, 21472, 47315, 5941, 344, 11, 60262, 11, 4877, 2608, 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 ]
Gr1N/copypaste
copypaste/unix.py
copy
def copy(string, cmd=copy_cmd, stdin=PIPE): """Copy given string into system clipboard. """ Popen(cmd, stdin=stdin).communicate(string.encode('utf-8'))
python
def copy(string, cmd=copy_cmd, stdin=PIPE): """Copy given string into system clipboard. """ Popen(cmd, stdin=stdin).communicate(string.encode('utf-8'))
[ "def", "copy", "(", "string", ",", "cmd", "=", "copy_cmd", ",", "stdin", "=", "PIPE", ")", ":", "Popen", "(", "cmd", ",", "stdin", "=", "stdin", ")", ".", "communicate", "(", "string", ".", "encode", "(", "'utf-8'", ")", ")" ]
Copy given string into system clipboard.
[ "Copy", "given", "string", "into", "system", "clipboard", "." ]
train
https://github.com/Gr1N/copypaste/blob/7d515d1d31db5ae686378b60e4c8717d7f6834de/copypaste/unix.py#L24-L27
<|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: Copy given string into system clipboard. ### Response: def copy(string, cmd=copy_cmd, stdin=PIPE): """Copy given string into system clipboard. """ Popen(cmd, stdin=stdin).communicate(string.encode('utf-8')) <|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, 12379, 2728, 925, 1139, 1887, 47134, 382, 14711, 6075, 512, 755, 3048, 3693, 11, 5556, 28, 8728, 11946, 11, 32469, 28, 60833, 997, 262, 4304, 12379, 2728, 925, 1139, 1887, 47134, 627, 262, 3270, 262, 393, 2569, 14493, 11, 32469, 28, 52702, 570, 26660, 349, 3693, 17762, 493, 4867, 12, 23, 7132, 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, 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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 ]
[ 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, 12379, 2728, 925, 1139, 1887, 47134, 382, 14711, 6075, 512, 755, 3048, 3693, 11, 5556, 28, 8728, 11946, 11, 32469, 28, 60833, 997, 262, 4304, 12379, 2728, 925, 1139, 1887, 47134, 627, 262, 3270, 262, 393, 2569, 14493, 11, 32469, 28, 52702, 570, 26660, 349, 3693, 17762, 493, 4867, 12, 23, 7132, 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 ]
BeyondTheClouds/enoslib
docs/tutorials/grid5000/virt/tuto_grid5000_virt.py
range_mac
def range_mac(mac_start, mac_end, step=1): """Iterate over mac addresses (given as string).""" start = int(EUI(mac_start)) end = int(EUI(mac_end)) for i_mac in range(start, end, step): mac = EUI(int(EUI(i_mac)) + 1) ip = ['10'] + [str(int(i, 2)) for i in mac.bits().split('-')[-3:]] yield str(mac).replace('-', ':'), '.'.join(ip)
python
def range_mac(mac_start, mac_end, step=1): """Iterate over mac addresses (given as string).""" start = int(EUI(mac_start)) end = int(EUI(mac_end)) for i_mac in range(start, end, step): mac = EUI(int(EUI(i_mac)) + 1) ip = ['10'] + [str(int(i, 2)) for i in mac.bits().split('-')[-3:]] yield str(mac).replace('-', ':'), '.'.join(ip)
[ "def", "range_mac", "(", "mac_start", ",", "mac_end", ",", "step", "=", "1", ")", ":", "start", "=", "int", "(", "EUI", "(", "mac_start", ")", ")", "end", "=", "int", "(", "EUI", "(", "mac_end", ")", ")", "for", "i_mac", "in", "range", "(", "start", ",", "end", ",", "step", ")", ":", "mac", "=", "EUI", "(", "int", "(", "EUI", "(", "i_mac", ")", ")", "+", "1", ")", "ip", "=", "[", "'10'", "]", "+", "[", "str", "(", "int", "(", "i", ",", "2", ")", ")", "for", "i", "in", "mac", ".", "bits", "(", ")", ".", "split", "(", "'-'", ")", "[", "-", "3", ":", "]", "]", "yield", "str", "(", "mac", ")", ".", "replace", "(", "'-'", ",", "':'", ")", ",", "'.'", ".", "join", "(", "ip", ")" ]
Iterate over mac addresses (given as string).
[ "Iterate", "over", "mac", "addresses", "(", "given", "as", "string", ")", "." ]
train
https://github.com/BeyondTheClouds/enoslib/blob/fb00be58e56a7848cfe482187d659744919fe2f7/docs/tutorials/grid5000/virt/tuto_grid5000_virt.py#L16-L23
<|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: Iterate over mac addresses (given as string). ### Response: def range_mac(mac_start, mac_end, step=1): """Iterate over mac addresses (given as string).""" start = int(EUI(mac_start)) end = int(EUI(mac_end)) for i_mac in range(start, end, step): mac = EUI(int(EUI(i_mac)) + 1) ip = ['10'] + [str(int(i, 2)) for i in mac.bits().split('-')[-3:]] yield str(mac).replace('-', ':'), '.'.join(ip) <|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, 8705, 349, 927, 9155, 14564, 320, 43068, 439, 925, 3677, 14711, 6075, 512, 755, 2134, 23647, 74711, 5011, 11, 9155, 6345, 11, 3094, 28, 16, 997, 262, 4304, 8705, 349, 927, 9155, 14564, 320, 43068, 439, 925, 570, 7275, 262, 1212, 284, 528, 10953, 2327, 74711, 5011, 1192, 262, 842, 284, 528, 10953, 2327, 74711, 6345, 1192, 262, 369, 602, 23647, 304, 2134, 10865, 11, 842, 11, 3094, 997, 286, 9155, 284, 469, 2327, 1577, 10953, 2327, 1998, 23647, 595, 489, 220, 16, 340, 286, 6125, 284, 2570, 605, 663, 489, 510, 496, 1577, 1998, 11, 220, 17, 595, 369, 602, 304, 9155, 39540, 1020, 7105, 14996, 873, 7764, 18, 25, 14623, 286, 7692, 610, 74711, 570, 8319, 66133, 13906, 4670, 25360, 13, 6115, 24338, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 8705, 349, 927, 9155, 14564, 320, 43068, 439, 925, 3677, 14711, 6075, 512, 755, 2134, 23647, 74711, 5011, 11, 9155, 6345, 11, 3094, 28, 16, 997, 262, 4304, 8705, 349, 927, 9155, 14564, 320, 43068, 439, 925, 570, 7275, 262, 1212, 284, 528, 10953, 2327, 74711, 5011, 1192, 262, 842, 284, 528, 10953, 2327, 74711, 6345, 1192, 262, 369, 602, 23647, 304, 2134, 10865, 11, 842, 11, 3094, 997, 286, 9155, 284, 469, 2327, 1577, 10953, 2327, 1998, 23647, 595, 489, 220, 16, 340, 286, 6125, 284, 2570, 605, 663, 489, 510, 496, 1577, 1998, 11, 220, 17, 595, 369, 602, 304, 9155, 39540, 1020, 7105, 14996, 873, 7764, 18, 25, 14623, 286, 7692, 610, 74711, 570, 8319, 66133, 13906, 4670, 25360, 13, 6115, 24338, 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 ]
rodluger/everest
everest/basecamp.py
Basecamp.plot_aperture
def plot_aperture(self, axes, labelsize=8): ''' Plots the aperture and the pixel images at the beginning, middle, and end of the time series. Also plots a high resolution image of the target, if available. ''' log.info('Plotting the aperture...') # Get colormap plasma = pl.get_cmap('plasma') plasma.set_bad(alpha=0) # Get aperture contour def PadWithZeros(vector, pad_width, iaxis, kwargs): vector[:pad_width[0]] = 0 vector[-pad_width[1]:] = 0 return vector ny, nx = self.pixel_images[0].shape contour = np.zeros((ny, nx)) contour[np.where(self.aperture)] = 1 contour = np.lib.pad(contour, 1, PadWithZeros) highres = zoom(contour, 100, order=0, mode='nearest') extent = np.array([-1, nx, -1, ny]) # Plot first, mid, and last TPF image title = ['start', 'mid', 'end'] for i, image in enumerate(self.pixel_images): ax = axes[i] ax.imshow(image, aspect='auto', interpolation='nearest', cmap=plasma) ax.contour(highres, levels=[0.5], extent=extent, origin='lower', colors='r', linewidths=1) # Check for saturated columns for x in range(self.aperture.shape[0]): for y in range(self.aperture.shape[1]): if self.aperture[x][y] == AP_SATURATED_PIXEL: ax.fill([y - 0.5, y + 0.5, y + 0.5, y - 0.5], [x - 0.5, x - 0.5, x + 0.5, x + 0.5], fill=False, hatch='xxxxx', color='r', lw=0) ax.axis('off') ax.set_xlim(-0.7, nx - 0.3) ax.set_ylim(-0.7, ny - 0.3) ax.annotate(title[i], xy=(0.5, 0.975), xycoords='axes fraction', ha='center', va='top', size=labelsize, color='w') if i == 1: for source in self.nearby: ax.annotate('%.1f' % source['mag'], xy=(source['x'] - source['x0'], source['y'] - source['y0']), ha='center', va='center', size=labelsize - 2, color='w', fontweight='bold') # Plot hi res image if self.hires is not None: ax = axes[-1] ax.imshow(self.hires, aspect='auto', extent=(-0.5, nx - 0.5, -0.5, ny - 0.5), interpolation='bicubic', cmap=plasma) ax.contour(highres, levels=[0.5], extent=extent, origin='lower', colors='r', linewidths=1) ax.axis('off') ax.set_xlim(-0.7, nx - 0.3) ax.set_ylim(-0.7, ny - 0.3) ax.annotate('hires', xy=(0.5, 0.975), xycoords='axes fraction', ha='center', va='top', size=labelsize, color='w') else: ax = axes[-1] ax.axis('off')
python
def plot_aperture(self, axes, labelsize=8): ''' Plots the aperture and the pixel images at the beginning, middle, and end of the time series. Also plots a high resolution image of the target, if available. ''' log.info('Plotting the aperture...') # Get colormap plasma = pl.get_cmap('plasma') plasma.set_bad(alpha=0) # Get aperture contour def PadWithZeros(vector, pad_width, iaxis, kwargs): vector[:pad_width[0]] = 0 vector[-pad_width[1]:] = 0 return vector ny, nx = self.pixel_images[0].shape contour = np.zeros((ny, nx)) contour[np.where(self.aperture)] = 1 contour = np.lib.pad(contour, 1, PadWithZeros) highres = zoom(contour, 100, order=0, mode='nearest') extent = np.array([-1, nx, -1, ny]) # Plot first, mid, and last TPF image title = ['start', 'mid', 'end'] for i, image in enumerate(self.pixel_images): ax = axes[i] ax.imshow(image, aspect='auto', interpolation='nearest', cmap=plasma) ax.contour(highres, levels=[0.5], extent=extent, origin='lower', colors='r', linewidths=1) # Check for saturated columns for x in range(self.aperture.shape[0]): for y in range(self.aperture.shape[1]): if self.aperture[x][y] == AP_SATURATED_PIXEL: ax.fill([y - 0.5, y + 0.5, y + 0.5, y - 0.5], [x - 0.5, x - 0.5, x + 0.5, x + 0.5], fill=False, hatch='xxxxx', color='r', lw=0) ax.axis('off') ax.set_xlim(-0.7, nx - 0.3) ax.set_ylim(-0.7, ny - 0.3) ax.annotate(title[i], xy=(0.5, 0.975), xycoords='axes fraction', ha='center', va='top', size=labelsize, color='w') if i == 1: for source in self.nearby: ax.annotate('%.1f' % source['mag'], xy=(source['x'] - source['x0'], source['y'] - source['y0']), ha='center', va='center', size=labelsize - 2, color='w', fontweight='bold') # Plot hi res image if self.hires is not None: ax = axes[-1] ax.imshow(self.hires, aspect='auto', extent=(-0.5, nx - 0.5, -0.5, ny - 0.5), interpolation='bicubic', cmap=plasma) ax.contour(highres, levels=[0.5], extent=extent, origin='lower', colors='r', linewidths=1) ax.axis('off') ax.set_xlim(-0.7, nx - 0.3) ax.set_ylim(-0.7, ny - 0.3) ax.annotate('hires', xy=(0.5, 0.975), xycoords='axes fraction', ha='center', va='top', size=labelsize, color='w') else: ax = axes[-1] ax.axis('off')
[ "def", "plot_aperture", "(", "self", ",", "axes", ",", "labelsize", "=", "8", ")", ":", "log", ".", "info", "(", "'Plotting the aperture...'", ")", "# Get colormap", "plasma", "=", "pl", ".", "get_cmap", "(", "'plasma'", ")", "plasma", ".", "set_bad", "(", "alpha", "=", "0", ")", "# Get aperture contour", "def", "PadWithZeros", "(", "vector", ",", "pad_width", ",", "iaxis", ",", "kwargs", ")", ":", "vector", "[", ":", "pad_width", "[", "0", "]", "]", "=", "0", "vector", "[", "-", "pad_width", "[", "1", "]", ":", "]", "=", "0", "return", "vector", "ny", ",", "nx", "=", "self", ".", "pixel_images", "[", "0", "]", ".", "shape", "contour", "=", "np", ".", "zeros", "(", "(", "ny", ",", "nx", ")", ")", "contour", "[", "np", ".", "where", "(", "self", ".", "aperture", ")", "]", "=", "1", "contour", "=", "np", ".", "lib", ".", "pad", "(", "contour", ",", "1", ",", "PadWithZeros", ")", "highres", "=", "zoom", "(", "contour", ",", "100", ",", "order", "=", "0", ",", "mode", "=", "'nearest'", ")", "extent", "=", "np", ".", "array", "(", "[", "-", "1", ",", "nx", ",", "-", "1", ",", "ny", "]", ")", "# Plot first, mid, and last TPF image", "title", "=", "[", "'start'", ",", "'mid'", ",", "'end'", "]", "for", "i", ",", "image", "in", "enumerate", "(", "self", ".", "pixel_images", ")", ":", "ax", "=", "axes", "[", "i", "]", "ax", ".", "imshow", "(", "image", ",", "aspect", "=", "'auto'", ",", "interpolation", "=", "'nearest'", ",", "cmap", "=", "plasma", ")", "ax", ".", "contour", "(", "highres", ",", "levels", "=", "[", "0.5", "]", ",", "extent", "=", "extent", ",", "origin", "=", "'lower'", ",", "colors", "=", "'r'", ",", "linewidths", "=", "1", ")", "# Check for saturated columns", "for", "x", "in", "range", "(", "self", ".", "aperture", ".", "shape", "[", "0", "]", ")", ":", "for", "y", "in", "range", "(", "self", ".", "aperture", ".", "shape", "[", "1", "]", ")", ":", "if", "self", ".", "aperture", "[", "x", "]", "[", "y", "]", "==", "AP_SATURATED_PIXEL", ":", "ax", ".", "fill", "(", "[", "y", "-", "0.5", ",", "y", "+", "0.5", ",", "y", "+", "0.5", ",", "y", "-", "0.5", "]", ",", "[", "x", "-", "0.5", ",", "x", "-", "0.5", ",", "x", "+", "0.5", ",", "x", "+", "0.5", "]", ",", "fill", "=", "False", ",", "hatch", "=", "'xxxxx'", ",", "color", "=", "'r'", ",", "lw", "=", "0", ")", "ax", ".", "axis", "(", "'off'", ")", "ax", ".", "set_xlim", "(", "-", "0.7", ",", "nx", "-", "0.3", ")", "ax", ".", "set_ylim", "(", "-", "0.7", ",", "ny", "-", "0.3", ")", "ax", ".", "annotate", "(", "title", "[", "i", "]", ",", "xy", "=", "(", "0.5", ",", "0.975", ")", ",", "xycoords", "=", "'axes fraction'", ",", "ha", "=", "'center'", ",", "va", "=", "'top'", ",", "size", "=", "labelsize", ",", "color", "=", "'w'", ")", "if", "i", "==", "1", ":", "for", "source", "in", "self", ".", "nearby", ":", "ax", ".", "annotate", "(", "'%.1f'", "%", "source", "[", "'mag'", "]", ",", "xy", "=", "(", "source", "[", "'x'", "]", "-", "source", "[", "'x0'", "]", ",", "source", "[", "'y'", "]", "-", "source", "[", "'y0'", "]", ")", ",", "ha", "=", "'center'", ",", "va", "=", "'center'", ",", "size", "=", "labelsize", "-", "2", ",", "color", "=", "'w'", ",", "fontweight", "=", "'bold'", ")", "# Plot hi res image", "if", "self", ".", "hires", "is", "not", "None", ":", "ax", "=", "axes", "[", "-", "1", "]", "ax", ".", "imshow", "(", "self", ".", "hires", ",", "aspect", "=", "'auto'", ",", "extent", "=", "(", "-", "0.5", ",", "nx", "-", "0.5", ",", "-", "0.5", ",", "ny", "-", "0.5", ")", ",", "interpolation", "=", "'bicubic'", ",", "cmap", "=", "plasma", ")", "ax", ".", "contour", "(", "highres", ",", "levels", "=", "[", "0.5", "]", ",", "extent", "=", "extent", ",", "origin", "=", "'lower'", ",", "colors", "=", "'r'", ",", "linewidths", "=", "1", ")", "ax", ".", "axis", "(", "'off'", ")", "ax", ".", "set_xlim", "(", "-", "0.7", ",", "nx", "-", "0.3", ")", "ax", ".", "set_ylim", "(", "-", "0.7", ",", "ny", "-", "0.3", ")", "ax", ".", "annotate", "(", "'hires'", ",", "xy", "=", "(", "0.5", ",", "0.975", ")", ",", "xycoords", "=", "'axes fraction'", ",", "ha", "=", "'center'", ",", "va", "=", "'top'", ",", "size", "=", "labelsize", ",", "color", "=", "'w'", ")", "else", ":", "ax", "=", "axes", "[", "-", "1", "]", "ax", ".", "axis", "(", "'off'", ")" ]
Plots the aperture and the pixel images at the beginning, middle, and end of the time series. Also plots a high resolution image of the target, if available.
[ "Plots", "the", "aperture", "and", "the", "pixel", "images", "at", "the", "beginning", "middle", "and", "end", "of", "the", "time", "series", ".", "Also", "plots", "a", "high", "resolution", "image", "of", "the", "target", "if", "available", "." ]
train
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/basecamp.py#L708-L779
<|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: Plots the aperture and the pixel images at the beginning, middle, and end of the time series. Also plots a high resolution image of the target, if available. ### Response: def plot_aperture(self, axes, labelsize=8): ''' Plots the aperture and the pixel images at the beginning, middle, and end of the time series. Also plots a high resolution image of the target, if available. ''' log.info('Plotting the aperture...') # Get colormap plasma = pl.get_cmap('plasma') plasma.set_bad(alpha=0) # Get aperture contour def PadWithZeros(vector, pad_width, iaxis, kwargs): vector[:pad_width[0]] = 0 vector[-pad_width[1]:] = 0 return vector ny, nx = self.pixel_images[0].shape contour = np.zeros((ny, nx)) contour[np.where(self.aperture)] = 1 contour = np.lib.pad(contour, 1, PadWithZeros) highres = zoom(contour, 100, order=0, mode='nearest') extent = np.array([-1, nx, -1, ny]) # Plot first, mid, and last TPF image title = ['start', 'mid', 'end'] for i, image in enumerate(self.pixel_images): ax = axes[i] ax.imshow(image, aspect='auto', interpolation='nearest', cmap=plasma) ax.contour(highres, levels=[0.5], extent=extent, origin='lower', colors='r', linewidths=1) # Check for saturated columns for x in range(self.aperture.shape[0]): for y in range(self.aperture.shape[1]): if self.aperture[x][y] == AP_SATURATED_PIXEL: ax.fill([y - 0.5, y + 0.5, y + 0.5, y - 0.5], [x - 0.5, x - 0.5, x + 0.5, x + 0.5], fill=False, hatch='xxxxx', color='r', lw=0) ax.axis('off') ax.set_xlim(-0.7, nx - 0.3) ax.set_ylim(-0.7, ny - 0.3) ax.annotate(title[i], xy=(0.5, 0.975), xycoords='axes fraction', ha='center', va='top', size=labelsize, color='w') if i == 1: for source in self.nearby: ax.annotate('%.1f' % source['mag'], xy=(source['x'] - source['x0'], source['y'] - source['y0']), ha='center', va='center', size=labelsize - 2, color='w', fontweight='bold') # Plot hi res image if self.hires is not None: ax = axes[-1] ax.imshow(self.hires, aspect='auto', extent=(-0.5, nx - 0.5, -0.5, ny - 0.5), interpolation='bicubic', cmap=plasma) ax.contour(highres, levels=[0.5], extent=extent, origin='lower', colors='r', linewidths=1) ax.axis('off') ax.set_xlim(-0.7, nx - 0.3) ax.set_ylim(-0.7, ny - 0.3) ax.annotate('hires', xy=(0.5, 0.975), xycoords='axes fraction', ha='center', va='top', size=labelsize, color='w') else: ax = axes[-1] ax.axis('off') <|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, 2169, 2469, 279, 58101, 323, 279, 13252, 5448, 520, 279, 7314, 11, 6278, 345, 286, 323, 842, 315, 279, 892, 4101, 13, 7429, 31794, 264, 1579, 11175, 2217, 315, 198, 286, 279, 2218, 11, 422, 2561, 382, 14711, 6075, 512, 755, 7234, 21773, 42947, 1214, 11, 25776, 11, 2440, 2190, 28, 23, 997, 286, 11414, 286, 1856, 2469, 279, 58101, 323, 279, 13252, 5448, 520, 279, 7314, 11, 6278, 345, 286, 323, 842, 315, 279, 892, 4101, 13, 7429, 31794, 264, 1579, 11175, 2217, 315, 198, 286, 279, 2218, 11, 422, 2561, 382, 286, 45832, 286, 1515, 5506, 493, 26687, 1303, 279, 58101, 1131, 4713, 286, 674, 2175, 77110, 198, 286, 32426, 284, 628, 673, 669, 2235, 493, 501, 23390, 1329, 286, 32426, 995, 35299, 37718, 28, 15, 696, 286, 674, 2175, 58101, 42533, 198, 286, 711, 26367, 2409, 57, 6398, 19606, 11, 11262, 8086, 11, 602, 7332, 11, 16901, 997, 310, 4724, 3530, 13545, 8086, 58, 15, 5163, 284, 220, 15, 198, 310, 4724, 7764, 13545, 8086, 58, 16, 5787, 60, 284, 220, 15, 198, 310, 471, 4724, 198, 286, 19541, 11, 25508, 284, 659, 63435, 13586, 58, 15, 948, 12510, 198, 286, 42533, 284, 2660, 13064, 1209, 3919, 11, 25508, 1192, 286, 42533, 48753, 18486, 1214, 4795, 42947, 7400, 284, 220, 16, 198, 286, 42533, 284, 2660, 15296, 57366, 38946, 414, 11, 220, 16, 11, 26367, 2409, 57, 6398, 340, 286, 1579, 417, 284, 15932, 38946, 414, 11, 220, 1041, 11, 2015, 28, 15, 11, 3941, 1151, 70611, 1329, 286, 13112, 284, 2660, 7382, 42297, 16, 11, 25508, 11, 482, 16, 11, 19541, 9801, 286, 674, 27124, 1176, 11, 5209, 11, 323, 1566, 350, 20280, 2217, 198, 286, 2316, 284, 2570, 2527, 518, 364, 16497, 518, 364, 408, 4532, 286, 369, 602, 11, 2217, 304, 13555, 1214, 63435, 13586, 997, 310, 3944, 284, 25776, 1004, 933, 310, 3944, 30186, 10281, 11, 13189, 1151, 3989, 756, 2611, 37587, 1151, 70611, 518, 41878, 28, 501, 23390, 340, 310, 3944, 5458, 414, 73070, 417, 11, 5990, 5941, 15, 13, 20, 1145, 13112, 28, 71272, 345, 5291, 6371, 1151, 15115, 518, 8146, 1151, 81, 518, 48947, 82, 28, 16, 696, 310, 674, 4343, 369, 50585, 8310, 198, 310, 369, 865, 304, 2134, 1214, 4795, 42947, 7201, 58, 15, 22953, 394, 369, 379, 304, 2134, 1214, 4795, 42947, 7201, 58, 16, 22953, 504, 422, 659, 4795, 42947, 8487, 1483, 88, 60, 624, 10314, 1117, 835, 1539, 9182, 51584, 512, 667, 3944, 12749, 2625, 88, 482, 220, 15, 13, 20, 11, 379, 489, 220, 15, 13, 20, 11, 379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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2169, 2469, 279, 58101, 323, 279, 13252, 5448, 520, 279, 7314, 11, 6278, 345, 286, 323, 842, 315, 279, 892, 4101, 13, 7429, 31794, 264, 1579, 11175, 2217, 315, 198, 286, 279, 2218, 11, 422, 2561, 382, 14711, 6075, 512, 755, 7234, 21773, 42947, 1214, 11, 25776, 11, 2440, 2190, 28, 23, 997, 286, 11414, 286, 1856, 2469, 279, 58101, 323, 279, 13252, 5448, 520, 279, 7314, 11, 6278, 345, 286, 323, 842, 315, 279, 892, 4101, 13, 7429, 31794, 264, 1579, 11175, 2217, 315, 198, 286, 279, 2218, 11, 422, 2561, 382, 286, 45832, 286, 1515, 5506, 493, 26687, 1303, 279, 58101, 1131, 4713, 286, 674, 2175, 77110, 198, 286, 32426, 284, 628, 673, 669, 2235, 493, 501, 23390, 1329, 286, 32426, 995, 35299, 37718, 28, 15, 696, 286, 674, 2175, 58101, 42533, 198, 286, 711, 26367, 2409, 57, 6398, 19606, 11, 11262, 8086, 11, 602, 7332, 11, 16901, 997, 310, 4724, 3530, 13545, 8086, 58, 15, 5163, 284, 220, 15, 198, 310, 4724, 7764, 13545, 8086, 58, 16, 5787, 60, 284, 220, 15, 198, 310, 471, 4724, 198, 286, 19541, 11, 25508, 284, 659, 63435, 13586, 58, 15, 948, 12510, 198, 286, 42533, 284, 2660, 13064, 1209, 3919, 11, 25508, 1192, 286, 42533, 48753, 18486, 1214, 4795, 42947, 7400, 284, 220, 16, 198, 286, 42533, 284, 2660, 15296, 57366, 38946, 414, 11, 220, 16, 11, 26367, 2409, 57, 6398, 340, 286, 1579, 417, 284, 15932, 38946, 414, 11, 220, 1041, 11, 2015, 28, 15, 11, 3941, 1151, 70611, 1329, 286, 13112, 284, 2660, 7382, 42297, 16, 11, 25508, 11, 482, 16, 11, 19541, 9801, 286, 674, 27124, 1176, 11, 5209, 11, 323, 1566, 350, 20280, 2217, 198, 286, 2316, 284, 2570, 2527, 518, 364, 16497, 518, 364, 408, 4532, 286, 369, 602, 11, 2217, 304, 13555, 1214, 63435, 13586, 997, 310, 3944, 284, 25776, 1004, 933, 310, 3944, 30186, 10281, 11, 13189, 1151, 3989, 756, 2611, 37587, 1151, 70611, 518, 41878, 28, 501, 23390, 340, 310, 3944, 5458, 414, 73070, 417, 11, 5990, 5941, 15, 13, 20, 1145, 13112, 28, 71272, 345, 5291, 6371, 1151, 15115, 518, 8146, 1151, 81, 518, 48947, 82, 28, 16, 696, 310, 674, 4343, 369, 50585, 8310, 198, 310, 369, 865, 304, 2134, 1214, 4795, 42947, 7201, 58, 15, 22953, 394, 369, 379, 304, 2134, 1214, 4795, 42947, 7201, 58, 16, 22953, 504, 422, 659, 4795, 42947, 8487, 1483, 88, 60, 624, 10314, 1117, 835, 1539, 9182, 51584, 512, 667, 3944, 12749, 2625, 88, 482, 220, 15, 13, 20, 11, 379, 489, 220, 15, 13, 20, 11, 379, 489, 220, 15, 13, 20, 11, 379, 482, 220, 15, 13, 20, 1282, 1408, 510, 87, 482, 220, 15, 13, 20, 11, 865, 482, 220, 15, 13, 20, 11, 865, 489, 220, 15, 13, 20, 11, 865, 489, 220, 15, 13, 20, 1282, 1408, 5266, 5725, 11, 44355 ]
pysathq/pysat
pysat/solvers.py
Lingeling.get_model
def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.lingeling and self.status == True: model = pysolvers.lingeling_model(self.lingeling) return model if model != None else []
python
def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.lingeling and self.status == True: model = pysolvers.lingeling_model(self.lingeling) return model if model != None else []
[ "def", "get_model", "(", "self", ")", ":", "if", "self", ".", "lingeling", "and", "self", ".", "status", "==", "True", ":", "model", "=", "pysolvers", ".", "lingeling_model", "(", "self", ".", "lingeling", ")", "return", "model", "if", "model", "!=", "None", "else", "[", "]" ]
Get a model if the formula was previously satisfied.
[ "Get", "a", "model", "if", "the", "formula", "was", "previously", "satisfied", "." ]
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/solvers.py#L1651-L1658
<|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 model if the formula was previously satisfied. ### Response: def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.lingeling and self.status == True: model = pysolvers.lingeling_model(self.lingeling) return model if model != None else [] <|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, 1646, 422, 279, 15150, 574, 8767, 20097, 382, 14711, 6075, 512, 755, 636, 5156, 1214, 997, 286, 3270, 310, 2175, 264, 1646, 422, 279, 15150, 574, 8767, 20097, 627, 286, 12713, 286, 422, 659, 929, 287, 20659, 323, 659, 4397, 624, 3082, 512, 310, 1646, 284, 67189, 40535, 929, 287, 20659, 5156, 1214, 929, 287, 20659, 340, 310, 471, 1646, 422, 1646, 976, 2290, 775, 4260, 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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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 ]
[ 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, 1646, 422, 279, 15150, 574, 8767, 20097, 382, 14711, 6075, 512, 755, 636, 5156, 1214, 997, 286, 3270, 310, 2175, 264, 1646, 422, 279, 15150, 574, 8767, 20097, 627, 286, 12713, 286, 422, 659, 929, 287, 20659, 323, 659, 4397, 624, 3082, 512, 310, 1646, 284, 67189, 40535, 929, 287, 20659, 5156, 1214, 929, 287, 20659, 340, 310, 471, 1646, 422, 1646, 976, 2290, 775, 4260, 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 ]
spyder-ide/spyder
spyder/widgets/helperwidgets.py
IconLineEdit.update_status
def update_status(self, value, value_set): """Update the status and set_status to update the icons to display.""" self._status = value self._status_set = value_set self.repaint() self.update()
python
def update_status(self, value, value_set): """Update the status and set_status to update the icons to display.""" self._status = value self._status_set = value_set self.repaint() self.update()
[ "def", "update_status", "(", "self", ",", "value", ",", "value_set", ")", ":", "self", ".", "_status", "=", "value", "self", ".", "_status_set", "=", "value_set", "self", ".", "repaint", "(", ")", "self", ".", "update", "(", ")" ]
Update the status and set_status to update the icons to display.
[ "Update", "the", "status", "and", "set_status", "to", "update", "the", "icons", "to", "display", "." ]
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/helperwidgets.py#L248-L253
<|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 the status and set_status to update the icons to display. ### Response: def update_status(self, value, value_set): """Update the status and set_status to update the icons to display.""" self._status = value self._status_set = value_set self.repaint() self.update() <|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, 279, 2704, 323, 743, 4878, 311, 2713, 279, 24699, 311, 3113, 382, 14711, 6075, 512, 755, 2713, 4878, 1214, 11, 907, 11, 907, 2667, 997, 286, 4304, 4387, 279, 2704, 323, 743, 4878, 311, 2713, 279, 24699, 311, 3113, 14781, 286, 659, 1462, 2899, 284, 907, 198, 286, 659, 1462, 2899, 2667, 284, 907, 2667, 198, 286, 659, 94759, 746, 286, 659, 5430, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 279, 2704, 323, 743, 4878, 311, 2713, 279, 24699, 311, 3113, 382, 14711, 6075, 512, 755, 2713, 4878, 1214, 11, 907, 11, 907, 2667, 997, 286, 4304, 4387, 279, 2704, 323, 743, 4878, 311, 2713, 279, 24699, 311, 3113, 14781, 286, 659, 1462, 2899, 284, 907, 198, 286, 659, 1462, 2899, 2667, 284, 907, 2667, 198, 286, 659, 94759, 746, 286, 659, 5430, 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 ]
samuraisam/django-json-rpc
jsonrpc/__init__.py
_inject_args
def _inject_args(sig, types): """ A function to inject arguments manually into a method signature before it's been parsed. If using keyword arguments use 'kw=type' instead in the types array. sig the string signature types a list of types to be inserted Returns the altered signature. """ if '(' in sig: parts = sig.split('(') sig = '%s(%s%s%s' % ( parts[0], ', '.join(types), (', ' if parts[1].index(')') > 0 else ''), parts[1]) else: sig = '%s(%s)' % (sig, ', '.join(types)) return sig
python
def _inject_args(sig, types): """ A function to inject arguments manually into a method signature before it's been parsed. If using keyword arguments use 'kw=type' instead in the types array. sig the string signature types a list of types to be inserted Returns the altered signature. """ if '(' in sig: parts = sig.split('(') sig = '%s(%s%s%s' % ( parts[0], ', '.join(types), (', ' if parts[1].index(')') > 0 else ''), parts[1]) else: sig = '%s(%s)' % (sig, ', '.join(types)) return sig
[ "def", "_inject_args", "(", "sig", ",", "types", ")", ":", "if", "'('", "in", "sig", ":", "parts", "=", "sig", ".", "split", "(", "'('", ")", "sig", "=", "'%s(%s%s%s'", "%", "(", "parts", "[", "0", "]", ",", "', '", ".", "join", "(", "types", ")", ",", "(", "', '", "if", "parts", "[", "1", "]", ".", "index", "(", "')'", ")", ">", "0", "else", "''", ")", ",", "parts", "[", "1", "]", ")", "else", ":", "sig", "=", "'%s(%s)'", "%", "(", "sig", ",", "', '", ".", "join", "(", "types", ")", ")", "return", "sig" ]
A function to inject arguments manually into a method signature before it's been parsed. If using keyword arguments use 'kw=type' instead in the types array. sig the string signature types a list of types to be inserted Returns the altered signature.
[ "A", "function", "to", "inject", "arguments", "manually", "into", "a", "method", "signature", "before", "it", "s", "been", "parsed", ".", "If", "using", "keyword", "arguments", "use", "kw", "=", "type", "instead", "in", "the", "types", "array", "." ]
train
https://github.com/samuraisam/django-json-rpc/blob/a88d744d960e828f3eb21265da0f10a694b8ebcf/jsonrpc/__init__.py#L120-L138
<|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: A function to inject arguments manually into a method signature before it's been parsed. If using keyword arguments use 'kw=type' instead in the types array. sig the string signature types a list of types to be inserted Returns the altered signature. ### Response: def _inject_args(sig, types): """ A function to inject arguments manually into a method signature before it's been parsed. If using keyword arguments use 'kw=type' instead in the types array. sig the string signature types a list of types to be inserted Returns the altered signature. """ if '(' in sig: parts = sig.split('(') sig = '%s(%s%s%s' % ( parts[0], ', '.join(types), (', ' if parts[1].index(')') > 0 else ''), parts[1]) else: sig = '%s(%s)' % (sig, ', '.join(types)) return sig <|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, 32, 734, 311, 15921, 6105, 20684, 1139, 264, 1749, 12223, 1603, 198, 262, 433, 596, 1027, 16051, 13, 1442, 1701, 16570, 6105, 1005, 364, 29700, 28, 1337, 6, 4619, 304, 198, 262, 279, 4595, 1358, 382, 415, 8531, 257, 279, 925, 12223, 198, 415, 4595, 256, 264, 1160, 315, 4595, 311, 387, 22306, 271, 262, 5295, 279, 29852, 12223, 382, 14711, 6075, 512, 755, 721, 33233, 8550, 50229, 11, 4595, 997, 262, 3270, 262, 362, 734, 311, 15921, 6105, 20684, 1139, 264, 1749, 12223, 1603, 198, 262, 433, 596, 1027, 16051, 13, 1442, 1701, 16570, 6105, 1005, 364, 29700, 28, 1337, 6, 4619, 304, 198, 262, 279, 4595, 1358, 382, 415, 8531, 257, 279, 925, 12223, 198, 415, 4595, 256, 264, 1160, 315, 4595, 311, 387, 22306, 271, 262, 5295, 279, 29852, 12223, 627, 262, 3270, 262, 422, 38980, 304, 8531, 512, 286, 5596, 284, 8531, 5402, 90956, 340, 286, 8531, 284, 7832, 82, 15595, 82, 13249, 13249, 6, 1034, 2456, 310, 5596, 58, 15, 1145, 6752, 6389, 6115, 53713, 1350, 310, 320, 518, 364, 422, 5596, 58, 16, 948, 1275, 493, 8, 873, 871, 220, 15, 775, 88875, 5596, 58, 16, 2608, 262, 775, 512, 286, 8531, 284, 7832, 82, 15595, 82, 22367, 1034, 320, 22046, 11, 6752, 6389, 6115, 53713, 1192, 262, 471, 8531, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 32, 734, 311, 15921, 6105, 20684, 1139, 264, 1749, 12223, 1603, 198, 262, 433, 596, 1027, 16051, 13, 1442, 1701, 16570, 6105, 1005, 364, 29700, 28, 1337, 6, 4619, 304, 198, 262, 279, 4595, 1358, 382, 415, 8531, 257, 279, 925, 12223, 198, 415, 4595, 256, 264, 1160, 315, 4595, 311, 387, 22306, 271, 262, 5295, 279, 29852, 12223, 382, 14711, 6075, 512, 755, 721, 33233, 8550, 50229, 11, 4595, 997, 262, 3270, 262, 362, 734, 311, 15921, 6105, 20684, 1139, 264, 1749, 12223, 1603, 198, 262, 433, 596, 1027, 16051, 13, 1442, 1701, 16570, 6105, 1005, 364, 29700, 28, 1337, 6, 4619, 304, 198, 262, 279, 4595, 1358, 382, 415, 8531, 257, 279, 925, 12223, 198, 415, 4595, 256, 264, 1160, 315, 4595, 311, 387, 22306, 271, 262, 5295, 279, 29852, 12223, 627, 262, 3270, 262, 422, 38980, 304, 8531, 512, 286, 5596, 284, 8531, 5402, 90956, 340, 286, 8531, 284, 7832, 82, 15595, 82, 13249, 13249, 6, 1034, 2456, 310, 5596, 58, 15, 1145, 6752, 6389, 6115, 53713, 1350, 310, 320, 518, 364, 422, 5596, 58, 16, 948, 1275, 493, 8, 873, 871, 220, 15, 775, 88875, 5596, 58, 16, 2608, 262, 775, 512, 286, 8531, 284, 7832, 82, 15595, 82, 22367, 1034, 320, 22046, 11, 6752, 6389, 6115, 53713, 1192, 262, 471, 8531, 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 ]
pandas-dev/pandas
pandas/core/indexes/base.py
Index._validate_names
def _validate_names(self, name=None, names=None, deep=False): """ Handles the quirks of having a singular 'name' parameter for general Index and plural 'names' parameter for MultiIndex. """ from copy import deepcopy if names is not None and name is not None: raise TypeError("Can only provide one of `names` and `name`") elif names is None and name is None: return deepcopy(self.names) if deep else self.names elif names is not None: if not is_list_like(names): raise TypeError("Must pass list-like as `names`.") return names else: if not is_list_like(name): return [name] return name
python
def _validate_names(self, name=None, names=None, deep=False): """ Handles the quirks of having a singular 'name' parameter for general Index and plural 'names' parameter for MultiIndex. """ from copy import deepcopy if names is not None and name is not None: raise TypeError("Can only provide one of `names` and `name`") elif names is None and name is None: return deepcopy(self.names) if deep else self.names elif names is not None: if not is_list_like(names): raise TypeError("Must pass list-like as `names`.") return names else: if not is_list_like(name): return [name] return name
[ "def", "_validate_names", "(", "self", ",", "name", "=", "None", ",", "names", "=", "None", ",", "deep", "=", "False", ")", ":", "from", "copy", "import", "deepcopy", "if", "names", "is", "not", "None", "and", "name", "is", "not", "None", ":", "raise", "TypeError", "(", "\"Can only provide one of `names` and `name`\"", ")", "elif", "names", "is", "None", "and", "name", "is", "None", ":", "return", "deepcopy", "(", "self", ".", "names", ")", "if", "deep", "else", "self", ".", "names", "elif", "names", "is", "not", "None", ":", "if", "not", "is_list_like", "(", "names", ")", ":", "raise", "TypeError", "(", "\"Must pass list-like as `names`.\"", ")", "return", "names", "else", ":", "if", "not", "is_list_like", "(", "name", ")", ":", "return", "[", "name", "]", "return", "name" ]
Handles the quirks of having a singular 'name' parameter for general Index and plural 'names' parameter for MultiIndex.
[ "Handles", "the", "quirks", "of", "having", "a", "singular", "name", "parameter", "for", "general", "Index", "and", "plural", "names", "parameter", "for", "MultiIndex", "." ]
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/base.py#L1214-L1231
<|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: Handles the quirks of having a singular 'name' parameter for general Index and plural 'names' parameter for MultiIndex. ### Response: def _validate_names(self, name=None, names=None, deep=False): """ Handles the quirks of having a singular 'name' parameter for general Index and plural 'names' parameter for MultiIndex. """ from copy import deepcopy if names is not None and name is not None: raise TypeError("Can only provide one of `names` and `name`") elif names is None and name is None: return deepcopy(self.names) if deep else self.names elif names is not None: if not is_list_like(names): raise TypeError("Must pass list-like as `names`.") return names else: if not is_list_like(name): return [name] return 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, 67028, 279, 50726, 2857, 315, 3515, 264, 35044, 364, 609, 6, 5852, 369, 4689, 198, 286, 8167, 323, 39598, 364, 11654, 6, 5852, 369, 17896, 1581, 382, 14711, 6075, 512, 755, 721, 7212, 9366, 1214, 11, 836, 5980, 11, 5144, 5980, 11, 5655, 5725, 997, 286, 3270, 286, 21684, 279, 50726, 2857, 315, 3515, 264, 35044, 364, 609, 6, 5852, 369, 4689, 198, 286, 8167, 323, 39598, 364, 11654, 6, 5852, 369, 17896, 1581, 627, 286, 3270, 286, 505, 3048, 1179, 56658, 198, 286, 422, 5144, 374, 539, 2290, 323, 836, 374, 539, 2290, 512, 310, 4933, 26082, 446, 6854, 1193, 3493, 832, 315, 1595, 11654, 63, 323, 1595, 609, 63, 1158, 286, 4508, 5144, 374, 2290, 323, 836, 374, 2290, 512, 310, 471, 56658, 1214, 48975, 8, 422, 5655, 775, 659, 48975, 198, 286, 4508, 5144, 374, 539, 2290, 512, 310, 422, 539, 374, 2062, 26616, 41501, 997, 394, 4933, 26082, 446, 32876, 1522, 1160, 12970, 439, 1595, 11654, 63, 13352, 310, 471, 5144, 198, 286, 775, 512, 310, 422, 539, 374, 2062, 26616, 3232, 997, 394, 471, 510, 609, 933, 310, 471, 836, 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 ]
[ 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, 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, 67028, 279, 50726, 2857, 315, 3515, 264, 35044, 364, 609, 6, 5852, 369, 4689, 198, 286, 8167, 323, 39598, 364, 11654, 6, 5852, 369, 17896, 1581, 382, 14711, 6075, 512, 755, 721, 7212, 9366, 1214, 11, 836, 5980, 11, 5144, 5980, 11, 5655, 5725, 997, 286, 3270, 286, 21684, 279, 50726, 2857, 315, 3515, 264, 35044, 364, 609, 6, 5852, 369, 4689, 198, 286, 8167, 323, 39598, 364, 11654, 6, 5852, 369, 17896, 1581, 627, 286, 3270, 286, 505, 3048, 1179, 56658, 198, 286, 422, 5144, 374, 539, 2290, 323, 836, 374, 539, 2290, 512, 310, 4933, 26082, 446, 6854, 1193, 3493, 832, 315, 1595, 11654, 63, 323, 1595, 609, 63, 1158, 286, 4508, 5144, 374, 2290, 323, 836, 374, 2290, 512, 310, 471, 56658, 1214, 48975, 8, 422, 5655, 775, 659, 48975, 198, 286, 4508, 5144, 374, 539, 2290, 512, 310, 422, 539, 374, 2062, 26616, 41501, 997, 394, 4933, 26082, 446, 32876, 1522, 1160, 12970, 439, 1595, 11654, 63, 13352, 310, 471, 5144, 198, 286, 775, 512, 310, 422, 539, 374, 2062, 26616, 3232, 997, 394, 471, 510, 609, 933, 310, 471, 836, 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 ]
cisco-sas/kitty
kitty/model/low_level/container.py
Container.push
def push(self, field): ''' Add a field to the container, if the field is a Container itself, it should be poped() when done pushing into it :param field: BaseField to push ''' kassert.is_of_types(field, BaseField) container = self._container() field.enclosing = self if isinstance(field, Container): self._containers.append(field) if container: container.push(field) else: name = field.get_name() if name in self._fields_dict: raise KittyException('field with the name (%s) already exists in this container' % (name)) if name: self._fields_dict[name] = field self._fields.append(field) return True
python
def push(self, field): ''' Add a field to the container, if the field is a Container itself, it should be poped() when done pushing into it :param field: BaseField to push ''' kassert.is_of_types(field, BaseField) container = self._container() field.enclosing = self if isinstance(field, Container): self._containers.append(field) if container: container.push(field) else: name = field.get_name() if name in self._fields_dict: raise KittyException('field with the name (%s) already exists in this container' % (name)) if name: self._fields_dict[name] = field self._fields.append(field) return True
[ "def", "push", "(", "self", ",", "field", ")", ":", "kassert", ".", "is_of_types", "(", "field", ",", "BaseField", ")", "container", "=", "self", ".", "_container", "(", ")", "field", ".", "enclosing", "=", "self", "if", "isinstance", "(", "field", ",", "Container", ")", ":", "self", ".", "_containers", ".", "append", "(", "field", ")", "if", "container", ":", "container", ".", "push", "(", "field", ")", "else", ":", "name", "=", "field", ".", "get_name", "(", ")", "if", "name", "in", "self", ".", "_fields_dict", ":", "raise", "KittyException", "(", "'field with the name (%s) already exists in this container'", "%", "(", "name", ")", ")", "if", "name", ":", "self", ".", "_fields_dict", "[", "name", "]", "=", "field", "self", ".", "_fields", ".", "append", "(", "field", ")", "return", "True" ]
Add a field to the container, if the field is a Container itself, it should be poped() when done pushing into it :param field: BaseField to push
[ "Add", "a", "field", "to", "the", "container", "if", "the", "field", "is", "a", "Container", "itself", "it", "should", "be", "poped", "()", "when", "done", "pushing", "into", "it" ]
train
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/container.py#L304-L324
<|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 a field to the container, if the field is a Container itself, it should be poped() when done pushing into it :param field: BaseField to push ### Response: def push(self, field): ''' Add a field to the container, if the field is a Container itself, it should be poped() when done pushing into it :param field: BaseField to push ''' kassert.is_of_types(field, BaseField) container = self._container() field.enclosing = self if isinstance(field, Container): self._containers.append(field) if container: container.push(field) else: name = field.get_name() if name in self._fields_dict: raise KittyException('field with the name (%s) already exists in this container' % (name)) if name: self._fields_dict[name] = field self._fields.append(field) return 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, 2261, 264, 2115, 311, 279, 5593, 11, 422, 279, 2115, 374, 264, 9876, 5196, 11, 433, 1288, 387, 2477, 291, 368, 994, 2884, 17919, 1139, 433, 271, 286, 551, 913, 2115, 25, 5464, 1915, 311, 4585, 271, 14711, 6075, 512, 755, 4585, 1214, 11, 2115, 997, 286, 11414, 286, 2758, 264, 2115, 311, 279, 5593, 11, 422, 279, 2115, 374, 264, 9876, 5196, 11, 433, 1288, 387, 2477, 291, 368, 994, 2884, 17919, 1139, 433, 271, 286, 551, 913, 2115, 25, 5464, 1915, 311, 4585, 198, 286, 11414, 286, 597, 2256, 2124, 3659, 9962, 15944, 11, 5464, 1915, 340, 286, 5593, 284, 659, 1462, 3670, 746, 286, 2115, 55544, 18310, 284, 659, 198, 286, 422, 11656, 15944, 11, 9876, 997, 310, 659, 1462, 40499, 2102, 15944, 340, 286, 422, 5593, 512, 310, 5593, 2615, 15944, 340, 286, 775, 512, 310, 836, 284, 2115, 673, 1292, 746, 310, 422, 836, 304, 659, 1462, 9184, 5356, 512, 394, 4933, 67281, 1378, 493, 2630, 449, 279, 836, 13764, 82, 8, 2736, 6866, 304, 420, 5593, 6, 1034, 320, 609, 1192, 310, 422, 836, 512, 394, 659, 1462, 9184, 5356, 11174, 60, 284, 2115, 198, 310, 659, 1462, 9184, 2102, 15944, 340, 286, 471, 3082, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 264, 2115, 311, 279, 5593, 11, 422, 279, 2115, 374, 264, 9876, 5196, 11, 433, 1288, 387, 2477, 291, 368, 994, 2884, 17919, 1139, 433, 271, 286, 551, 913, 2115, 25, 5464, 1915, 311, 4585, 271, 14711, 6075, 512, 755, 4585, 1214, 11, 2115, 997, 286, 11414, 286, 2758, 264, 2115, 311, 279, 5593, 11, 422, 279, 2115, 374, 264, 9876, 5196, 11, 433, 1288, 387, 2477, 291, 368, 994, 2884, 17919, 1139, 433, 271, 286, 551, 913, 2115, 25, 5464, 1915, 311, 4585, 198, 286, 11414, 286, 597, 2256, 2124, 3659, 9962, 15944, 11, 5464, 1915, 340, 286, 5593, 284, 659, 1462, 3670, 746, 286, 2115, 55544, 18310, 284, 659, 198, 286, 422, 11656, 15944, 11, 9876, 997, 310, 659, 1462, 40499, 2102, 15944, 340, 286, 422, 5593, 512, 310, 5593, 2615, 15944, 340, 286, 775, 512, 310, 836, 284, 2115, 673, 1292, 746, 310, 422, 836, 304, 659, 1462, 9184, 5356, 512, 394, 4933, 67281, 1378, 493, 2630, 449, 279, 836, 13764, 82, 8, 2736, 6866, 304, 420, 5593, 6, 1034, 320, 609, 1192, 310, 422, 836, 512, 394, 659, 1462, 9184, 5356, 11174, 60, 284, 2115, 198, 310, 659, 1462, 9184, 2102, 15944, 340, 286, 471, 3082, 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 ]
pypa/pipenv
pipenv/patched/notpip/_vendor/distro.py
LinuxDistribution.version_parts
def version_parts(self, best=False): """ Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. """ version_str = self.version(best=best) if version_str: version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?') matches = version_regex.match(version_str) if matches: major, minor, build_number = matches.groups() return major, minor or '', build_number or '' return '', '', ''
python
def version_parts(self, best=False): """ Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. """ version_str = self.version(best=best) if version_str: version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?') matches = version_regex.match(version_str) if matches: major, minor, build_number = matches.groups() return major, minor or '', build_number or '' return '', '', ''
[ "def", "version_parts", "(", "self", ",", "best", "=", "False", ")", ":", "version_str", "=", "self", ".", "version", "(", "best", "=", "best", ")", "if", "version_str", ":", "version_regex", "=", "re", ".", "compile", "(", "r'(\\d+)\\.?(\\d+)?\\.?(\\d+)?'", ")", "matches", "=", "version_regex", ".", "match", "(", "version_str", ")", "if", "matches", ":", "major", ",", "minor", ",", "build_number", "=", "matches", ".", "groups", "(", ")", "return", "major", ",", "minor", "or", "''", ",", "build_number", "or", "''", "return", "''", ",", "''", ",", "''" ]
Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`.
[ "Return", "the", "version", "of", "the", "OS", "distribution", "as", "a", "tuple", "of", "version", "numbers", "." ]
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L761-L775
<|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 version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. ### Response: def version_parts(self, best=False): """ Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. """ version_str = self.version(best=best) if version_str: version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?') matches = version_regex.match(version_str) if matches: major, minor, build_number = matches.groups() return major, minor or '', build_number or '' return '', '', '' <|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, 2373, 315, 279, 10293, 8141, 11, 439, 264, 14743, 315, 2373, 198, 286, 5219, 382, 286, 1789, 3649, 11, 1518, 551, 2900, 19258, 12489, 299, 20049, 34317, 63438, 14711, 6075, 512, 755, 2373, 34317, 1214, 11, 1888, 5725, 997, 286, 3270, 286, 3494, 279, 2373, 315, 279, 10293, 8141, 11, 439, 264, 14743, 315, 2373, 198, 286, 5219, 382, 286, 1789, 3649, 11, 1518, 551, 2900, 19258, 12489, 299, 20049, 34317, 19154, 286, 3270, 286, 2373, 2966, 284, 659, 20049, 60523, 28, 16241, 340, 286, 422, 2373, 2966, 512, 310, 2373, 42932, 284, 312, 19458, 2666, 6, 11781, 67, 80958, 82508, 11781, 67, 10, 12106, 19362, 30, 11781, 67, 10, 12106, 1329, 310, 9248, 284, 2373, 42932, 11319, 38870, 2966, 340, 310, 422, 9248, 512, 394, 3682, 11, 9099, 11, 1977, 5617, 284, 9248, 41721, 746, 394, 471, 3682, 11, 9099, 477, 9158, 1977, 5617, 477, 12038, 286, 471, 9158, 9158, 12038, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 2373, 315, 279, 10293, 8141, 11, 439, 264, 14743, 315, 2373, 198, 286, 5219, 382, 286, 1789, 3649, 11, 1518, 551, 2900, 19258, 12489, 299, 20049, 34317, 63438, 14711, 6075, 512, 755, 2373, 34317, 1214, 11, 1888, 5725, 997, 286, 3270, 286, 3494, 279, 2373, 315, 279, 10293, 8141, 11, 439, 264, 14743, 315, 2373, 198, 286, 5219, 382, 286, 1789, 3649, 11, 1518, 551, 2900, 19258, 12489, 299, 20049, 34317, 19154, 286, 3270, 286, 2373, 2966, 284, 659, 20049, 60523, 28, 16241, 340, 286, 422, 2373, 2966, 512, 310, 2373, 42932, 284, 312, 19458, 2666, 6, 11781, 67, 80958, 82508, 11781, 67, 10, 12106, 19362, 30, 11781, 67, 10, 12106, 1329, 310, 9248, 284, 2373, 42932, 11319, 38870, 2966, 340, 310, 422, 9248, 512, 394, 3682, 11, 9099, 11, 1977, 5617, 284, 9248, 41721, 746, 394, 471, 3682, 11, 9099, 477, 9158, 1977, 5617, 477, 12038, 286, 471, 9158, 9158, 12038, 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 ]
GPflow/GPflow
gpflow/models/gpr.py
GPR._build_predict
def _build_predict(self, Xnew, full_cov=False): """ Xnew is a data matrix, the points at which we want to predict. This method computes p(F* | Y) where F* are points on the GP at Xnew, Y are noisy observations at X. """ y = self.Y - self.mean_function(self.X) Kmn = self.kern.K(self.X, Xnew) Kmm_sigma = self.kern.K(self.X) + tf.eye(tf.shape(self.X)[0], dtype=settings.float_type) * self.likelihood.variance Knn = self.kern.K(Xnew) if full_cov else self.kern.Kdiag(Xnew) f_mean, f_var = base_conditional(Kmn, Kmm_sigma, Knn, y, full_cov=full_cov, white=False) # N x P, N x P or P x N x N return f_mean + self.mean_function(Xnew), f_var
python
def _build_predict(self, Xnew, full_cov=False): """ Xnew is a data matrix, the points at which we want to predict. This method computes p(F* | Y) where F* are points on the GP at Xnew, Y are noisy observations at X. """ y = self.Y - self.mean_function(self.X) Kmn = self.kern.K(self.X, Xnew) Kmm_sigma = self.kern.K(self.X) + tf.eye(tf.shape(self.X)[0], dtype=settings.float_type) * self.likelihood.variance Knn = self.kern.K(Xnew) if full_cov else self.kern.Kdiag(Xnew) f_mean, f_var = base_conditional(Kmn, Kmm_sigma, Knn, y, full_cov=full_cov, white=False) # N x P, N x P or P x N x N return f_mean + self.mean_function(Xnew), f_var
[ "def", "_build_predict", "(", "self", ",", "Xnew", ",", "full_cov", "=", "False", ")", ":", "y", "=", "self", ".", "Y", "-", "self", ".", "mean_function", "(", "self", ".", "X", ")", "Kmn", "=", "self", ".", "kern", ".", "K", "(", "self", ".", "X", ",", "Xnew", ")", "Kmm_sigma", "=", "self", ".", "kern", ".", "K", "(", "self", ".", "X", ")", "+", "tf", ".", "eye", "(", "tf", ".", "shape", "(", "self", ".", "X", ")", "[", "0", "]", ",", "dtype", "=", "settings", ".", "float_type", ")", "*", "self", ".", "likelihood", ".", "variance", "Knn", "=", "self", ".", "kern", ".", "K", "(", "Xnew", ")", "if", "full_cov", "else", "self", ".", "kern", ".", "Kdiag", "(", "Xnew", ")", "f_mean", ",", "f_var", "=", "base_conditional", "(", "Kmn", ",", "Kmm_sigma", ",", "Knn", ",", "y", ",", "full_cov", "=", "full_cov", ",", "white", "=", "False", ")", "# N x P, N x P or P x N x N", "return", "f_mean", "+", "self", ".", "mean_function", "(", "Xnew", ")", ",", "f_var" ]
Xnew is a data matrix, the points at which we want to predict. This method computes p(F* | Y) where F* are points on the GP at Xnew, Y are noisy observations at X.
[ "Xnew", "is", "a", "data", "matrix", "the", "points", "at", "which", "we", "want", "to", "predict", "." ]
train
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/models/gpr.py#L80-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: Xnew is a data matrix, the points at which we want to predict. This method computes p(F* | Y) where F* are points on the GP at Xnew, Y are noisy observations at X. ### Response: def _build_predict(self, Xnew, full_cov=False): """ Xnew is a data matrix, the points at which we want to predict. This method computes p(F* | Y) where F* are points on the GP at Xnew, Y are noisy observations at X. """ y = self.Y - self.mean_function(self.X) Kmn = self.kern.K(self.X, Xnew) Kmm_sigma = self.kern.K(self.X) + tf.eye(tf.shape(self.X)[0], dtype=settings.float_type) * self.likelihood.variance Knn = self.kern.K(Xnew) if full_cov else self.kern.Kdiag(Xnew) f_mean, f_var = base_conditional(Kmn, Kmm_sigma, Knn, y, full_cov=full_cov, white=False) # N x P, N x P or P x N x N return f_mean + self.mean_function(Xnew), f_var <|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, 55, 943, 374, 264, 828, 6303, 11, 279, 3585, 520, 902, 584, 1390, 311, 7168, 382, 286, 1115, 1749, 58303, 271, 310, 281, 7988, 9, 765, 816, 696, 286, 1405, 435, 9, 527, 3585, 389, 279, 24618, 520, 1630, 943, 11, 816, 527, 50380, 24654, 520, 1630, 382, 14711, 6075, 512, 755, 721, 5957, 27913, 1214, 11, 1630, 943, 11, 2539, 51128, 5725, 997, 286, 3270, 286, 1630, 943, 374, 264, 828, 6303, 11, 279, 3585, 520, 902, 584, 1390, 311, 7168, 382, 286, 1115, 1749, 58303, 271, 310, 281, 7988, 9, 765, 816, 696, 286, 1405, 435, 9, 527, 3585, 389, 279, 24618, 520, 1630, 943, 11, 816, 527, 50380, 24654, 520, 1630, 382, 286, 3270, 286, 379, 284, 659, 7659, 482, 659, 19231, 9353, 1214, 4436, 340, 286, 735, 22524, 284, 659, 5314, 944, 11606, 1214, 4436, 11, 1630, 943, 340, 286, 735, 3906, 50105, 284, 659, 5314, 944, 11606, 1214, 4436, 8, 489, 6543, 73840, 20511, 7201, 1214, 4436, 6758, 15, 1145, 13534, 73752, 16304, 1857, 8, 353, 659, 13, 62230, 20096, 5397, 198, 286, 735, 7521, 284, 659, 5314, 944, 11606, 7799, 943, 8, 422, 2539, 51128, 775, 659, 5314, 944, 11606, 61314, 7799, 943, 340, 286, 282, 17363, 11, 282, 4715, 284, 2385, 25437, 3079, 17155, 22524, 11, 735, 3906, 50105, 11, 735, 7521, 11, 379, 11, 2539, 51128, 28, 9054, 51128, 11, 4251, 5725, 8, 220, 674, 452, 865, 393, 11, 452, 865, 393, 477, 393, 865, 452, 865, 452, 198, 286, 471, 282, 17363, 489, 659, 19231, 9353, 7799, 943, 705, 282, 4715, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 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, 55, 943, 374, 264, 828, 6303, 11, 279, 3585, 520, 902, 584, 1390, 311, 7168, 382, 286, 1115, 1749, 58303, 271, 310, 281, 7988, 9, 765, 816, 696, 286, 1405, 435, 9, 527, 3585, 389, 279, 24618, 520, 1630, 943, 11, 816, 527, 50380, 24654, 520, 1630, 382, 14711, 6075, 512, 755, 721, 5957, 27913, 1214, 11, 1630, 943, 11, 2539, 51128, 5725, 997, 286, 3270, 286, 1630, 943, 374, 264, 828, 6303, 11, 279, 3585, 520, 902, 584, 1390, 311, 7168, 382, 286, 1115, 1749, 58303, 271, 310, 281, 7988, 9, 765, 816, 696, 286, 1405, 435, 9, 527, 3585, 389, 279, 24618, 520, 1630, 943, 11, 816, 527, 50380, 24654, 520, 1630, 382, 286, 3270, 286, 379, 284, 659, 7659, 482, 659, 19231, 9353, 1214, 4436, 340, 286, 735, 22524, 284, 659, 5314, 944, 11606, 1214, 4436, 11, 1630, 943, 340, 286, 735, 3906, 50105, 284, 659, 5314, 944, 11606, 1214, 4436, 8, 489, 6543, 73840, 20511, 7201, 1214, 4436, 6758, 15, 1145, 13534, 73752, 16304, 1857, 8, 353, 659, 13, 62230, 20096, 5397, 198, 286, 735, 7521, 284, 659, 5314, 944, 11606, 7799, 943, 8, 422, 2539, 51128, 775, 659, 5314, 944, 11606, 61314, 7799, 943, 340, 286, 282, 17363, 11, 282, 4715, 284, 2385, 25437, 3079, 17155, 22524, 11, 735, 3906, 50105, 11, 735, 7521, 11, 379, 11, 2539, 51128, 28, 9054, 51128, 11, 4251, 5725, 8, 220, 674, 452, 865, 393, 11, 452, 865, 393, 477, 393, 865, 452, 865, 452, 198, 286, 471, 282, 17363, 489, 659, 19231, 9353, 7799, 943, 705, 282, 4715, 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 ]