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
zalando/patroni
patroni/postgresql.py
Postgresql.restore_configuration_files
def restore_configuration_files(self): """ restore a previously saved postgresql.conf """ try: for f in self._configuration_to_save: config_file = os.path.join(self._config_dir, f) backup_file = os.path.join(self._data_dir, f + '.backup') if not os.path.isfile(config_file): if os.path.isfile(backup_file): shutil.copy(backup_file, config_file) # Previously we didn't backup pg_ident.conf, if file is missing just create empty elif f == 'pg_ident.conf': open(config_file, 'w').close() except IOError: logger.exception('unable to restore configuration files from backup')
python
def restore_configuration_files(self): """ restore a previously saved postgresql.conf """ try: for f in self._configuration_to_save: config_file = os.path.join(self._config_dir, f) backup_file = os.path.join(self._data_dir, f + '.backup') if not os.path.isfile(config_file): if os.path.isfile(backup_file): shutil.copy(backup_file, config_file) # Previously we didn't backup pg_ident.conf, if file is missing just create empty elif f == 'pg_ident.conf': open(config_file, 'w').close() except IOError: logger.exception('unable to restore configuration files from backup')
[ "def", "restore_configuration_files", "(", "self", ")", ":", "try", ":", "for", "f", "in", "self", ".", "_configuration_to_save", ":", "config_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_config_dir", ",", "f", ")", "backup_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_data_dir", ",", "f", "+", "'.backup'", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "config_file", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "backup_file", ")", ":", "shutil", ".", "copy", "(", "backup_file", ",", "config_file", ")", "# Previously we didn't backup pg_ident.conf, if file is missing just create empty", "elif", "f", "==", "'pg_ident.conf'", ":", "open", "(", "config_file", ",", "'w'", ")", ".", "close", "(", ")", "except", "IOError", ":", "logger", ".", "exception", "(", "'unable to restore configuration files from backup'", ")" ]
restore a previously saved postgresql.conf
[ "restore", "a", "previously", "saved", "postgresql", ".", "conf" ]
train
https://github.com/zalando/patroni/blob/f6d29081c90af52064b981cdd877a07338d86038/patroni/postgresql.py#L1532-L1545
<|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: restore a previously saved postgresql.conf ### Response: def restore_configuration_files(self): """ restore a previously saved postgresql.conf """ try: for f in self._configuration_to_save: config_file = os.path.join(self._config_dir, f) backup_file = os.path.join(self._data_dir, f + '.backup') if not os.path.isfile(config_file): if os.path.isfile(backup_file): shutil.copy(backup_file, config_file) # Previously we didn't backup pg_ident.conf, if file is missing just create empty elif f == 'pg_ident.conf': open(config_file, 'w').close() except IOError: logger.exception('unable to restore configuration files from backup') <|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, 31904, 264, 8767, 6924, 60926, 1498, 14263, 271, 14711, 6075, 512, 755, 15301, 36826, 11171, 1214, 997, 286, 4304, 15301, 264, 8767, 6924, 60926, 1498, 14263, 3270, 286, 1456, 512, 310, 369, 282, 304, 659, 1462, 21822, 2401, 15737, 512, 394, 2242, 2517, 284, 2709, 3960, 5563, 1214, 1462, 1710, 4432, 11, 282, 340, 394, 16101, 2517, 284, 2709, 3960, 5563, 1214, 1462, 695, 4432, 11, 282, 489, 6389, 32471, 1329, 394, 422, 539, 2709, 3960, 40047, 8928, 2517, 997, 504, 422, 2709, 3960, 40047, 7, 32471, 2517, 997, 667, 35060, 12511, 7, 32471, 2517, 11, 2242, 2517, 340, 504, 674, 59787, 584, 3287, 956, 16101, 17953, 39499, 14263, 11, 422, 1052, 374, 7554, 1120, 1893, 4384, 198, 504, 4508, 282, 624, 364, 3601, 39499, 14263, 3730, 667, 1825, 8928, 2517, 11, 364, 86, 1861, 5669, 746, 286, 3734, 62061, 512, 310, 6050, 14161, 493, 47028, 311, 15301, 6683, 3626, 505, 16101, 1329, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 31904, 264, 8767, 6924, 60926, 1498, 14263, 271, 14711, 6075, 512, 755, 15301, 36826, 11171, 1214, 997, 286, 4304, 15301, 264, 8767, 6924, 60926, 1498, 14263, 3270, 286, 1456, 512, 310, 369, 282, 304, 659, 1462, 21822, 2401, 15737, 512, 394, 2242, 2517, 284, 2709, 3960, 5563, 1214, 1462, 1710, 4432, 11, 282, 340, 394, 16101, 2517, 284, 2709, 3960, 5563, 1214, 1462, 695, 4432, 11, 282, 489, 6389, 32471, 1329, 394, 422, 539, 2709, 3960, 40047, 8928, 2517, 997, 504, 422, 2709, 3960, 40047, 7, 32471, 2517, 997, 667, 35060, 12511, 7, 32471, 2517, 11, 2242, 2517, 340, 504, 674, 59787, 584, 3287, 956, 16101, 17953, 39499, 14263, 11, 422, 1052, 374, 7554, 1120, 1893, 4384, 198, 504, 4508, 282, 624, 364, 3601, 39499, 14263, 3730, 667, 1825, 8928, 2517, 11, 364, 86, 1861, 5669, 746, 286, 3734, 62061, 512, 310, 6050, 14161, 493, 47028, 311, 15301, 6683, 3626, 505, 16101, 1329, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
_BufferWatchCondition.remove
def remove(self, bw): """ Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. """ try: self.__ranges.remove(bw) except KeyError: if not bw.oneshot: raise
python
def remove(self, bw): """ Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. """ try: self.__ranges.remove(bw) except KeyError: if not bw.oneshot: raise
[ "def", "remove", "(", "self", ",", "bw", ")", ":", "try", ":", "self", ".", "__ranges", ".", "remove", "(", "bw", ")", "except", "KeyError", ":", "if", "not", "bw", ".", "oneshot", ":", "raise" ]
Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed.
[ "Removes", "a", "buffer", "watch", "identifier", "." ]
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L1840-L1854
<|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: Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. ### Response: def remove(self, bw): """ Removes a buffer watch identifier. @type bw: L{BufferWatch} @param bw: Buffer watch identifier. @raise KeyError: The buffer watch identifier was already removed. """ try: self.__ranges.remove(bw) except KeyError: if not bw.oneshot: raise <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6728, 10296, 264, 4240, 3821, 13110, 382, 286, 571, 1337, 220, 35475, 25, 445, 90, 4187, 14581, 534, 286, 571, 913, 35475, 512, 310, 10525, 3821, 13110, 382, 286, 571, 19223, 39194, 25, 578, 4240, 3821, 13110, 574, 2736, 7108, 382, 14711, 6075, 512, 755, 4148, 1214, 11, 35475, 997, 286, 3270, 286, 39875, 264, 4240, 3821, 13110, 382, 286, 571, 1337, 220, 35475, 25, 445, 90, 4187, 14581, 534, 286, 571, 913, 35475, 512, 310, 10525, 3821, 13110, 382, 286, 571, 19223, 39194, 25, 578, 4240, 3821, 13110, 574, 2736, 7108, 627, 286, 3270, 286, 1456, 512, 310, 659, 4952, 67662, 4955, 1921, 86, 340, 286, 3734, 39194, 512, 310, 422, 539, 35475, 32890, 10847, 512, 394, 4933, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6728, 10296, 264, 4240, 3821, 13110, 382, 286, 571, 1337, 220, 35475, 25, 445, 90, 4187, 14581, 534, 286, 571, 913, 35475, 512, 310, 10525, 3821, 13110, 382, 286, 571, 19223, 39194, 25, 578, 4240, 3821, 13110, 574, 2736, 7108, 382, 14711, 6075, 512, 755, 4148, 1214, 11, 35475, 997, 286, 3270, 286, 39875, 264, 4240, 3821, 13110, 382, 286, 571, 1337, 220, 35475, 25, 445, 90, 4187, 14581, 534, 286, 571, 913, 35475, 512, 310, 10525, 3821, 13110, 382, 286, 571, 19223, 39194, 25, 578, 4240, 3821, 13110, 574, 2736, 7108, 627, 286, 3270, 286, 1456, 512, 310, 659, 4952, 67662, 4955, 1921, 86, 340, 286, 3734, 39194, 512, 310, 422, 539, 35475, 32890, 10847, 512, 394, 4933, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
SamLau95/nbinteract
nbinteract/cli.py
yes_or_no
def yes_or_no(question, default="yes"): """Ask a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "yes" or False for "no". """ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} if default is None: prompt = " [y/n] " elif default == "yes": prompt = " [Y/n] " elif default == "no": prompt = " [y/N] " else: raise ValueError("invalid default answer: '%s'" % default) while True: sys.stdout.write( '{}[nbinteract]{} {}{}'.format(BLUE, NOCOLOR, question, prompt) ) choice = input().lower() if default is not None and choice == '': return valid[default] elif choice in valid: return valid[choice] else: sys.stdout.write( "Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n" )
python
def yes_or_no(question, default="yes"): """Ask a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "yes" or False for "no". """ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} if default is None: prompt = " [y/n] " elif default == "yes": prompt = " [Y/n] " elif default == "no": prompt = " [y/N] " else: raise ValueError("invalid default answer: '%s'" % default) while True: sys.stdout.write( '{}[nbinteract]{} {}{}'.format(BLUE, NOCOLOR, question, prompt) ) choice = input().lower() if default is not None and choice == '': return valid[default] elif choice in valid: return valid[choice] else: sys.stdout.write( "Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n" )
[ "def", "yes_or_no", "(", "question", ",", "default", "=", "\"yes\"", ")", ":", "valid", "=", "{", "\"yes\"", ":", "True", ",", "\"y\"", ":", "True", ",", "\"ye\"", ":", "True", ",", "\"no\"", ":", "False", ",", "\"n\"", ":", "False", "}", "if", "default", "is", "None", ":", "prompt", "=", "\" [y/n] \"", "elif", "default", "==", "\"yes\"", ":", "prompt", "=", "\" [Y/n] \"", "elif", "default", "==", "\"no\"", ":", "prompt", "=", "\" [y/N] \"", "else", ":", "raise", "ValueError", "(", "\"invalid default answer: '%s'\"", "%", "default", ")", "while", "True", ":", "sys", ".", "stdout", ".", "write", "(", "'{}[nbinteract]{} {}{}'", ".", "format", "(", "BLUE", ",", "NOCOLOR", ",", "question", ",", "prompt", ")", ")", "choice", "=", "input", "(", ")", ".", "lower", "(", ")", "if", "default", "is", "not", "None", "and", "choice", "==", "''", ":", "return", "valid", "[", "default", "]", "elif", "choice", "in", "valid", ":", "return", "valid", "[", "choice", "]", "else", ":", "sys", ".", "stdout", ".", "write", "(", "\"Please respond with 'yes' or 'no' \"", "\"(or 'y' or 'n').\\n\"", ")" ]
Ask a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "yes" or False for "no".
[ "Ask", "a", "yes", "/", "no", "question", "via", "input", "()", "and", "return", "their", "answer", "." ]
train
https://github.com/SamLau95/nbinteract/blob/9f346452283831aad3f4416c04879f1d187ec3b7/nbinteract/cli.py#L126-L159
<|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: Ask a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "yes" or False for "no". ### Response: def yes_or_no(question, default="yes"): """Ask a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "yes" or False for "no". """ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} if default is None: prompt = " [y/n] " elif default == "yes": prompt = " [Y/n] " elif default == "no": prompt = " [y/N] " else: raise ValueError("invalid default answer: '%s'" % default) while True: sys.stdout.write( '{}[nbinteract]{} {}{}'.format(BLUE, NOCOLOR, question, prompt) ) choice = input().lower() if default is not None and choice == '': return valid[default] elif choice in valid: return valid[choice] else: sys.stdout.write( "Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n" ) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 27264, 264, 10035, 34200, 3488, 4669, 1988, 368, 323, 471, 872, 4320, 382, 262, 330, 7998, 1, 374, 264, 925, 430, 374, 10666, 311, 279, 1217, 627, 262, 330, 2309, 1, 374, 279, 62357, 4320, 422, 279, 1217, 1120, 13280, 366, 6403, 30916, 286, 1102, 2011, 387, 330, 9891, 1, 320, 1820, 1670, 705, 330, 2201, 1, 477, 2290, 320, 57865, 198, 286, 459, 4320, 374, 2631, 315, 279, 1217, 3677, 262, 578, 330, 9399, 1, 471, 907, 374, 3082, 369, 330, 9891, 1, 477, 3641, 369, 330, 2201, 11690, 14711, 6075, 512, 755, 10035, 8908, 6673, 41157, 11, 1670, 429, 9891, 15497, 262, 4304, 27264, 264, 10035, 34200, 3488, 4669, 1988, 368, 323, 471, 872, 4320, 382, 262, 330, 7998, 1, 374, 264, 925, 430, 374, 10666, 311, 279, 1217, 627, 262, 330, 2309, 1, 374, 279, 62357, 4320, 422, 279, 1217, 1120, 13280, 366, 6403, 30916, 286, 1102, 2011, 387, 330, 9891, 1, 320, 1820, 1670, 705, 330, 2201, 1, 477, 2290, 320, 57865, 198, 286, 459, 4320, 374, 2631, 315, 279, 1217, 3677, 262, 578, 330, 9399, 1, 471, 907, 374, 3082, 369, 330, 9891, 1, 477, 3641, 369, 330, 2201, 23811, 262, 3270, 262, 2764, 284, 5324, 9891, 794, 3082, 11, 330, 88, 794, 3082, 11, 330, 9188, 794, 3082, 11, 330, 2201, 794, 3641, 11, 330, 77, 794, 3641, 534, 262, 422, 1670, 374, 2290, 512, 286, 10137, 284, 330, 510, 88, 9809, 60, 6360, 262, 4508, 1670, 624, 330, 9891, 4764, 286, 10137, 284, 330, 510, 56, 9809, 60, 6360, 262, 4508, 1670, 624, 330, 2201, 4764, 286, 10137, 284, 330, 510, 88, 20906, 60, 6360, 262, 775, 512, 286, 4933, 15764, 446, 12071, 1670, 4320, 25, 7832, 82, 15260, 1034, 1670, 696, 262, 1418, 3082, 512, 286, 5826, 25880, 3921, 1021, 310, 34012, 58, 18571, 2295, 533, 60, 6390, 4792, 39338, 2293, 5462, 43, 2279, 11, 5782, 32043, 11, 3488, 11, 10137, 340, 286, 1763, 286, 5873, 284, 1988, 1020, 15115, 746, 286, 422, 1670, 374, 539, 2290, 323, 5873, 624, 49215, 310, 471, 2764, 58, 2309, 933, 286, 4508, 5873, 304, 2764, 512, 310, 471, 2764, 58, 12008, 933, 286, 775, 512, 310, 5826, 25880, 3921, 1021, 394, 330, 5618, 6013, 449, 364, 9891, 6, 477, 364, 2201, 6, 6360, 394, 12262, 269, 364, 88, 6, 477, 364, 77, 1861, 59, 77, 702, 310, 1763, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 27264, 264, 10035, 34200, 3488, 4669, 1988, 368, 323, 471, 872, 4320, 382, 262, 330, 7998, 1, 374, 264, 925, 430, 374, 10666, 311, 279, 1217, 627, 262, 330, 2309, 1, 374, 279, 62357, 4320, 422, 279, 1217, 1120, 13280, 366, 6403, 30916, 286, 1102, 2011, 387, 330, 9891, 1, 320, 1820, 1670, 705, 330, 2201, 1, 477, 2290, 320, 57865, 198, 286, 459, 4320, 374, 2631, 315, 279, 1217, 3677, 262, 578, 330, 9399, 1, 471, 907, 374, 3082, 369, 330, 9891, 1, 477, 3641, 369, 330, 2201, 11690, 14711, 6075, 512, 755, 10035, 8908, 6673, 41157, 11, 1670, 429, 9891, 15497, 262, 4304, 27264, 264, 10035, 34200, 3488, 4669, 1988, 368, 323, 471, 872, 4320, 382, 262, 330, 7998, 1, 374, 264, 925, 430, 374, 10666, 311, 279, 1217, 627, 262, 330, 2309, 1, 374, 279, 62357, 4320, 422, 279, 1217, 1120, 13280, 366, 6403, 30916, 286, 1102, 2011, 387, 330, 9891, 1, 320, 1820, 1670, 705, 330, 2201, 1, 477, 2290, 320, 57865, 198, 286, 459, 4320, 374, 2631, 315, 279, 1217, 3677, 262, 578, 330, 9399, 1, 471, 907, 374, 3082, 369, 330, 9891, 1, 477, 3641, 369, 330, 2201, 23811, 262, 3270, 262, 2764, 284, 5324, 9891, 794, 3082, 11, 330, 88, 794, 3082, 11, 330, 9188, 794, 3082, 11, 330, 2201, 794, 3641, 11, 330, 77, 794, 3641, 534, 262, 422, 1670, 374, 2290, 512, 286, 10137, 284, 330, 510, 88, 9809, 60, 6360, 262, 4508, 1670, 624, 330, 9891, 4764, 286, 10137, 284, 330, 510, 56, 9809, 60, 6360, 262, 4508, 1670, 624, 330, 2201, 4764, 286, 10137, 284, 330, 510, 88, 20906, 60, 6360, 262, 775, 512, 286, 4933, 15764, 446, 12071, 1670, 4320, 25, 7832, 82, 15260, 1034, 1670, 696, 262, 1418, 3082, 512, 286, 5826, 25880, 3921, 1021, 310, 34012, 58, 18571, 2295, 533, 60, 6390, 4792, 39338, 2293, 5462, 43, 2279, 11, 5782, 32043, 11, 3488, 11, 10137, 340, 286, 1763, 286, 5873, 284, 1988, 1020, 15115, 746, 286, 422, 1670, 374, 539, 2290, 323, 5873, 624, 49215, 310, 471, 2764, 58, 2309, 933, 286, 4508, 5873, 304, 2764, 512, 310, 471, 2764, 58, 12008, 933, 286, 775, 512, 310, 5826, 25880, 3921, 1021, 394, 330, 5618, 6013, 449, 364, 9891, 6, 477, 364, 2201, 6, 6360, 394, 12262, 269, 364, 88, 6, 477, 364, 77, 1861, 59, 77, 702, 310, 1763, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
jbittel/django-mama-cas
mama_cas/callbacks.py
user_model_attributes
def user_model_attributes(user, service): """ Return all fields on the user object that are not in the list of fields to ignore. """ ignore_fields = ['id', 'password'] attributes = {} for field in user._meta.fields: if field.name not in ignore_fields: attributes[field.name] = getattr(user, field.name) return attributes
python
def user_model_attributes(user, service): """ Return all fields on the user object that are not in the list of fields to ignore. """ ignore_fields = ['id', 'password'] attributes = {} for field in user._meta.fields: if field.name not in ignore_fields: attributes[field.name] = getattr(user, field.name) return attributes
[ "def", "user_model_attributes", "(", "user", ",", "service", ")", ":", "ignore_fields", "=", "[", "'id'", ",", "'password'", "]", "attributes", "=", "{", "}", "for", "field", "in", "user", ".", "_meta", ".", "fields", ":", "if", "field", ".", "name", "not", "in", "ignore_fields", ":", "attributes", "[", "field", ".", "name", "]", "=", "getattr", "(", "user", ",", "field", ".", "name", ")", "return", "attributes" ]
Return all fields on the user object that are not in the list of fields to ignore.
[ "Return", "all", "fields", "on", "the", "user", "object", "that", "are", "not", "in", "the", "list", "of", "fields", "to", "ignore", "." ]
train
https://github.com/jbittel/django-mama-cas/blob/03935d97442b46d8127ab9e1cd8deb96953fe156/mama_cas/callbacks.py#L10-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: Return all fields on the user object that are not in the list of fields to ignore. ### Response: def user_model_attributes(user, service): """ Return all fields on the user object that are not in the list of fields to ignore. """ ignore_fields = ['id', 'password'] attributes = {} for field in user._meta.fields: if field.name not in ignore_fields: attributes[field.name] = getattr(user, field.name) return attributes <|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, 682, 5151, 389, 279, 1217, 1665, 430, 527, 539, 304, 279, 1160, 198, 262, 315, 5151, 311, 10240, 382, 14711, 6075, 512, 755, 1217, 5156, 18741, 4374, 11, 2532, 997, 262, 3270, 262, 3494, 682, 5151, 389, 279, 1217, 1665, 430, 527, 539, 304, 279, 1160, 198, 262, 315, 5151, 311, 10240, 627, 262, 3270, 262, 10240, 12406, 284, 2570, 307, 518, 364, 3918, 4532, 262, 8365, 284, 5731, 262, 369, 2115, 304, 1217, 1462, 5607, 13216, 512, 286, 422, 2115, 2710, 539, 304, 10240, 12406, 512, 310, 8365, 39740, 2710, 60, 284, 31097, 4374, 11, 2115, 2710, 340, 262, 471, 8365, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 682, 5151, 389, 279, 1217, 1665, 430, 527, 539, 304, 279, 1160, 198, 262, 315, 5151, 311, 10240, 382, 14711, 6075, 512, 755, 1217, 5156, 18741, 4374, 11, 2532, 997, 262, 3270, 262, 3494, 682, 5151, 389, 279, 1217, 1665, 430, 527, 539, 304, 279, 1160, 198, 262, 315, 5151, 311, 10240, 627, 262, 3270, 262, 10240, 12406, 284, 2570, 307, 518, 364, 3918, 4532, 262, 8365, 284, 5731, 262, 369, 2115, 304, 1217, 1462, 5607, 13216, 512, 286, 422, 2115, 2710, 539, 304, 10240, 12406, 512, 310, 8365, 39740, 2710, 60, 284, 31097, 4374, 11, 2115, 2710, 340, 262, 471, 8365, 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 ]
sentinel-hub/sentinelhub-py
sentinelhub/download.py
_check_if_must_download
def _check_if_must_download(request_list, redownload): """ Updates request.will_download attribute of each request in request_list. **Note:** the function mutates the elements of the list! :param request_list: a list of ``DownloadRequest`` instances :type: list[DownloadRequest] :param redownload: tells whether to download the data again or not :type: bool """ for request in request_list: request.will_download = (request.save_response or request.return_data) \ and (not request.is_downloaded() or redownload)
python
def _check_if_must_download(request_list, redownload): """ Updates request.will_download attribute of each request in request_list. **Note:** the function mutates the elements of the list! :param request_list: a list of ``DownloadRequest`` instances :type: list[DownloadRequest] :param redownload: tells whether to download the data again or not :type: bool """ for request in request_list: request.will_download = (request.save_response or request.return_data) \ and (not request.is_downloaded() or redownload)
[ "def", "_check_if_must_download", "(", "request_list", ",", "redownload", ")", ":", "for", "request", "in", "request_list", ":", "request", ".", "will_download", "=", "(", "request", ".", "save_response", "or", "request", ".", "return_data", ")", "and", "(", "not", "request", ".", "is_downloaded", "(", ")", "or", "redownload", ")" ]
Updates request.will_download attribute of each request in request_list. **Note:** the function mutates the elements of the list! :param request_list: a list of ``DownloadRequest`` instances :type: list[DownloadRequest] :param redownload: tells whether to download the data again or not :type: bool
[ "Updates", "request", ".", "will_download", "attribute", "of", "each", "request", "in", "request_list", "." ]
train
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/download.py#L202-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: Updates request.will_download attribute of each request in request_list. **Note:** the function mutates the elements of the list! :param request_list: a list of ``DownloadRequest`` instances :type: list[DownloadRequest] :param redownload: tells whether to download the data again or not :type: bool ### Response: def _check_if_must_download(request_list, redownload): """ Updates request.will_download attribute of each request in request_list. **Note:** the function mutates the elements of the list! :param request_list: a list of ``DownloadRequest`` instances :type: list[DownloadRequest] :param redownload: tells whether to download the data again or not :type: bool """ for request in request_list: request.will_download = (request.save_response or request.return_data) \ and (not request.is_downloaded() or redownload) <|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, 38191, 1715, 1444, 484, 37039, 7180, 315, 1855, 1715, 304, 1715, 2062, 382, 262, 3146, 9290, 68063, 279, 734, 5318, 988, 279, 5540, 315, 279, 1160, 2268, 262, 551, 913, 1715, 2062, 25, 264, 1160, 315, 10103, 11631, 1939, 14196, 13422, 198, 262, 551, 1337, 25, 1160, 58, 11631, 1939, 933, 262, 551, 913, 2579, 38802, 25, 10975, 3508, 311, 4232, 279, 828, 1578, 477, 539, 198, 262, 551, 1337, 25, 1845, 271, 14711, 6075, 512, 755, 721, 2071, 11366, 722, 592, 37039, 4980, 2062, 11, 2579, 38802, 997, 262, 3270, 262, 28600, 1715, 1444, 484, 37039, 7180, 315, 1855, 1715, 304, 1715, 2062, 382, 262, 3146, 9290, 68063, 279, 734, 5318, 988, 279, 5540, 315, 279, 1160, 2268, 262, 551, 913, 1715, 2062, 25, 264, 1160, 315, 10103, 11631, 1939, 14196, 13422, 198, 262, 551, 1337, 25, 1160, 58, 11631, 1939, 933, 262, 551, 913, 2579, 38802, 25, 10975, 3508, 311, 4232, 279, 828, 1578, 477, 539, 198, 262, 551, 1337, 25, 1845, 198, 262, 3270, 262, 369, 1715, 304, 1715, 2062, 512, 286, 1715, 1444, 484, 37039, 284, 320, 2079, 5799, 9852, 477, 1715, 22175, 1807, 8, 3120, 1408, 323, 320, 1962, 1715, 2124, 14325, 15961, 368, 477, 2579, 38802, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 38191, 1715, 1444, 484, 37039, 7180, 315, 1855, 1715, 304, 1715, 2062, 382, 262, 3146, 9290, 68063, 279, 734, 5318, 988, 279, 5540, 315, 279, 1160, 2268, 262, 551, 913, 1715, 2062, 25, 264, 1160, 315, 10103, 11631, 1939, 14196, 13422, 198, 262, 551, 1337, 25, 1160, 58, 11631, 1939, 933, 262, 551, 913, 2579, 38802, 25, 10975, 3508, 311, 4232, 279, 828, 1578, 477, 539, 198, 262, 551, 1337, 25, 1845, 271, 14711, 6075, 512, 755, 721, 2071, 11366, 722, 592, 37039, 4980, 2062, 11, 2579, 38802, 997, 262, 3270, 262, 28600, 1715, 1444, 484, 37039, 7180, 315, 1855, 1715, 304, 1715, 2062, 382, 262, 3146, 9290, 68063, 279, 734, 5318, 988, 279, 5540, 315, 279, 1160, 2268, 262, 551, 913, 1715, 2062, 25, 264, 1160, 315, 10103, 11631, 1939, 14196, 13422, 198, 262, 551, 1337, 25, 1160, 58, 11631, 1939, 933, 262, 551, 913, 2579, 38802, 25, 10975, 3508, 311, 4232, 279, 828, 1578, 477, 539, 198, 262, 551, 1337, 25, 1845, 198, 262, 3270, 262, 369, 1715, 304, 1715, 2062, 512, 286, 1715, 1444, 484, 37039, 284, 320, 2079, 5799, 9852, 477, 1715, 22175, 1807, 8, 3120, 1408, 323, 320, 1962, 1715, 2124, 14325, 15961, 368, 477, 2579, 38802, 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 ]
Telefonica/toolium
toolium/pageelements/page_element.py
PageElement.web_element
def web_element(self): """Find WebElement using element locator :returns: web element object :rtype: selenium.webdriver.remote.webelement.WebElement or appium.webdriver.webelement.WebElement """ try: self._find_web_element() except NoSuchElementException as exception: parent_msg = " and parent locator '{}'".format(self.parent) if self.parent else '' msg = "Page element of type '%s' with locator %s%s not found" self.logger.error(msg, type(self).__name__, self.locator, parent_msg) exception.msg += "\n {}".format(msg % (type(self).__name__, self.locator, parent_msg)) raise exception return self._web_element
python
def web_element(self): """Find WebElement using element locator :returns: web element object :rtype: selenium.webdriver.remote.webelement.WebElement or appium.webdriver.webelement.WebElement """ try: self._find_web_element() except NoSuchElementException as exception: parent_msg = " and parent locator '{}'".format(self.parent) if self.parent else '' msg = "Page element of type '%s' with locator %s%s not found" self.logger.error(msg, type(self).__name__, self.locator, parent_msg) exception.msg += "\n {}".format(msg % (type(self).__name__, self.locator, parent_msg)) raise exception return self._web_element
[ "def", "web_element", "(", "self", ")", ":", "try", ":", "self", ".", "_find_web_element", "(", ")", "except", "NoSuchElementException", "as", "exception", ":", "parent_msg", "=", "\" and parent locator '{}'\"", ".", "format", "(", "self", ".", "parent", ")", "if", "self", ".", "parent", "else", "''", "msg", "=", "\"Page element of type '%s' with locator %s%s not found\"", "self", ".", "logger", ".", "error", "(", "msg", ",", "type", "(", "self", ")", ".", "__name__", ",", "self", ".", "locator", ",", "parent_msg", ")", "exception", ".", "msg", "+=", "\"\\n {}\"", ".", "format", "(", "msg", "%", "(", "type", "(", "self", ")", ".", "__name__", ",", "self", ".", "locator", ",", "parent_msg", ")", ")", "raise", "exception", "return", "self", ".", "_web_element" ]
Find WebElement using element locator :returns: web element object :rtype: selenium.webdriver.remote.webelement.WebElement or appium.webdriver.webelement.WebElement
[ "Find", "WebElement", "using", "element", "locator" ]
train
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/pageelements/page_element.py#L68-L82
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Find WebElement using element locator :returns: web element object :rtype: selenium.webdriver.remote.webelement.WebElement or appium.webdriver.webelement.WebElement ### Response: def web_element(self): """Find WebElement using element locator :returns: web element object :rtype: selenium.webdriver.remote.webelement.WebElement or appium.webdriver.webelement.WebElement """ try: self._find_web_element() except NoSuchElementException as exception: parent_msg = " and parent locator '{}'".format(self.parent) if self.parent else '' msg = "Page element of type '%s' with locator %s%s not found" self.logger.error(msg, type(self).__name__, self.locator, parent_msg) exception.msg += "\n {}".format(msg % (type(self).__name__, self.locator, parent_msg)) raise exception return self._web_element <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10086, 40982, 1701, 2449, 48217, 271, 286, 551, 4310, 25, 3566, 2449, 1665, 198, 286, 551, 33613, 25, 37045, 58793, 35193, 31339, 1395, 1001, 90892, 477, 917, 2411, 58793, 31339, 1395, 1001, 90892, 271, 14711, 6075, 512, 755, 3566, 8053, 1214, 997, 286, 4304, 10086, 40982, 1701, 2449, 48217, 271, 286, 551, 4310, 25, 3566, 2449, 1665, 198, 286, 551, 33613, 25, 37045, 58793, 35193, 31339, 1395, 1001, 90892, 477, 917, 2411, 58793, 31339, 1395, 1001, 90892, 198, 286, 3270, 286, 1456, 512, 310, 659, 1462, 3990, 27050, 8053, 746, 286, 3734, 95549, 439, 4788, 512, 310, 2748, 6619, 284, 330, 323, 2748, 48217, 70522, 3343, 2293, 1214, 8829, 8, 422, 659, 8829, 775, 12038, 310, 3835, 284, 330, 2732, 2449, 315, 955, 7832, 82, 6, 449, 48217, 1034, 82, 13249, 539, 1766, 702, 310, 659, 16465, 4517, 8282, 11, 955, 1214, 21015, 609, 10662, 659, 15006, 859, 11, 2748, 6619, 340, 310, 4788, 15488, 1447, 2990, 77, 220, 21532, 2293, 8282, 1034, 320, 1337, 1214, 21015, 609, 10662, 659, 15006, 859, 11, 2748, 6619, 1192, 310, 4933, 4788, 198, 286, 471, 659, 1462, 2984, 8053, 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,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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10086, 40982, 1701, 2449, 48217, 271, 286, 551, 4310, 25, 3566, 2449, 1665, 198, 286, 551, 33613, 25, 37045, 58793, 35193, 31339, 1395, 1001, 90892, 477, 917, 2411, 58793, 31339, 1395, 1001, 90892, 271, 14711, 6075, 512, 755, 3566, 8053, 1214, 997, 286, 4304, 10086, 40982, 1701, 2449, 48217, 271, 286, 551, 4310, 25, 3566, 2449, 1665, 198, 286, 551, 33613, 25, 37045, 58793, 35193, 31339, 1395, 1001, 90892, 477, 917, 2411, 58793, 31339, 1395, 1001, 90892, 198, 286, 3270, 286, 1456, 512, 310, 659, 1462, 3990, 27050, 8053, 746, 286, 3734, 95549, 439, 4788, 512, 310, 2748, 6619, 284, 330, 323, 2748, 48217, 70522, 3343, 2293, 1214, 8829, 8, 422, 659, 8829, 775, 12038, 310, 3835, 284, 330, 2732, 2449, 315, 955, 7832, 82, 6, 449, 48217, 1034, 82, 13249, 539, 1766, 702, 310, 659, 16465, 4517, 8282, 11, 955, 1214, 21015, 609, 10662, 659, 15006, 859, 11, 2748, 6619, 340, 310, 4788, 15488, 1447, 2990, 77, 220, 21532, 2293, 8282, 1034, 320, 1337, 1214, 21015, 609, 10662, 659, 15006, 859, 11, 2748, 6619, 1192, 310, 4933, 4788, 198, 286, 471, 659, 1462, 2984, 8053, 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 ]
pyviz/imagen
imagen/image.py
GenericImage._process_channels
def _process_channels(self,p,**params_to_override): """ Add the channel information to the channel_data attribute. """ orig_image = self._image for i in range(len(self._channel_data)): self._image = self._original_channel_data[i] self._channel_data[i] = self._reduced_call(**params_to_override) self._image = orig_image return self._channel_data
python
def _process_channels(self,p,**params_to_override): """ Add the channel information to the channel_data attribute. """ orig_image = self._image for i in range(len(self._channel_data)): self._image = self._original_channel_data[i] self._channel_data[i] = self._reduced_call(**params_to_override) self._image = orig_image return self._channel_data
[ "def", "_process_channels", "(", "self", ",", "p", ",", "*", "*", "params_to_override", ")", ":", "orig_image", "=", "self", ".", "_image", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_channel_data", ")", ")", ":", "self", ".", "_image", "=", "self", ".", "_original_channel_data", "[", "i", "]", "self", ".", "_channel_data", "[", "i", "]", "=", "self", ".", "_reduced_call", "(", "*", "*", "params_to_override", ")", "self", ".", "_image", "=", "orig_image", "return", "self", ".", "_channel_data" ]
Add the channel information to the channel_data attribute.
[ "Add", "the", "channel", "information", "to", "the", "channel_data", "attribute", "." ]
train
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/image.py#L322-L332
<|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 the channel information to the channel_data attribute. ### Response: def _process_channels(self,p,**params_to_override): """ Add the channel information to the channel_data attribute. """ orig_image = self._image for i in range(len(self._channel_data)): self._image = self._original_channel_data[i] self._channel_data[i] = self._reduced_call(**params_to_override) self._image = orig_image return self._channel_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, 2261, 279, 5613, 2038, 311, 279, 5613, 1807, 7180, 382, 14711, 6075, 512, 755, 721, 4734, 19848, 1214, 7385, 71079, 3603, 2401, 49676, 997, 286, 3270, 286, 2758, 279, 5613, 2038, 311, 279, 5613, 1807, 7180, 627, 286, 3270, 286, 2780, 5060, 284, 659, 1462, 1843, 271, 286, 369, 602, 304, 2134, 7046, 1214, 1462, 10327, 1807, 10162, 310, 659, 1462, 1843, 284, 659, 1462, 10090, 14913, 1807, 1004, 933, 310, 659, 1462, 10327, 1807, 1004, 60, 284, 659, 1462, 265, 54478, 13735, 22551, 3603, 2401, 49676, 340, 286, 659, 1462, 1843, 284, 2780, 5060, 198, 286, 471, 659, 1462, 10327, 1807, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 279, 5613, 2038, 311, 279, 5613, 1807, 7180, 382, 14711, 6075, 512, 755, 721, 4734, 19848, 1214, 7385, 71079, 3603, 2401, 49676, 997, 286, 3270, 286, 2758, 279, 5613, 2038, 311, 279, 5613, 1807, 7180, 627, 286, 3270, 286, 2780, 5060, 284, 659, 1462, 1843, 271, 286, 369, 602, 304, 2134, 7046, 1214, 1462, 10327, 1807, 10162, 310, 659, 1462, 1843, 284, 659, 1462, 10090, 14913, 1807, 1004, 933, 310, 659, 1462, 10327, 1807, 1004, 60, 284, 659, 1462, 265, 54478, 13735, 22551, 3603, 2401, 49676, 340, 286, 659, 1462, 1843, 284, 2780, 5060, 198, 286, 471, 659, 1462, 10327, 1807, 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 ]
prometheus/client_python
prometheus_client/metrics_core.py
Metric.add_sample
def add_sample(self, name, labels, value, timestamp=None, exemplar=None): """Add a sample to the metric. Internal-only, do not use.""" self.samples.append(Sample(name, labels, value, timestamp, exemplar))
python
def add_sample(self, name, labels, value, timestamp=None, exemplar=None): """Add a sample to the metric. Internal-only, do not use.""" self.samples.append(Sample(name, labels, value, timestamp, exemplar))
[ "def", "add_sample", "(", "self", ",", "name", ",", "labels", ",", "value", ",", "timestamp", "=", "None", ",", "exemplar", "=", "None", ")", ":", "self", ".", "samples", ".", "append", "(", "Sample", "(", "name", ",", "labels", ",", "value", ",", "timestamp", ",", "exemplar", ")", ")" ]
Add a sample to the metric. Internal-only, do not use.
[ "Add", "a", "sample", "to", "the", "metric", "." ]
train
https://github.com/prometheus/client_python/blob/31f5557e2e84ca4ffa9a03abf6e3f4d0c8b8c3eb/prometheus_client/metrics_core.py#L38-L42
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Add a sample to the metric. Internal-only, do not use. ### Response: def add_sample(self, name, labels, value, timestamp=None, exemplar=None): """Add a sample to the metric. Internal-only, do not use.""" self.samples.append(Sample(name, labels, value, timestamp, exemplar)) <|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, 6205, 311, 279, 18767, 382, 286, 15774, 15744, 11, 656, 539, 1005, 382, 14711, 6075, 512, 755, 923, 17949, 1214, 11, 836, 11, 9382, 11, 907, 11, 11695, 5980, 11, 39039, 277, 5980, 997, 286, 4304, 2261, 264, 6205, 311, 279, 18767, 382, 286, 15774, 15744, 11, 656, 539, 1005, 14781, 286, 659, 63307, 2102, 3844, 1545, 3232, 11, 9382, 11, 907, 11, 11695, 11, 39039, 277, 1192, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 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, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 264, 6205, 311, 279, 18767, 382, 286, 15774, 15744, 11, 656, 539, 1005, 382, 14711, 6075, 512, 755, 923, 17949, 1214, 11, 836, 11, 9382, 11, 907, 11, 11695, 5980, 11, 39039, 277, 5980, 997, 286, 4304, 2261, 264, 6205, 311, 279, 18767, 382, 286, 15774, 15744, 11, 656, 539, 1005, 14781, 286, 659, 63307, 2102, 3844, 1545, 3232, 11, 9382, 11, 907, 11, 11695, 11, 39039, 277, 1192, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
GeorgeArgyros/symautomata
symautomata/pythondfa.py
PythonDFA.define
def define(self): """If DFA is empty, create a sink state""" if len(self.states) == 0: for char in self.alphabet: self.add_arc(0, 0, char) self[0].final = False
python
def define(self): """If DFA is empty, create a sink state""" if len(self.states) == 0: for char in self.alphabet: self.add_arc(0, 0, char) self[0].final = False
[ "def", "define", "(", "self", ")", ":", "if", "len", "(", "self", ".", "states", ")", "==", "0", ":", "for", "char", "in", "self", ".", "alphabet", ":", "self", ".", "add_arc", "(", "0", ",", "0", ",", "char", ")", "self", "[", "0", "]", ".", "final", "=", "False" ]
If DFA is empty, create a sink state
[ "If", "DFA", "is", "empty", "create", "a", "sink", "state" ]
train
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pythondfa.py#L160-L165
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: If DFA is empty, create a sink state ### Response: def define(self): """If DFA is empty, create a sink state""" if len(self.states) == 0: for char in self.alphabet: self.add_arc(0, 0, char) self[0].final = False <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2746, 94731, 374, 4384, 11, 1893, 264, 19868, 1614, 271, 14711, 6075, 512, 755, 7124, 1214, 997, 286, 4304, 2746, 94731, 374, 4384, 11, 1893, 264, 19868, 1614, 7275, 286, 422, 2479, 1214, 53247, 8, 624, 220, 15, 512, 310, 369, 1181, 304, 659, 12444, 18992, 512, 394, 659, 1388, 64014, 7, 15, 11, 220, 15, 11, 1181, 340, 394, 659, 58, 15, 948, 12085, 284, 3641, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2746, 94731, 374, 4384, 11, 1893, 264, 19868, 1614, 271, 14711, 6075, 512, 755, 7124, 1214, 997, 286, 4304, 2746, 94731, 374, 4384, 11, 1893, 264, 19868, 1614, 7275, 286, 422, 2479, 1214, 53247, 8, 624, 220, 15, 512, 310, 369, 1181, 304, 659, 12444, 18992, 512, 394, 659, 1388, 64014, 7, 15, 11, 220, 15, 11, 1181, 340, 394, 659, 58, 15, 948, 12085, 284, 3641, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
Robin8Put/pmes
pdms/views.py
PriceHandler.put
async def put(self, cid): """Update price of current content Accepts: Query string args: - "cid" - int Request body params: - "access_type" - str - "price" - int - "coinid" - str Returns: dict with following fields: - "confirmed": None - "txid" - str - "description" - str - "content" - str - "read_access" - int - "write_access" - int - "cid" - int - "txid" - str - "seller_pubkey" - str - "seller_access_string": None or str Verified: True """ if settings.SIGNATURE_VERIFICATION: super().verify() try: body = json.loads(self.request.body) except: self.set_status(400) self.write({"error":400, "reason":"Unexpected data format. JSON required"}) raise tornado.web.Finish # Get data from signed message public_key = body.get("public_key", None) if isinstance(body["message"], str): message = json.loads(body["message"]) elif isinstance(body["message"], dict): message = body["message"] price = message.get("price") access_type = message.get("access_type") coinid = message.get("coinid") # Check if required fields exists if not any([price, access_type, coinid]): self.set_status(400) self.write({"error":400, "reason":"Missed price and access type for content"}) # Set bridges url if coinid in settings.bridges.keys(): self.account.blockchain.setendpoint(settings.bridges[coinid]) else: self.set_status(400) self.write({"error":400, "reason":"Invalid coin ID"}) raise tornado.web.Finish # Get public key hex or checksum format check = self.account.validator[coinid](public_key) # Get content owner address owneraddr = await self.account.blockchain.ownerbycid(cid=cid) if isinstance(owneraddr, dict): if "error" in owneraddr.keys(): self.set_status(404) self.write({"error":404, "reason":"Owner not found."}) raise tornado.web.Finish # Check if current content belongs to current user if owneraddr != check: self.set_status(403) self.write({"error":403, "reason":"Owner does not match."}) raise tornado.web.Finish response = {"cid":cid, "coinid":coinid} # Make setprice request to the bridge if access_type == "write_price": result = await self.account.blockchain.setwriteprice(cid=cid, write_price=price) response["write_access"] = result["price"] elif access_type == "read_price": result = await self.account.blockchain.setreadprice(cid=cid, read_price=price) response["read_access"] = result["price"] # Fee fee = await billing.set_price_fee(cid=cid, price=price, owneraddr=owneraddr) if "error" in fee.keys(): self.set_status(fee["error"]) self.write(fee) raise tornado.web.Finish self.write(response)
python
async def put(self, cid): """Update price of current content Accepts: Query string args: - "cid" - int Request body params: - "access_type" - str - "price" - int - "coinid" - str Returns: dict with following fields: - "confirmed": None - "txid" - str - "description" - str - "content" - str - "read_access" - int - "write_access" - int - "cid" - int - "txid" - str - "seller_pubkey" - str - "seller_access_string": None or str Verified: True """ if settings.SIGNATURE_VERIFICATION: super().verify() try: body = json.loads(self.request.body) except: self.set_status(400) self.write({"error":400, "reason":"Unexpected data format. JSON required"}) raise tornado.web.Finish # Get data from signed message public_key = body.get("public_key", None) if isinstance(body["message"], str): message = json.loads(body["message"]) elif isinstance(body["message"], dict): message = body["message"] price = message.get("price") access_type = message.get("access_type") coinid = message.get("coinid") # Check if required fields exists if not any([price, access_type, coinid]): self.set_status(400) self.write({"error":400, "reason":"Missed price and access type for content"}) # Set bridges url if coinid in settings.bridges.keys(): self.account.blockchain.setendpoint(settings.bridges[coinid]) else: self.set_status(400) self.write({"error":400, "reason":"Invalid coin ID"}) raise tornado.web.Finish # Get public key hex or checksum format check = self.account.validator[coinid](public_key) # Get content owner address owneraddr = await self.account.blockchain.ownerbycid(cid=cid) if isinstance(owneraddr, dict): if "error" in owneraddr.keys(): self.set_status(404) self.write({"error":404, "reason":"Owner not found."}) raise tornado.web.Finish # Check if current content belongs to current user if owneraddr != check: self.set_status(403) self.write({"error":403, "reason":"Owner does not match."}) raise tornado.web.Finish response = {"cid":cid, "coinid":coinid} # Make setprice request to the bridge if access_type == "write_price": result = await self.account.blockchain.setwriteprice(cid=cid, write_price=price) response["write_access"] = result["price"] elif access_type == "read_price": result = await self.account.blockchain.setreadprice(cid=cid, read_price=price) response["read_access"] = result["price"] # Fee fee = await billing.set_price_fee(cid=cid, price=price, owneraddr=owneraddr) if "error" in fee.keys(): self.set_status(fee["error"]) self.write(fee) raise tornado.web.Finish self.write(response)
[ "async", "def", "put", "(", "self", ",", "cid", ")", ":", "if", "settings", ".", "SIGNATURE_VERIFICATION", ":", "super", "(", ")", ".", "verify", "(", ")", "try", ":", "body", "=", "json", ".", "loads", "(", "self", ".", "request", ".", "body", ")", "except", ":", "self", ".", "set_status", "(", "400", ")", "self", ".", "write", "(", "{", "\"error\"", ":", "400", ",", "\"reason\"", ":", "\"Unexpected data format. JSON required\"", "}", ")", "raise", "tornado", ".", "web", ".", "Finish", "# Get data from signed message\t", "public_key", "=", "body", ".", "get", "(", "\"public_key\"", ",", "None", ")", "if", "isinstance", "(", "body", "[", "\"message\"", "]", ",", "str", ")", ":", "message", "=", "json", ".", "loads", "(", "body", "[", "\"message\"", "]", ")", "elif", "isinstance", "(", "body", "[", "\"message\"", "]", ",", "dict", ")", ":", "message", "=", "body", "[", "\"message\"", "]", "price", "=", "message", ".", "get", "(", "\"price\"", ")", "access_type", "=", "message", ".", "get", "(", "\"access_type\"", ")", "coinid", "=", "message", ".", "get", "(", "\"coinid\"", ")", "# Check if required fields exists", "if", "not", "any", "(", "[", "price", ",", "access_type", ",", "coinid", "]", ")", ":", "self", ".", "set_status", "(", "400", ")", "self", ".", "write", "(", "{", "\"error\"", ":", "400", ",", "\"reason\"", ":", "\"Missed price and access type for content\"", "}", ")", "# Set bridges url", "if", "coinid", "in", "settings", ".", "bridges", ".", "keys", "(", ")", ":", "self", ".", "account", ".", "blockchain", ".", "setendpoint", "(", "settings", ".", "bridges", "[", "coinid", "]", ")", "else", ":", "self", ".", "set_status", "(", "400", ")", "self", ".", "write", "(", "{", "\"error\"", ":", "400", ",", "\"reason\"", ":", "\"Invalid coin ID\"", "}", ")", "raise", "tornado", ".", "web", ".", "Finish", "# Get public key hex or checksum format", "check", "=", "self", ".", "account", ".", "validator", "[", "coinid", "]", "(", "public_key", ")", "# Get content owner address", "owneraddr", "=", "await", "self", ".", "account", ".", "blockchain", ".", "ownerbycid", "(", "cid", "=", "cid", ")", "if", "isinstance", "(", "owneraddr", ",", "dict", ")", ":", "if", "\"error\"", "in", "owneraddr", ".", "keys", "(", ")", ":", "self", ".", "set_status", "(", "404", ")", "self", ".", "write", "(", "{", "\"error\"", ":", "404", ",", "\"reason\"", ":", "\"Owner not found.\"", "}", ")", "raise", "tornado", ".", "web", ".", "Finish", "# Check if current content belongs to current user", "if", "owneraddr", "!=", "check", ":", "self", ".", "set_status", "(", "403", ")", "self", ".", "write", "(", "{", "\"error\"", ":", "403", ",", "\"reason\"", ":", "\"Owner does not match.\"", "}", ")", "raise", "tornado", ".", "web", ".", "Finish", "response", "=", "{", "\"cid\"", ":", "cid", ",", "\"coinid\"", ":", "coinid", "}", "# Make setprice request to the bridge", "if", "access_type", "==", "\"write_price\"", ":", "result", "=", "await", "self", ".", "account", ".", "blockchain", ".", "setwriteprice", "(", "cid", "=", "cid", ",", "write_price", "=", "price", ")", "response", "[", "\"write_access\"", "]", "=", "result", "[", "\"price\"", "]", "elif", "access_type", "==", "\"read_price\"", ":", "result", "=", "await", "self", ".", "account", ".", "blockchain", ".", "setreadprice", "(", "cid", "=", "cid", ",", "read_price", "=", "price", ")", "response", "[", "\"read_access\"", "]", "=", "result", "[", "\"price\"", "]", "# Fee", "fee", "=", "await", "billing", ".", "set_price_fee", "(", "cid", "=", "cid", ",", "price", "=", "price", ",", "owneraddr", "=", "owneraddr", ")", "if", "\"error\"", "in", "fee", ".", "keys", "(", ")", ":", "self", ".", "set_status", "(", "fee", "[", "\"error\"", "]", ")", "self", ".", "write", "(", "fee", ")", "raise", "tornado", ".", "web", ".", "Finish", "self", ".", "write", "(", "response", ")" ]
Update price of current content Accepts: Query string args: - "cid" - int Request body params: - "access_type" - str - "price" - int - "coinid" - str Returns: dict with following fields: - "confirmed": None - "txid" - str - "description" - str - "content" - str - "read_access" - int - "write_access" - int - "cid" - int - "txid" - str - "seller_pubkey" - str - "seller_access_string": None or str Verified: True
[ "Update", "price", "of", "current", "content" ]
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/pdms/views.py#L449-L545
<|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 price of current content Accepts: Query string args: - "cid" - int Request body params: - "access_type" - str - "price" - int - "coinid" - str Returns: dict with following fields: - "confirmed": None - "txid" - str - "description" - str - "content" - str - "read_access" - int - "write_access" - int - "cid" - int - "txid" - str - "seller_pubkey" - str - "seller_access_string": None or str Verified: True ### Response: async def put(self, cid): """Update price of current content Accepts: Query string args: - "cid" - int Request body params: - "access_type" - str - "price" - int - "coinid" - str Returns: dict with following fields: - "confirmed": None - "txid" - str - "description" - str - "content" - str - "read_access" - int - "write_access" - int - "cid" - int - "txid" - str - "seller_pubkey" - str - "seller_access_string": None or str Verified: True """ if settings.SIGNATURE_VERIFICATION: super().verify() try: body = json.loads(self.request.body) except: self.set_status(400) self.write({"error":400, "reason":"Unexpected data format. JSON required"}) raise tornado.web.Finish # Get data from signed message public_key = body.get("public_key", None) if isinstance(body["message"], str): message = json.loads(body["message"]) elif isinstance(body["message"], dict): message = body["message"] price = message.get("price") access_type = message.get("access_type") coinid = message.get("coinid") # Check if required fields exists if not any([price, access_type, coinid]): self.set_status(400) self.write({"error":400, "reason":"Missed price and access type for content"}) # Set bridges url if coinid in settings.bridges.keys(): self.account.blockchain.setendpoint(settings.bridges[coinid]) else: self.set_status(400) self.write({"error":400, "reason":"Invalid coin ID"}) raise tornado.web.Finish # Get public key hex or checksum format check = self.account.validator[coinid](public_key) # Get content owner address owneraddr = await self.account.blockchain.ownerbycid(cid=cid) if isinstance(owneraddr, dict): if "error" in owneraddr.keys(): self.set_status(404) self.write({"error":404, "reason":"Owner not found."}) raise tornado.web.Finish # Check if current content belongs to current user if owneraddr != check: self.set_status(403) self.write({"error":403, "reason":"Owner does not match."}) raise tornado.web.Finish response = {"cid":cid, "coinid":coinid} # Make setprice request to the bridge if access_type == "write_price": result = await self.account.blockchain.setwriteprice(cid=cid, write_price=price) response["write_access"] = result["price"] elif access_type == "read_price": result = await self.account.blockchain.setreadprice(cid=cid, read_price=price) response["read_access"] = result["price"] # Fee fee = await billing.set_price_fee(cid=cid, price=price, owneraddr=owneraddr) if "error" in fee.keys(): self.set_status(fee["error"]) self.write(fee) raise tornado.web.Finish self.write(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, 4387, 3430, 315, 1510, 2262, 271, 197, 197, 17059, 82, 512, 298, 61462, 925, 2897, 512, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 298, 74906, 2547, 3712, 25, 720, 573, 197, 12, 330, 5323, 1857, 1, 482, 610, 198, 573, 197, 12, 330, 6692, 1, 482, 528, 198, 573, 197, 12, 330, 7307, 307, 1, 482, 610, 271, 197, 77186, 512, 298, 2765, 858, 449, 2768, 5151, 512, 573, 197, 12, 330, 42128, 794, 2290, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 4789, 1, 482, 610, 198, 573, 197, 12, 330, 1834, 1, 482, 610, 198, 573, 197, 12, 330, 888, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 5040, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 35114, 798, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 13049, 3991, 794, 2290, 477, 610, 271, 197, 197, 55658, 25, 3082, 271, 14711, 6075, 512, 7847, 711, 2231, 1214, 11, 33241, 997, 197, 197, 12885, 4387, 3430, 315, 1510, 2262, 271, 197, 197, 17059, 82, 512, 298, 61462, 925, 2897, 512, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 298, 74906, 2547, 3712, 25, 720, 573, 197, 12, 330, 5323, 1857, 1, 482, 610, 198, 573, 197, 12, 330, 6692, 1, 482, 528, 198, 573, 197, 12, 330, 7307, 307, 1, 482, 610, 271, 197, 77186, 512, 298, 2765, 858, 449, 2768, 5151, 512, 573, 197, 12, 330, 42128, 794, 2290, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 4789, 1, 482, 610, 198, 573, 197, 12, 330, 1834, 1, 482, 610, 198, 573, 197, 12, 330, 888, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 5040, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 35114, 798, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 13049, 3991, 794, 2290, 477, 610, 271, 197, 197, 55658, 25, 3082, 271, 197, 197, 12885, 720, 197, 748, 5110, 815, 6399, 15215, 15159, 23721, 512, 298, 12750, 1020, 12728, 2892, 197, 6942, 512, 298, 36502, 284, 3024, 23818, 1214, 8387, 5189, 340, 197, 35699, 512, 298, 5311, 995, 4878, 7, 3443, 340, 298, 5311, 3921, 17289, 850, 794, 3443, 11, 330, 20489, 3332, 30530, 828, 3645, 13, 4823, 2631, 24546, 298, 55118, 45272, 6545, 1006, 18675, 271, 197, 197, 2, 2175, 828, 505, 8667, 1984, 1602, 197, 1241, 3173, 284, 2547, 673, 446, 898, 3173, 498, 2290, 340, 197, 748, 11656, 15582, 1204, 2037, 8073, 610, 997, 298, 25785,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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 3430, 315, 1510, 2262, 271, 197, 197, 17059, 82, 512, 298, 61462, 925, 2897, 512, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 298, 74906, 2547, 3712, 25, 720, 573, 197, 12, 330, 5323, 1857, 1, 482, 610, 198, 573, 197, 12, 330, 6692, 1, 482, 528, 198, 573, 197, 12, 330, 7307, 307, 1, 482, 610, 271, 197, 77186, 512, 298, 2765, 858, 449, 2768, 5151, 512, 573, 197, 12, 330, 42128, 794, 2290, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 4789, 1, 482, 610, 198, 573, 197, 12, 330, 1834, 1, 482, 610, 198, 573, 197, 12, 330, 888, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 5040, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 35114, 798, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 13049, 3991, 794, 2290, 477, 610, 271, 197, 197, 55658, 25, 3082, 271, 14711, 6075, 512, 7847, 711, 2231, 1214, 11, 33241, 997, 197, 197, 12885, 4387, 3430, 315, 1510, 2262, 271, 197, 197, 17059, 82, 512, 298, 61462, 925, 2897, 512, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 298, 74906, 2547, 3712, 25, 720, 573, 197, 12, 330, 5323, 1857, 1, 482, 610, 198, 573, 197, 12, 330, 6692, 1, 482, 528, 198, 573, 197, 12, 330, 7307, 307, 1, 482, 610, 271, 197, 77186, 512, 298, 2765, 858, 449, 2768, 5151, 512, 573, 197, 12, 330, 42128, 794, 2290, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 4789, 1, 482, 610, 198, 573, 197, 12, 330, 1834, 1, 482, 610, 198, 573, 197, 12, 330, 888, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 5040, 13049, 1, 482, 528, 198, 573, 197, 12, 330, 21200, 1, 482, 528, 198, 573, 197, 12, 330, 4086, 307, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 35114, 798, 1, 482, 610, 198, 573, 197, 12, 330, 35199, 13049, 3991, 794, 2290, 477, 610, 271, 197, 197, 55658, 25, 3082, 271, 197, 197, 12885, 720, 197, 748, 5110, 815, 6399, 15215, 15159, 23721, 512, 298, 12750, 1020, 12728, 2892, 197, 6942, 512, 298, 36502, 284, 3024, 23818, 1214, 8387, 5189, 340, 197, 35699, 512, 298, 5311, 995, 4878, 7, 3443, 340, 298, 5311, 3921, 17289, 850, 794, 3443, 11, 330, 20489, 3332, 30530, 828, 3645, 13, 4823, 2631, 24546, 298, 55118, 45272, 6545, 1006, 18675, 271, 197, 197, 2, 2175, 828, 505, 8667, 1984, 1602, 197, 1241, 3173, 284, 2547, 673, 446, 898, 3173, 498, 2290, 340, 197, 748, 11656, 15582, 1204, 2037, 8073, 610, 997, 298, 25785, 284, 3024, 23818, 15582, 1204, 2037, 14440, 197, 23560, 11656, 15582, 1204, 2037, 8073, 6587 ]
dcos/shakedown
shakedown/dcos/agent.py
partition_agent
def partition_agent(host): """ Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster """ network.save_iptables(host) network.flush_all_rules(host) network.allow_all_traffic(host) network.run_iptables(host, ALLOW_SSH) network.run_iptables(host, ALLOW_PING) network.run_iptables(host, DISALLOW_MESOS) network.run_iptables(host, DISALLOW_INPUT)
python
def partition_agent(host): """ Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster """ network.save_iptables(host) network.flush_all_rules(host) network.allow_all_traffic(host) network.run_iptables(host, ALLOW_SSH) network.run_iptables(host, ALLOW_PING) network.run_iptables(host, DISALLOW_MESOS) network.run_iptables(host, DISALLOW_INPUT)
[ "def", "partition_agent", "(", "host", ")", ":", "network", ".", "save_iptables", "(", "host", ")", "network", ".", "flush_all_rules", "(", "host", ")", "network", ".", "allow_all_traffic", "(", "host", ")", "network", ".", "run_iptables", "(", "host", ",", "ALLOW_SSH", ")", "network", ".", "run_iptables", "(", "host", ",", "ALLOW_PING", ")", "network", ".", "run_iptables", "(", "host", ",", "DISALLOW_MESOS", ")", "network", ".", "run_iptables", "(", "host", ",", "DISALLOW_INPUT", ")" ]
Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster
[ "Partition", "a", "node", "from", "all", "network", "traffic", "except", "for", "SSH", "and", "loopback" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L78-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: Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster ### Response: def partition_agent(host): """ Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster """ network.save_iptables(host) network.flush_all_rules(host) network.allow_all_traffic(host) network.run_iptables(host, ALLOW_SSH) network.run_iptables(host, ALLOW_PING) network.run_iptables(host, DISALLOW_MESOS) network.run_iptables(host, DISALLOW_INPUT) <|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, 51078, 264, 2494, 505, 682, 4009, 9629, 3734, 369, 41563, 323, 6471, 1445, 271, 286, 551, 913, 29215, 25, 3552, 477, 6933, 315, 279, 5780, 311, 17071, 505, 279, 10879, 271, 14711, 6075, 512, 755, 17071, 26814, 20569, 997, 262, 4304, 55726, 264, 2494, 505, 682, 4009, 9629, 3734, 369, 41563, 323, 6471, 1445, 271, 286, 551, 913, 29215, 25, 3552, 477, 6933, 315, 279, 5780, 311, 17071, 505, 279, 10879, 198, 262, 12713, 262, 4009, 5799, 5431, 418, 4893, 20569, 340, 262, 4009, 23907, 5823, 22122, 20569, 340, 262, 4009, 58556, 5823, 91112, 20569, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 73360, 1117, 8758, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 73360, 1106, 1753, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 12244, 54425, 1267, 1600, 3204, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 12244, 54425, 21698, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 51078, 264, 2494, 505, 682, 4009, 9629, 3734, 369, 41563, 323, 6471, 1445, 271, 286, 551, 913, 29215, 25, 3552, 477, 6933, 315, 279, 5780, 311, 17071, 505, 279, 10879, 271, 14711, 6075, 512, 755, 17071, 26814, 20569, 997, 262, 4304, 55726, 264, 2494, 505, 682, 4009, 9629, 3734, 369, 41563, 323, 6471, 1445, 271, 286, 551, 913, 29215, 25, 3552, 477, 6933, 315, 279, 5780, 311, 17071, 505, 279, 10879, 198, 262, 12713, 262, 4009, 5799, 5431, 418, 4893, 20569, 340, 262, 4009, 23907, 5823, 22122, 20569, 340, 262, 4009, 58556, 5823, 91112, 20569, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 73360, 1117, 8758, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 73360, 1106, 1753, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 12244, 54425, 1267, 1600, 3204, 340, 262, 4009, 7789, 5431, 418, 4893, 20569, 11, 12244, 54425, 21698, 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 ]
cjdrake/pyeda
pyeda/parsing/lex.py
action
def action(toktype): """Return a parser action property.""" def outer(func): """Return a function that pushes a token onto the token queue.""" def inner(lexer, text): """Push a token onto the token queue.""" value = func(lexer, text) lexer.tokens.append(toktype(value, lexer.lineno, lexer.offset)) return inner return outer
python
def action(toktype): """Return a parser action property.""" def outer(func): """Return a function that pushes a token onto the token queue.""" def inner(lexer, text): """Push a token onto the token queue.""" value = func(lexer, text) lexer.tokens.append(toktype(value, lexer.lineno, lexer.offset)) return inner return outer
[ "def", "action", "(", "toktype", ")", ":", "def", "outer", "(", "func", ")", ":", "\"\"\"Return a function that pushes a token onto the token queue.\"\"\"", "def", "inner", "(", "lexer", ",", "text", ")", ":", "\"\"\"Push a token onto the token queue.\"\"\"", "value", "=", "func", "(", "lexer", ",", "text", ")", "lexer", ".", "tokens", ".", "append", "(", "toktype", "(", "value", ",", "lexer", ".", "lineno", ",", "lexer", ".", "offset", ")", ")", "return", "inner", "return", "outer" ]
Return a parser action property.
[ "Return", "a", "parser", "action", "property", "." ]
train
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/parsing/lex.py#L174-L183
<|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 parser action property. ### Response: def action(toktype): """Return a parser action property.""" def outer(func): """Return a function that pushes a token onto the token queue.""" def inner(lexer, text): """Push a token onto the token queue.""" value = func(lexer, text) lexer.tokens.append(toktype(value, lexer.lineno, lexer.offset)) return inner return outer <|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, 6871, 1957, 3424, 382, 14711, 6075, 512, 755, 1957, 67953, 1337, 997, 262, 4304, 5715, 264, 6871, 1957, 3424, 14781, 262, 711, 16335, 19062, 997, 286, 4304, 5715, 264, 734, 430, 41802, 264, 4037, 8800, 279, 4037, 7325, 14781, 286, 711, 9358, 7, 39915, 11, 1495, 997, 310, 4304, 17056, 264, 4037, 8800, 279, 4037, 7325, 14781, 310, 907, 284, 2988, 7, 39915, 11, 1495, 340, 310, 54359, 60649, 2102, 67953, 1337, 3764, 11, 54359, 65610, 12052, 11, 54359, 15103, 1192, 286, 471, 9358, 198, 262, 471, 16335, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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, 6498, 382, 14711, 5546, 512, 5715, 264, 6871, 1957, 3424, 382, 14711, 6075, 512, 755, 1957, 67953, 1337, 997, 262, 4304, 5715, 264, 6871, 1957, 3424, 14781, 262, 711, 16335, 19062, 997, 286, 4304, 5715, 264, 734, 430, 41802, 264, 4037, 8800, 279, 4037, 7325, 14781, 286, 711, 9358, 7, 39915, 11, 1495, 997, 310, 4304, 17056, 264, 4037, 8800, 279, 4037, 7325, 14781, 310, 907, 284, 2988, 7, 39915, 11, 1495, 340, 310, 54359, 60649, 2102, 67953, 1337, 3764, 11, 54359, 65610, 12052, 11, 54359, 15103, 1192, 286, 471, 9358, 198, 262, 471, 16335, 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 ]
pandas-dev/pandas
pandas/core/algorithms.py
take_2d_multi
def take_2d_multi(arr, indexer, out=None, fill_value=np.nan, mask_info=None, allow_fill=True): """ Specialized Cython take which sets NaN values in one pass """ if indexer is None or (indexer[0] is None and indexer[1] is None): row_idx = np.arange(arr.shape[0], dtype=np.int64) col_idx = np.arange(arr.shape[1], dtype=np.int64) indexer = row_idx, col_idx dtype, fill_value = arr.dtype, arr.dtype.type() else: row_idx, col_idx = indexer if row_idx is None: row_idx = np.arange(arr.shape[0], dtype=np.int64) else: row_idx = ensure_int64(row_idx) if col_idx is None: col_idx = np.arange(arr.shape[1], dtype=np.int64) else: col_idx = ensure_int64(col_idx) indexer = row_idx, col_idx if not allow_fill: dtype, fill_value = arr.dtype, arr.dtype.type() mask_info = None, False else: # check for promotion based on types only (do this first because # it's faster than computing a mask) dtype, fill_value = maybe_promote(arr.dtype, fill_value) if dtype != arr.dtype and (out is None or out.dtype != dtype): # check if promotion is actually required based on indexer if mask_info is not None: (row_mask, col_mask), (row_needs, col_needs) = mask_info else: row_mask = row_idx == -1 col_mask = col_idx == -1 row_needs = row_mask.any() col_needs = col_mask.any() mask_info = (row_mask, col_mask), (row_needs, col_needs) if row_needs or col_needs: if out is not None and out.dtype != dtype: raise TypeError('Incompatible type for fill_value') else: # if not, then depromote, set fill_value to dummy # (it won't be used but we don't want the cython code # to crash when trying to cast it to dtype) dtype, fill_value = arr.dtype, arr.dtype.type() # at this point, it's guaranteed that dtype can hold both the arr values # and the fill_value if out is None: out_shape = len(row_idx), len(col_idx) out = np.empty(out_shape, dtype=dtype) func = _take_2d_multi_dict.get((arr.dtype.name, out.dtype.name), None) if func is None and arr.dtype != out.dtype: func = _take_2d_multi_dict.get((out.dtype.name, out.dtype.name), None) if func is not None: func = _convert_wrapper(func, out.dtype) if func is None: def func(arr, indexer, out, fill_value=np.nan): _take_2d_multi_object(arr, indexer, out, fill_value=fill_value, mask_info=mask_info) func(arr, indexer, out=out, fill_value=fill_value) return out
python
def take_2d_multi(arr, indexer, out=None, fill_value=np.nan, mask_info=None, allow_fill=True): """ Specialized Cython take which sets NaN values in one pass """ if indexer is None or (indexer[0] is None and indexer[1] is None): row_idx = np.arange(arr.shape[0], dtype=np.int64) col_idx = np.arange(arr.shape[1], dtype=np.int64) indexer = row_idx, col_idx dtype, fill_value = arr.dtype, arr.dtype.type() else: row_idx, col_idx = indexer if row_idx is None: row_idx = np.arange(arr.shape[0], dtype=np.int64) else: row_idx = ensure_int64(row_idx) if col_idx is None: col_idx = np.arange(arr.shape[1], dtype=np.int64) else: col_idx = ensure_int64(col_idx) indexer = row_idx, col_idx if not allow_fill: dtype, fill_value = arr.dtype, arr.dtype.type() mask_info = None, False else: # check for promotion based on types only (do this first because # it's faster than computing a mask) dtype, fill_value = maybe_promote(arr.dtype, fill_value) if dtype != arr.dtype and (out is None or out.dtype != dtype): # check if promotion is actually required based on indexer if mask_info is not None: (row_mask, col_mask), (row_needs, col_needs) = mask_info else: row_mask = row_idx == -1 col_mask = col_idx == -1 row_needs = row_mask.any() col_needs = col_mask.any() mask_info = (row_mask, col_mask), (row_needs, col_needs) if row_needs or col_needs: if out is not None and out.dtype != dtype: raise TypeError('Incompatible type for fill_value') else: # if not, then depromote, set fill_value to dummy # (it won't be used but we don't want the cython code # to crash when trying to cast it to dtype) dtype, fill_value = arr.dtype, arr.dtype.type() # at this point, it's guaranteed that dtype can hold both the arr values # and the fill_value if out is None: out_shape = len(row_idx), len(col_idx) out = np.empty(out_shape, dtype=dtype) func = _take_2d_multi_dict.get((arr.dtype.name, out.dtype.name), None) if func is None and arr.dtype != out.dtype: func = _take_2d_multi_dict.get((out.dtype.name, out.dtype.name), None) if func is not None: func = _convert_wrapper(func, out.dtype) if func is None: def func(arr, indexer, out, fill_value=np.nan): _take_2d_multi_object(arr, indexer, out, fill_value=fill_value, mask_info=mask_info) func(arr, indexer, out=out, fill_value=fill_value) return out
[ "def", "take_2d_multi", "(", "arr", ",", "indexer", ",", "out", "=", "None", ",", "fill_value", "=", "np", ".", "nan", ",", "mask_info", "=", "None", ",", "allow_fill", "=", "True", ")", ":", "if", "indexer", "is", "None", "or", "(", "indexer", "[", "0", "]", "is", "None", "and", "indexer", "[", "1", "]", "is", "None", ")", ":", "row_idx", "=", "np", ".", "arange", "(", "arr", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "int64", ")", "col_idx", "=", "np", ".", "arange", "(", "arr", ".", "shape", "[", "1", "]", ",", "dtype", "=", "np", ".", "int64", ")", "indexer", "=", "row_idx", ",", "col_idx", "dtype", ",", "fill_value", "=", "arr", ".", "dtype", ",", "arr", ".", "dtype", ".", "type", "(", ")", "else", ":", "row_idx", ",", "col_idx", "=", "indexer", "if", "row_idx", "is", "None", ":", "row_idx", "=", "np", ".", "arange", "(", "arr", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "int64", ")", "else", ":", "row_idx", "=", "ensure_int64", "(", "row_idx", ")", "if", "col_idx", "is", "None", ":", "col_idx", "=", "np", ".", "arange", "(", "arr", ".", "shape", "[", "1", "]", ",", "dtype", "=", "np", ".", "int64", ")", "else", ":", "col_idx", "=", "ensure_int64", "(", "col_idx", ")", "indexer", "=", "row_idx", ",", "col_idx", "if", "not", "allow_fill", ":", "dtype", ",", "fill_value", "=", "arr", ".", "dtype", ",", "arr", ".", "dtype", ".", "type", "(", ")", "mask_info", "=", "None", ",", "False", "else", ":", "# check for promotion based on types only (do this first because", "# it's faster than computing a mask)", "dtype", ",", "fill_value", "=", "maybe_promote", "(", "arr", ".", "dtype", ",", "fill_value", ")", "if", "dtype", "!=", "arr", ".", "dtype", "and", "(", "out", "is", "None", "or", "out", ".", "dtype", "!=", "dtype", ")", ":", "# check if promotion is actually required based on indexer", "if", "mask_info", "is", "not", "None", ":", "(", "row_mask", ",", "col_mask", ")", ",", "(", "row_needs", ",", "col_needs", ")", "=", "mask_info", "else", ":", "row_mask", "=", "row_idx", "==", "-", "1", "col_mask", "=", "col_idx", "==", "-", "1", "row_needs", "=", "row_mask", ".", "any", "(", ")", "col_needs", "=", "col_mask", ".", "any", "(", ")", "mask_info", "=", "(", "row_mask", ",", "col_mask", ")", ",", "(", "row_needs", ",", "col_needs", ")", "if", "row_needs", "or", "col_needs", ":", "if", "out", "is", "not", "None", "and", "out", ".", "dtype", "!=", "dtype", ":", "raise", "TypeError", "(", "'Incompatible type for fill_value'", ")", "else", ":", "# if not, then depromote, set fill_value to dummy", "# (it won't be used but we don't want the cython code", "# to crash when trying to cast it to dtype)", "dtype", ",", "fill_value", "=", "arr", ".", "dtype", ",", "arr", ".", "dtype", ".", "type", "(", ")", "# at this point, it's guaranteed that dtype can hold both the arr values", "# and the fill_value", "if", "out", "is", "None", ":", "out_shape", "=", "len", "(", "row_idx", ")", ",", "len", "(", "col_idx", ")", "out", "=", "np", ".", "empty", "(", "out_shape", ",", "dtype", "=", "dtype", ")", "func", "=", "_take_2d_multi_dict", ".", "get", "(", "(", "arr", ".", "dtype", ".", "name", ",", "out", ".", "dtype", ".", "name", ")", ",", "None", ")", "if", "func", "is", "None", "and", "arr", ".", "dtype", "!=", "out", ".", "dtype", ":", "func", "=", "_take_2d_multi_dict", ".", "get", "(", "(", "out", ".", "dtype", ".", "name", ",", "out", ".", "dtype", ".", "name", ")", ",", "None", ")", "if", "func", "is", "not", "None", ":", "func", "=", "_convert_wrapper", "(", "func", ",", "out", ".", "dtype", ")", "if", "func", "is", "None", ":", "def", "func", "(", "arr", ",", "indexer", ",", "out", ",", "fill_value", "=", "np", ".", "nan", ")", ":", "_take_2d_multi_object", "(", "arr", ",", "indexer", ",", "out", ",", "fill_value", "=", "fill_value", ",", "mask_info", "=", "mask_info", ")", "func", "(", "arr", ",", "indexer", ",", "out", "=", "out", ",", "fill_value", "=", "fill_value", ")", "return", "out" ]
Specialized Cython take which sets NaN values in one pass
[ "Specialized", "Cython", "take", "which", "sets", "NaN", "values", "in", "one", "pass" ]
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/algorithms.py#L1672-L1737
<|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: Specialized Cython take which sets NaN values in one pass ### Response: def take_2d_multi(arr, indexer, out=None, fill_value=np.nan, mask_info=None, allow_fill=True): """ Specialized Cython take which sets NaN values in one pass """ if indexer is None or (indexer[0] is None and indexer[1] is None): row_idx = np.arange(arr.shape[0], dtype=np.int64) col_idx = np.arange(arr.shape[1], dtype=np.int64) indexer = row_idx, col_idx dtype, fill_value = arr.dtype, arr.dtype.type() else: row_idx, col_idx = indexer if row_idx is None: row_idx = np.arange(arr.shape[0], dtype=np.int64) else: row_idx = ensure_int64(row_idx) if col_idx is None: col_idx = np.arange(arr.shape[1], dtype=np.int64) else: col_idx = ensure_int64(col_idx) indexer = row_idx, col_idx if not allow_fill: dtype, fill_value = arr.dtype, arr.dtype.type() mask_info = None, False else: # check for promotion based on types only (do this first because # it's faster than computing a mask) dtype, fill_value = maybe_promote(arr.dtype, fill_value) if dtype != arr.dtype and (out is None or out.dtype != dtype): # check if promotion is actually required based on indexer if mask_info is not None: (row_mask, col_mask), (row_needs, col_needs) = mask_info else: row_mask = row_idx == -1 col_mask = col_idx == -1 row_needs = row_mask.any() col_needs = col_mask.any() mask_info = (row_mask, col_mask), (row_needs, col_needs) if row_needs or col_needs: if out is not None and out.dtype != dtype: raise TypeError('Incompatible type for fill_value') else: # if not, then depromote, set fill_value to dummy # (it won't be used but we don't want the cython code # to crash when trying to cast it to dtype) dtype, fill_value = arr.dtype, arr.dtype.type() # at this point, it's guaranteed that dtype can hold both the arr values # and the fill_value if out is None: out_shape = len(row_idx), len(col_idx) out = np.empty(out_shape, dtype=dtype) func = _take_2d_multi_dict.get((arr.dtype.name, out.dtype.name), None) if func is None and arr.dtype != out.dtype: func = _take_2d_multi_dict.get((out.dtype.name, out.dtype.name), None) if func is not None: func = _convert_wrapper(func, out.dtype) if func is None: def func(arr, indexer, out, fill_value=np.nan): _take_2d_multi_object(arr, indexer, out, fill_value=fill_value, mask_info=mask_info) func(arr, indexer, out=out, fill_value=fill_value) return out <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 20989, 1534, 18221, 4690, 1935, 902, 7437, 33278, 2819, 304, 832, 1522, 271, 14711, 6075, 512, 755, 1935, 62, 17, 67, 26190, 11179, 11, 88316, 11, 704, 5980, 11, 5266, 3220, 17874, 38261, 11, 7056, 3186, 5980, 345, 1733, 2187, 31828, 3702, 997, 262, 3270, 262, 9984, 1534, 18221, 4690, 1935, 902, 7437, 33278, 2819, 304, 832, 1522, 198, 262, 3270, 262, 422, 88316, 374, 2290, 477, 320, 1275, 261, 58, 15, 60, 374, 2290, 323, 88316, 58, 16, 60, 374, 2290, 997, 286, 2872, 7406, 284, 2660, 25306, 11179, 7201, 58, 15, 1145, 13534, 17874, 6537, 1227, 340, 286, 1400, 7406, 284, 2660, 25306, 11179, 7201, 58, 16, 1145, 13534, 17874, 6537, 1227, 340, 286, 88316, 284, 2872, 7406, 11, 1400, 7406, 198, 286, 13534, 11, 5266, 3220, 284, 2961, 46855, 11, 2961, 46855, 4957, 746, 262, 775, 512, 286, 2872, 7406, 11, 1400, 7406, 284, 88316, 198, 286, 422, 2872, 7406, 374, 2290, 512, 310, 2872, 7406, 284, 2660, 25306, 11179, 7201, 58, 15, 1145, 13534, 17874, 6537, 1227, 340, 286, 775, 512, 310, 2872, 7406, 284, 6106, 4132, 1227, 7991, 7406, 340, 286, 422, 1400, 7406, 374, 2290, 512, 310, 1400, 7406, 284, 2660, 25306, 11179, 7201, 58, 16, 1145, 13534, 17874, 6537, 1227, 340, 286, 775, 512, 310, 1400, 7406, 284, 6106, 4132, 1227, 20184, 7406, 340, 286, 88316, 284, 2872, 7406, 11, 1400, 7406, 198, 286, 422, 539, 2187, 31828, 512, 310, 13534, 11, 5266, 3220, 284, 2961, 46855, 11, 2961, 46855, 4957, 746, 310, 7056, 3186, 284, 2290, 11, 3641, 198, 286, 775, 512, 310, 674, 1817, 369, 20862, 3196, 389, 4595, 1193, 320, 3055, 420, 1176, 1606, 198, 310, 674, 433, 596, 10819, 1109, 25213, 264, 7056, 340, 310, 13534, 11, 5266, 3220, 284, 7344, 48977, 1295, 11179, 46855, 11, 5266, 3220, 340, 310, 422, 13534, 976, 2961, 46855, 323, 320, 412, 374, 2290, 477, 704, 46855, 976, 13534, 997, 394, 674, 1817, 422, 20862, 374, 3604, 2631, 3196, 389, 88316, 198, 394, 422, 7056, 3186, 374, 539, 2290, 512, 504, 320, 654, 10204, 11, 1400, 10204, 705, 320, 654, 14250, 6910, 11, 1400, 14250, 6910, 8, 284, 7056, 3186, 198, 394, 775, 512, 504, 2872, 10204, 284, 2872, 7406, 624, 482, 16, 198, 504, 1400, 10204, 284, 1400, 7406, 624, 482, 16, 198, 504, 2872, 14250, 6910, 284, 2872, 10204, 30415, 746, 504, 1400, 14250, 6910, 284, 1400, 10204, 30415, 746, 504, 7056, 3186, 284, 320, 654, 10204, 11, 1400, 10204, 705, 320, 654, 14250, 6910, 11, 1400, 14250, 6910, 340, 394, 422, 2872, 14250, 6910, 477, 1400, 14250, 6910, 512, 504, 422, 704, 374, 539, 2290, 323, 704, 46855, 976, 13534, 512, 667, 4933, 26082, 493, 644, 35942, 955, 369, 5266, 3220, 1329, 394, 775, 512, 504, 674, 422, 539, 11, 1243, 2219, 442, 1295, 11, 743, 5266, 3220, 311, 17741, 198, 504, 674 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 20989, 1534, 18221, 4690, 1935, 902, 7437, 33278, 2819, 304, 832, 1522, 271, 14711, 6075, 512, 755, 1935, 62, 17, 67, 26190, 11179, 11, 88316, 11, 704, 5980, 11, 5266, 3220, 17874, 38261, 11, 7056, 3186, 5980, 345, 1733, 2187, 31828, 3702, 997, 262, 3270, 262, 9984, 1534, 18221, 4690, 1935, 902, 7437, 33278, 2819, 304, 832, 1522, 198, 262, 3270, 262, 422, 88316, 374, 2290, 477, 320, 1275, 261, 58, 15, 60, 374, 2290, 323, 88316, 58, 16, 60, 374, 2290, 997, 286, 2872, 7406, 284, 2660, 25306, 11179, 7201, 58, 15, 1145, 13534, 17874, 6537, 1227, 340, 286, 1400, 7406, 284, 2660, 25306, 11179, 7201, 58, 16, 1145, 13534, 17874, 6537, 1227, 340, 286, 88316, 284, 2872, 7406, 11, 1400, 7406, 198, 286, 13534, 11, 5266, 3220, 284, 2961, 46855, 11, 2961, 46855, 4957, 746, 262, 775, 512, 286, 2872, 7406, 11, 1400, 7406, 284, 88316, 198, 286, 422, 2872, 7406, 374, 2290, 512, 310, 2872, 7406, 284, 2660, 25306, 11179, 7201, 58, 15, 1145, 13534, 17874, 6537, 1227, 340, 286, 775, 512, 310, 2872, 7406, 284, 6106, 4132, 1227, 7991, 7406, 340, 286, 422, 1400, 7406, 374, 2290, 512, 310, 1400, 7406, 284, 2660, 25306, 11179, 7201, 58, 16, 1145, 13534, 17874, 6537, 1227, 340, 286, 775, 512, 310, 1400, 7406, 284, 6106, 4132, 1227, 20184, 7406, 340, 286, 88316, 284, 2872, 7406, 11, 1400, 7406, 198, 286, 422, 539, 2187, 31828, 512, 310, 13534, 11, 5266, 3220, 284, 2961, 46855, 11, 2961, 46855, 4957, 746, 310, 7056, 3186, 284, 2290, 11, 3641, 198, 286, 775, 512, 310, 674, 1817, 369, 20862, 3196, 389, 4595, 1193, 320, 3055, 420, 1176, 1606, 198, 310, 674, 433, 596, 10819, 1109, 25213, 264, 7056, 340, 310, 13534, 11, 5266, 3220, 284, 7344, 48977, 1295, 11179, 46855, 11, 5266, 3220, 340, 310, 422, 13534, 976, 2961, 46855, 323, 320, 412, 374, 2290, 477, 704, 46855, 976, 13534, 997, 394, 674, 1817, 422, 20862, 374, 3604, 2631, 3196, 389, 88316, 198, 394, 422, 7056, 3186, 374, 539, 2290, 512, 504, 320, 654, 10204, 11, 1400, 10204, 705, 320, 654, 14250, 6910, 11, 1400, 14250, 6910, 8, 284, 7056, 3186, 198, 394, 775, 512, 504, 2872, 10204, 284, 2872, 7406, 624, 482, 16, 198, 504, 1400, 10204, 284, 1400, 7406, 624, 482, 16, 198, 504, 2872, 14250, 6910, 284, 2872, 10204, 30415, 746, 504, 1400, 14250, 6910, 284, 1400, 10204, 30415, 746, 504, 7056, 3186, 284, 320, 654, 10204, 11, 1400, 10204, 705, 320, 654, 14250, 6910, 11, 1400, 14250, 6910, 340, 394, 422, 2872, 14250, 6910, 477, 1400, 14250, 6910, 512, 504, 422, 704, 374, 539, 2290, 323, 704, 46855, 976, 13534, 512, 667, 4933, 26082, 493, 644, 35942, 955, 369, 5266, 3220, 1329, 394, 775, 512, 504, 674, 422, 539, 11, 1243, 2219, 442, 1295, 11, 743, 5266, 3220, 311, 17741, 198, 504, 674 ]
ulule/django-linguist
linguist/mixins.py
ModelMixin.override_language
def override_language(self, language): """ Context manager to override the instance language. """ previous_language = self._linguist.language self._linguist.language = language yield self._linguist.language = previous_language
python
def override_language(self, language): """ Context manager to override the instance language. """ previous_language = self._linguist.language self._linguist.language = language yield self._linguist.language = previous_language
[ "def", "override_language", "(", "self", ",", "language", ")", ":", "previous_language", "=", "self", ".", "_linguist", ".", "language", "self", ".", "_linguist", ".", "language", "=", "language", "yield", "self", ".", "_linguist", ".", "language", "=", "previous_language" ]
Context manager to override the instance language.
[ "Context", "manager", "to", "override", "the", "instance", "language", "." ]
train
https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L435-L442
<|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: Context manager to override the instance language. ### Response: def override_language(self, language): """ Context manager to override the instance language. """ previous_language = self._linguist.language self._linguist.language = language yield self._linguist.language = previous_language <|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, 2014, 6783, 311, 2882, 279, 2937, 4221, 382, 14711, 6075, 512, 755, 2882, 30121, 1214, 11, 4221, 997, 286, 3270, 286, 9805, 6783, 311, 2882, 279, 2937, 4221, 627, 286, 3270, 286, 3766, 30121, 284, 659, 1462, 2785, 84, 380, 32733, 198, 286, 659, 1462, 2785, 84, 380, 32733, 284, 4221, 198, 286, 7692, 198, 286, 659, 1462, 2785, 84, 380, 32733, 284, 3766, 30121, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2014, 6783, 311, 2882, 279, 2937, 4221, 382, 14711, 6075, 512, 755, 2882, 30121, 1214, 11, 4221, 997, 286, 3270, 286, 9805, 6783, 311, 2882, 279, 2937, 4221, 627, 286, 3270, 286, 3766, 30121, 284, 659, 1462, 2785, 84, 380, 32733, 198, 286, 659, 1462, 2785, 84, 380, 32733, 284, 4221, 198, 286, 7692, 198, 286, 659, 1462, 2785, 84, 380, 32733, 284, 3766, 30121, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
DreamLab/VmShepherd
src/vmshepherd/iaas/openstack_driver.py
OpenStackDriver.initialize
async def initialize(self): ''' Initialize static data like images and flavores and set it as object property ''' flavors = await self._list_flavors() images = await self._list_images() self.flavors_map = bidict() self.images_map = bidict() self.images_details = {} for flavor in flavors: self.flavors_map.put(flavor['id'], flavor['name'], on_dup_key='OVERWRITE', on_dup_val='OVERWRITE') for image in images: # @TODO filetes : # @TODO filtering by owner # if hasattr(image, 'owner_id') and image.owner_id in self.config['image_owner_ids']: # @TODO enable filtering by tag # if 'lastest' in image.tags: self.images_details[image['id']] = { 'name': image['name'], 'created_at': image['created_at'], 'latest': 'latest' in image['tags'] } self.images_map.put(image['id'], image['name'], on_dup_key='OVERWRITE', on_dup_val='OVERWRITE')
python
async def initialize(self): ''' Initialize static data like images and flavores and set it as object property ''' flavors = await self._list_flavors() images = await self._list_images() self.flavors_map = bidict() self.images_map = bidict() self.images_details = {} for flavor in flavors: self.flavors_map.put(flavor['id'], flavor['name'], on_dup_key='OVERWRITE', on_dup_val='OVERWRITE') for image in images: # @TODO filetes : # @TODO filtering by owner # if hasattr(image, 'owner_id') and image.owner_id in self.config['image_owner_ids']: # @TODO enable filtering by tag # if 'lastest' in image.tags: self.images_details[image['id']] = { 'name': image['name'], 'created_at': image['created_at'], 'latest': 'latest' in image['tags'] } self.images_map.put(image['id'], image['name'], on_dup_key='OVERWRITE', on_dup_val='OVERWRITE')
[ "async", "def", "initialize", "(", "self", ")", ":", "flavors", "=", "await", "self", ".", "_list_flavors", "(", ")", "images", "=", "await", "self", ".", "_list_images", "(", ")", "self", ".", "flavors_map", "=", "bidict", "(", ")", "self", ".", "images_map", "=", "bidict", "(", ")", "self", ".", "images_details", "=", "{", "}", "for", "flavor", "in", "flavors", ":", "self", ".", "flavors_map", ".", "put", "(", "flavor", "[", "'id'", "]", ",", "flavor", "[", "'name'", "]", ",", "on_dup_key", "=", "'OVERWRITE'", ",", "on_dup_val", "=", "'OVERWRITE'", ")", "for", "image", "in", "images", ":", "# @TODO filetes :", "# @TODO filtering by owner", "# if hasattr(image, 'owner_id') and image.owner_id in self.config['image_owner_ids']:", "# @TODO enable filtering by tag", "# if 'lastest' in image.tags:", "self", ".", "images_details", "[", "image", "[", "'id'", "]", "]", "=", "{", "'name'", ":", "image", "[", "'name'", "]", ",", "'created_at'", ":", "image", "[", "'created_at'", "]", ",", "'latest'", ":", "'latest'", "in", "image", "[", "'tags'", "]", "}", "self", ".", "images_map", ".", "put", "(", "image", "[", "'id'", "]", ",", "image", "[", "'name'", "]", ",", "on_dup_key", "=", "'OVERWRITE'", ",", "on_dup_val", "=", "'OVERWRITE'", ")" ]
Initialize static data like images and flavores and set it as object property
[ "Initialize", "static", "data", "like", "images", "and", "flavores", "and", "set", "it", "as", "object", "property" ]
train
https://github.com/DreamLab/VmShepherd/blob/709a412c372b897d53808039c5c64a8b69c12c8d/src/vmshepherd/iaas/openstack_driver.py#L54-L79
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Initialize static data like images and flavores and set it as object property ### Response: async def initialize(self): ''' Initialize static data like images and flavores and set it as object property ''' flavors = await self._list_flavors() images = await self._list_images() self.flavors_map = bidict() self.images_map = bidict() self.images_details = {} for flavor in flavors: self.flavors_map.put(flavor['id'], flavor['name'], on_dup_key='OVERWRITE', on_dup_val='OVERWRITE') for image in images: # @TODO filetes : # @TODO filtering by owner # if hasattr(image, 'owner_id') and image.owner_id in self.config['image_owner_ids']: # @TODO enable filtering by tag # if 'lastest' in image.tags: self.images_details[image['id']] = { 'name': image['name'], 'created_at': image['created_at'], 'latest': 'latest' in image['tags'] } self.images_map.put(image['id'], image['name'], on_dup_key='OVERWRITE', on_dup_val='OVERWRITE') <|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, 10130, 1118, 828, 1093, 5448, 323, 18779, 4692, 323, 743, 433, 439, 1665, 3424, 271, 14711, 6075, 512, 7847, 711, 9656, 1214, 997, 286, 11414, 260, 9185, 1118, 828, 1093, 5448, 323, 18779, 4692, 323, 743, 433, 439, 1665, 3424, 198, 286, 11414, 286, 32523, 284, 2597, 659, 1462, 1638, 5191, 51585, 746, 286, 5448, 284, 2597, 659, 1462, 1638, 13586, 2892, 286, 659, 8265, 51585, 5489, 284, 14435, 858, 746, 286, 659, 33311, 5489, 284, 14435, 858, 746, 286, 659, 33311, 13563, 284, 10294, 286, 369, 17615, 304, 32523, 512, 310, 659, 8265, 51585, 5489, 3681, 50847, 3372, 681, 307, 4181, 17615, 681, 609, 4181, 389, 53032, 3173, 1151, 50205, 33881, 518, 389, 53032, 6320, 1151, 50205, 33881, 4713, 286, 369, 2217, 304, 5448, 512, 310, 674, 571, 15074, 1052, 2392, 6394, 310, 674, 571, 15074, 30770, 555, 6506, 198, 310, 674, 422, 32156, 10281, 11, 364, 8281, 851, 873, 323, 220, 2217, 26772, 851, 304, 659, 5539, 681, 1843, 30127, 8237, 18888, 310, 674, 220, 571, 15074, 7431, 30770, 555, 4877, 198, 310, 674, 422, 364, 4354, 478, 6, 304, 2217, 33608, 512, 310, 659, 33311, 13563, 93926, 681, 307, 31940, 284, 341, 394, 364, 609, 1232, 2217, 681, 609, 4479, 394, 364, 7266, 3837, 1232, 2217, 681, 7266, 3837, 4479, 394, 364, 19911, 1232, 364, 19911, 6, 304, 2217, 681, 14412, 4532, 310, 457, 310, 659, 33311, 5489, 3681, 10281, 681, 307, 4181, 2217, 681, 609, 4181, 389, 53032, 3173, 1151, 50205, 33881, 518, 389, 53032, 6320, 1151, 50205, 33881, 1329, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10130, 1118, 828, 1093, 5448, 323, 18779, 4692, 323, 743, 433, 439, 1665, 3424, 271, 14711, 6075, 512, 7847, 711, 9656, 1214, 997, 286, 11414, 260, 9185, 1118, 828, 1093, 5448, 323, 18779, 4692, 323, 743, 433, 439, 1665, 3424, 198, 286, 11414, 286, 32523, 284, 2597, 659, 1462, 1638, 5191, 51585, 746, 286, 5448, 284, 2597, 659, 1462, 1638, 13586, 2892, 286, 659, 8265, 51585, 5489, 284, 14435, 858, 746, 286, 659, 33311, 5489, 284, 14435, 858, 746, 286, 659, 33311, 13563, 284, 10294, 286, 369, 17615, 304, 32523, 512, 310, 659, 8265, 51585, 5489, 3681, 50847, 3372, 681, 307, 4181, 17615, 681, 609, 4181, 389, 53032, 3173, 1151, 50205, 33881, 518, 389, 53032, 6320, 1151, 50205, 33881, 4713, 286, 369, 2217, 304, 5448, 512, 310, 674, 571, 15074, 1052, 2392, 6394, 310, 674, 571, 15074, 30770, 555, 6506, 198, 310, 674, 422, 32156, 10281, 11, 364, 8281, 851, 873, 323, 220, 2217, 26772, 851, 304, 659, 5539, 681, 1843, 30127, 8237, 18888, 310, 674, 220, 571, 15074, 7431, 30770, 555, 4877, 198, 310, 674, 422, 364, 4354, 478, 6, 304, 2217, 33608, 512, 310, 659, 33311, 13563, 93926, 681, 307, 31940, 284, 341, 394, 364, 609, 1232, 2217, 681, 609, 4479, 394, 364, 7266, 3837, 1232, 2217, 681, 7266, 3837, 4479, 394, 364, 19911, 1232, 364, 19911, 6, 304, 2217, 681, 14412, 4532, 310, 457, 310, 659, 33311, 5489, 3681, 10281, 681, 307, 4181, 2217, 681, 609, 4181, 389, 53032, 3173, 1151, 50205, 33881, 518, 389, 53032, 6320, 1151, 50205, 33881, 1329, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
MartinThoma/hwrt
hwrt/datasets/inkml.py
read
def read(filepath): """ Read a single InkML file Parameters ---------- filepath : string path to the (readable) InkML file Returns ------- HandwrittenData : The parsed InkML file as a HandwrittenData object """ import xml.etree.ElementTree root = xml.etree.ElementTree.parse(filepath).getroot() # Get the raw data recording = [] strokes = sorted(root.findall('{http://www.w3.org/2003/InkML}trace'), key=lambda child: int(child.attrib['id'])) time = 0 for stroke in strokes: stroke = stroke.text.strip().split(',') stroke = [point.strip().split(' ') for point in stroke] if len(stroke[0]) == 3: stroke = [{'x': float(x), 'y': float(y), 'time': float(t)} for x, y, t in stroke] else: stroke = [{'x': float(x), 'y': float(y)} for x, y in stroke] new_stroke = [] for p in stroke: new_stroke.append({'x': p['x'], 'y': p['y'], 'time': time}) time += 20 stroke = new_stroke time += 200 recording.append(stroke) # Get LaTeX formula_in_latex = None annotations = root.findall('{http://www.w3.org/2003/InkML}annotation') for annotation in annotations: if annotation.attrib['type'] == 'truth': formula_in_latex = annotation.text hw = handwritten_data.HandwrittenData(json.dumps(recording), formula_in_latex=formula_in_latex) for annotation in annotations: if annotation.attrib['type'] == 'writer': hw.writer = annotation.text elif annotation.attrib['type'] == 'category': hw.category = annotation.text elif annotation.attrib['type'] == 'expression': hw.expression = annotation.text # Get segmentation segmentation = [] trace_groups = root.findall('{http://www.w3.org/2003/InkML}traceGroup') if len(trace_groups) != 1: raise Exception('Malformed InkML', ('Exactly 1 top level traceGroup expected, found %i. ' '(%s) - probably no ground truth?') % (len(trace_groups), filepath)) trace_group = trace_groups[0] symbol_stream = [] # has to be consistent with segmentation for tg in trace_group.findall('{http://www.w3.org/2003/InkML}traceGroup'): annotations = tg.findall('{http://www.w3.org/2003/InkML}annotation') if len(annotations) != 1: raise ValueError("%i annotations found for '%s'." % (len(annotations), filepath)) db_id = formula_to_dbid(normalize_symbol_name(annotations[0].text)) symbol_stream.append(db_id) trace_views = tg.findall('{http://www.w3.org/2003/InkML}traceView') symbol = [] for traceView in trace_views: symbol.append(int(traceView.attrib['traceDataRef'])) segmentation.append(symbol) hw.symbol_stream = symbol_stream hw.segmentation = segmentation _flat_seg = [stroke2 for symbol2 in segmentation for stroke2 in symbol2] assert len(_flat_seg) == len(recording), \ ("Segmentation had length %i, but recording has %i strokes (%s)" % (len(_flat_seg), len(recording), filepath)) assert set(_flat_seg) == set(range(len(_flat_seg))) hw.inkml = beautify_xml(filepath) hw.filepath = filepath return hw
python
def read(filepath): """ Read a single InkML file Parameters ---------- filepath : string path to the (readable) InkML file Returns ------- HandwrittenData : The parsed InkML file as a HandwrittenData object """ import xml.etree.ElementTree root = xml.etree.ElementTree.parse(filepath).getroot() # Get the raw data recording = [] strokes = sorted(root.findall('{http://www.w3.org/2003/InkML}trace'), key=lambda child: int(child.attrib['id'])) time = 0 for stroke in strokes: stroke = stroke.text.strip().split(',') stroke = [point.strip().split(' ') for point in stroke] if len(stroke[0]) == 3: stroke = [{'x': float(x), 'y': float(y), 'time': float(t)} for x, y, t in stroke] else: stroke = [{'x': float(x), 'y': float(y)} for x, y in stroke] new_stroke = [] for p in stroke: new_stroke.append({'x': p['x'], 'y': p['y'], 'time': time}) time += 20 stroke = new_stroke time += 200 recording.append(stroke) # Get LaTeX formula_in_latex = None annotations = root.findall('{http://www.w3.org/2003/InkML}annotation') for annotation in annotations: if annotation.attrib['type'] == 'truth': formula_in_latex = annotation.text hw = handwritten_data.HandwrittenData(json.dumps(recording), formula_in_latex=formula_in_latex) for annotation in annotations: if annotation.attrib['type'] == 'writer': hw.writer = annotation.text elif annotation.attrib['type'] == 'category': hw.category = annotation.text elif annotation.attrib['type'] == 'expression': hw.expression = annotation.text # Get segmentation segmentation = [] trace_groups = root.findall('{http://www.w3.org/2003/InkML}traceGroup') if len(trace_groups) != 1: raise Exception('Malformed InkML', ('Exactly 1 top level traceGroup expected, found %i. ' '(%s) - probably no ground truth?') % (len(trace_groups), filepath)) trace_group = trace_groups[0] symbol_stream = [] # has to be consistent with segmentation for tg in trace_group.findall('{http://www.w3.org/2003/InkML}traceGroup'): annotations = tg.findall('{http://www.w3.org/2003/InkML}annotation') if len(annotations) != 1: raise ValueError("%i annotations found for '%s'." % (len(annotations), filepath)) db_id = formula_to_dbid(normalize_symbol_name(annotations[0].text)) symbol_stream.append(db_id) trace_views = tg.findall('{http://www.w3.org/2003/InkML}traceView') symbol = [] for traceView in trace_views: symbol.append(int(traceView.attrib['traceDataRef'])) segmentation.append(symbol) hw.symbol_stream = symbol_stream hw.segmentation = segmentation _flat_seg = [stroke2 for symbol2 in segmentation for stroke2 in symbol2] assert len(_flat_seg) == len(recording), \ ("Segmentation had length %i, but recording has %i strokes (%s)" % (len(_flat_seg), len(recording), filepath)) assert set(_flat_seg) == set(range(len(_flat_seg))) hw.inkml = beautify_xml(filepath) hw.filepath = filepath return hw
[ "def", "read", "(", "filepath", ")", ":", "import", "xml", ".", "etree", ".", "ElementTree", "root", "=", "xml", ".", "etree", ".", "ElementTree", ".", "parse", "(", "filepath", ")", ".", "getroot", "(", ")", "# Get the raw data", "recording", "=", "[", "]", "strokes", "=", "sorted", "(", "root", ".", "findall", "(", "'{http://www.w3.org/2003/InkML}trace'", ")", ",", "key", "=", "lambda", "child", ":", "int", "(", "child", ".", "attrib", "[", "'id'", "]", ")", ")", "time", "=", "0", "for", "stroke", "in", "strokes", ":", "stroke", "=", "stroke", ".", "text", ".", "strip", "(", ")", ".", "split", "(", "','", ")", "stroke", "=", "[", "point", ".", "strip", "(", ")", ".", "split", "(", "' '", ")", "for", "point", "in", "stroke", "]", "if", "len", "(", "stroke", "[", "0", "]", ")", "==", "3", ":", "stroke", "=", "[", "{", "'x'", ":", "float", "(", "x", ")", ",", "'y'", ":", "float", "(", "y", ")", ",", "'time'", ":", "float", "(", "t", ")", "}", "for", "x", ",", "y", ",", "t", "in", "stroke", "]", "else", ":", "stroke", "=", "[", "{", "'x'", ":", "float", "(", "x", ")", ",", "'y'", ":", "float", "(", "y", ")", "}", "for", "x", ",", "y", "in", "stroke", "]", "new_stroke", "=", "[", "]", "for", "p", "in", "stroke", ":", "new_stroke", ".", "append", "(", "{", "'x'", ":", "p", "[", "'x'", "]", ",", "'y'", ":", "p", "[", "'y'", "]", ",", "'time'", ":", "time", "}", ")", "time", "+=", "20", "stroke", "=", "new_stroke", "time", "+=", "200", "recording", ".", "append", "(", "stroke", ")", "# Get LaTeX", "formula_in_latex", "=", "None", "annotations", "=", "root", ".", "findall", "(", "'{http://www.w3.org/2003/InkML}annotation'", ")", "for", "annotation", "in", "annotations", ":", "if", "annotation", ".", "attrib", "[", "'type'", "]", "==", "'truth'", ":", "formula_in_latex", "=", "annotation", ".", "text", "hw", "=", "handwritten_data", ".", "HandwrittenData", "(", "json", ".", "dumps", "(", "recording", ")", ",", "formula_in_latex", "=", "formula_in_latex", ")", "for", "annotation", "in", "annotations", ":", "if", "annotation", ".", "attrib", "[", "'type'", "]", "==", "'writer'", ":", "hw", ".", "writer", "=", "annotation", ".", "text", "elif", "annotation", ".", "attrib", "[", "'type'", "]", "==", "'category'", ":", "hw", ".", "category", "=", "annotation", ".", "text", "elif", "annotation", ".", "attrib", "[", "'type'", "]", "==", "'expression'", ":", "hw", ".", "expression", "=", "annotation", ".", "text", "# Get segmentation", "segmentation", "=", "[", "]", "trace_groups", "=", "root", ".", "findall", "(", "'{http://www.w3.org/2003/InkML}traceGroup'", ")", "if", "len", "(", "trace_groups", ")", "!=", "1", ":", "raise", "Exception", "(", "'Malformed InkML'", ",", "(", "'Exactly 1 top level traceGroup expected, found %i. '", "'(%s) - probably no ground truth?'", ")", "%", "(", "len", "(", "trace_groups", ")", ",", "filepath", ")", ")", "trace_group", "=", "trace_groups", "[", "0", "]", "symbol_stream", "=", "[", "]", "# has to be consistent with segmentation", "for", "tg", "in", "trace_group", ".", "findall", "(", "'{http://www.w3.org/2003/InkML}traceGroup'", ")", ":", "annotations", "=", "tg", ".", "findall", "(", "'{http://www.w3.org/2003/InkML}annotation'", ")", "if", "len", "(", "annotations", ")", "!=", "1", ":", "raise", "ValueError", "(", "\"%i annotations found for '%s'.\"", "%", "(", "len", "(", "annotations", ")", ",", "filepath", ")", ")", "db_id", "=", "formula_to_dbid", "(", "normalize_symbol_name", "(", "annotations", "[", "0", "]", ".", "text", ")", ")", "symbol_stream", ".", "append", "(", "db_id", ")", "trace_views", "=", "tg", ".", "findall", "(", "'{http://www.w3.org/2003/InkML}traceView'", ")", "symbol", "=", "[", "]", "for", "traceView", "in", "trace_views", ":", "symbol", ".", "append", "(", "int", "(", "traceView", ".", "attrib", "[", "'traceDataRef'", "]", ")", ")", "segmentation", ".", "append", "(", "symbol", ")", "hw", ".", "symbol_stream", "=", "symbol_stream", "hw", ".", "segmentation", "=", "segmentation", "_flat_seg", "=", "[", "stroke2", "for", "symbol2", "in", "segmentation", "for", "stroke2", "in", "symbol2", "]", "assert", "len", "(", "_flat_seg", ")", "==", "len", "(", "recording", ")", ",", "(", "\"Segmentation had length %i, but recording has %i strokes (%s)\"", "%", "(", "len", "(", "_flat_seg", ")", ",", "len", "(", "recording", ")", ",", "filepath", ")", ")", "assert", "set", "(", "_flat_seg", ")", "==", "set", "(", "range", "(", "len", "(", "_flat_seg", ")", ")", ")", "hw", ".", "inkml", "=", "beautify_xml", "(", "filepath", ")", "hw", ".", "filepath", "=", "filepath", "return", "hw" ]
Read a single InkML file Parameters ---------- filepath : string path to the (readable) InkML file Returns ------- HandwrittenData : The parsed InkML file as a HandwrittenData object
[ "Read", "a", "single", "InkML", "file" ]
train
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/datasets/inkml.py#L70-L155
<|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: Read a single InkML file Parameters ---------- filepath : string path to the (readable) InkML file Returns ------- HandwrittenData : The parsed InkML file as a HandwrittenData object ### Response: def read(filepath): """ Read a single InkML file Parameters ---------- filepath : string path to the (readable) InkML file Returns ------- HandwrittenData : The parsed InkML file as a HandwrittenData object """ import xml.etree.ElementTree root = xml.etree.ElementTree.parse(filepath).getroot() # Get the raw data recording = [] strokes = sorted(root.findall('{http://www.w3.org/2003/InkML}trace'), key=lambda child: int(child.attrib['id'])) time = 0 for stroke in strokes: stroke = stroke.text.strip().split(',') stroke = [point.strip().split(' ') for point in stroke] if len(stroke[0]) == 3: stroke = [{'x': float(x), 'y': float(y), 'time': float(t)} for x, y, t in stroke] else: stroke = [{'x': float(x), 'y': float(y)} for x, y in stroke] new_stroke = [] for p in stroke: new_stroke.append({'x': p['x'], 'y': p['y'], 'time': time}) time += 20 stroke = new_stroke time += 200 recording.append(stroke) # Get LaTeX formula_in_latex = None annotations = root.findall('{http://www.w3.org/2003/InkML}annotation') for annotation in annotations: if annotation.attrib['type'] == 'truth': formula_in_latex = annotation.text hw = handwritten_data.HandwrittenData(json.dumps(recording), formula_in_latex=formula_in_latex) for annotation in annotations: if annotation.attrib['type'] == 'writer': hw.writer = annotation.text elif annotation.attrib['type'] == 'category': hw.category = annotation.text elif annotation.attrib['type'] == 'expression': hw.expression = annotation.text # Get segmentation segmentation = [] trace_groups = root.findall('{http://www.w3.org/2003/InkML}traceGroup') if len(trace_groups) != 1: raise Exception('Malformed InkML', ('Exactly 1 top level traceGroup expected, found %i. ' '(%s) - probably no ground truth?') % (len(trace_groups), filepath)) trace_group = trace_groups[0] symbol_stream = [] # has to be consistent with segmentation for tg in trace_group.findall('{http://www.w3.org/2003/InkML}traceGroup'): annotations = tg.findall('{http://www.w3.org/2003/InkML}annotation') if len(annotations) != 1: raise ValueError("%i annotations found for '%s'." % (len(annotations), filepath)) db_id = formula_to_dbid(normalize_symbol_name(annotations[0].text)) symbol_stream.append(db_id) trace_views = tg.findall('{http://www.w3.org/2003/InkML}traceView') symbol = [] for traceView in trace_views: symbol.append(int(traceView.attrib['traceDataRef'])) segmentation.append(symbol) hw.symbol_stream = symbol_stream hw.segmentation = segmentation _flat_seg = [stroke2 for symbol2 in segmentation for stroke2 in symbol2] assert len(_flat_seg) == len(recording), \ ("Segmentation had length %i, but recording has %i strokes (%s)" % (len(_flat_seg), len(recording), filepath)) assert set(_flat_seg) == set(range(len(_flat_seg))) hw.inkml = beautify_xml(filepath) hw.filepath = filepath return hw <|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, 4518, 264, 3254, 42183, 2735, 1052, 271, 262, 13831, 198, 262, 31423, 262, 27146, 551, 925, 198, 286, 1853, 311, 279, 320, 888, 481, 8, 42183, 2735, 1052, 271, 262, 5295, 198, 262, 39707, 262, 8704, 26650, 1061, 6394, 286, 578, 16051, 42183, 2735, 1052, 439, 264, 8704, 26650, 1061, 1665, 271, 14711, 6075, 512, 755, 1373, 35893, 997, 262, 3270, 262, 4557, 264, 3254, 42183, 2735, 1052, 271, 262, 13831, 198, 262, 31423, 262, 27146, 551, 925, 198, 286, 1853, 311, 279, 320, 888, 481, 8, 42183, 2735, 1052, 271, 262, 5295, 198, 262, 39707, 262, 8704, 26650, 1061, 6394, 286, 578, 16051, 42183, 2735, 1052, 439, 264, 8704, 26650, 1061, 1665, 198, 262, 3270, 262, 1179, 8562, 39932, 770, 20743, 6670, 198, 262, 3789, 284, 8562, 39932, 770, 20743, 6670, 4736, 35893, 570, 456, 2959, 2892, 262, 674, 2175, 279, 7257, 828, 198, 262, 14975, 284, 4260, 262, 53572, 284, 10839, 9387, 38533, 34540, 1277, 1129, 2185, 1444, 18, 2726, 14, 1049, 18, 14, 644, 74, 2735, 92, 15417, 3379, 3909, 1401, 28604, 1716, 25, 528, 18272, 49542, 681, 307, 20084, 262, 892, 284, 220, 15, 198, 262, 369, 12943, 304, 53572, 512, 286, 12943, 284, 12943, 2858, 17624, 1020, 7105, 62365, 286, 12943, 284, 510, 2837, 17624, 1020, 7105, 493, 17081, 369, 1486, 304, 12943, 933, 286, 422, 2479, 6019, 7593, 58, 15, 2526, 624, 220, 18, 512, 310, 12943, 284, 62208, 87, 1232, 2273, 2120, 705, 364, 88, 1232, 2273, 7166, 705, 364, 1712, 1232, 2273, 1175, 10792, 2611, 369, 865, 11, 379, 11, 259, 304, 12943, 933, 286, 775, 512, 310, 12943, 284, 62208, 87, 1232, 2273, 2120, 705, 364, 88, 1232, 2273, 7166, 9317, 369, 865, 11, 379, 304, 12943, 933, 310, 502, 1284, 7593, 284, 4260, 310, 369, 281, 304, 12943, 512, 394, 502, 1284, 7593, 2102, 15597, 87, 1232, 281, 681, 87, 4181, 364, 88, 1232, 281, 681, 88, 4181, 364, 1712, 1232, 892, 3602, 394, 892, 1447, 220, 508, 198, 310, 12943, 284, 502, 1284, 7593, 198, 310, 892, 1447, 220, 1049, 198, 286, 14975, 2102, 6019, 7593, 696, 262, 674, 2175, 99013, 198, 262, 15150, 1265, 27266, 327, 284, 2290, 198, 262, 33307, 284, 3789, 38533, 34540, 1277, 1129, 2185, 1444, 18, 2726, 14, 1049, 18, 14, 644, 74, 2735, 92, 25701, 1329, 262, 369, 21917, 304, 33307, 512, 286, 422, 21917, 49542, 681, 1337, 663, 624, 364, 59677, 3730, 310, 15150, 1265, 27266, 327, 284, 21917, 2858, 198, 262, 32356, 284, 99489, 1807, 36408, 26650, 1061, 9488, 22252, 21285, 2745, 1350, 10724, 15150, 1265, 27266, 327, 52474, 5724, 1265, 27266, 327, 340, 262, 369, 21917, 304, 33307, 512, 286, 422, 21917, 49542, 681, 1337, 663, 624, 364, 18688, 3730, 310, 32356, 31932, 284, 21917, 2858, 198, 286, 4508, 21917, 49542, 681, 1337, 663, 624, 364, 5588, 3730, 310, 32356, 18898, 284, 21917 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 4518, 264, 3254, 42183, 2735, 1052, 271, 262, 13831, 198, 262, 31423, 262, 27146, 551, 925, 198, 286, 1853, 311, 279, 320, 888, 481, 8, 42183, 2735, 1052, 271, 262, 5295, 198, 262, 39707, 262, 8704, 26650, 1061, 6394, 286, 578, 16051, 42183, 2735, 1052, 439, 264, 8704, 26650, 1061, 1665, 271, 14711, 6075, 512, 755, 1373, 35893, 997, 262, 3270, 262, 4557, 264, 3254, 42183, 2735, 1052, 271, 262, 13831, 198, 262, 31423, 262, 27146, 551, 925, 198, 286, 1853, 311, 279, 320, 888, 481, 8, 42183, 2735, 1052, 271, 262, 5295, 198, 262, 39707, 262, 8704, 26650, 1061, 6394, 286, 578, 16051, 42183, 2735, 1052, 439, 264, 8704, 26650, 1061, 1665, 198, 262, 3270, 262, 1179, 8562, 39932, 770, 20743, 6670, 198, 262, 3789, 284, 8562, 39932, 770, 20743, 6670, 4736, 35893, 570, 456, 2959, 2892, 262, 674, 2175, 279, 7257, 828, 198, 262, 14975, 284, 4260, 262, 53572, 284, 10839, 9387, 38533, 34540, 1277, 1129, 2185, 1444, 18, 2726, 14, 1049, 18, 14, 644, 74, 2735, 92, 15417, 3379, 3909, 1401, 28604, 1716, 25, 528, 18272, 49542, 681, 307, 20084, 262, 892, 284, 220, 15, 198, 262, 369, 12943, 304, 53572, 512, 286, 12943, 284, 12943, 2858, 17624, 1020, 7105, 62365, 286, 12943, 284, 510, 2837, 17624, 1020, 7105, 493, 17081, 369, 1486, 304, 12943, 933, 286, 422, 2479, 6019, 7593, 58, 15, 2526, 624, 220, 18, 512, 310, 12943, 284, 62208, 87, 1232, 2273, 2120, 705, 364, 88, 1232, 2273, 7166, 705, 364, 1712, 1232, 2273, 1175, 10792, 2611, 369, 865, 11, 379, 11, 259, 304, 12943, 933, 286, 775, 512, 310, 12943, 284, 62208, 87, 1232, 2273, 2120, 705, 364, 88, 1232, 2273, 7166, 9317, 369, 865, 11, 379, 304, 12943, 933, 310, 502, 1284, 7593, 284, 4260, 310, 369, 281, 304, 12943, 512, 394, 502, 1284, 7593, 2102, 15597, 87, 1232, 281, 681, 87, 4181, 364, 88, 1232, 281, 681, 88, 4181, 364, 1712, 1232, 892, 3602, 394, 892, 1447, 220, 508, 198, 310, 12943, 284, 502, 1284, 7593, 198, 310, 892, 1447, 220, 1049, 198, 286, 14975, 2102, 6019, 7593, 696, 262, 674, 2175, 99013, 198, 262, 15150, 1265, 27266, 327, 284, 2290, 198, 262, 33307, 284, 3789, 38533, 34540, 1277, 1129, 2185, 1444, 18, 2726, 14, 1049, 18, 14, 644, 74, 2735, 92, 25701, 1329, 262, 369, 21917, 304, 33307, 512, 286, 422, 21917, 49542, 681, 1337, 663, 624, 364, 59677, 3730, 310, 15150, 1265, 27266, 327, 284, 21917, 2858, 198, 262, 32356, 284, 99489, 1807, 36408, 26650, 1061, 9488, 22252, 21285, 2745, 1350, 10724, 15150, 1265, 27266, 327, 52474, 5724, 1265, 27266, 327, 340, 262, 369, 21917, 304, 33307, 512, 286, 422, 21917, 49542, 681, 1337, 663, 624, 364, 18688, 3730, 310, 32356, 31932, 284, 21917, 2858, 198, 286, 4508, 21917, 49542, 681, 1337, 663, 624, 364, 5588, 3730, 310, 32356, 18898, 284, 21917 ]
gwastro/pycbc
pycbc/events/coinc.py
LiveCoincTimeslideBackgroundEstimator.add_singles
def add_singles(self, results): """Add singles to the bacckground estimate and find candidates Parameters ---------- results: dict of arrays Dictionary of dictionaries indexed by ifo and keys such as 'snr', 'chisq', etc. The specific format it determined by the LiveBatchMatchedFilter class. Returns ------- coinc_results: dict of arrays A dictionary of arrays containing the coincident results. """ # Let's see how large everything is logging.info('BKG Coincs %s stored %s bytes', len(self.coincs), self.coincs.nbytes) # If there are no results just return valid_ifos = [k for k in results.keys() if results[k] and k in self.ifos] if len(valid_ifos) == 0: return {} # Add single triggers to the internal buffer self._add_singles_to_buffer(results, ifos=valid_ifos) # Calculate zerolag and background coincidences _, coinc_results = self._find_coincs(results, ifos=valid_ifos) # record if a coinc is possible in this chunk if len(valid_ifos) == 2: coinc_results['coinc_possible'] = True return coinc_results
python
def add_singles(self, results): """Add singles to the bacckground estimate and find candidates Parameters ---------- results: dict of arrays Dictionary of dictionaries indexed by ifo and keys such as 'snr', 'chisq', etc. The specific format it determined by the LiveBatchMatchedFilter class. Returns ------- coinc_results: dict of arrays A dictionary of arrays containing the coincident results. """ # Let's see how large everything is logging.info('BKG Coincs %s stored %s bytes', len(self.coincs), self.coincs.nbytes) # If there are no results just return valid_ifos = [k for k in results.keys() if results[k] and k in self.ifos] if len(valid_ifos) == 0: return {} # Add single triggers to the internal buffer self._add_singles_to_buffer(results, ifos=valid_ifos) # Calculate zerolag and background coincidences _, coinc_results = self._find_coincs(results, ifos=valid_ifos) # record if a coinc is possible in this chunk if len(valid_ifos) == 2: coinc_results['coinc_possible'] = True return coinc_results
[ "def", "add_singles", "(", "self", ",", "results", ")", ":", "# Let's see how large everything is", "logging", ".", "info", "(", "'BKG Coincs %s stored %s bytes'", ",", "len", "(", "self", ".", "coincs", ")", ",", "self", ".", "coincs", ".", "nbytes", ")", "# If there are no results just return", "valid_ifos", "=", "[", "k", "for", "k", "in", "results", ".", "keys", "(", ")", "if", "results", "[", "k", "]", "and", "k", "in", "self", ".", "ifos", "]", "if", "len", "(", "valid_ifos", ")", "==", "0", ":", "return", "{", "}", "# Add single triggers to the internal buffer", "self", ".", "_add_singles_to_buffer", "(", "results", ",", "ifos", "=", "valid_ifos", ")", "# Calculate zerolag and background coincidences", "_", ",", "coinc_results", "=", "self", ".", "_find_coincs", "(", "results", ",", "ifos", "=", "valid_ifos", ")", "# record if a coinc is possible in this chunk", "if", "len", "(", "valid_ifos", ")", "==", "2", ":", "coinc_results", "[", "'coinc_possible'", "]", "=", "True", "return", "coinc_results" ]
Add singles to the bacckground estimate and find candidates Parameters ---------- results: dict of arrays Dictionary of dictionaries indexed by ifo and keys such as 'snr', 'chisq', etc. The specific format it determined by the LiveBatchMatchedFilter class. Returns ------- coinc_results: dict of arrays A dictionary of arrays containing the coincident results.
[ "Add", "singles", "to", "the", "bacckground", "estimate", "and", "find", "candidates" ]
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/events/coinc.py#L1097-L1130
<|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 singles to the bacckground estimate and find candidates Parameters ---------- results: dict of arrays Dictionary of dictionaries indexed by ifo and keys such as 'snr', 'chisq', etc. The specific format it determined by the LiveBatchMatchedFilter class. Returns ------- coinc_results: dict of arrays A dictionary of arrays containing the coincident results. ### Response: def add_singles(self, results): """Add singles to the bacckground estimate and find candidates Parameters ---------- results: dict of arrays Dictionary of dictionaries indexed by ifo and keys such as 'snr', 'chisq', etc. The specific format it determined by the LiveBatchMatchedFilter class. Returns ------- coinc_results: dict of arrays A dictionary of arrays containing the coincident results. """ # Let's see how large everything is logging.info('BKG Coincs %s stored %s bytes', len(self.coincs), self.coincs.nbytes) # If there are no results just return valid_ifos = [k for k in results.keys() if results[k] and k in self.ifos] if len(valid_ifos) == 0: return {} # Add single triggers to the internal buffer self._add_singles_to_buffer(results, ifos=valid_ifos) # Calculate zerolag and background coincidences _, coinc_results = self._find_coincs(results, ifos=valid_ifos) # record if a coinc is possible in this chunk if len(valid_ifos) == 2: coinc_results['coinc_possible'] = True return coinc_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, 2261, 17845, 311, 279, 80980, 377, 1993, 16430, 323, 1505, 11426, 271, 286, 13831, 198, 286, 31423, 286, 3135, 25, 6587, 315, 18893, 198, 310, 10685, 315, 58614, 31681, 555, 422, 78, 323, 7039, 1778, 439, 364, 9810, 81, 756, 310, 364, 331, 285, 80, 518, 5099, 13, 578, 3230, 3645, 433, 11075, 555, 279, 198, 310, 11406, 21753, 8495, 291, 5750, 538, 382, 286, 5295, 198, 286, 39707, 286, 23828, 13888, 25, 6587, 315, 18893, 198, 310, 362, 11240, 315, 18893, 8649, 279, 23828, 1748, 3135, 382, 14711, 6075, 512, 755, 923, 646, 50703, 1214, 11, 3135, 997, 286, 4304, 2261, 17845, 311, 279, 80980, 377, 1993, 16430, 323, 1505, 11426, 271, 286, 13831, 198, 286, 31423, 286, 3135, 25, 6587, 315, 18893, 198, 310, 10685, 315, 58614, 31681, 555, 422, 78, 323, 7039, 1778, 439, 364, 9810, 81, 756, 310, 364, 331, 285, 80, 518, 5099, 13, 578, 3230, 3645, 433, 11075, 555, 279, 198, 310, 11406, 21753, 8495, 291, 5750, 538, 382, 286, 5295, 198, 286, 39707, 286, 23828, 13888, 25, 6587, 315, 18893, 198, 310, 362, 11240, 315, 18893, 8649, 279, 23828, 1748, 3135, 627, 286, 3270, 286, 674, 6914, 596, 1518, 1268, 3544, 4395, 374, 198, 286, 8558, 5506, 493, 33, 44016, 27328, 4942, 1034, 82, 9967, 1034, 82, 5943, 756, 3909, 2479, 1214, 81599, 4942, 705, 659, 81599, 4942, 1276, 9848, 696, 286, 674, 1442, 1070, 527, 912, 3135, 1120, 471, 198, 286, 2764, 11366, 437, 284, 510, 74, 369, 597, 304, 3135, 9301, 368, 422, 3135, 6874, 60, 323, 597, 304, 659, 36531, 437, 933, 286, 422, 2479, 42629, 11366, 437, 8, 624, 220, 15, 25, 471, 10294, 286, 674, 2758, 3254, 31854, 311, 279, 5419, 4240, 198, 286, 659, 1462, 723, 646, 50703, 2401, 7932, 21118, 11, 422, 437, 28, 1930, 11366, 437, 696, 286, 674, 21157, 77278, 337, 351, 323, 4092, 23828, 85096, 198, 286, 8523, 23828, 13888, 284, 659, 1462, 3990, 76818, 4942, 21118, 11, 422, 437, 28, 1930, 11366, 437, 696, 286, 674, 3335, 422, 264, 23828, 374, 3284, 304, 420, 12143, 198, 286, 422, 2479, 42629, 11366, 437, 8, 624, 220, 17, 512, 310, 23828, 13888, 681, 1030, 2910, 72344, 663, 284, 3082, 271, 286, 471, 23828, 13888, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 17845, 311, 279, 80980, 377, 1993, 16430, 323, 1505, 11426, 271, 286, 13831, 198, 286, 31423, 286, 3135, 25, 6587, 315, 18893, 198, 310, 10685, 315, 58614, 31681, 555, 422, 78, 323, 7039, 1778, 439, 364, 9810, 81, 756, 310, 364, 331, 285, 80, 518, 5099, 13, 578, 3230, 3645, 433, 11075, 555, 279, 198, 310, 11406, 21753, 8495, 291, 5750, 538, 382, 286, 5295, 198, 286, 39707, 286, 23828, 13888, 25, 6587, 315, 18893, 198, 310, 362, 11240, 315, 18893, 8649, 279, 23828, 1748, 3135, 382, 14711, 6075, 512, 755, 923, 646, 50703, 1214, 11, 3135, 997, 286, 4304, 2261, 17845, 311, 279, 80980, 377, 1993, 16430, 323, 1505, 11426, 271, 286, 13831, 198, 286, 31423, 286, 3135, 25, 6587, 315, 18893, 198, 310, 10685, 315, 58614, 31681, 555, 422, 78, 323, 7039, 1778, 439, 364, 9810, 81, 756, 310, 364, 331, 285, 80, 518, 5099, 13, 578, 3230, 3645, 433, 11075, 555, 279, 198, 310, 11406, 21753, 8495, 291, 5750, 538, 382, 286, 5295, 198, 286, 39707, 286, 23828, 13888, 25, 6587, 315, 18893, 198, 310, 362, 11240, 315, 18893, 8649, 279, 23828, 1748, 3135, 627, 286, 3270, 286, 674, 6914, 596, 1518, 1268, 3544, 4395, 374, 198, 286, 8558, 5506, 493, 33, 44016, 27328, 4942, 1034, 82, 9967, 1034, 82, 5943, 756, 3909, 2479, 1214, 81599, 4942, 705, 659, 81599, 4942, 1276, 9848, 696, 286, 674, 1442, 1070, 527, 912, 3135, 1120, 471, 198, 286, 2764, 11366, 437, 284, 510, 74, 369, 597, 304, 3135, 9301, 368, 422, 3135, 6874, 60, 323, 597, 304, 659, 36531, 437, 933, 286, 422, 2479, 42629, 11366, 437, 8, 624, 220, 15, 25, 471, 10294, 286, 674, 2758, 3254, 31854, 311, 279, 5419, 4240, 198, 286, 659, 1462, 723, 646, 50703, 2401, 7932, 21118, 11, 422, 437, 28, 1930, 11366, 437, 696, 286, 674, 21157, 77278, 337, 351, 323, 4092, 23828, 85096, 198, 286, 8523, 23828, 13888, 284, 659, 1462, 3990, 76818, 4942, 21118, 11, 422, 437, 28, 1930, 11366, 437, 696, 286, 674, 3335, 422, 264, 23828, 374, 3284, 304, 420, 12143, 198, 286, 422, 2479, 42629, 11366, 437, 8, 624, 220, 17, 512, 310, 23828, 13888, 681, 1030, 2910, 72344, 663, 284, 3082, 271, 286, 471, 23828, 13888, 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 ]
mojaie/chorus
chorus/v2000writer.py
mols_to_file
def mols_to_file(mols, path): """Save molecules to the SDFile format file Args: mols: list of molecule objects path: file path to save """ with open(path, 'w') as f: f.write(mols_to_text(mols))
python
def mols_to_file(mols, path): """Save molecules to the SDFile format file Args: mols: list of molecule objects path: file path to save """ with open(path, 'w') as f: f.write(mols_to_text(mols))
[ "def", "mols_to_file", "(", "mols", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "mols_to_text", "(", "mols", ")", ")" ]
Save molecules to the SDFile format file Args: mols: list of molecule objects path: file path to save
[ "Save", "molecules", "to", "the", "SDFile", "format", "file" ]
train
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000writer.py#L130-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: Save molecules to the SDFile format file Args: mols: list of molecule objects path: file path to save ### Response: def mols_to_file(mols, path): """Save molecules to the SDFile format file Args: mols: list of molecule objects path: file path to save """ with open(path, 'w') as f: f.write(mols_to_text(mols)) <|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, 35715, 311, 279, 8189, 1738, 3645, 1052, 271, 262, 18161, 512, 286, 296, 3145, 25, 1160, 315, 43030, 6302, 198, 286, 1853, 25, 1052, 1853, 311, 3665, 271, 14711, 6075, 512, 755, 296, 3145, 2401, 2517, 1278, 3145, 11, 1853, 997, 262, 4304, 8960, 35715, 311, 279, 8189, 1738, 3645, 1052, 271, 262, 18161, 512, 286, 296, 3145, 25, 1160, 315, 43030, 6302, 198, 286, 1853, 25, 1052, 1853, 311, 3665, 198, 262, 3270, 262, 449, 1825, 5698, 11, 364, 86, 873, 439, 282, 512, 286, 282, 3921, 1278, 3145, 2401, 4424, 1278, 3145, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 35715, 311, 279, 8189, 1738, 3645, 1052, 271, 262, 18161, 512, 286, 296, 3145, 25, 1160, 315, 43030, 6302, 198, 286, 1853, 25, 1052, 1853, 311, 3665, 271, 14711, 6075, 512, 755, 296, 3145, 2401, 2517, 1278, 3145, 11, 1853, 997, 262, 4304, 8960, 35715, 311, 279, 8189, 1738, 3645, 1052, 271, 262, 18161, 512, 286, 296, 3145, 25, 1160, 315, 43030, 6302, 198, 286, 1853, 25, 1052, 1853, 311, 3665, 198, 262, 3270, 262, 449, 1825, 5698, 11, 364, 86, 873, 439, 282, 512, 286, 282, 3921, 1278, 3145, 2401, 4424, 1278, 3145, 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 ]
blockstack/blockstack-core
blockstack/lib/atlas.py
atlasdb_init
def atlasdb_init( path, zonefile_dir, db, peer_seeds, peer_blacklist, recover=False, validate=False): """ Set up the atlas node: * create the db if it doesn't exist * go through all the names and verify that we have the *current* zonefiles * if we don't, queue them for fetching. * set up the peer db @db should be an instance of BlockstackDB @initial_peers should be a list of URLs Return the newly-initialized peer table """ global ATLASDB_SQL peer_table = {} if os.path.exists( path ): log.debug("Atlas DB exists at %s" % path) con = atlasdb_open( path ) atlasdb_last_block = atlasdb_get_lastblock( con=con, path=path ) if atlasdb_last_block is None: atlasdb_last_block = FIRST_BLOCK_MAINNET log.debug("Synchronize zonefiles from %s to %s" % (atlasdb_last_block, db.lastblock) ) atlasdb_queue_zonefiles( con, db, atlasdb_last_block, zonefile_dir, recover=recover, validate=validate) log.debug("Refreshing seed peers") for peer in peer_seeds: # forcibly add seed peers atlasdb_add_peer( peer, con=con, peer_table=peer_table, ping_on_evict=False ) # re-try fetching zonefiles from storage if we don't have them yet atlasdb_reset_zonefile_tried_storage( con=con, path=path ) # load up peer table from the db log.debug("Loading peer table") peer_table = atlasdb_load_peer_table( con=con, path=path ) # cache zonefile inventory and count atlasdb_cache_zonefile_info( con=con ) con.close() else: log.debug("Initializing Atlas DB at %s" % path) lines = [l + ";" for l in ATLASDB_SQL.split(";")] con = sqlite3.connect( path, isolation_level=None ) for line in lines: db_query_execute(con, line, ()) con.row_factory = atlasdb_row_factory # populate from db log.debug("Queuing all zonefiles") atlasdb_queue_zonefiles( con, db, FIRST_BLOCK_MAINNET, zonefile_dir, recover=recover, validate=validate) log.debug("Adding seed peers") for peer in peer_seeds: atlasdb_add_peer( peer, con=con, peer_table=peer_table ) atlasdb_cache_zonefile_info( con=con ) con.close() log.debug("peer_table: {}".format(peer_table.keys())) # whitelist and blacklist for peer_url in peer_seeds: host, port = url_to_host_port( peer_url ) peer_hostport = "%s:%s" % (host, port) if peer_hostport not in peer_table.keys(): atlasdb_add_peer( peer_hostport, path=path, peer_table=peer_table ) log.debug("peer_table: {}".format(peer_table.keys())) peer_table[peer_hostport]['whitelisted'] = True for peer_url in peer_blacklist: host, port = url_to_host_port( peer_url ) peer_hostport = "%s:%s" % (host, port) if peer_hostport not in peer_table.keys(): atlasdb_add_peer( peer_hostport, path=path, peer_table=peer_table ) log.debug("peer_table: {}".format(peer_table.keys())) peer_table[peer_hostport]['blacklisted'] = True return peer_table
python
def atlasdb_init( path, zonefile_dir, db, peer_seeds, peer_blacklist, recover=False, validate=False): """ Set up the atlas node: * create the db if it doesn't exist * go through all the names and verify that we have the *current* zonefiles * if we don't, queue them for fetching. * set up the peer db @db should be an instance of BlockstackDB @initial_peers should be a list of URLs Return the newly-initialized peer table """ global ATLASDB_SQL peer_table = {} if os.path.exists( path ): log.debug("Atlas DB exists at %s" % path) con = atlasdb_open( path ) atlasdb_last_block = atlasdb_get_lastblock( con=con, path=path ) if atlasdb_last_block is None: atlasdb_last_block = FIRST_BLOCK_MAINNET log.debug("Synchronize zonefiles from %s to %s" % (atlasdb_last_block, db.lastblock) ) atlasdb_queue_zonefiles( con, db, atlasdb_last_block, zonefile_dir, recover=recover, validate=validate) log.debug("Refreshing seed peers") for peer in peer_seeds: # forcibly add seed peers atlasdb_add_peer( peer, con=con, peer_table=peer_table, ping_on_evict=False ) # re-try fetching zonefiles from storage if we don't have them yet atlasdb_reset_zonefile_tried_storage( con=con, path=path ) # load up peer table from the db log.debug("Loading peer table") peer_table = atlasdb_load_peer_table( con=con, path=path ) # cache zonefile inventory and count atlasdb_cache_zonefile_info( con=con ) con.close() else: log.debug("Initializing Atlas DB at %s" % path) lines = [l + ";" for l in ATLASDB_SQL.split(";")] con = sqlite3.connect( path, isolation_level=None ) for line in lines: db_query_execute(con, line, ()) con.row_factory = atlasdb_row_factory # populate from db log.debug("Queuing all zonefiles") atlasdb_queue_zonefiles( con, db, FIRST_BLOCK_MAINNET, zonefile_dir, recover=recover, validate=validate) log.debug("Adding seed peers") for peer in peer_seeds: atlasdb_add_peer( peer, con=con, peer_table=peer_table ) atlasdb_cache_zonefile_info( con=con ) con.close() log.debug("peer_table: {}".format(peer_table.keys())) # whitelist and blacklist for peer_url in peer_seeds: host, port = url_to_host_port( peer_url ) peer_hostport = "%s:%s" % (host, port) if peer_hostport not in peer_table.keys(): atlasdb_add_peer( peer_hostport, path=path, peer_table=peer_table ) log.debug("peer_table: {}".format(peer_table.keys())) peer_table[peer_hostport]['whitelisted'] = True for peer_url in peer_blacklist: host, port = url_to_host_port( peer_url ) peer_hostport = "%s:%s" % (host, port) if peer_hostport not in peer_table.keys(): atlasdb_add_peer( peer_hostport, path=path, peer_table=peer_table ) log.debug("peer_table: {}".format(peer_table.keys())) peer_table[peer_hostport]['blacklisted'] = True return peer_table
[ "def", "atlasdb_init", "(", "path", ",", "zonefile_dir", ",", "db", ",", "peer_seeds", ",", "peer_blacklist", ",", "recover", "=", "False", ",", "validate", "=", "False", ")", ":", "global", "ATLASDB_SQL", "peer_table", "=", "{", "}", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "log", ".", "debug", "(", "\"Atlas DB exists at %s\"", "%", "path", ")", "con", "=", "atlasdb_open", "(", "path", ")", "atlasdb_last_block", "=", "atlasdb_get_lastblock", "(", "con", "=", "con", ",", "path", "=", "path", ")", "if", "atlasdb_last_block", "is", "None", ":", "atlasdb_last_block", "=", "FIRST_BLOCK_MAINNET", "log", ".", "debug", "(", "\"Synchronize zonefiles from %s to %s\"", "%", "(", "atlasdb_last_block", ",", "db", ".", "lastblock", ")", ")", "atlasdb_queue_zonefiles", "(", "con", ",", "db", ",", "atlasdb_last_block", ",", "zonefile_dir", ",", "recover", "=", "recover", ",", "validate", "=", "validate", ")", "log", ".", "debug", "(", "\"Refreshing seed peers\"", ")", "for", "peer", "in", "peer_seeds", ":", "# forcibly add seed peers", "atlasdb_add_peer", "(", "peer", ",", "con", "=", "con", ",", "peer_table", "=", "peer_table", ",", "ping_on_evict", "=", "False", ")", "# re-try fetching zonefiles from storage if we don't have them yet", "atlasdb_reset_zonefile_tried_storage", "(", "con", "=", "con", ",", "path", "=", "path", ")", "# load up peer table from the db", "log", ".", "debug", "(", "\"Loading peer table\"", ")", "peer_table", "=", "atlasdb_load_peer_table", "(", "con", "=", "con", ",", "path", "=", "path", ")", "# cache zonefile inventory and count", "atlasdb_cache_zonefile_info", "(", "con", "=", "con", ")", "con", ".", "close", "(", ")", "else", ":", "log", ".", "debug", "(", "\"Initializing Atlas DB at %s\"", "%", "path", ")", "lines", "=", "[", "l", "+", "\";\"", "for", "l", "in", "ATLASDB_SQL", ".", "split", "(", "\";\"", ")", "]", "con", "=", "sqlite3", ".", "connect", "(", "path", ",", "isolation_level", "=", "None", ")", "for", "line", "in", "lines", ":", "db_query_execute", "(", "con", ",", "line", ",", "(", ")", ")", "con", ".", "row_factory", "=", "atlasdb_row_factory", "# populate from db", "log", ".", "debug", "(", "\"Queuing all zonefiles\"", ")", "atlasdb_queue_zonefiles", "(", "con", ",", "db", ",", "FIRST_BLOCK_MAINNET", ",", "zonefile_dir", ",", "recover", "=", "recover", ",", "validate", "=", "validate", ")", "log", ".", "debug", "(", "\"Adding seed peers\"", ")", "for", "peer", "in", "peer_seeds", ":", "atlasdb_add_peer", "(", "peer", ",", "con", "=", "con", ",", "peer_table", "=", "peer_table", ")", "atlasdb_cache_zonefile_info", "(", "con", "=", "con", ")", "con", ".", "close", "(", ")", "log", ".", "debug", "(", "\"peer_table: {}\"", ".", "format", "(", "peer_table", ".", "keys", "(", ")", ")", ")", "# whitelist and blacklist", "for", "peer_url", "in", "peer_seeds", ":", "host", ",", "port", "=", "url_to_host_port", "(", "peer_url", ")", "peer_hostport", "=", "\"%s:%s\"", "%", "(", "host", ",", "port", ")", "if", "peer_hostport", "not", "in", "peer_table", ".", "keys", "(", ")", ":", "atlasdb_add_peer", "(", "peer_hostport", ",", "path", "=", "path", ",", "peer_table", "=", "peer_table", ")", "log", ".", "debug", "(", "\"peer_table: {}\"", ".", "format", "(", "peer_table", ".", "keys", "(", ")", ")", ")", "peer_table", "[", "peer_hostport", "]", "[", "'whitelisted'", "]", "=", "True", "for", "peer_url", "in", "peer_blacklist", ":", "host", ",", "port", "=", "url_to_host_port", "(", "peer_url", ")", "peer_hostport", "=", "\"%s:%s\"", "%", "(", "host", ",", "port", ")", "if", "peer_hostport", "not", "in", "peer_table", ".", "keys", "(", ")", ":", "atlasdb_add_peer", "(", "peer_hostport", ",", "path", "=", "path", ",", "peer_table", "=", "peer_table", ")", "log", ".", "debug", "(", "\"peer_table: {}\"", ".", "format", "(", "peer_table", ".", "keys", "(", ")", ")", ")", "peer_table", "[", "peer_hostport", "]", "[", "'blacklisted'", "]", "=", "True", "return", "peer_table" ]
Set up the atlas node: * create the db if it doesn't exist * go through all the names and verify that we have the *current* zonefiles * if we don't, queue them for fetching. * set up the peer db @db should be an instance of BlockstackDB @initial_peers should be a list of URLs Return the newly-initialized peer table
[ "Set", "up", "the", "atlas", "node", ":", "*", "create", "the", "db", "if", "it", "doesn", "t", "exist", "*", "go", "through", "all", "the", "names", "and", "verify", "that", "we", "have", "the", "*", "current", "*", "zonefiles", "*", "if", "we", "don", "t", "queue", "them", "for", "fetching", ".", "*", "set", "up", "the", "peer", "db" ]
train
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/atlas.py#L1260-L1352
<|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 up the atlas node: * create the db if it doesn't exist * go through all the names and verify that we have the *current* zonefiles * if we don't, queue them for fetching. * set up the peer db @db should be an instance of BlockstackDB @initial_peers should be a list of URLs Return the newly-initialized peer table ### Response: def atlasdb_init( path, zonefile_dir, db, peer_seeds, peer_blacklist, recover=False, validate=False): """ Set up the atlas node: * create the db if it doesn't exist * go through all the names and verify that we have the *current* zonefiles * if we don't, queue them for fetching. * set up the peer db @db should be an instance of BlockstackDB @initial_peers should be a list of URLs Return the newly-initialized peer table """ global ATLASDB_SQL peer_table = {} if os.path.exists( path ): log.debug("Atlas DB exists at %s" % path) con = atlasdb_open( path ) atlasdb_last_block = atlasdb_get_lastblock( con=con, path=path ) if atlasdb_last_block is None: atlasdb_last_block = FIRST_BLOCK_MAINNET log.debug("Synchronize zonefiles from %s to %s" % (atlasdb_last_block, db.lastblock) ) atlasdb_queue_zonefiles( con, db, atlasdb_last_block, zonefile_dir, recover=recover, validate=validate) log.debug("Refreshing seed peers") for peer in peer_seeds: # forcibly add seed peers atlasdb_add_peer( peer, con=con, peer_table=peer_table, ping_on_evict=False ) # re-try fetching zonefiles from storage if we don't have them yet atlasdb_reset_zonefile_tried_storage( con=con, path=path ) # load up peer table from the db log.debug("Loading peer table") peer_table = atlasdb_load_peer_table( con=con, path=path ) # cache zonefile inventory and count atlasdb_cache_zonefile_info( con=con ) con.close() else: log.debug("Initializing Atlas DB at %s" % path) lines = [l + ";" for l in ATLASDB_SQL.split(";")] con = sqlite3.connect( path, isolation_level=None ) for line in lines: db_query_execute(con, line, ()) con.row_factory = atlasdb_row_factory # populate from db log.debug("Queuing all zonefiles") atlasdb_queue_zonefiles( con, db, FIRST_BLOCK_MAINNET, zonefile_dir, recover=recover, validate=validate) log.debug("Adding seed peers") for peer in peer_seeds: atlasdb_add_peer( peer, con=con, peer_table=peer_table ) atlasdb_cache_zonefile_info( con=con ) con.close() log.debug("peer_table: {}".format(peer_table.keys())) # whitelist and blacklist for peer_url in peer_seeds: host, port = url_to_host_port( peer_url ) peer_hostport = "%s:%s" % (host, port) if peer_hostport not in peer_table.keys(): atlasdb_add_peer( peer_hostport, path=path, peer_table=peer_table ) log.debug("peer_table: {}".format(peer_table.keys())) peer_table[peer_hostport]['whitelisted'] = True for peer_url in peer_blacklist: host, port = url_to_host_port( peer_url ) peer_hostport = "%s:%s" % (host, port) if peer_hostport not in peer_table.keys(): atlasdb_add_peer( peer_hostport, path=path, peer_table=peer_table ) log.debug("peer_table: {}".format(peer_table.keys())) peer_table[peer_hostport]['blacklisted'] = True return peer_table <|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, 709, 279, 62032, 2494, 512, 262, 353, 1893, 279, 3000, 422, 433, 3250, 956, 3073, 198, 262, 353, 733, 1555, 682, 279, 5144, 323, 10356, 430, 584, 617, 279, 353, 3311, 9, 10353, 7346, 198, 262, 353, 422, 584, 1541, 956, 11, 7325, 1124, 369, 45334, 627, 262, 353, 743, 709, 279, 14734, 3000, 271, 262, 571, 2042, 1288, 387, 459, 2937, 315, 8527, 7848, 3590, 198, 262, 571, 9613, 37467, 388, 1288, 387, 264, 1160, 315, 36106, 271, 262, 3494, 279, 13945, 69128, 14734, 2007, 271, 14711, 6075, 512, 755, 62032, 2042, 6265, 7, 1853, 11, 10353, 1213, 4432, 11, 3000, 11, 14734, 3537, 6910, 11, 14734, 41372, 1638, 11, 11993, 5725, 11, 9788, 5725, 997, 262, 3270, 262, 2638, 709, 279, 62032, 2494, 512, 262, 353, 1893, 279, 3000, 422, 433, 3250, 956, 3073, 198, 262, 353, 733, 1555, 682, 279, 5144, 323, 10356, 430, 584, 617, 279, 353, 3311, 9, 10353, 7346, 198, 262, 353, 422, 584, 1541, 956, 11, 7325, 1124, 369, 45334, 627, 262, 353, 743, 709, 279, 14734, 3000, 271, 262, 571, 2042, 1288, 387, 459, 2937, 315, 8527, 7848, 3590, 198, 262, 571, 9613, 37467, 388, 1288, 387, 264, 1160, 315, 36106, 271, 262, 3494, 279, 13945, 69128, 14734, 2007, 198, 262, 3270, 1084, 262, 3728, 7520, 61549, 3590, 47725, 271, 262, 14734, 5350, 284, 10294, 262, 422, 2709, 3960, 12347, 7, 1853, 21711, 286, 1515, 8042, 446, 62216, 6078, 6866, 520, 1034, 82, 1, 1034, 1853, 340, 1827, 286, 390, 284, 62032, 2042, 11563, 7, 1853, 1763, 286, 62032, 2042, 12473, 7258, 284, 62032, 2042, 3138, 12473, 4677, 7, 390, 28, 444, 11, 1853, 83040, 1763, 286, 422, 62032, 2042, 12473, 7258, 374, 2290, 512, 310, 62032, 2042, 12473, 7258, 284, 35913, 19281, 33376, 15734, 271, 286, 1515, 8042, 446, 50, 53887, 10353, 7346, 505, 1034, 82, 311, 1034, 82, 1, 1034, 320, 266, 14833, 2042, 12473, 7258, 11, 3000, 9288, 4677, 8, 5235, 286, 62032, 2042, 11078, 29792, 7346, 7, 390, 11, 3000, 11, 62032, 2042, 12473, 7258, 11, 10353, 1213, 4432, 11, 11993, 50752, 3773, 11, 9788, 28, 7212, 696, 286, 1515, 8042, 446, 52504, 10533, 26081, 1158, 286, 369, 14734, 304, 14734, 3537, 6910, 512, 310, 674, 74923, 923, 10533, 26081, 198, 310, 62032, 2042, 2962, 46259, 7, 14734, 11, 390, 28, 444, 11, 14734, 5350, 28, 16944, 5350, 11, 31098, 4570, 44813, 858, 5725, 5235, 286, 674, 312, 12, 1568, 45334, 10353, 7346, 505, 5942, 422, 584, 1541, 956, 617, 1124, 3686, 198, 286, 62032, 2042, 19520, 29792, 1213, 3631, 1142, 24192, 7, 390, 28, 444, 11, 1853, 83040, 5235, 286, 674, 2865, 709, 14734, 2007, 505, 279, 3000, 198, 286, 1515, 8042, 446, 8746, 14734, 2007, 1158, 286, 14734, 5350, 284, 62032, 2042, 12693, 46259, 5350, 7, 390, 28, 444, 11, 1853, 83040, 5235, 286, 674, 6636, 10353, 1213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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 709, 279, 62032, 2494, 512, 262, 353, 1893, 279, 3000, 422, 433, 3250, 956, 3073, 198, 262, 353, 733, 1555, 682, 279, 5144, 323, 10356, 430, 584, 617, 279, 353, 3311, 9, 10353, 7346, 198, 262, 353, 422, 584, 1541, 956, 11, 7325, 1124, 369, 45334, 627, 262, 353, 743, 709, 279, 14734, 3000, 271, 262, 571, 2042, 1288, 387, 459, 2937, 315, 8527, 7848, 3590, 198, 262, 571, 9613, 37467, 388, 1288, 387, 264, 1160, 315, 36106, 271, 262, 3494, 279, 13945, 69128, 14734, 2007, 271, 14711, 6075, 512, 755, 62032, 2042, 6265, 7, 1853, 11, 10353, 1213, 4432, 11, 3000, 11, 14734, 3537, 6910, 11, 14734, 41372, 1638, 11, 11993, 5725, 11, 9788, 5725, 997, 262, 3270, 262, 2638, 709, 279, 62032, 2494, 512, 262, 353, 1893, 279, 3000, 422, 433, 3250, 956, 3073, 198, 262, 353, 733, 1555, 682, 279, 5144, 323, 10356, 430, 584, 617, 279, 353, 3311, 9, 10353, 7346, 198, 262, 353, 422, 584, 1541, 956, 11, 7325, 1124, 369, 45334, 627, 262, 353, 743, 709, 279, 14734, 3000, 271, 262, 571, 2042, 1288, 387, 459, 2937, 315, 8527, 7848, 3590, 198, 262, 571, 9613, 37467, 388, 1288, 387, 264, 1160, 315, 36106, 271, 262, 3494, 279, 13945, 69128, 14734, 2007, 198, 262, 3270, 1084, 262, 3728, 7520, 61549, 3590, 47725, 271, 262, 14734, 5350, 284, 10294, 262, 422, 2709, 3960, 12347, 7, 1853, 21711, 286, 1515, 8042, 446, 62216, 6078, 6866, 520, 1034, 82, 1, 1034, 1853, 340, 1827, 286, 390, 284, 62032, 2042, 11563, 7, 1853, 1763, 286, 62032, 2042, 12473, 7258, 284, 62032, 2042, 3138, 12473, 4677, 7, 390, 28, 444, 11, 1853, 83040, 1763, 286, 422, 62032, 2042, 12473, 7258, 374, 2290, 512, 310, 62032, 2042, 12473, 7258, 284, 35913, 19281, 33376, 15734, 271, 286, 1515, 8042, 446, 50, 53887, 10353, 7346, 505, 1034, 82, 311, 1034, 82, 1, 1034, 320, 266, 14833, 2042, 12473, 7258, 11, 3000, 9288, 4677, 8, 5235, 286, 62032, 2042, 11078, 29792, 7346, 7, 390, 11, 3000, 11, 62032, 2042, 12473, 7258, 11, 10353, 1213, 4432, 11, 11993, 50752, 3773, 11, 9788, 28, 7212, 696, 286, 1515, 8042, 446, 52504, 10533, 26081, 1158, 286, 369, 14734, 304, 14734, 3537, 6910, 512, 310, 674, 74923, 923, 10533, 26081, 198, 310, 62032, 2042, 2962, 46259, 7, 14734, 11, 390, 28, 444, 11, 14734, 5350, 28, 16944, 5350, 11, 31098, 4570, 44813, 858, 5725, 5235, 286, 674, 312, 12, 1568, 45334, 10353, 7346, 505, 5942, 422, 584, 1541, 956, 617, 1124, 3686, 198, 286, 62032, 2042, 19520, 29792, 1213, 3631, 1142, 24192, 7, 390, 28, 444, 11, 1853, 83040, 5235, 286, 674, 2865, 709, 14734, 2007, 505, 279, 3000, 198, 286, 1515, 8042, 446, 8746, 14734, 2007, 1158, 286, 14734, 5350, 284, 62032, 2042, 12693, 46259, 5350, 7, 390, 28, 444, 11, 1853, 83040, 5235, 286, 674, 6636, 10353, 1213 ]
matousc89/padasip
padasip/filters/base_filter.py
AdaptiveFilter.init_weights
def init_weights(self, w, n=-1): """ This function initialises the adaptive weights of the filter. **Args:** * `w` : initial weights of filter. Possible values are: * array with initial weights (1 dimensional array) of filter size * "random" : create random weights * "zeros" : create zero value weights **Kwargs:** * `n` : size of filter (int) - number of filter coefficients. **Returns:** * `y` : output value (float) calculated from input array. """ if n == -1: n = self.n if type(w) == str: if w == "random": w = np.random.normal(0, 0.5, n) elif w == "zeros": w = np.zeros(n) else: raise ValueError('Impossible to understand the w') elif len(w) == n: try: w = np.array(w, dtype="float64") except: raise ValueError('Impossible to understand the w') else: raise ValueError('Impossible to understand the w') self.w = w
python
def init_weights(self, w, n=-1): """ This function initialises the adaptive weights of the filter. **Args:** * `w` : initial weights of filter. Possible values are: * array with initial weights (1 dimensional array) of filter size * "random" : create random weights * "zeros" : create zero value weights **Kwargs:** * `n` : size of filter (int) - number of filter coefficients. **Returns:** * `y` : output value (float) calculated from input array. """ if n == -1: n = self.n if type(w) == str: if w == "random": w = np.random.normal(0, 0.5, n) elif w == "zeros": w = np.zeros(n) else: raise ValueError('Impossible to understand the w') elif len(w) == n: try: w = np.array(w, dtype="float64") except: raise ValueError('Impossible to understand the w') else: raise ValueError('Impossible to understand the w') self.w = w
[ "def", "init_weights", "(", "self", ",", "w", ",", "n", "=", "-", "1", ")", ":", "if", "n", "==", "-", "1", ":", "n", "=", "self", ".", "n", "if", "type", "(", "w", ")", "==", "str", ":", "if", "w", "==", "\"random\"", ":", "w", "=", "np", ".", "random", ".", "normal", "(", "0", ",", "0.5", ",", "n", ")", "elif", "w", "==", "\"zeros\"", ":", "w", "=", "np", ".", "zeros", "(", "n", ")", "else", ":", "raise", "ValueError", "(", "'Impossible to understand the w'", ")", "elif", "len", "(", "w", ")", "==", "n", ":", "try", ":", "w", "=", "np", ".", "array", "(", "w", ",", "dtype", "=", "\"float64\"", ")", "except", ":", "raise", "ValueError", "(", "'Impossible to understand the w'", ")", "else", ":", "raise", "ValueError", "(", "'Impossible to understand the w'", ")", "self", ".", "w", "=", "w" ]
This function initialises the adaptive weights of the filter. **Args:** * `w` : initial weights of filter. Possible values are: * array with initial weights (1 dimensional array) of filter size * "random" : create random weights * "zeros" : create zero value weights **Kwargs:** * `n` : size of filter (int) - number of filter coefficients. **Returns:** * `y` : output value (float) calculated from input array.
[ "This", "function", "initialises", "the", "adaptive", "weights", "of", "the", "filter", "." ]
train
https://github.com/matousc89/padasip/blob/c969eadd7fa181a84da0554d737fc13c6450d16f/padasip/filters/base_filter.py#L16-L56
<|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 initialises the adaptive weights of the filter. **Args:** * `w` : initial weights of filter. Possible values are: * array with initial weights (1 dimensional array) of filter size * "random" : create random weights * "zeros" : create zero value weights **Kwargs:** * `n` : size of filter (int) - number of filter coefficients. **Returns:** * `y` : output value (float) calculated from input array. ### Response: def init_weights(self, w, n=-1): """ This function initialises the adaptive weights of the filter. **Args:** * `w` : initial weights of filter. Possible values are: * array with initial weights (1 dimensional array) of filter size * "random" : create random weights * "zeros" : create zero value weights **Kwargs:** * `n` : size of filter (int) - number of filter coefficients. **Returns:** * `y` : output value (float) calculated from input array. """ if n == -1: n = self.n if type(w) == str: if w == "random": w = np.random.normal(0, 0.5, n) elif w == "zeros": w = np.zeros(n) else: raise ValueError('Impossible to understand the w') elif len(w) == n: try: w = np.array(w, dtype="float64") except: raise ValueError('Impossible to understand the w') else: raise ValueError('Impossible to understand the w') self.w = w <|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, 2926, 5014, 279, 48232, 14661, 315, 279, 4141, 382, 286, 3146, 4209, 25, 57277, 286, 353, 1595, 86, 63, 551, 2926, 14661, 315, 4141, 13, 37207, 2819, 527, 512, 1827, 310, 353, 1358, 449, 2926, 14661, 320, 16, 56987, 1358, 8, 315, 4141, 1404, 9122, 310, 353, 330, 11719, 1, 551, 1893, 4288, 14661, 19086, 310, 353, 330, 36816, 1, 551, 1893, 7315, 907, 14661, 271, 12586, 286, 3146, 42, 6813, 25, 57277, 286, 353, 1595, 77, 63, 551, 1404, 315, 4141, 320, 396, 8, 482, 1396, 315, 4141, 37929, 382, 286, 3146, 16851, 25, 57277, 286, 353, 1595, 88, 63, 551, 2612, 907, 320, 3733, 8, 16997, 505, 1988, 1358, 382, 14711, 6075, 512, 755, 3003, 21798, 1214, 11, 289, 11, 308, 11065, 16, 997, 286, 3270, 286, 1115, 734, 2926, 5014, 279, 48232, 14661, 315, 279, 4141, 382, 286, 3146, 4209, 25, 57277, 286, 353, 1595, 86, 63, 551, 2926, 14661, 315, 4141, 13, 37207, 2819, 527, 512, 1827, 310, 353, 1358, 449, 2926, 14661, 320, 16, 56987, 1358, 8, 315, 4141, 1404, 9122, 310, 353, 330, 11719, 1, 551, 1893, 4288, 14661, 19086, 310, 353, 330, 36816, 1, 551, 1893, 7315, 907, 14661, 271, 12586, 286, 3146, 42, 6813, 25, 57277, 286, 353, 1595, 77, 63, 551, 1404, 315, 4141, 320, 396, 8, 482, 1396, 315, 4141, 37929, 382, 286, 3146, 16851, 25, 57277, 286, 353, 1595, 88, 63, 551, 2612, 907, 320, 3733, 8, 16997, 505, 1988, 1358, 382, 286, 3270, 286, 422, 308, 624, 482, 16, 512, 310, 308, 284, 659, 1276, 198, 286, 422, 955, 3706, 8, 624, 610, 512, 310, 422, 289, 624, 330, 11719, 4764, 394, 289, 284, 2660, 7985, 20738, 7, 15, 11, 220, 15, 13, 20, 11, 308, 340, 310, 4508, 289, 624, 330, 36816, 4764, 394, 289, 284, 2660, 13064, 1471, 340, 310, 775, 512, 394, 4933, 15764, 493, 90755, 311, 3619, 279, 289, 1329, 286, 4508, 2479, 3706, 8, 624, 308, 512, 310, 1456, 512, 394, 289, 284, 2660, 7382, 3706, 11, 13534, 429, 3733, 1227, 1158, 310, 3734, 512, 394, 4933, 15764, 493, 90755, 311, 3619, 279, 289, 1329, 286, 775, 512, 310, 4933, 15764, 493, 90755, 311, 3619, 279, 289, 1329, 286, 659, 1444, 284, 289, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2028, 734, 2926, 5014, 279, 48232, 14661, 315, 279, 4141, 382, 286, 3146, 4209, 25, 57277, 286, 353, 1595, 86, 63, 551, 2926, 14661, 315, 4141, 13, 37207, 2819, 527, 512, 1827, 310, 353, 1358, 449, 2926, 14661, 320, 16, 56987, 1358, 8, 315, 4141, 1404, 9122, 310, 353, 330, 11719, 1, 551, 1893, 4288, 14661, 19086, 310, 353, 330, 36816, 1, 551, 1893, 7315, 907, 14661, 271, 12586, 286, 3146, 42, 6813, 25, 57277, 286, 353, 1595, 77, 63, 551, 1404, 315, 4141, 320, 396, 8, 482, 1396, 315, 4141, 37929, 382, 286, 3146, 16851, 25, 57277, 286, 353, 1595, 88, 63, 551, 2612, 907, 320, 3733, 8, 16997, 505, 1988, 1358, 382, 14711, 6075, 512, 755, 3003, 21798, 1214, 11, 289, 11, 308, 11065, 16, 997, 286, 3270, 286, 1115, 734, 2926, 5014, 279, 48232, 14661, 315, 279, 4141, 382, 286, 3146, 4209, 25, 57277, 286, 353, 1595, 86, 63, 551, 2926, 14661, 315, 4141, 13, 37207, 2819, 527, 512, 1827, 310, 353, 1358, 449, 2926, 14661, 320, 16, 56987, 1358, 8, 315, 4141, 1404, 9122, 310, 353, 330, 11719, 1, 551, 1893, 4288, 14661, 19086, 310, 353, 330, 36816, 1, 551, 1893, 7315, 907, 14661, 271, 12586, 286, 3146, 42, 6813, 25, 57277, 286, 353, 1595, 77, 63, 551, 1404, 315, 4141, 320, 396, 8, 482, 1396, 315, 4141, 37929, 382, 286, 3146, 16851, 25, 57277, 286, 353, 1595, 88, 63, 551, 2612, 907, 320, 3733, 8, 16997, 505, 1988, 1358, 382, 286, 3270, 286, 422, 308, 624, 482, 16, 512, 310, 308, 284, 659, 1276, 198, 286, 422, 955, 3706, 8, 624, 610, 512, 310, 422, 289, 624, 330, 11719, 4764, 394, 289, 284, 2660, 7985, 20738, 7, 15, 11, 220, 15, 13, 20, 11, 308, 340, 310, 4508, 289, 624, 330, 36816, 4764, 394, 289, 284, 2660, 13064, 1471, 340, 310, 775, 512, 394, 4933, 15764, 493, 90755, 311, 3619, 279, 289, 1329, 286, 4508, 2479, 3706, 8, 624, 308, 512, 310, 1456, 512, 394, 289, 284, 2660, 7382, 3706, 11, 13534, 429, 3733, 1227, 1158, 310, 3734, 512, 394, 4933, 15764, 493, 90755, 311, 3619, 279, 289, 1329, 286, 775, 512, 310, 4933, 15764, 493, 90755, 311, 3619, 279, 289, 1329, 286, 659, 1444, 284, 289, 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 ]
google/grr
grr/server/grr_response_server/flow_utils.py
WaitForFlow
def WaitForFlow(flow_urn, token=None, timeout=DEFAULT_TIMEOUT, max_sleep_time=1, min_sleep_time=0.2, dampening_multiplier=0.9): """Waits for a flow to finish, polling while we wait. Args: flow_urn: The urn of the flow to wait for. token: The datastore access token. timeout: How long to wait before giving up, usually because the client has gone away. max_sleep_time: The initial and longest time to wait in between polls. min_sleep_time: The final and shortest time to wait in between polls. dampening_multiplier: The current sleep time is multiplied by this number on each iteration. Controls how fast the polling reaches its minimum sleep time. You probably want this to be less than 1, unless you want to wait an increasing amount of time in between flows. Raises: IOError: If we time out while waiting for the client. """ start_time = time.time() sleep_time = max_sleep_time while True: # Reopen the AFF4Object to check if its status has changed, and also make # sure it's a flow. with aff4.FACTORY.Open( flow_urn, token=token, aff4_type=flow.GRRFlow) as flow_obj: # Stop if the flow is done or has timed out. if time.time() - start_time > timeout: logging.warning("Timed out after waiting %ss for %s!", timeout, flow_obj) raise IOError("Timed out trying to access client! Is it connected?") if not flow_obj.GetRunner().IsRunning(): break # Decrease the time we sleep each iteration. sleep_time = max(sleep_time * dampening_multiplier, min_sleep_time) time.sleep(sleep_time) logging.debug("Waiting for %s, sleeping for %.3fs", flow_obj, sleep_time)
python
def WaitForFlow(flow_urn, token=None, timeout=DEFAULT_TIMEOUT, max_sleep_time=1, min_sleep_time=0.2, dampening_multiplier=0.9): """Waits for a flow to finish, polling while we wait. Args: flow_urn: The urn of the flow to wait for. token: The datastore access token. timeout: How long to wait before giving up, usually because the client has gone away. max_sleep_time: The initial and longest time to wait in between polls. min_sleep_time: The final and shortest time to wait in between polls. dampening_multiplier: The current sleep time is multiplied by this number on each iteration. Controls how fast the polling reaches its minimum sleep time. You probably want this to be less than 1, unless you want to wait an increasing amount of time in between flows. Raises: IOError: If we time out while waiting for the client. """ start_time = time.time() sleep_time = max_sleep_time while True: # Reopen the AFF4Object to check if its status has changed, and also make # sure it's a flow. with aff4.FACTORY.Open( flow_urn, token=token, aff4_type=flow.GRRFlow) as flow_obj: # Stop if the flow is done or has timed out. if time.time() - start_time > timeout: logging.warning("Timed out after waiting %ss for %s!", timeout, flow_obj) raise IOError("Timed out trying to access client! Is it connected?") if not flow_obj.GetRunner().IsRunning(): break # Decrease the time we sleep each iteration. sleep_time = max(sleep_time * dampening_multiplier, min_sleep_time) time.sleep(sleep_time) logging.debug("Waiting for %s, sleeping for %.3fs", flow_obj, sleep_time)
[ "def", "WaitForFlow", "(", "flow_urn", ",", "token", "=", "None", ",", "timeout", "=", "DEFAULT_TIMEOUT", ",", "max_sleep_time", "=", "1", ",", "min_sleep_time", "=", "0.2", ",", "dampening_multiplier", "=", "0.9", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "sleep_time", "=", "max_sleep_time", "while", "True", ":", "# Reopen the AFF4Object to check if its status has changed, and also make", "# sure it's a flow.", "with", "aff4", ".", "FACTORY", ".", "Open", "(", "flow_urn", ",", "token", "=", "token", ",", "aff4_type", "=", "flow", ".", "GRRFlow", ")", "as", "flow_obj", ":", "# Stop if the flow is done or has timed out.", "if", "time", ".", "time", "(", ")", "-", "start_time", ">", "timeout", ":", "logging", ".", "warning", "(", "\"Timed out after waiting %ss for %s!\"", ",", "timeout", ",", "flow_obj", ")", "raise", "IOError", "(", "\"Timed out trying to access client! Is it connected?\"", ")", "if", "not", "flow_obj", ".", "GetRunner", "(", ")", ".", "IsRunning", "(", ")", ":", "break", "# Decrease the time we sleep each iteration.", "sleep_time", "=", "max", "(", "sleep_time", "*", "dampening_multiplier", ",", "min_sleep_time", ")", "time", ".", "sleep", "(", "sleep_time", ")", "logging", ".", "debug", "(", "\"Waiting for %s, sleeping for %.3fs\"", ",", "flow_obj", ",", "sleep_time", ")" ]
Waits for a flow to finish, polling while we wait. Args: flow_urn: The urn of the flow to wait for. token: The datastore access token. timeout: How long to wait before giving up, usually because the client has gone away. max_sleep_time: The initial and longest time to wait in between polls. min_sleep_time: The final and shortest time to wait in between polls. dampening_multiplier: The current sleep time is multiplied by this number on each iteration. Controls how fast the polling reaches its minimum sleep time. You probably want this to be less than 1, unless you want to wait an increasing amount of time in between flows. Raises: IOError: If we time out while waiting for the client.
[ "Waits", "for", "a", "flow", "to", "finish", "polling", "while", "we", "wait", "." ]
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_utils.py#L88-L130
<|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: Waits for a flow to finish, polling while we wait. Args: flow_urn: The urn of the flow to wait for. token: The datastore access token. timeout: How long to wait before giving up, usually because the client has gone away. max_sleep_time: The initial and longest time to wait in between polls. min_sleep_time: The final and shortest time to wait in between polls. dampening_multiplier: The current sleep time is multiplied by this number on each iteration. Controls how fast the polling reaches its minimum sleep time. You probably want this to be less than 1, unless you want to wait an increasing amount of time in between flows. Raises: IOError: If we time out while waiting for the client. ### Response: def WaitForFlow(flow_urn, token=None, timeout=DEFAULT_TIMEOUT, max_sleep_time=1, min_sleep_time=0.2, dampening_multiplier=0.9): """Waits for a flow to finish, polling while we wait. Args: flow_urn: The urn of the flow to wait for. token: The datastore access token. timeout: How long to wait before giving up, usually because the client has gone away. max_sleep_time: The initial and longest time to wait in between polls. min_sleep_time: The final and shortest time to wait in between polls. dampening_multiplier: The current sleep time is multiplied by this number on each iteration. Controls how fast the polling reaches its minimum sleep time. You probably want this to be less than 1, unless you want to wait an increasing amount of time in between flows. Raises: IOError: If we time out while waiting for the client. """ start_time = time.time() sleep_time = max_sleep_time while True: # Reopen the AFF4Object to check if its status has changed, and also make # sure it's a flow. with aff4.FACTORY.Open( flow_urn, token=token, aff4_type=flow.GRRFlow) as flow_obj: # Stop if the flow is done or has timed out. if time.time() - start_time > timeout: logging.warning("Timed out after waiting %ss for %s!", timeout, flow_obj) raise IOError("Timed out trying to access client! Is it connected?") if not flow_obj.GetRunner().IsRunning(): break # Decrease the time we sleep each iteration. sleep_time = max(sleep_time * dampening_multiplier, min_sleep_time) time.sleep(sleep_time) logging.debug("Waiting for %s, sleeping for %.3fs", flow_obj, sleep_time) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 54, 57579, 369, 264, 6530, 311, 6381, 11, 31744, 1418, 584, 3868, 382, 220, 18161, 512, 262, 6530, 62, 399, 25, 578, 66967, 315, 279, 6530, 311, 3868, 369, 627, 262, 4037, 25, 578, 66086, 2680, 4037, 627, 262, 9829, 25, 2650, 1317, 311, 3868, 1603, 7231, 709, 11, 6118, 1606, 279, 3016, 706, 198, 415, 8208, 3201, 627, 262, 1973, 50493, 3084, 25, 578, 2926, 323, 22807, 892, 311, 3868, 304, 1990, 23925, 627, 262, 1332, 50493, 3084, 25, 578, 1620, 323, 40243, 892, 311, 3868, 304, 1990, 23925, 627, 262, 41369, 6147, 52900, 25, 578, 1510, 6212, 892, 374, 56016, 555, 420, 1396, 389, 198, 415, 1855, 20140, 13, 33170, 1268, 5043, 279, 31744, 25501, 1202, 8187, 6212, 198, 415, 892, 13, 1472, 4762, 1390, 420, 311, 387, 2753, 1109, 220, 16, 11, 7389, 499, 1390, 311, 3868, 459, 198, 415, 7859, 3392, 315, 892, 304, 1990, 28555, 382, 220, 61411, 512, 262, 62061, 25, 1442, 584, 892, 704, 1418, 8748, 369, 279, 3016, 382, 14711, 6075, 512, 755, 38701, 19410, 75737, 62, 399, 345, 394, 4037, 5980, 345, 394, 9829, 28, 17733, 24303, 345, 394, 1973, 50493, 3084, 28, 16, 345, 394, 1332, 50493, 3084, 28, 15, 13, 17, 345, 394, 41369, 6147, 52900, 28, 15, 13, 24, 997, 220, 4304, 54, 57579, 369, 264, 6530, 311, 6381, 11, 31744, 1418, 584, 3868, 382, 220, 18161, 512, 262, 6530, 62, 399, 25, 578, 66967, 315, 279, 6530, 311, 3868, 369, 627, 262, 4037, 25, 578, 66086, 2680, 4037, 627, 262, 9829, 25, 2650, 1317, 311, 3868, 1603, 7231, 709, 11, 6118, 1606, 279, 3016, 706, 198, 415, 8208, 3201, 627, 262, 1973, 50493, 3084, 25, 578, 2926, 323, 22807, 892, 311, 3868, 304, 1990, 23925, 627, 262, 1332, 50493, 3084, 25, 578, 1620, 323, 40243, 892, 311, 3868, 304, 1990, 23925, 627, 262, 41369, 6147, 52900, 25, 578, 1510, 6212, 892, 374, 56016, 555, 420, 1396, 389, 198, 415, 1855, 20140, 13, 33170, 1268, 5043, 279, 31744, 25501, 1202, 8187, 6212, 198, 415, 892, 13, 1472, 4762, 1390, 420, 311, 387, 2753, 1109, 220, 16, 11, 7389, 499, 1390, 311, 3868, 459, 198, 415, 7859, 3392, 315, 892, 304, 1990, 28555, 382, 220, 61411, 512, 262, 62061, 25, 1442, 584, 892, 704, 1418, 8748, 369, 279, 3016, 627, 220, 12713, 220, 1212, 3084, 284, 892, 6512, 746, 220, 6212, 3084, 284, 1973, 50493, 3084, 198, 220, 1418, 3082, 512, 262, 674, 1050, 2569, 279, 70038, 19, 1211, 311, 1817, 422, 1202, 2704, 706, 5614, 11, 323, 1101, 1304, 198, 262, 674, 2771, 433, 596, 264, 6530, 627, 262, 449, 3611, 19, 1006, 6966, 7668, 13250, 1021, 286, 6530, 62, 399, 11, 4037, 28, 5963, 11, 3611, 19, 1857, 28, 5072, 1246, 8268, 19410, 8, 439, 6530, 7478, 1473, 415, 674, 14549, 422, 279, 6530, 374, 2884, 477, 706, 26245, 704 ]
[ 1, 1, 1, 1, 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, 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, 54, 57579, 369, 264, 6530, 311, 6381, 11, 31744, 1418, 584, 3868, 382, 220, 18161, 512, 262, 6530, 62, 399, 25, 578, 66967, 315, 279, 6530, 311, 3868, 369, 627, 262, 4037, 25, 578, 66086, 2680, 4037, 627, 262, 9829, 25, 2650, 1317, 311, 3868, 1603, 7231, 709, 11, 6118, 1606, 279, 3016, 706, 198, 415, 8208, 3201, 627, 262, 1973, 50493, 3084, 25, 578, 2926, 323, 22807, 892, 311, 3868, 304, 1990, 23925, 627, 262, 1332, 50493, 3084, 25, 578, 1620, 323, 40243, 892, 311, 3868, 304, 1990, 23925, 627, 262, 41369, 6147, 52900, 25, 578, 1510, 6212, 892, 374, 56016, 555, 420, 1396, 389, 198, 415, 1855, 20140, 13, 33170, 1268, 5043, 279, 31744, 25501, 1202, 8187, 6212, 198, 415, 892, 13, 1472, 4762, 1390, 420, 311, 387, 2753, 1109, 220, 16, 11, 7389, 499, 1390, 311, 3868, 459, 198, 415, 7859, 3392, 315, 892, 304, 1990, 28555, 382, 220, 61411, 512, 262, 62061, 25, 1442, 584, 892, 704, 1418, 8748, 369, 279, 3016, 382, 14711, 6075, 512, 755, 38701, 19410, 75737, 62, 399, 345, 394, 4037, 5980, 345, 394, 9829, 28, 17733, 24303, 345, 394, 1973, 50493, 3084, 28, 16, 345, 394, 1332, 50493, 3084, 28, 15, 13, 17, 345, 394, 41369, 6147, 52900, 28, 15, 13, 24, 997, 220, 4304, 54, 57579, 369, 264, 6530, 311, 6381, 11, 31744, 1418, 584, 3868, 382, 220, 18161, 512, 262, 6530, 62, 399, 25, 578, 66967, 315, 279, 6530, 311, 3868, 369, 627, 262, 4037, 25, 578, 66086, 2680, 4037, 627, 262, 9829, 25, 2650, 1317, 311, 3868, 1603, 7231, 709, 11, 6118, 1606, 279, 3016, 706, 198, 415, 8208, 3201, 627, 262, 1973, 50493, 3084, 25, 578, 2926, 323, 22807, 892, 311, 3868, 304, 1990, 23925, 627, 262, 1332, 50493, 3084, 25, 578, 1620, 323, 40243, 892, 311, 3868, 304, 1990, 23925, 627, 262, 41369, 6147, 52900, 25, 578, 1510, 6212, 892, 374, 56016, 555, 420, 1396, 389, 198, 415, 1855, 20140, 13, 33170, 1268, 5043, 279, 31744, 25501, 1202, 8187, 6212, 198, 415, 892, 13, 1472, 4762, 1390, 420, 311, 387, 2753, 1109, 220, 16, 11, 7389, 499, 1390, 311, 3868, 459, 198, 415, 7859, 3392, 315, 892, 304, 1990, 28555, 382, 220, 61411, 512, 262, 62061, 25, 1442, 584, 892, 704, 1418, 8748, 369, 279, 3016, 627, 220, 12713, 220, 1212, 3084, 284, 892, 6512, 746, 220, 6212, 3084, 284, 1973, 50493, 3084, 198, 220, 1418, 3082, 512, 262, 674, 1050, 2569, 279, 70038, 19, 1211, 311, 1817, 422, 1202, 2704, 706, 5614, 11, 323, 1101, 1304, 198, 262, 674, 2771, 433, 596, 264, 6530, 627, 262, 449, 3611, 19, 1006, 6966, 7668, 13250, 1021, 286, 6530, 62, 399, 11, 4037, 28, 5963, 11, 3611, 19, 1857, 28, 5072, 1246, 8268, 19410, 8, 439, 6530, 7478, 1473, 415, 674, 14549, 422, 279, 6530, 374, 2884, 477, 706, 26245, 704 ]
alefnula/tea
tea/utils/compress.py
unzip
def unzip(archive, destination, filenames=None): """Unzip a zip archive into destination directory. It unzips either the whole archive or specific file(s) from the archive. Usage: >>> output = os.path.join(os.getcwd(), 'output') >>> # Archive can be an instance of a ZipFile class >>> archive = zipfile.ZipFile('test.zip', 'r') >>> # Or just a filename >>> archive = 'test.zip' >>> # Extracts all files >>> unzip(archive, output) >>> # Extract only one file >>> unzip(archive, output, 'my_file.txt') >>> # Extract a list of files >>> unzip(archive, output, ['my_file1.txt', 'my_file2.txt']) >>> unzip_file('test.zip', 'my_file.txt', output) Args: archive (zipfile.ZipFile or str): Zipfile object to extract from or path to the zip archive. destination (str): Path to the output directory. filenames (str or list of str or None): Path(s) to the filename(s) inside the zip archive that you want to extract. """ close = False try: if not isinstance(archive, zipfile.ZipFile): archive = zipfile.ZipFile(archive, "r", allowZip64=True) close = True logger.info("Extracting: %s -> %s" % (archive.filename, destination)) if isinstance(filenames, str): filenames = [filenames] if filenames is None: # extract all filenames = archive.namelist() for filename in filenames: if filename.endswith("/"): # it's a directory shell.mkdir(os.path.join(destination, filename)) else: if not _extract_file(archive, destination, filename): raise Exception() logger.info('Extracting zip archive "%s" succeeded' % archive.filename) return True except Exception: logger.exception("Error while unzipping archive %s" % archive.filename) return False finally: if close: archive.close()
python
def unzip(archive, destination, filenames=None): """Unzip a zip archive into destination directory. It unzips either the whole archive or specific file(s) from the archive. Usage: >>> output = os.path.join(os.getcwd(), 'output') >>> # Archive can be an instance of a ZipFile class >>> archive = zipfile.ZipFile('test.zip', 'r') >>> # Or just a filename >>> archive = 'test.zip' >>> # Extracts all files >>> unzip(archive, output) >>> # Extract only one file >>> unzip(archive, output, 'my_file.txt') >>> # Extract a list of files >>> unzip(archive, output, ['my_file1.txt', 'my_file2.txt']) >>> unzip_file('test.zip', 'my_file.txt', output) Args: archive (zipfile.ZipFile or str): Zipfile object to extract from or path to the zip archive. destination (str): Path to the output directory. filenames (str or list of str or None): Path(s) to the filename(s) inside the zip archive that you want to extract. """ close = False try: if not isinstance(archive, zipfile.ZipFile): archive = zipfile.ZipFile(archive, "r", allowZip64=True) close = True logger.info("Extracting: %s -> %s" % (archive.filename, destination)) if isinstance(filenames, str): filenames = [filenames] if filenames is None: # extract all filenames = archive.namelist() for filename in filenames: if filename.endswith("/"): # it's a directory shell.mkdir(os.path.join(destination, filename)) else: if not _extract_file(archive, destination, filename): raise Exception() logger.info('Extracting zip archive "%s" succeeded' % archive.filename) return True except Exception: logger.exception("Error while unzipping archive %s" % archive.filename) return False finally: if close: archive.close()
[ "def", "unzip", "(", "archive", ",", "destination", ",", "filenames", "=", "None", ")", ":", "close", "=", "False", "try", ":", "if", "not", "isinstance", "(", "archive", ",", "zipfile", ".", "ZipFile", ")", ":", "archive", "=", "zipfile", ".", "ZipFile", "(", "archive", ",", "\"r\"", ",", "allowZip64", "=", "True", ")", "close", "=", "True", "logger", ".", "info", "(", "\"Extracting: %s -> %s\"", "%", "(", "archive", ".", "filename", ",", "destination", ")", ")", "if", "isinstance", "(", "filenames", ",", "str", ")", ":", "filenames", "=", "[", "filenames", "]", "if", "filenames", "is", "None", ":", "# extract all", "filenames", "=", "archive", ".", "namelist", "(", ")", "for", "filename", "in", "filenames", ":", "if", "filename", ".", "endswith", "(", "\"/\"", ")", ":", "# it's a directory", "shell", ".", "mkdir", "(", "os", ".", "path", ".", "join", "(", "destination", ",", "filename", ")", ")", "else", ":", "if", "not", "_extract_file", "(", "archive", ",", "destination", ",", "filename", ")", ":", "raise", "Exception", "(", ")", "logger", ".", "info", "(", "'Extracting zip archive \"%s\" succeeded'", "%", "archive", ".", "filename", ")", "return", "True", "except", "Exception", ":", "logger", ".", "exception", "(", "\"Error while unzipping archive %s\"", "%", "archive", ".", "filename", ")", "return", "False", "finally", ":", "if", "close", ":", "archive", ".", "close", "(", ")" ]
Unzip a zip archive into destination directory. It unzips either the whole archive or specific file(s) from the archive. Usage: >>> output = os.path.join(os.getcwd(), 'output') >>> # Archive can be an instance of a ZipFile class >>> archive = zipfile.ZipFile('test.zip', 'r') >>> # Or just a filename >>> archive = 'test.zip' >>> # Extracts all files >>> unzip(archive, output) >>> # Extract only one file >>> unzip(archive, output, 'my_file.txt') >>> # Extract a list of files >>> unzip(archive, output, ['my_file1.txt', 'my_file2.txt']) >>> unzip_file('test.zip', 'my_file.txt', output) Args: archive (zipfile.ZipFile or str): Zipfile object to extract from or path to the zip archive. destination (str): Path to the output directory. filenames (str or list of str or None): Path(s) to the filename(s) inside the zip archive that you want to extract.
[ "Unzip", "a", "zip", "archive", "into", "destination", "directory", "." ]
train
https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/utils/compress.py#L40-L89
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Unzip a zip archive into destination directory. It unzips either the whole archive or specific file(s) from the archive. Usage: >>> output = os.path.join(os.getcwd(), 'output') >>> # Archive can be an instance of a ZipFile class >>> archive = zipfile.ZipFile('test.zip', 'r') >>> # Or just a filename >>> archive = 'test.zip' >>> # Extracts all files >>> unzip(archive, output) >>> # Extract only one file >>> unzip(archive, output, 'my_file.txt') >>> # Extract a list of files >>> unzip(archive, output, ['my_file1.txt', 'my_file2.txt']) >>> unzip_file('test.zip', 'my_file.txt', output) Args: archive (zipfile.ZipFile or str): Zipfile object to extract from or path to the zip archive. destination (str): Path to the output directory. filenames (str or list of str or None): Path(s) to the filename(s) inside the zip archive that you want to extract. ### Response: def unzip(archive, destination, filenames=None): """Unzip a zip archive into destination directory. It unzips either the whole archive or specific file(s) from the archive. Usage: >>> output = os.path.join(os.getcwd(), 'output') >>> # Archive can be an instance of a ZipFile class >>> archive = zipfile.ZipFile('test.zip', 'r') >>> # Or just a filename >>> archive = 'test.zip' >>> # Extracts all files >>> unzip(archive, output) >>> # Extract only one file >>> unzip(archive, output, 'my_file.txt') >>> # Extract a list of files >>> unzip(archive, output, ['my_file1.txt', 'my_file2.txt']) >>> unzip_file('test.zip', 'my_file.txt', output) Args: archive (zipfile.ZipFile or str): Zipfile object to extract from or path to the zip archive. destination (str): Path to the output directory. filenames (str or list of str or None): Path(s) to the filename(s) inside the zip archive that you want to extract. """ close = False try: if not isinstance(archive, zipfile.ZipFile): archive = zipfile.ZipFile(archive, "r", allowZip64=True) close = True logger.info("Extracting: %s -> %s" % (archive.filename, destination)) if isinstance(filenames, str): filenames = [filenames] if filenames is None: # extract all filenames = archive.namelist() for filename in filenames: if filename.endswith("/"): # it's a directory shell.mkdir(os.path.join(destination, filename)) else: if not _extract_file(archive, destination, filename): raise Exception() logger.info('Extracting zip archive "%s" succeeded' % archive.filename) return True except Exception: logger.exception("Error while unzipping archive %s" % archive.filename) return False finally: if close: archive.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, 1844, 10169, 264, 10521, 18624, 1139, 9284, 6352, 382, 262, 1102, 653, 89, 3153, 3060, 279, 4459, 18624, 477, 3230, 1052, 1161, 8, 505, 279, 18624, 382, 262, 25585, 512, 286, 12382, 2612, 284, 2709, 3960, 5563, 9835, 47574, 1535, 364, 3081, 1329, 286, 12382, 674, 30802, 649, 387, 459, 2937, 315, 264, 30332, 1738, 538, 198, 286, 12382, 18624, 284, 88052, 74054, 1738, 493, 1985, 21666, 518, 364, 81, 1329, 286, 12382, 674, 2582, 1120, 264, 3986, 198, 286, 12382, 18624, 284, 364, 1985, 21666, 1270, 286, 12382, 674, 23673, 82, 682, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 340, 286, 12382, 674, 23673, 1193, 832, 1052, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 364, 2465, 2517, 3996, 1329, 286, 12382, 674, 23673, 264, 1160, 315, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 2570, 2465, 2517, 16, 3996, 518, 364, 2465, 2517, 17, 3996, 7519, 286, 12382, 77013, 2517, 493, 1985, 21666, 518, 364, 2465, 2517, 3996, 518, 2612, 696, 262, 18161, 512, 286, 18624, 320, 10169, 1213, 74054, 1738, 477, 610, 1680, 30332, 1213, 1665, 311, 8819, 505, 477, 198, 310, 1853, 311, 279, 10521, 18624, 627, 286, 9284, 320, 496, 1680, 8092, 311, 279, 2612, 6352, 627, 286, 41640, 320, 496, 477, 1160, 315, 610, 477, 2290, 1680, 8092, 1161, 8, 311, 279, 3986, 1161, 340, 310, 4871, 279, 10521, 18624, 430, 499, 1390, 311, 8819, 382, 14711, 6075, 512, 755, 77013, 7, 16402, 11, 9284, 11, 41640, 5980, 997, 262, 4304, 1844, 10169, 264, 10521, 18624, 1139, 9284, 6352, 382, 262, 1102, 653, 89, 3153, 3060, 279, 4459, 18624, 477, 3230, 1052, 1161, 8, 505, 279, 18624, 382, 262, 25585, 512, 286, 12382, 2612, 284, 2709, 3960, 5563, 9835, 47574, 1535, 364, 3081, 1329, 286, 12382, 674, 30802, 649, 387, 459, 2937, 315, 264, 30332, 1738, 538, 198, 286, 12382, 18624, 284, 88052, 74054, 1738, 493, 1985, 21666, 518, 364, 81, 1329, 286, 12382, 674, 2582, 1120, 264, 3986, 198, 286, 12382, 18624, 284, 364, 1985, 21666, 1270, 286, 12382, 674, 23673, 82, 682, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 340, 286, 12382, 674, 23673, 1193, 832, 1052, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 364, 2465, 2517, 3996, 1329, 286, 12382, 674, 23673, 264, 1160, 315, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 2570, 2465, 2517, 16, 3996, 518, 364, 2465, 2517, 17, 3996, 7519, 286, 12382, 77013, 2517, 493, 1985, 21666, 518, 364, 2465, 2517, 3996, 518, 2612, 696, 262, 18161, 512, 286, 18624, 320, 10169, 1213, 74054, 1738, 477, 610, 1680, 30332, 1213, 1665, 311, 8819, 505, 477, 198, 310, 1853, 311, 279, 10521, 18624, 627, 286, 9284, 320, 496, 1680, 8092, 311, 279, 2612, 6352, 627, 286, 41640, 320, 496, 477, 1160, 315, 610, 477, 2290, 1680, 8092, 1161, 8 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1844, 10169, 264, 10521, 18624, 1139, 9284, 6352, 382, 262, 1102, 653, 89, 3153, 3060, 279, 4459, 18624, 477, 3230, 1052, 1161, 8, 505, 279, 18624, 382, 262, 25585, 512, 286, 12382, 2612, 284, 2709, 3960, 5563, 9835, 47574, 1535, 364, 3081, 1329, 286, 12382, 674, 30802, 649, 387, 459, 2937, 315, 264, 30332, 1738, 538, 198, 286, 12382, 18624, 284, 88052, 74054, 1738, 493, 1985, 21666, 518, 364, 81, 1329, 286, 12382, 674, 2582, 1120, 264, 3986, 198, 286, 12382, 18624, 284, 364, 1985, 21666, 1270, 286, 12382, 674, 23673, 82, 682, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 340, 286, 12382, 674, 23673, 1193, 832, 1052, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 364, 2465, 2517, 3996, 1329, 286, 12382, 674, 23673, 264, 1160, 315, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 2570, 2465, 2517, 16, 3996, 518, 364, 2465, 2517, 17, 3996, 7519, 286, 12382, 77013, 2517, 493, 1985, 21666, 518, 364, 2465, 2517, 3996, 518, 2612, 696, 262, 18161, 512, 286, 18624, 320, 10169, 1213, 74054, 1738, 477, 610, 1680, 30332, 1213, 1665, 311, 8819, 505, 477, 198, 310, 1853, 311, 279, 10521, 18624, 627, 286, 9284, 320, 496, 1680, 8092, 311, 279, 2612, 6352, 627, 286, 41640, 320, 496, 477, 1160, 315, 610, 477, 2290, 1680, 8092, 1161, 8, 311, 279, 3986, 1161, 340, 310, 4871, 279, 10521, 18624, 430, 499, 1390, 311, 8819, 382, 14711, 6075, 512, 755, 77013, 7, 16402, 11, 9284, 11, 41640, 5980, 997, 262, 4304, 1844, 10169, 264, 10521, 18624, 1139, 9284, 6352, 382, 262, 1102, 653, 89, 3153, 3060, 279, 4459, 18624, 477, 3230, 1052, 1161, 8, 505, 279, 18624, 382, 262, 25585, 512, 286, 12382, 2612, 284, 2709, 3960, 5563, 9835, 47574, 1535, 364, 3081, 1329, 286, 12382, 674, 30802, 649, 387, 459, 2937, 315, 264, 30332, 1738, 538, 198, 286, 12382, 18624, 284, 88052, 74054, 1738, 493, 1985, 21666, 518, 364, 81, 1329, 286, 12382, 674, 2582, 1120, 264, 3986, 198, 286, 12382, 18624, 284, 364, 1985, 21666, 1270, 286, 12382, 674, 23673, 82, 682, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 340, 286, 12382, 674, 23673, 1193, 832, 1052, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 364, 2465, 2517, 3996, 1329, 286, 12382, 674, 23673, 264, 1160, 315, 3626, 198, 286, 12382, 77013, 7, 16402, 11, 2612, 11, 2570, 2465, 2517, 16, 3996, 518, 364, 2465, 2517, 17, 3996, 7519, 286, 12382, 77013, 2517, 493, 1985, 21666, 518, 364, 2465, 2517, 3996, 518, 2612, 696, 262, 18161, 512, 286, 18624, 320, 10169, 1213, 74054, 1738, 477, 610, 1680, 30332, 1213, 1665, 311, 8819, 505, 477, 198, 310, 1853, 311, 279, 10521, 18624, 627, 286, 9284, 320, 496, 1680, 8092, 311, 279, 2612, 6352, 627, 286, 41640, 320, 496, 477, 1160, 315, 610, 477, 2290, 1680, 8092, 1161, 8 ]
astropy/photutils
photutils/isophote/geometry.py
EllipseGeometry.to_polar
def to_polar(self, x, y): """ Return the radius and polar angle in the ellipse coordinate system given (x, y) pixel image coordinates. This function takes care of the different definitions for position angle (PA) and polar angle (phi): .. math:: -\\pi < PA < \\pi 0 < phi < 2 \\pi Note that radius can be anything. The solution is not tied to the semimajor axis length, but to the center position and tilt angle. Parameters ---------- x, y : float The (x, y) image coordinates. Returns ------- radius, angle : float The ellipse radius and polar angle. """ # We split in between a scalar version and a # vectorized version. This is necessary for # now so we don't pay a heavy speed penalty # that is incurred when using vectorized code. # The split in two separate functions helps in # the profiling analysis: most of the time is # spent in the scalar function. if isinstance(x, int) or isinstance(x, float): return self._to_polar_scalar(x, y) else: return self._to_polar_vectorized(x, y)
python
def to_polar(self, x, y): """ Return the radius and polar angle in the ellipse coordinate system given (x, y) pixel image coordinates. This function takes care of the different definitions for position angle (PA) and polar angle (phi): .. math:: -\\pi < PA < \\pi 0 < phi < 2 \\pi Note that radius can be anything. The solution is not tied to the semimajor axis length, but to the center position and tilt angle. Parameters ---------- x, y : float The (x, y) image coordinates. Returns ------- radius, angle : float The ellipse radius and polar angle. """ # We split in between a scalar version and a # vectorized version. This is necessary for # now so we don't pay a heavy speed penalty # that is incurred when using vectorized code. # The split in two separate functions helps in # the profiling analysis: most of the time is # spent in the scalar function. if isinstance(x, int) or isinstance(x, float): return self._to_polar_scalar(x, y) else: return self._to_polar_vectorized(x, y)
[ "def", "to_polar", "(", "self", ",", "x", ",", "y", ")", ":", "# We split in between a scalar version and a", "# vectorized version. This is necessary for", "# now so we don't pay a heavy speed penalty", "# that is incurred when using vectorized code.", "# The split in two separate functions helps in", "# the profiling analysis: most of the time is", "# spent in the scalar function.", "if", "isinstance", "(", "x", ",", "int", ")", "or", "isinstance", "(", "x", ",", "float", ")", ":", "return", "self", ".", "_to_polar_scalar", "(", "x", ",", "y", ")", "else", ":", "return", "self", ".", "_to_polar_vectorized", "(", "x", ",", "y", ")" ]
Return the radius and polar angle in the ellipse coordinate system given (x, y) pixel image coordinates. This function takes care of the different definitions for position angle (PA) and polar angle (phi): .. math:: -\\pi < PA < \\pi 0 < phi < 2 \\pi Note that radius can be anything. The solution is not tied to the semimajor axis length, but to the center position and tilt angle. Parameters ---------- x, y : float The (x, y) image coordinates. Returns ------- radius, angle : float The ellipse radius and polar angle.
[ "Return", "the", "radius", "and", "polar", "angle", "in", "the", "ellipse", "coordinate", "system", "given", "(", "x", "y", ")", "pixel", "image", "coordinates", "." ]
train
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L385-L424
<|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 radius and polar angle in the ellipse coordinate system given (x, y) pixel image coordinates. This function takes care of the different definitions for position angle (PA) and polar angle (phi): .. math:: -\\pi < PA < \\pi 0 < phi < 2 \\pi Note that radius can be anything. The solution is not tied to the semimajor axis length, but to the center position and tilt angle. Parameters ---------- x, y : float The (x, y) image coordinates. Returns ------- radius, angle : float The ellipse radius and polar angle. ### Response: def to_polar(self, x, y): """ Return the radius and polar angle in the ellipse coordinate system given (x, y) pixel image coordinates. This function takes care of the different definitions for position angle (PA) and polar angle (phi): .. math:: -\\pi < PA < \\pi 0 < phi < 2 \\pi Note that radius can be anything. The solution is not tied to the semimajor axis length, but to the center position and tilt angle. Parameters ---------- x, y : float The (x, y) image coordinates. Returns ------- radius, angle : float The ellipse radius and polar angle. """ # We split in between a scalar version and a # vectorized version. This is necessary for # now so we don't pay a heavy speed penalty # that is incurred when using vectorized code. # The split in two separate functions helps in # the profiling analysis: most of the time is # spent in the scalar function. if isinstance(x, int) or isinstance(x, float): return self._to_polar_scalar(x, y) else: return self._to_polar_vectorized(x, y) <|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, 10801, 323, 25685, 9392, 304, 279, 58497, 16580, 198, 286, 1887, 2728, 320, 87, 11, 379, 8, 13252, 2217, 14259, 382, 286, 1115, 734, 5097, 2512, 315, 279, 2204, 17931, 369, 198, 286, 2361, 9392, 320, 8201, 8, 323, 25685, 9392, 320, 17247, 7887, 286, 5354, 7033, 50677, 310, 482, 3505, 2554, 366, 13174, 366, 26033, 2554, 271, 310, 220, 15, 366, 23526, 366, 220, 17, 26033, 2554, 271, 286, 7181, 430, 10801, 649, 387, 4205, 13, 220, 578, 6425, 374, 539, 17791, 311, 198, 286, 279, 5347, 318, 3111, 8183, 3160, 11, 719, 311, 279, 4219, 2361, 323, 37300, 198, 286, 9392, 382, 286, 13831, 198, 286, 31423, 286, 865, 11, 379, 551, 2273, 198, 310, 578, 320, 87, 11, 379, 8, 2217, 14259, 382, 286, 5295, 198, 286, 39707, 286, 10801, 11, 9392, 551, 2273, 198, 310, 578, 58497, 10801, 323, 25685, 9392, 382, 14711, 6075, 512, 755, 311, 623, 7569, 1214, 11, 865, 11, 379, 997, 286, 3270, 286, 3494, 279, 10801, 323, 25685, 9392, 304, 279, 58497, 16580, 198, 286, 1887, 2728, 320, 87, 11, 379, 8, 13252, 2217, 14259, 382, 286, 1115, 734, 5097, 2512, 315, 279, 2204, 17931, 369, 198, 286, 2361, 9392, 320, 8201, 8, 323, 25685, 9392, 320, 17247, 7887, 286, 5354, 7033, 50677, 310, 482, 3505, 2554, 366, 13174, 366, 26033, 2554, 271, 310, 220, 15, 366, 23526, 366, 220, 17, 26033, 2554, 271, 286, 7181, 430, 10801, 649, 387, 4205, 13, 220, 578, 6425, 374, 539, 17791, 311, 198, 286, 279, 5347, 318, 3111, 8183, 3160, 11, 719, 311, 279, 4219, 2361, 323, 37300, 198, 286, 9392, 382, 286, 13831, 198, 286, 31423, 286, 865, 11, 379, 551, 2273, 198, 310, 578, 320, 87, 11, 379, 8, 2217, 14259, 382, 286, 5295, 198, 286, 39707, 286, 10801, 11, 9392, 551, 2273, 198, 310, 578, 58497, 10801, 323, 25685, 9392, 627, 286, 3270, 286, 674, 1226, 6859, 304, 1990, 264, 17722, 2373, 323, 264, 198, 286, 674, 4724, 1534, 2373, 13, 1115, 374, 5995, 369, 198, 286, 674, 1457, 779, 584, 1541, 956, 2343, 264, 8987, 4732, 16750, 198, 286, 674, 430, 374, 52872, 994, 1701, 4724, 1534, 2082, 382, 286, 674, 578, 6859, 304, 1403, 8821, 5865, 8779, 304, 198, 286, 674, 279, 56186, 6492, 25, 1455, 315, 279, 892, 374, 198, 286, 674, 7543, 304, 279, 17722, 734, 382, 286, 422, 11656, 2120, 11, 528, 8, 477, 11656, 2120, 11, 2273, 997, 310, 471, 659, 1462, 998, 623, 7569, 42752, 2120, 11, 379, 340, 286, 775, 512, 310, 471, 659, 1462, 998, 623, 7569, 12526, 1534, 2120, 11, 379, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 10801, 323, 25685, 9392, 304, 279, 58497, 16580, 198, 286, 1887, 2728, 320, 87, 11, 379, 8, 13252, 2217, 14259, 382, 286, 1115, 734, 5097, 2512, 315, 279, 2204, 17931, 369, 198, 286, 2361, 9392, 320, 8201, 8, 323, 25685, 9392, 320, 17247, 7887, 286, 5354, 7033, 50677, 310, 482, 3505, 2554, 366, 13174, 366, 26033, 2554, 271, 310, 220, 15, 366, 23526, 366, 220, 17, 26033, 2554, 271, 286, 7181, 430, 10801, 649, 387, 4205, 13, 220, 578, 6425, 374, 539, 17791, 311, 198, 286, 279, 5347, 318, 3111, 8183, 3160, 11, 719, 311, 279, 4219, 2361, 323, 37300, 198, 286, 9392, 382, 286, 13831, 198, 286, 31423, 286, 865, 11, 379, 551, 2273, 198, 310, 578, 320, 87, 11, 379, 8, 2217, 14259, 382, 286, 5295, 198, 286, 39707, 286, 10801, 11, 9392, 551, 2273, 198, 310, 578, 58497, 10801, 323, 25685, 9392, 382, 14711, 6075, 512, 755, 311, 623, 7569, 1214, 11, 865, 11, 379, 997, 286, 3270, 286, 3494, 279, 10801, 323, 25685, 9392, 304, 279, 58497, 16580, 198, 286, 1887, 2728, 320, 87, 11, 379, 8, 13252, 2217, 14259, 382, 286, 1115, 734, 5097, 2512, 315, 279, 2204, 17931, 369, 198, 286, 2361, 9392, 320, 8201, 8, 323, 25685, 9392, 320, 17247, 7887, 286, 5354, 7033, 50677, 310, 482, 3505, 2554, 366, 13174, 366, 26033, 2554, 271, 310, 220, 15, 366, 23526, 366, 220, 17, 26033, 2554, 271, 286, 7181, 430, 10801, 649, 387, 4205, 13, 220, 578, 6425, 374, 539, 17791, 311, 198, 286, 279, 5347, 318, 3111, 8183, 3160, 11, 719, 311, 279, 4219, 2361, 323, 37300, 198, 286, 9392, 382, 286, 13831, 198, 286, 31423, 286, 865, 11, 379, 551, 2273, 198, 310, 578, 320, 87, 11, 379, 8, 2217, 14259, 382, 286, 5295, 198, 286, 39707, 286, 10801, 11, 9392, 551, 2273, 198, 310, 578, 58497, 10801, 323, 25685, 9392, 627, 286, 3270, 286, 674, 1226, 6859, 304, 1990, 264, 17722, 2373, 323, 264, 198, 286, 674, 4724, 1534, 2373, 13, 1115, 374, 5995, 369, 198, 286, 674, 1457, 779, 584, 1541, 956, 2343, 264, 8987, 4732, 16750, 198, 286, 674, 430, 374, 52872, 994, 1701, 4724, 1534, 2082, 382, 286, 674, 578, 6859, 304, 1403, 8821, 5865, 8779, 304, 198, 286, 674, 279, 56186, 6492, 25, 1455, 315, 279, 892, 374, 198, 286, 674, 7543, 304, 279, 17722, 734, 382, 286, 422, 11656, 2120, 11, 528, 8, 477, 11656, 2120, 11, 2273, 997, 310, 471, 659, 1462, 998, 623, 7569, 42752, 2120, 11, 379, 340, 286, 775, 512, 310, 471, 659, 1462, 998, 623, 7569, 12526, 1534, 2120, 11, 379, 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 ]
stbraun/fuzzing
fuzzing/fuzzer.py
FuzzExecutor._execute
def _execute(self, app_, file_): """Run app with file as input. :param app_: application to run. :param file_: file to run app with. :return: success True, else False :rtype: bool """ app_name = os.path.basename(app_) args = [app_] args.extend(self.args[app_]) args.append(file_) process = subprocess.Popen(args) time.sleep(1) status = {True: Status.SUCCESS, False: Status.FAILED} crashed = process.poll() result = status[crashed is None] self.stats_.add(app_name, result) if result is Status.SUCCESS: # process did not crash, so just terminate it process.terminate()
python
def _execute(self, app_, file_): """Run app with file as input. :param app_: application to run. :param file_: file to run app with. :return: success True, else False :rtype: bool """ app_name = os.path.basename(app_) args = [app_] args.extend(self.args[app_]) args.append(file_) process = subprocess.Popen(args) time.sleep(1) status = {True: Status.SUCCESS, False: Status.FAILED} crashed = process.poll() result = status[crashed is None] self.stats_.add(app_name, result) if result is Status.SUCCESS: # process did not crash, so just terminate it process.terminate()
[ "def", "_execute", "(", "self", ",", "app_", ",", "file_", ")", ":", "app_name", "=", "os", ".", "path", ".", "basename", "(", "app_", ")", "args", "=", "[", "app_", "]", "args", ".", "extend", "(", "self", ".", "args", "[", "app_", "]", ")", "args", ".", "append", "(", "file_", ")", "process", "=", "subprocess", ".", "Popen", "(", "args", ")", "time", ".", "sleep", "(", "1", ")", "status", "=", "{", "True", ":", "Status", ".", "SUCCESS", ",", "False", ":", "Status", ".", "FAILED", "}", "crashed", "=", "process", ".", "poll", "(", ")", "result", "=", "status", "[", "crashed", "is", "None", "]", "self", ".", "stats_", ".", "add", "(", "app_name", ",", "result", ")", "if", "result", "is", "Status", ".", "SUCCESS", ":", "# process did not crash, so just terminate it", "process", ".", "terminate", "(", ")" ]
Run app with file as input. :param app_: application to run. :param file_: file to run app with. :return: success True, else False :rtype: bool
[ "Run", "app", "with", "file", "as", "input", "." ]
train
https://github.com/stbraun/fuzzing/blob/974a64472732d4e40db919d242149bf0856fe199/fuzzing/fuzzer.py#L271-L292
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Run app with file as input. :param app_: application to run. :param file_: file to run app with. :return: success True, else False :rtype: bool ### Response: def _execute(self, app_, file_): """Run app with file as input. :param app_: application to run. :param file_: file to run app with. :return: success True, else False :rtype: bool """ app_name = os.path.basename(app_) args = [app_] args.extend(self.args[app_]) args.append(file_) process = subprocess.Popen(args) time.sleep(1) status = {True: Status.SUCCESS, False: Status.FAILED} crashed = process.poll() result = status[crashed is None] self.stats_.add(app_name, result) if result is Status.SUCCESS: # process did not crash, so just terminate it process.terminate() <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6869, 917, 449, 1052, 439, 1988, 382, 286, 551, 913, 917, 24089, 3851, 311, 1629, 627, 286, 551, 913, 1052, 24089, 1052, 311, 1629, 917, 449, 627, 286, 551, 693, 25, 2450, 3082, 11, 775, 3641, 198, 286, 551, 33613, 25, 1845, 271, 14711, 6075, 512, 755, 721, 10469, 1214, 11, 917, 7022, 1052, 62, 997, 286, 4304, 6869, 917, 449, 1052, 439, 1988, 382, 286, 551, 913, 917, 24089, 3851, 311, 1629, 627, 286, 551, 913, 1052, 24089, 1052, 311, 1629, 917, 449, 627, 286, 551, 693, 25, 2450, 3082, 11, 775, 3641, 198, 286, 551, 33613, 25, 1845, 198, 286, 3270, 286, 917, 1292, 284, 2709, 3960, 38092, 11718, 24262, 286, 2897, 284, 510, 680, 62, 933, 286, 2897, 16209, 1214, 16769, 58, 680, 62, 2608, 286, 2897, 2102, 4971, 24262, 286, 1920, 284, 24418, 66640, 7506, 696, 286, 892, 11365, 7, 16, 340, 286, 2704, 284, 314, 2575, 25, 8266, 45784, 11, 3641, 25, 8266, 1006, 32, 14873, 534, 286, 34853, 284, 1920, 42577, 746, 286, 1121, 284, 2704, 58, 5192, 13883, 374, 2290, 933, 286, 659, 30956, 5056, 723, 11718, 1292, 11, 1121, 340, 286, 422, 1121, 374, 8266, 45784, 512, 310, 674, 1920, 1550, 539, 10121, 11, 779, 1120, 30754, 433, 198, 310, 1920, 100042, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6869, 917, 449, 1052, 439, 1988, 382, 286, 551, 913, 917, 24089, 3851, 311, 1629, 627, 286, 551, 913, 1052, 24089, 1052, 311, 1629, 917, 449, 627, 286, 551, 693, 25, 2450, 3082, 11, 775, 3641, 198, 286, 551, 33613, 25, 1845, 271, 14711, 6075, 512, 755, 721, 10469, 1214, 11, 917, 7022, 1052, 62, 997, 286, 4304, 6869, 917, 449, 1052, 439, 1988, 382, 286, 551, 913, 917, 24089, 3851, 311, 1629, 627, 286, 551, 913, 1052, 24089, 1052, 311, 1629, 917, 449, 627, 286, 551, 693, 25, 2450, 3082, 11, 775, 3641, 198, 286, 551, 33613, 25, 1845, 198, 286, 3270, 286, 917, 1292, 284, 2709, 3960, 38092, 11718, 24262, 286, 2897, 284, 510, 680, 62, 933, 286, 2897, 16209, 1214, 16769, 58, 680, 62, 2608, 286, 2897, 2102, 4971, 24262, 286, 1920, 284, 24418, 66640, 7506, 696, 286, 892, 11365, 7, 16, 340, 286, 2704, 284, 314, 2575, 25, 8266, 45784, 11, 3641, 25, 8266, 1006, 32, 14873, 534, 286, 34853, 284, 1920, 42577, 746, 286, 1121, 284, 2704, 58, 5192, 13883, 374, 2290, 933, 286, 659, 30956, 5056, 723, 11718, 1292, 11, 1121, 340, 286, 422, 1121, 374, 8266, 45784, 512, 310, 674, 1920, 1550, 539, 10121, 11, 779, 1120, 30754, 433, 198, 310, 1920, 100042, 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 ]
rosenbrockc/fortpy
fortpy/scripts/analyze.py
FortpyShell.do_rmdep
def do_rmdep(self, args): """Removes dependent variables currently set for plotting/tabulating etc.""" for arg in args.split(): if arg in self.curargs["dependents"]: self.curargs["dependents"].remove(arg) if arg in self.curargs["plottypes"]: del self.curargs["plottypes"][arg] if arg in self.curargs["twinplots"]: del self.curargs["twinplots"][arg] if arg in self.curargs["colors"]: del self.curargs["colors"][arg] if arg in self.curargs["labels"]: del self.curargs["labels"][arg] if arg in self.curargs["markers"]: del self.curargs["markers"][arg] if arg in self.curargs["lines"]: del self.curargs["lines"][arg]
python
def do_rmdep(self, args): """Removes dependent variables currently set for plotting/tabulating etc.""" for arg in args.split(): if arg in self.curargs["dependents"]: self.curargs["dependents"].remove(arg) if arg in self.curargs["plottypes"]: del self.curargs["plottypes"][arg] if arg in self.curargs["twinplots"]: del self.curargs["twinplots"][arg] if arg in self.curargs["colors"]: del self.curargs["colors"][arg] if arg in self.curargs["labels"]: del self.curargs["labels"][arg] if arg in self.curargs["markers"]: del self.curargs["markers"][arg] if arg in self.curargs["lines"]: del self.curargs["lines"][arg]
[ "def", "do_rmdep", "(", "self", ",", "args", ")", ":", "for", "arg", "in", "args", ".", "split", "(", ")", ":", "if", "arg", "in", "self", ".", "curargs", "[", "\"dependents\"", "]", ":", "self", ".", "curargs", "[", "\"dependents\"", "]", ".", "remove", "(", "arg", ")", "if", "arg", "in", "self", ".", "curargs", "[", "\"plottypes\"", "]", ":", "del", "self", ".", "curargs", "[", "\"plottypes\"", "]", "[", "arg", "]", "if", "arg", "in", "self", ".", "curargs", "[", "\"twinplots\"", "]", ":", "del", "self", ".", "curargs", "[", "\"twinplots\"", "]", "[", "arg", "]", "if", "arg", "in", "self", ".", "curargs", "[", "\"colors\"", "]", ":", "del", "self", ".", "curargs", "[", "\"colors\"", "]", "[", "arg", "]", "if", "arg", "in", "self", ".", "curargs", "[", "\"labels\"", "]", ":", "del", "self", ".", "curargs", "[", "\"labels\"", "]", "[", "arg", "]", "if", "arg", "in", "self", ".", "curargs", "[", "\"markers\"", "]", ":", "del", "self", ".", "curargs", "[", "\"markers\"", "]", "[", "arg", "]", "if", "arg", "in", "self", ".", "curargs", "[", "\"lines\"", "]", ":", "del", "self", ".", "curargs", "[", "\"lines\"", "]", "[", "arg", "]" ]
Removes dependent variables currently set for plotting/tabulating etc.
[ "Removes", "dependent", "variables", "currently", "set", "for", "plotting", "/", "tabulating", "etc", "." ]
train
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/scripts/analyze.py#L594-L610
<|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: Removes dependent variables currently set for plotting/tabulating etc. ### Response: def do_rmdep(self, args): """Removes dependent variables currently set for plotting/tabulating etc.""" for arg in args.split(): if arg in self.curargs["dependents"]: self.curargs["dependents"].remove(arg) if arg in self.curargs["plottypes"]: del self.curargs["plottypes"][arg] if arg in self.curargs["twinplots"]: del self.curargs["twinplots"][arg] if arg in self.curargs["colors"]: del self.curargs["colors"][arg] if arg in self.curargs["labels"]: del self.curargs["labels"][arg] if arg in self.curargs["markers"]: del self.curargs["markers"][arg] if arg in self.curargs["lines"]: del self.curargs["lines"][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, 6728, 10296, 18222, 7482, 5131, 743, 369, 45002, 79959, 15853, 5099, 382, 14711, 6075, 512, 755, 656, 59637, 15237, 1214, 11, 2897, 997, 286, 4304, 6728, 10296, 18222, 7482, 5131, 743, 369, 45002, 79959, 15853, 5099, 14781, 286, 369, 1417, 304, 2897, 5402, 4019, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 20080, 812, 34834, 394, 659, 25846, 2164, 1204, 20080, 812, 5638, 5514, 9590, 340, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 501, 1751, 1842, 34834, 394, 1624, 659, 25846, 2164, 1204, 501, 1751, 1842, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 83, 7678, 33897, 34834, 394, 1624, 659, 25846, 2164, 1204, 83, 7678, 33897, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 21712, 34834, 394, 1624, 659, 25846, 2164, 1204, 21712, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 17298, 34834, 394, 1624, 659, 25846, 2164, 1204, 17298, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 61873, 34834, 394, 1624, 659, 25846, 2164, 1204, 61873, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 8128, 34834, 394, 1624, 659, 25846, 2164, 1204, 8128, 18613, 867, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6728, 10296, 18222, 7482, 5131, 743, 369, 45002, 79959, 15853, 5099, 382, 14711, 6075, 512, 755, 656, 59637, 15237, 1214, 11, 2897, 997, 286, 4304, 6728, 10296, 18222, 7482, 5131, 743, 369, 45002, 79959, 15853, 5099, 14781, 286, 369, 1417, 304, 2897, 5402, 4019, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 20080, 812, 34834, 394, 659, 25846, 2164, 1204, 20080, 812, 5638, 5514, 9590, 340, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 501, 1751, 1842, 34834, 394, 1624, 659, 25846, 2164, 1204, 501, 1751, 1842, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 83, 7678, 33897, 34834, 394, 1624, 659, 25846, 2164, 1204, 83, 7678, 33897, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 21712, 34834, 394, 1624, 659, 25846, 2164, 1204, 21712, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 17298, 34834, 394, 1624, 659, 25846, 2164, 1204, 17298, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 61873, 34834, 394, 1624, 659, 25846, 2164, 1204, 61873, 18613, 867, 933, 310, 422, 1417, 304, 659, 25846, 2164, 1204, 8128, 34834, 394, 1624, 659, 25846, 2164, 1204, 8128, 18613, 867, 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 ]
kubernetes-client/python
kubernetes/client/models/runtime_raw_extension.py
RuntimeRawExtension.raw
def raw(self, raw): """ Sets the raw of this RuntimeRawExtension. Raw is the underlying serialization of this object. :param raw: The raw of this RuntimeRawExtension. :type: str """ if raw is None: raise ValueError("Invalid value for `raw`, must not be `None`") if raw is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', raw): raise ValueError("Invalid value for `raw`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") self._raw = raw
python
def raw(self, raw): """ Sets the raw of this RuntimeRawExtension. Raw is the underlying serialization of this object. :param raw: The raw of this RuntimeRawExtension. :type: str """ if raw is None: raise ValueError("Invalid value for `raw`, must not be `None`") if raw is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', raw): raise ValueError("Invalid value for `raw`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") self._raw = raw
[ "def", "raw", "(", "self", ",", "raw", ")", ":", "if", "raw", "is", "None", ":", "raise", "ValueError", "(", "\"Invalid value for `raw`, must not be `None`\"", ")", "if", "raw", "is", "not", "None", "and", "not", "re", ".", "search", "(", "'^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$'", ",", "raw", ")", ":", "raise", "ValueError", "(", "\"Invalid value for `raw`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$/`\"", ")", "self", ".", "_raw", "=", "raw" ]
Sets the raw of this RuntimeRawExtension. Raw is the underlying serialization of this object. :param raw: The raw of this RuntimeRawExtension. :type: str
[ "Sets", "the", "raw", "of", "this", "RuntimeRawExtension", ".", "Raw", "is", "the", "underlying", "serialization", "of", "this", "object", "." ]
train
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/models/runtime_raw_extension.py#L63-L76
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Sets the raw of this RuntimeRawExtension. Raw is the underlying serialization of this object. :param raw: The raw of this RuntimeRawExtension. :type: str ### Response: def raw(self, raw): """ Sets the raw of this RuntimeRawExtension. Raw is the underlying serialization of this object. :param raw: The raw of this RuntimeRawExtension. :type: str """ if raw is None: raise ValueError("Invalid value for `raw`, must not be `None`") if raw is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', raw): raise ValueError("Invalid value for `raw`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") self._raw = raw <|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, 31275, 279, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 23886, 374, 279, 16940, 48543, 315, 420, 1665, 382, 286, 551, 913, 7257, 25, 578, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 551, 1337, 25, 610, 271, 14711, 6075, 512, 755, 7257, 1214, 11, 7257, 997, 286, 3270, 286, 12808, 279, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 23886, 374, 279, 16940, 48543, 315, 420, 1665, 382, 286, 551, 913, 7257, 25, 578, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 551, 1337, 25, 610, 198, 286, 3270, 286, 422, 7257, 374, 2290, 512, 310, 4933, 15764, 446, 8087, 907, 369, 1595, 1059, 7964, 2011, 539, 387, 1595, 4155, 63, 1158, 286, 422, 7257, 374, 539, 2290, 323, 539, 312, 9472, 493, 13571, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 19, 92, 18201, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 17, 92, 419, 75823, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 18, 52285, 12106, 35772, 7257, 997, 310, 4933, 15764, 446, 8087, 907, 369, 1595, 1059, 7964, 2011, 387, 264, 1833, 5497, 477, 6273, 311, 38401, 13571, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 19, 92, 18201, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 17, 92, 419, 75823, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 18, 52285, 12106, 17471, 63, 5240, 286, 659, 1462, 1059, 284, 7257, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 31275, 279, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 23886, 374, 279, 16940, 48543, 315, 420, 1665, 382, 286, 551, 913, 7257, 25, 578, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 551, 1337, 25, 610, 271, 14711, 6075, 512, 755, 7257, 1214, 11, 7257, 997, 286, 3270, 286, 12808, 279, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 23886, 374, 279, 16940, 48543, 315, 420, 1665, 382, 286, 551, 913, 7257, 25, 578, 7257, 315, 420, 11195, 20613, 12318, 627, 286, 551, 1337, 25, 610, 198, 286, 3270, 286, 422, 7257, 374, 2290, 512, 310, 4933, 15764, 446, 8087, 907, 369, 1595, 1059, 7964, 2011, 539, 387, 1595, 4155, 63, 1158, 286, 422, 7257, 374, 539, 2290, 323, 539, 312, 9472, 493, 13571, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 19, 92, 18201, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 17, 92, 419, 75823, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 18, 52285, 12106, 35772, 7257, 997, 310, 4933, 15764, 446, 8087, 907, 369, 1595, 1059, 7964, 2011, 387, 264, 1833, 5497, 477, 6273, 311, 38401, 13571, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 19, 92, 18201, 4925, 58, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 17, 92, 419, 75823, 32, 40379, 9319, 15, 12, 24, 10, 4844, 15731, 18, 52285, 12106, 17471, 63, 5240, 286, 659, 1462, 1059, 284, 7257, 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 ]
juju/charm-helpers
charmhelpers/contrib/database/mysql.py
MySQLHelper.get_allowed_units
def get_allowed_units(self, database, username, relation_id=None): """Get list of units with access grants for database with username. This is typically used to provide shared-db relations with a list of which units have been granted access to the given database. """ self.connect(password=self.get_mysql_root_password()) allowed_units = set() for unit in related_units(relation_id): settings = relation_get(rid=relation_id, unit=unit) # First check for setting with prefix, then without for attr in ["%s_hostname" % (database), 'hostname']: hosts = settings.get(attr, None) if hosts: break if hosts: # hostname can be json-encoded list of hostnames try: hosts = json.loads(hosts) except ValueError: hosts = [hosts] else: hosts = [settings['private-address']] if hosts: for host in hosts: host = self.normalize_address(host) if self.grant_exists(database, username, host): log("Grant exists for host '%s' on db '%s'" % (host, database), level=DEBUG) if unit not in allowed_units: allowed_units.add(unit) else: log("Grant does NOT exist for host '%s' on db '%s'" % (host, database), level=DEBUG) else: log("No hosts found for grant check", level=INFO) return allowed_units
python
def get_allowed_units(self, database, username, relation_id=None): """Get list of units with access grants for database with username. This is typically used to provide shared-db relations with a list of which units have been granted access to the given database. """ self.connect(password=self.get_mysql_root_password()) allowed_units = set() for unit in related_units(relation_id): settings = relation_get(rid=relation_id, unit=unit) # First check for setting with prefix, then without for attr in ["%s_hostname" % (database), 'hostname']: hosts = settings.get(attr, None) if hosts: break if hosts: # hostname can be json-encoded list of hostnames try: hosts = json.loads(hosts) except ValueError: hosts = [hosts] else: hosts = [settings['private-address']] if hosts: for host in hosts: host = self.normalize_address(host) if self.grant_exists(database, username, host): log("Grant exists for host '%s' on db '%s'" % (host, database), level=DEBUG) if unit not in allowed_units: allowed_units.add(unit) else: log("Grant does NOT exist for host '%s' on db '%s'" % (host, database), level=DEBUG) else: log("No hosts found for grant check", level=INFO) return allowed_units
[ "def", "get_allowed_units", "(", "self", ",", "database", ",", "username", ",", "relation_id", "=", "None", ")", ":", "self", ".", "connect", "(", "password", "=", "self", ".", "get_mysql_root_password", "(", ")", ")", "allowed_units", "=", "set", "(", ")", "for", "unit", "in", "related_units", "(", "relation_id", ")", ":", "settings", "=", "relation_get", "(", "rid", "=", "relation_id", ",", "unit", "=", "unit", ")", "# First check for setting with prefix, then without", "for", "attr", "in", "[", "\"%s_hostname\"", "%", "(", "database", ")", ",", "'hostname'", "]", ":", "hosts", "=", "settings", ".", "get", "(", "attr", ",", "None", ")", "if", "hosts", ":", "break", "if", "hosts", ":", "# hostname can be json-encoded list of hostnames", "try", ":", "hosts", "=", "json", ".", "loads", "(", "hosts", ")", "except", "ValueError", ":", "hosts", "=", "[", "hosts", "]", "else", ":", "hosts", "=", "[", "settings", "[", "'private-address'", "]", "]", "if", "hosts", ":", "for", "host", "in", "hosts", ":", "host", "=", "self", ".", "normalize_address", "(", "host", ")", "if", "self", ".", "grant_exists", "(", "database", ",", "username", ",", "host", ")", ":", "log", "(", "\"Grant exists for host '%s' on db '%s'\"", "%", "(", "host", ",", "database", ")", ",", "level", "=", "DEBUG", ")", "if", "unit", "not", "in", "allowed_units", ":", "allowed_units", ".", "add", "(", "unit", ")", "else", ":", "log", "(", "\"Grant does NOT exist for host '%s' on db '%s'\"", "%", "(", "host", ",", "database", ")", ",", "level", "=", "DEBUG", ")", "else", ":", "log", "(", "\"No hosts found for grant check\"", ",", "level", "=", "INFO", ")", "return", "allowed_units" ]
Get list of units with access grants for database with username. This is typically used to provide shared-db relations with a list of which units have been granted access to the given database.
[ "Get", "list", "of", "units", "with", "access", "grants", "for", "database", "with", "username", "." ]
train
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/database/mysql.py#L387-L426
<|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 list of units with access grants for database with username. This is typically used to provide shared-db relations with a list of which units have been granted access to the given database. ### Response: def get_allowed_units(self, database, username, relation_id=None): """Get list of units with access grants for database with username. This is typically used to provide shared-db relations with a list of which units have been granted access to the given database. """ self.connect(password=self.get_mysql_root_password()) allowed_units = set() for unit in related_units(relation_id): settings = relation_get(rid=relation_id, unit=unit) # First check for setting with prefix, then without for attr in ["%s_hostname" % (database), 'hostname']: hosts = settings.get(attr, None) if hosts: break if hosts: # hostname can be json-encoded list of hostnames try: hosts = json.loads(hosts) except ValueError: hosts = [hosts] else: hosts = [settings['private-address']] if hosts: for host in hosts: host = self.normalize_address(host) if self.grant_exists(database, username, host): log("Grant exists for host '%s' on db '%s'" % (host, database), level=DEBUG) if unit not in allowed_units: allowed_units.add(unit) else: log("Grant does NOT exist for host '%s' on db '%s'" % (host, database), level=DEBUG) else: log("No hosts found for grant check", level=INFO) return allowed_units <|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, 1160, 315, 8316, 449, 2680, 25076, 369, 4729, 449, 6059, 382, 286, 1115, 374, 11383, 1511, 311, 3493, 6222, 61499, 4398, 449, 264, 1160, 315, 198, 286, 902, 8316, 617, 1027, 11938, 2680, 311, 279, 2728, 4729, 382, 14711, 6075, 512, 755, 636, 43255, 29445, 1214, 11, 4729, 11, 6059, 11, 12976, 851, 5980, 997, 286, 4304, 1991, 1160, 315, 8316, 449, 2680, 25076, 369, 4729, 449, 6059, 382, 286, 1115, 374, 11383, 1511, 311, 3493, 6222, 61499, 4398, 449, 264, 1160, 315, 198, 286, 902, 8316, 617, 1027, 11938, 2680, 311, 279, 2728, 4729, 627, 286, 3270, 286, 659, 11034, 23608, 7822, 673, 61092, 13290, 10330, 2455, 286, 5535, 29445, 284, 743, 746, 286, 369, 5089, 304, 5552, 29445, 5921, 2354, 851, 997, 310, 5110, 284, 12976, 3138, 7, 1907, 28, 23013, 851, 11, 5089, 28, 3928, 340, 310, 674, 5629, 1817, 369, 6376, 449, 9436, 11, 1243, 2085, 198, 310, 369, 6510, 304, 4482, 4, 82, 64940, 1, 1034, 320, 12494, 705, 364, 28906, 18888, 394, 18939, 284, 5110, 673, 33531, 11, 2290, 340, 394, 422, 18939, 512, 504, 1464, 271, 310, 422, 18939, 512, 394, 674, 29215, 649, 387, 3024, 93362, 1160, 315, 3552, 11654, 198, 394, 1456, 512, 504, 18939, 284, 3024, 23818, 20569, 82, 340, 394, 3734, 15764, 512, 504, 18939, 284, 510, 45792, 933, 310, 775, 512, 394, 18939, 284, 510, 6648, 681, 2039, 42733, 663, 2595, 310, 422, 18939, 512, 394, 369, 3552, 304, 18939, 512, 504, 3552, 284, 659, 45757, 6886, 20569, 340, 504, 422, 659, 18810, 519, 9965, 42749, 11, 6059, 11, 3552, 997, 667, 1515, 446, 69071, 6866, 369, 3552, 7832, 82, 6, 389, 3000, 7832, 82, 15260, 33648, 1014, 320, 3875, 11, 4729, 705, 2237, 28, 5261, 340, 667, 422, 5089, 539, 304, 5535, 29445, 512, 1014, 5535, 29445, 1388, 25116, 340, 504, 775, 512, 667, 1515, 446, 69071, 1587, 4276, 3073, 369, 3552, 7832, 82, 6, 389, 3000, 7832, 82, 15260, 33648, 1014, 320, 3875, 11, 4729, 705, 2237, 28, 5261, 340, 310, 775, 512, 394, 1515, 446, 2822, 18939, 1766, 369, 13500, 1817, 498, 2237, 28, 6775, 696, 286, 471, 5535, 29445, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1160, 315, 8316, 449, 2680, 25076, 369, 4729, 449, 6059, 382, 286, 1115, 374, 11383, 1511, 311, 3493, 6222, 61499, 4398, 449, 264, 1160, 315, 198, 286, 902, 8316, 617, 1027, 11938, 2680, 311, 279, 2728, 4729, 382, 14711, 6075, 512, 755, 636, 43255, 29445, 1214, 11, 4729, 11, 6059, 11, 12976, 851, 5980, 997, 286, 4304, 1991, 1160, 315, 8316, 449, 2680, 25076, 369, 4729, 449, 6059, 382, 286, 1115, 374, 11383, 1511, 311, 3493, 6222, 61499, 4398, 449, 264, 1160, 315, 198, 286, 902, 8316, 617, 1027, 11938, 2680, 311, 279, 2728, 4729, 627, 286, 3270, 286, 659, 11034, 23608, 7822, 673, 61092, 13290, 10330, 2455, 286, 5535, 29445, 284, 743, 746, 286, 369, 5089, 304, 5552, 29445, 5921, 2354, 851, 997, 310, 5110, 284, 12976, 3138, 7, 1907, 28, 23013, 851, 11, 5089, 28, 3928, 340, 310, 674, 5629, 1817, 369, 6376, 449, 9436, 11, 1243, 2085, 198, 310, 369, 6510, 304, 4482, 4, 82, 64940, 1, 1034, 320, 12494, 705, 364, 28906, 18888, 394, 18939, 284, 5110, 673, 33531, 11, 2290, 340, 394, 422, 18939, 512, 504, 1464, 271, 310, 422, 18939, 512, 394, 674, 29215, 649, 387, 3024, 93362, 1160, 315, 3552, 11654, 198, 394, 1456, 512, 504, 18939, 284, 3024, 23818, 20569, 82, 340, 394, 3734, 15764, 512, 504, 18939, 284, 510, 45792, 933, 310, 775, 512, 394, 18939, 284, 510, 6648, 681, 2039, 42733, 663, 2595, 310, 422, 18939, 512, 394, 369, 3552, 304, 18939, 512, 504, 3552, 284, 659, 45757, 6886, 20569, 340, 504, 422, 659, 18810, 519, 9965, 42749, 11, 6059, 11, 3552, 997, 667, 1515, 446, 69071, 6866, 369, 3552, 7832, 82, 6, 389, 3000, 7832, 82, 15260, 33648, 1014, 320, 3875, 11, 4729, 705, 2237, 28, 5261, 340, 667, 422, 5089, 539, 304, 5535, 29445, 512, 1014, 5535, 29445, 1388, 25116, 340, 504, 775, 512, 667, 1515, 446, 69071, 1587, 4276, 3073, 369, 3552, 7832, 82, 6, 389, 3000, 7832, 82, 15260, 33648, 1014, 320, 3875, 11, 4729, 705, 2237, 28, 5261, 340, 310, 775, 512, 394, 1515, 446, 2822, 18939, 1766, 369, 13500, 1817, 498, 2237, 28, 6775, 696, 286, 471, 5535, 29445, 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 ]
pandas-dev/pandas
pandas/io/stata.py
StataWriter117._update_strl_names
def _update_strl_names(self): """Update column names for conversion to strl if they might have been changed to comply with Stata naming rules""" # Update convert_strl if names changed for orig, new in self._converted_names.items(): if orig in self._convert_strl: idx = self._convert_strl.index(orig) self._convert_strl[idx] = new
python
def _update_strl_names(self): """Update column names for conversion to strl if they might have been changed to comply with Stata naming rules""" # Update convert_strl if names changed for orig, new in self._converted_names.items(): if orig in self._convert_strl: idx = self._convert_strl.index(orig) self._convert_strl[idx] = new
[ "def", "_update_strl_names", "(", "self", ")", ":", "# Update convert_strl if names changed", "for", "orig", ",", "new", "in", "self", ".", "_converted_names", ".", "items", "(", ")", ":", "if", "orig", "in", "self", ".", "_convert_strl", ":", "idx", "=", "self", ".", "_convert_strl", ".", "index", "(", "orig", ")", "self", ".", "_convert_strl", "[", "idx", "]", "=", "new" ]
Update column names for conversion to strl if they might have been changed to comply with Stata naming rules
[ "Update", "column", "names", "for", "conversion", "to", "strl", "if", "they", "might", "have", "been", "changed", "to", "comply", "with", "Stata", "naming", "rules" ]
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/stata.py#L2948-L2955
<|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 column names for conversion to strl if they might have been changed to comply with Stata naming rules ### Response: def _update_strl_names(self): """Update column names for conversion to strl if they might have been changed to comply with Stata naming rules""" # Update convert_strl if names changed for orig, new in self._converted_names.items(): if orig in self._convert_strl: idx = self._convert_strl.index(orig) self._convert_strl[idx] = new <|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, 3330, 5144, 369, 14747, 311, 610, 75, 422, 814, 2643, 617, 1027, 198, 286, 5614, 311, 26069, 449, 800, 460, 36048, 5718, 271, 14711, 6075, 512, 755, 721, 2443, 2966, 75, 9366, 1214, 997, 286, 4304, 4387, 3330, 5144, 369, 14747, 311, 610, 75, 422, 814, 2643, 617, 1027, 198, 286, 5614, 311, 26069, 449, 800, 460, 36048, 5718, 7275, 286, 674, 5666, 5625, 2966, 75, 422, 5144, 5614, 198, 286, 369, 2780, 11, 502, 304, 659, 1462, 77304, 9366, 9812, 4019, 310, 422, 2780, 304, 659, 1462, 14500, 2966, 75, 512, 394, 7335, 284, 659, 1462, 14500, 2966, 75, 5265, 55937, 340, 394, 659, 1462, 14500, 2966, 75, 11858, 60, 284, 502, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 4387, 3330, 5144, 369, 14747, 311, 610, 75, 422, 814, 2643, 617, 1027, 198, 286, 5614, 311, 26069, 449, 800, 460, 36048, 5718, 271, 14711, 6075, 512, 755, 721, 2443, 2966, 75, 9366, 1214, 997, 286, 4304, 4387, 3330, 5144, 369, 14747, 311, 610, 75, 422, 814, 2643, 617, 1027, 198, 286, 5614, 311, 26069, 449, 800, 460, 36048, 5718, 7275, 286, 674, 5666, 5625, 2966, 75, 422, 5144, 5614, 198, 286, 369, 2780, 11, 502, 304, 659, 1462, 77304, 9366, 9812, 4019, 310, 422, 2780, 304, 659, 1462, 14500, 2966, 75, 512, 394, 7335, 284, 659, 1462, 14500, 2966, 75, 5265, 55937, 340, 394, 659, 1462, 14500, 2966, 75, 11858, 60, 284, 502, 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 ]
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_beginning_vertically
def scroll_to_beginning_vertically(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toBeginning(steps=steps)
python
def scroll_to_beginning_vertically(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toBeginning(steps=steps)
[ "def", "scroll_to_beginning_vertically", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "toBeginning", "(", "steps", "=", "steps", ")" ]
Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details.
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "beginning", "*", "vertically", "." ]
train
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L472-L478
<|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: Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. ### Response: def scroll_to_beginning_vertically(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toBeginning(steps=steps) <|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, 8591, 279, 1665, 902, 706, 353, 96364, 9, 8365, 311, 353, 7413, 1251, 9, 52035, 382, 286, 3580, 1595, 8591, 22952, 15408, 2740, 63, 369, 810, 3649, 382, 14711, 6075, 512, 755, 9236, 2401, 24223, 1251, 55100, 2740, 1214, 11, 7504, 28, 605, 11, 353, 2164, 71079, 96364, 997, 286, 3270, 286, 23198, 279, 1665, 902, 706, 353, 96364, 9, 8365, 311, 353, 7413, 1251, 9, 52035, 382, 286, 3580, 1595, 8591, 22952, 15408, 2740, 63, 369, 810, 3649, 627, 286, 3270, 286, 471, 659, 18861, 22551, 96364, 570, 12891, 58865, 2446, 76390, 85371, 28, 25047, 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, 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, 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, 8591, 279, 1665, 902, 706, 353, 96364, 9, 8365, 311, 353, 7413, 1251, 9, 52035, 382, 286, 3580, 1595, 8591, 22952, 15408, 2740, 63, 369, 810, 3649, 382, 14711, 6075, 512, 755, 9236, 2401, 24223, 1251, 55100, 2740, 1214, 11, 7504, 28, 605, 11, 353, 2164, 71079, 96364, 997, 286, 3270, 286, 23198, 279, 1665, 902, 706, 353, 96364, 9, 8365, 311, 353, 7413, 1251, 9, 52035, 382, 286, 3580, 1595, 8591, 22952, 15408, 2740, 63, 369, 810, 3649, 627, 286, 3270, 286, 471, 659, 18861, 22551, 96364, 570, 12891, 58865, 2446, 76390, 85371, 28, 25047, 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 ]
wearpants/instrument
instrument/output/csv.py
CSVFileMetric.dump
def dump(self): """Output all recorded metrics""" with self.lock: atexit.unregister(self.dump) self.fh.close()
python
def dump(self): """Output all recorded metrics""" with self.lock: atexit.unregister(self.dump) self.fh.close()
[ "def", "dump", "(", "self", ")", ":", "with", "self", ".", "lock", ":", "atexit", ".", "unregister", "(", "self", ".", "dump", ")", "self", ".", "fh", ".", "close", "(", ")" ]
Output all recorded metrics
[ "Output", "all", "recorded", "metrics" ]
train
https://github.com/wearpants/instrument/blob/a0f6103574ab58a82361a951e5e56b69aedfe294/instrument/output/csv.py#L117-L121
<|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: Output all recorded metrics ### Response: def dump(self): """Output all recorded metrics""" with self.lock: atexit.unregister(self.dump) self.fh.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, 5207, 682, 12715, 17150, 271, 14711, 6075, 512, 755, 10488, 1214, 997, 286, 4304, 5207, 682, 12715, 17150, 7275, 286, 449, 659, 21679, 512, 310, 520, 13966, 83206, 1214, 28026, 340, 310, 659, 840, 71, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 5207, 682, 12715, 17150, 271, 14711, 6075, 512, 755, 10488, 1214, 997, 286, 4304, 5207, 682, 12715, 17150, 7275, 286, 449, 659, 21679, 512, 310, 520, 13966, 83206, 1214, 28026, 340, 310, 659, 840, 71, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
ray-project/ray
python/ray/experimental/array/distributed/linalg.py
tsqr
def tsqr(a): """Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble(), then q_full.shape == (M, K). - np.allclose(np.dot(q_full.T, q_full), np.eye(K)) == True. - If r_val = ray.get(np.ndarray, r), then r_val.shape == (K, N). - np.allclose(r, np.triu(r)) == True. """ if len(a.shape) != 2: raise Exception("tsqr requires len(a.shape) == 2, but a.shape is " "{}".format(a.shape)) if a.num_blocks[1] != 1: raise Exception("tsqr requires a.num_blocks[1] == 1, but a.num_blocks " "is {}".format(a.num_blocks)) num_blocks = a.num_blocks[0] K = int(np.ceil(np.log2(num_blocks))) + 1 q_tree = np.empty((num_blocks, K), dtype=object) current_rs = [] for i in range(num_blocks): block = a.objectids[i, 0] q, r = ra.linalg.qr.remote(block) q_tree[i, 0] = q current_rs.append(r) for j in range(1, K): new_rs = [] for i in range(int(np.ceil(1.0 * len(current_rs) / 2))): stacked_rs = ra.vstack.remote(*current_rs[(2 * i):(2 * i + 2)]) q, r = ra.linalg.qr.remote(stacked_rs) q_tree[i, j] = q new_rs.append(r) current_rs = new_rs assert len(current_rs) == 1, "len(current_rs) = " + str(len(current_rs)) # handle the special case in which the whole DistArray "a" fits in one # block and has fewer rows than columns, this is a bit ugly so think about # how to remove it if a.shape[0] >= a.shape[1]: q_shape = a.shape else: q_shape = [a.shape[0], a.shape[0]] q_num_blocks = core.DistArray.compute_num_blocks(q_shape) q_objectids = np.empty(q_num_blocks, dtype=object) q_result = core.DistArray(q_shape, q_objectids) # reconstruct output for i in range(num_blocks): q_block_current = q_tree[i, 0] ith_index = i for j in range(1, K): if np.mod(ith_index, 2) == 0: lower = [0, 0] upper = [a.shape[1], core.BLOCK_SIZE] else: lower = [a.shape[1], 0] upper = [2 * a.shape[1], core.BLOCK_SIZE] ith_index //= 2 q_block_current = ra.dot.remote( q_block_current, ra.subarray.remote(q_tree[ith_index, j], lower, upper)) q_result.objectids[i] = q_block_current r = current_rs[0] return q_result, ray.get(r)
python
def tsqr(a): """Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble(), then q_full.shape == (M, K). - np.allclose(np.dot(q_full.T, q_full), np.eye(K)) == True. - If r_val = ray.get(np.ndarray, r), then r_val.shape == (K, N). - np.allclose(r, np.triu(r)) == True. """ if len(a.shape) != 2: raise Exception("tsqr requires len(a.shape) == 2, but a.shape is " "{}".format(a.shape)) if a.num_blocks[1] != 1: raise Exception("tsqr requires a.num_blocks[1] == 1, but a.num_blocks " "is {}".format(a.num_blocks)) num_blocks = a.num_blocks[0] K = int(np.ceil(np.log2(num_blocks))) + 1 q_tree = np.empty((num_blocks, K), dtype=object) current_rs = [] for i in range(num_blocks): block = a.objectids[i, 0] q, r = ra.linalg.qr.remote(block) q_tree[i, 0] = q current_rs.append(r) for j in range(1, K): new_rs = [] for i in range(int(np.ceil(1.0 * len(current_rs) / 2))): stacked_rs = ra.vstack.remote(*current_rs[(2 * i):(2 * i + 2)]) q, r = ra.linalg.qr.remote(stacked_rs) q_tree[i, j] = q new_rs.append(r) current_rs = new_rs assert len(current_rs) == 1, "len(current_rs) = " + str(len(current_rs)) # handle the special case in which the whole DistArray "a" fits in one # block and has fewer rows than columns, this is a bit ugly so think about # how to remove it if a.shape[0] >= a.shape[1]: q_shape = a.shape else: q_shape = [a.shape[0], a.shape[0]] q_num_blocks = core.DistArray.compute_num_blocks(q_shape) q_objectids = np.empty(q_num_blocks, dtype=object) q_result = core.DistArray(q_shape, q_objectids) # reconstruct output for i in range(num_blocks): q_block_current = q_tree[i, 0] ith_index = i for j in range(1, K): if np.mod(ith_index, 2) == 0: lower = [0, 0] upper = [a.shape[1], core.BLOCK_SIZE] else: lower = [a.shape[1], 0] upper = [2 * a.shape[1], core.BLOCK_SIZE] ith_index //= 2 q_block_current = ra.dot.remote( q_block_current, ra.subarray.remote(q_tree[ith_index, j], lower, upper)) q_result.objectids[i] = q_block_current r = current_rs[0] return q_result, ray.get(r)
[ "def", "tsqr", "(", "a", ")", ":", "if", "len", "(", "a", ".", "shape", ")", "!=", "2", ":", "raise", "Exception", "(", "\"tsqr requires len(a.shape) == 2, but a.shape is \"", "\"{}\"", ".", "format", "(", "a", ".", "shape", ")", ")", "if", "a", ".", "num_blocks", "[", "1", "]", "!=", "1", ":", "raise", "Exception", "(", "\"tsqr requires a.num_blocks[1] == 1, but a.num_blocks \"", "\"is {}\"", ".", "format", "(", "a", ".", "num_blocks", ")", ")", "num_blocks", "=", "a", ".", "num_blocks", "[", "0", "]", "K", "=", "int", "(", "np", ".", "ceil", "(", "np", ".", "log2", "(", "num_blocks", ")", ")", ")", "+", "1", "q_tree", "=", "np", ".", "empty", "(", "(", "num_blocks", ",", "K", ")", ",", "dtype", "=", "object", ")", "current_rs", "=", "[", "]", "for", "i", "in", "range", "(", "num_blocks", ")", ":", "block", "=", "a", ".", "objectids", "[", "i", ",", "0", "]", "q", ",", "r", "=", "ra", ".", "linalg", ".", "qr", ".", "remote", "(", "block", ")", "q_tree", "[", "i", ",", "0", "]", "=", "q", "current_rs", ".", "append", "(", "r", ")", "for", "j", "in", "range", "(", "1", ",", "K", ")", ":", "new_rs", "=", "[", "]", "for", "i", "in", "range", "(", "int", "(", "np", ".", "ceil", "(", "1.0", "*", "len", "(", "current_rs", ")", "/", "2", ")", ")", ")", ":", "stacked_rs", "=", "ra", ".", "vstack", ".", "remote", "(", "*", "current_rs", "[", "(", "2", "*", "i", ")", ":", "(", "2", "*", "i", "+", "2", ")", "]", ")", "q", ",", "r", "=", "ra", ".", "linalg", ".", "qr", ".", "remote", "(", "stacked_rs", ")", "q_tree", "[", "i", ",", "j", "]", "=", "q", "new_rs", ".", "append", "(", "r", ")", "current_rs", "=", "new_rs", "assert", "len", "(", "current_rs", ")", "==", "1", ",", "\"len(current_rs) = \"", "+", "str", "(", "len", "(", "current_rs", ")", ")", "# handle the special case in which the whole DistArray \"a\" fits in one", "# block and has fewer rows than columns, this is a bit ugly so think about", "# how to remove it", "if", "a", ".", "shape", "[", "0", "]", ">=", "a", ".", "shape", "[", "1", "]", ":", "q_shape", "=", "a", ".", "shape", "else", ":", "q_shape", "=", "[", "a", ".", "shape", "[", "0", "]", ",", "a", ".", "shape", "[", "0", "]", "]", "q_num_blocks", "=", "core", ".", "DistArray", ".", "compute_num_blocks", "(", "q_shape", ")", "q_objectids", "=", "np", ".", "empty", "(", "q_num_blocks", ",", "dtype", "=", "object", ")", "q_result", "=", "core", ".", "DistArray", "(", "q_shape", ",", "q_objectids", ")", "# reconstruct output", "for", "i", "in", "range", "(", "num_blocks", ")", ":", "q_block_current", "=", "q_tree", "[", "i", ",", "0", "]", "ith_index", "=", "i", "for", "j", "in", "range", "(", "1", ",", "K", ")", ":", "if", "np", ".", "mod", "(", "ith_index", ",", "2", ")", "==", "0", ":", "lower", "=", "[", "0", ",", "0", "]", "upper", "=", "[", "a", ".", "shape", "[", "1", "]", ",", "core", ".", "BLOCK_SIZE", "]", "else", ":", "lower", "=", "[", "a", ".", "shape", "[", "1", "]", ",", "0", "]", "upper", "=", "[", "2", "*", "a", ".", "shape", "[", "1", "]", ",", "core", ".", "BLOCK_SIZE", "]", "ith_index", "//=", "2", "q_block_current", "=", "ra", ".", "dot", ".", "remote", "(", "q_block_current", ",", "ra", ".", "subarray", ".", "remote", "(", "q_tree", "[", "ith_index", ",", "j", "]", ",", "lower", ",", "upper", ")", ")", "q_result", ".", "objectids", "[", "i", "]", "=", "q_block_current", "r", "=", "current_rs", "[", "0", "]", "return", "q_result", ",", "ray", ".", "get", "(", "r", ")" ]
Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble(), then q_full.shape == (M, K). - np.allclose(np.dot(q_full.T, q_full), np.eye(K)) == True. - If r_val = ray.get(np.ndarray, r), then r_val.shape == (K, N). - np.allclose(r, np.triu(r)) == True.
[ "Perform", "a", "QR", "decomposition", "of", "a", "tall", "-", "skinny", "matrix", "." ]
train
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/array/distributed/linalg.py#L15-L84
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble(), then q_full.shape == (M, K). - np.allclose(np.dot(q_full.T, q_full), np.eye(K)) == True. - If r_val = ray.get(np.ndarray, r), then r_val.shape == (K, N). - np.allclose(r, np.triu(r)) == True. ### Response: def tsqr(a): """Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble(), then q_full.shape == (M, K). - np.allclose(np.dot(q_full.T, q_full), np.eye(K)) == True. - If r_val = ray.get(np.ndarray, r), then r_val.shape == (K, N). - np.allclose(r, np.triu(r)) == True. """ if len(a.shape) != 2: raise Exception("tsqr requires len(a.shape) == 2, but a.shape is " "{}".format(a.shape)) if a.num_blocks[1] != 1: raise Exception("tsqr requires a.num_blocks[1] == 1, but a.num_blocks " "is {}".format(a.num_blocks)) num_blocks = a.num_blocks[0] K = int(np.ceil(np.log2(num_blocks))) + 1 q_tree = np.empty((num_blocks, K), dtype=object) current_rs = [] for i in range(num_blocks): block = a.objectids[i, 0] q, r = ra.linalg.qr.remote(block) q_tree[i, 0] = q current_rs.append(r) for j in range(1, K): new_rs = [] for i in range(int(np.ceil(1.0 * len(current_rs) / 2))): stacked_rs = ra.vstack.remote(*current_rs[(2 * i):(2 * i + 2)]) q, r = ra.linalg.qr.remote(stacked_rs) q_tree[i, j] = q new_rs.append(r) current_rs = new_rs assert len(current_rs) == 1, "len(current_rs) = " + str(len(current_rs)) # handle the special case in which the whole DistArray "a" fits in one # block and has fewer rows than columns, this is a bit ugly so think about # how to remove it if a.shape[0] >= a.shape[1]: q_shape = a.shape else: q_shape = [a.shape[0], a.shape[0]] q_num_blocks = core.DistArray.compute_num_blocks(q_shape) q_objectids = np.empty(q_num_blocks, dtype=object) q_result = core.DistArray(q_shape, q_objectids) # reconstruct output for i in range(num_blocks): q_block_current = q_tree[i, 0] ith_index = i for j in range(1, K): if np.mod(ith_index, 2) == 0: lower = [0, 0] upper = [a.shape[1], core.BLOCK_SIZE] else: lower = [a.shape[1], 0] upper = [2 * a.shape[1], core.BLOCK_SIZE] ith_index //= 2 q_block_current = ra.dot.remote( q_block_current, ra.subarray.remote(q_tree[ith_index, j], lower, upper)) q_result.objectids[i] = q_block_current r = current_rs[0] return q_result, ray.get(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, 48051, 264, 39799, 66266, 315, 264, 16615, 1355, 8148, 3919, 6303, 382, 262, 18161, 512, 286, 264, 25, 362, 4332, 6303, 449, 6211, 386, 87, 45, 320, 13066, 2972, 735, 284, 1332, 3269, 11, 452, 595, 382, 262, 5295, 512, 286, 362, 14743, 315, 2874, 320, 64, 28704, 1895, 8, 323, 436, 320, 64, 8760, 1358, 8, 37154, 279, 198, 310, 2768, 627, 310, 482, 1442, 2874, 16776, 284, 18803, 673, 5549, 380, 1895, 11, 2874, 570, 70208, 1535, 1243, 198, 1078, 2874, 16776, 7201, 624, 320, 44, 11, 735, 4390, 310, 482, 2660, 7825, 5669, 10101, 23633, 10806, 16776, 844, 11, 2874, 16776, 705, 2660, 73840, 17155, 595, 624, 3082, 627, 310, 482, 1442, 436, 6320, 284, 18803, 673, 10101, 36649, 11, 436, 705, 1243, 436, 6320, 7201, 624, 320, 42, 11, 452, 4390, 310, 482, 2660, 7825, 5669, 2666, 11, 2660, 5543, 19260, 2666, 595, 624, 3082, 382, 14711, 6075, 512, 755, 10814, 23866, 2948, 997, 262, 4304, 48051, 264, 39799, 66266, 315, 264, 16615, 1355, 8148, 3919, 6303, 382, 262, 18161, 512, 286, 264, 25, 362, 4332, 6303, 449, 6211, 386, 87, 45, 320, 13066, 2972, 735, 284, 1332, 3269, 11, 452, 595, 382, 262, 5295, 512, 286, 362, 14743, 315, 2874, 320, 64, 28704, 1895, 8, 323, 436, 320, 64, 8760, 1358, 8, 37154, 279, 198, 310, 2768, 627, 310, 482, 1442, 2874, 16776, 284, 18803, 673, 5549, 380, 1895, 11, 2874, 570, 70208, 1535, 1243, 198, 1078, 2874, 16776, 7201, 624, 320, 44, 11, 735, 4390, 310, 482, 2660, 7825, 5669, 10101, 23633, 10806, 16776, 844, 11, 2874, 16776, 705, 2660, 73840, 17155, 595, 624, 3082, 627, 310, 482, 1442, 436, 6320, 284, 18803, 673, 10101, 36649, 11, 436, 705, 1243, 436, 6320, 7201, 624, 320, 42, 11, 452, 4390, 310, 482, 2660, 7825, 5669, 2666, 11, 2660, 5543, 19260, 2666, 595, 624, 3082, 627, 262, 3270, 262, 422, 2479, 2948, 7201, 8, 976, 220, 17, 512, 286, 4933, 4204, 446, 2641, 23866, 7612, 2479, 2948, 7201, 8, 624, 220, 17, 11, 719, 264, 7201, 374, 6360, 667, 36603, 3343, 2293, 2948, 7201, 1192, 262, 422, 264, 10744, 26266, 58, 16, 60, 976, 220, 16, 512, 286, 4933, 4204, 446, 2641, 23866, 7612, 264, 10744, 26266, 58, 16, 60, 624, 220, 16, 11, 719, 264, 10744, 26266, 6360, 667, 330, 285, 21532, 2293, 2948, 10744, 26266, 4489, 262, 1661, 26266, 284, 264, 10744, 26266, 58, 15, 933, 262, 735, 284, 528, 10101, 30746, 10101, 1699, 17, 8228, 26266, 7861, 489, 220, 16, 198, 262, 2874, 11925, 284, 2660, 9357, 1209, 2470, 26266, 11, 735, 705, 13534, 28, 1735, 340, 262, 1510, 48215, 284, 4260, 262, 369, 602, 304, 2134, 8228, 26266, 997, 286, 2565, 284, 264, 6163, 3447, 1004, 11, 220, 15, 933, 286, 2874, 11, 436, 284, 15473, 38832, 11608, 81, 35193, 19200, 340, 286, 2874, 11925 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 48051, 264, 39799, 66266, 315, 264, 16615, 1355, 8148, 3919, 6303, 382, 262, 18161, 512, 286, 264, 25, 362, 4332, 6303, 449, 6211, 386, 87, 45, 320, 13066, 2972, 735, 284, 1332, 3269, 11, 452, 595, 382, 262, 5295, 512, 286, 362, 14743, 315, 2874, 320, 64, 28704, 1895, 8, 323, 436, 320, 64, 8760, 1358, 8, 37154, 279, 198, 310, 2768, 627, 310, 482, 1442, 2874, 16776, 284, 18803, 673, 5549, 380, 1895, 11, 2874, 570, 70208, 1535, 1243, 198, 1078, 2874, 16776, 7201, 624, 320, 44, 11, 735, 4390, 310, 482, 2660, 7825, 5669, 10101, 23633, 10806, 16776, 844, 11, 2874, 16776, 705, 2660, 73840, 17155, 595, 624, 3082, 627, 310, 482, 1442, 436, 6320, 284, 18803, 673, 10101, 36649, 11, 436, 705, 1243, 436, 6320, 7201, 624, 320, 42, 11, 452, 4390, 310, 482, 2660, 7825, 5669, 2666, 11, 2660, 5543, 19260, 2666, 595, 624, 3082, 382, 14711, 6075, 512, 755, 10814, 23866, 2948, 997, 262, 4304, 48051, 264, 39799, 66266, 315, 264, 16615, 1355, 8148, 3919, 6303, 382, 262, 18161, 512, 286, 264, 25, 362, 4332, 6303, 449, 6211, 386, 87, 45, 320, 13066, 2972, 735, 284, 1332, 3269, 11, 452, 595, 382, 262, 5295, 512, 286, 362, 14743, 315, 2874, 320, 64, 28704, 1895, 8, 323, 436, 320, 64, 8760, 1358, 8, 37154, 279, 198, 310, 2768, 627, 310, 482, 1442, 2874, 16776, 284, 18803, 673, 5549, 380, 1895, 11, 2874, 570, 70208, 1535, 1243, 198, 1078, 2874, 16776, 7201, 624, 320, 44, 11, 735, 4390, 310, 482, 2660, 7825, 5669, 10101, 23633, 10806, 16776, 844, 11, 2874, 16776, 705, 2660, 73840, 17155, 595, 624, 3082, 627, 310, 482, 1442, 436, 6320, 284, 18803, 673, 10101, 36649, 11, 436, 705, 1243, 436, 6320, 7201, 624, 320, 42, 11, 452, 4390, 310, 482, 2660, 7825, 5669, 2666, 11, 2660, 5543, 19260, 2666, 595, 624, 3082, 627, 262, 3270, 262, 422, 2479, 2948, 7201, 8, 976, 220, 17, 512, 286, 4933, 4204, 446, 2641, 23866, 7612, 2479, 2948, 7201, 8, 624, 220, 17, 11, 719, 264, 7201, 374, 6360, 667, 36603, 3343, 2293, 2948, 7201, 1192, 262, 422, 264, 10744, 26266, 58, 16, 60, 976, 220, 16, 512, 286, 4933, 4204, 446, 2641, 23866, 7612, 264, 10744, 26266, 58, 16, 60, 624, 220, 16, 11, 719, 264, 10744, 26266, 6360, 667, 330, 285, 21532, 2293, 2948, 10744, 26266, 4489, 262, 1661, 26266, 284, 264, 10744, 26266, 58, 15, 933, 262, 735, 284, 528, 10101, 30746, 10101, 1699, 17, 8228, 26266, 7861, 489, 220, 16, 198, 262, 2874, 11925, 284, 2660, 9357, 1209, 2470, 26266, 11, 735, 705, 13534, 28, 1735, 340, 262, 1510, 48215, 284, 4260, 262, 369, 602, 304, 2134, 8228, 26266, 997, 286, 2565, 284, 264, 6163, 3447, 1004, 11, 220, 15, 933, 286, 2874, 11, 436, 284, 15473, 38832, 11608, 81, 35193, 19200, 340, 286, 2874, 11925 ]
steveYeah/PyBomb
pybomb/clients/game_client.py
GameClient.fetch
def fetch(self, id_, return_fields=None): """ Wrapper for fetching details of game by ID :param id_: int :param return_fields: tuple :return: pybomb.clients.Response """ game_params = {"id": id_} if return_fields is not None: self._validate_return_fields(return_fields) field_list = ",".join(return_fields) game_params["field_list"] = field_list response = self._query(game_params, direct=True) return response
python
def fetch(self, id_, return_fields=None): """ Wrapper for fetching details of game by ID :param id_: int :param return_fields: tuple :return: pybomb.clients.Response """ game_params = {"id": id_} if return_fields is not None: self._validate_return_fields(return_fields) field_list = ",".join(return_fields) game_params["field_list"] = field_list response = self._query(game_params, direct=True) return response
[ "def", "fetch", "(", "self", ",", "id_", ",", "return_fields", "=", "None", ")", ":", "game_params", "=", "{", "\"id\"", ":", "id_", "}", "if", "return_fields", "is", "not", "None", ":", "self", ".", "_validate_return_fields", "(", "return_fields", ")", "field_list", "=", "\",\"", ".", "join", "(", "return_fields", ")", "game_params", "[", "\"field_list\"", "]", "=", "field_list", "response", "=", "self", ".", "_query", "(", "game_params", ",", "direct", "=", "True", ")", "return", "response" ]
Wrapper for fetching details of game by ID :param id_: int :param return_fields: tuple :return: pybomb.clients.Response
[ "Wrapper", "for", "fetching", "details", "of", "game", "by", "ID" ]
train
https://github.com/steveYeah/PyBomb/blob/54045d74e642f8a1c4366c24bd6a330ae3da6257/pybomb/clients/game_client.py#L57-L76
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Wrapper for fetching details of game by ID :param id_: int :param return_fields: tuple :return: pybomb.clients.Response ### Response: def fetch(self, id_, return_fields=None): """ Wrapper for fetching details of game by ID :param id_: int :param return_fields: tuple :return: pybomb.clients.Response """ game_params = {"id": id_} if return_fields is not None: self._validate_return_fields(return_fields) field_list = ",".join(return_fields) game_params["field_list"] = field_list response = self._query(game_params, direct=True) 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, 11803, 369, 45334, 3649, 315, 1847, 555, 3110, 271, 286, 551, 913, 887, 24089, 528, 198, 286, 551, 913, 471, 12406, 25, 14743, 271, 286, 551, 693, 25, 4611, 79444, 50833, 12859, 271, 14711, 6075, 512, 755, 7963, 1214, 11, 887, 7022, 471, 12406, 5980, 997, 286, 3270, 286, 36588, 369, 45334, 3649, 315, 1847, 555, 3110, 271, 286, 551, 913, 887, 24089, 528, 198, 286, 551, 913, 471, 12406, 25, 14743, 271, 286, 551, 693, 25, 4611, 79444, 50833, 12859, 198, 286, 3270, 286, 1847, 6887, 284, 5324, 307, 794, 887, 62, 633, 286, 422, 471, 12406, 374, 539, 2290, 512, 310, 659, 1462, 7212, 12794, 12406, 36206, 12406, 340, 310, 2115, 2062, 284, 15923, 13, 6115, 36206, 12406, 696, 310, 1847, 6887, 1204, 2630, 2062, 1365, 284, 2115, 2062, 271, 286, 2077, 284, 659, 1462, 1663, 15446, 6887, 11, 2167, 3702, 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, 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,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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 11803, 369, 45334, 3649, 315, 1847, 555, 3110, 271, 286, 551, 913, 887, 24089, 528, 198, 286, 551, 913, 471, 12406, 25, 14743, 271, 286, 551, 693, 25, 4611, 79444, 50833, 12859, 271, 14711, 6075, 512, 755, 7963, 1214, 11, 887, 7022, 471, 12406, 5980, 997, 286, 3270, 286, 36588, 369, 45334, 3649, 315, 1847, 555, 3110, 271, 286, 551, 913, 887, 24089, 528, 198, 286, 551, 913, 471, 12406, 25, 14743, 271, 286, 551, 693, 25, 4611, 79444, 50833, 12859, 198, 286, 3270, 286, 1847, 6887, 284, 5324, 307, 794, 887, 62, 633, 286, 422, 471, 12406, 374, 539, 2290, 512, 310, 659, 1462, 7212, 12794, 12406, 36206, 12406, 340, 310, 2115, 2062, 284, 15923, 13, 6115, 36206, 12406, 696, 310, 1847, 6887, 1204, 2630, 2062, 1365, 284, 2115, 2062, 271, 286, 2077, 284, 659, 1462, 1663, 15446, 6887, 11, 2167, 3702, 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, 128009, 128009, 128009 ]
wonambi-python/wonambi
wonambi/widgets/notes.py
Notes.add_event
def add_event(self, name, time, chan): """Action: add a single event.""" self.annot.add_event(name, time, chan=chan) self.update_annotations()
python
def add_event(self, name, time, chan): """Action: add a single event.""" self.annot.add_event(name, time, chan=chan) self.update_annotations()
[ "def", "add_event", "(", "self", ",", "name", ",", "time", ",", "chan", ")", ":", "self", ".", "annot", ".", "add_event", "(", "name", ",", "time", ",", "chan", "=", "chan", ")", "self", ".", "update_annotations", "(", ")" ]
Action: add a single event.
[ "Action", ":", "add", "a", "single", "event", "." ]
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1401-L1404
<|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: Action: add a single event. ### Response: def add_event(self, name, time, chan): """Action: add a single event.""" self.annot.add_event(name, time, chan=chan) self.update_annotations() <|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, 2573, 25, 923, 264, 3254, 1567, 382, 14711, 6075, 512, 755, 923, 6891, 1214, 11, 836, 11, 892, 11, 27114, 997, 286, 4304, 2573, 25, 923, 264, 3254, 1567, 14781, 286, 659, 4525, 1388, 6891, 3232, 11, 892, 11, 27114, 28, 5776, 340, 286, 659, 5430, 79996, 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, 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, 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, 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, 2573, 25, 923, 264, 3254, 1567, 382, 14711, 6075, 512, 755, 923, 6891, 1214, 11, 836, 11, 892, 11, 27114, 997, 286, 4304, 2573, 25, 923, 264, 3254, 1567, 14781, 286, 659, 4525, 1388, 6891, 3232, 11, 892, 11, 27114, 28, 5776, 340, 286, 659, 5430, 79996, 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, 128009 ]
Cadair/jupyter_environment_kernels
environment_kernels/activate_helper.py
escape_windows_cmd_string
def escape_windows_cmd_string(s): """Returns a string that is usable by the Windows cmd.exe. The escaping is based on details here and emperical testing: http://www.robvanderwoude.com/escapechars.php """ for c in '()%!^<>&|"': s = s.replace(c, '^' + c) s = s.replace('/?', '/.') return s
python
def escape_windows_cmd_string(s): """Returns a string that is usable by the Windows cmd.exe. The escaping is based on details here and emperical testing: http://www.robvanderwoude.com/escapechars.php """ for c in '()%!^<>&|"': s = s.replace(c, '^' + c) s = s.replace('/?', '/.') return s
[ "def", "escape_windows_cmd_string", "(", "s", ")", ":", "for", "c", "in", "'()%!^<>&|\"'", ":", "s", "=", "s", ".", "replace", "(", "c", ",", "'^'", "+", "c", ")", "s", "=", "s", ".", "replace", "(", "'/?'", ",", "'/.'", ")", "return", "s" ]
Returns a string that is usable by the Windows cmd.exe. The escaping is based on details here and emperical testing: http://www.robvanderwoude.com/escapechars.php
[ "Returns", "a", "string", "that", "is", "usable", "by", "the", "Windows", "cmd", ".", "exe", ".", "The", "escaping", "is", "based", "on", "details", "here", "and", "emperical", "testing", ":", "http", ":", "//", "www", ".", "robvanderwoude", ".", "com", "/", "escapechars", ".", "php" ]
train
https://github.com/Cadair/jupyter_environment_kernels/blob/3da304550b511bda7d5d39280379b5ca39bb31bc/environment_kernels/activate_helper.py#L158-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: Returns a string that is usable by the Windows cmd.exe. The escaping is based on details here and emperical testing: http://www.robvanderwoude.com/escapechars.php ### Response: def escape_windows_cmd_string(s): """Returns a string that is usable by the Windows cmd.exe. The escaping is based on details here and emperical testing: http://www.robvanderwoude.com/escapechars.php """ for c in '()%!^<>&|"': s = s.replace(c, '^' + c) s = s.replace('/?', '/.') return s <|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, 925, 430, 374, 41030, 555, 279, 5632, 5556, 19963, 627, 262, 578, 53754, 374, 3196, 389, 3649, 1618, 323, 991, 716, 950, 7649, 512, 262, 1795, 1129, 2185, 13, 23576, 85, 8363, 86, 283, 451, 916, 14, 13295, 19811, 2348, 271, 14711, 6075, 512, 755, 12731, 59320, 11946, 3991, 1161, 997, 262, 4304, 16851, 264, 925, 430, 374, 41030, 555, 279, 5632, 5556, 19963, 627, 262, 578, 53754, 374, 3196, 389, 3649, 1618, 323, 991, 716, 950, 7649, 512, 262, 1795, 1129, 2185, 13, 23576, 85, 8363, 86, 283, 451, 916, 14, 13295, 19811, 2348, 198, 262, 3270, 262, 369, 272, 304, 364, 55022, 0, 61, 27, 5909, 48676, 3730, 286, 274, 284, 274, 7125, 1361, 11, 50538, 6, 489, 272, 340, 262, 274, 284, 274, 7125, 3478, 50734, 3434, 21537, 262, 471, 274, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 925, 430, 374, 41030, 555, 279, 5632, 5556, 19963, 627, 262, 578, 53754, 374, 3196, 389, 3649, 1618, 323, 991, 716, 950, 7649, 512, 262, 1795, 1129, 2185, 13, 23576, 85, 8363, 86, 283, 451, 916, 14, 13295, 19811, 2348, 271, 14711, 6075, 512, 755, 12731, 59320, 11946, 3991, 1161, 997, 262, 4304, 16851, 264, 925, 430, 374, 41030, 555, 279, 5632, 5556, 19963, 627, 262, 578, 53754, 374, 3196, 389, 3649, 1618, 323, 991, 716, 950, 7649, 512, 262, 1795, 1129, 2185, 13, 23576, 85, 8363, 86, 283, 451, 916, 14, 13295, 19811, 2348, 198, 262, 3270, 262, 369, 272, 304, 364, 55022, 0, 61, 27, 5909, 48676, 3730, 286, 274, 284, 274, 7125, 1361, 11, 50538, 6, 489, 272, 340, 262, 274, 284, 274, 7125, 3478, 50734, 3434, 21537, 262, 471, 274, 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 ]
proycon/clam
clam/common/auth.py
NonceMemory.cleanup
def cleanup(self): """Delete expired nonces""" t = time.time() for noncefile in glob(self.path + '/*.nonce'): if os.path.getmtime(noncefile) + self.expiration > t: os.unlink(noncefile)
python
def cleanup(self): """Delete expired nonces""" t = time.time() for noncefile in glob(self.path + '/*.nonce'): if os.path.getmtime(noncefile) + self.expiration > t: os.unlink(noncefile)
[ "def", "cleanup", "(", "self", ")", ":", "t", "=", "time", ".", "time", "(", ")", "for", "noncefile", "in", "glob", "(", "self", ".", "path", "+", "'/*.nonce'", ")", ":", "if", "os", ".", "path", ".", "getmtime", "(", "noncefile", ")", "+", "self", ".", "expiration", ">", "t", ":", "os", ".", "unlink", "(", "noncefile", ")" ]
Delete expired nonces
[ "Delete", "expired", "nonces" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/auth.py#L503-L508
<|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: Delete expired nonces ### Response: def cleanup(self): """Delete expired nonces""" t = time.time() for noncefile in glob(self.path + '/*.nonce'): if os.path.getmtime(noncefile) + self.expiration > t: os.unlink(noncefile) <|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, 6571, 27489, 2536, 1634, 271, 14711, 6075, 512, 755, 21993, 1214, 997, 286, 4304, 6571, 27489, 2536, 1634, 7275, 286, 259, 284, 892, 6512, 746, 286, 369, 40776, 1213, 304, 13509, 1214, 3960, 489, 364, 24449, 40693, 11290, 310, 422, 2709, 3960, 673, 62076, 1471, 13486, 1213, 8, 489, 659, 2272, 29579, 871, 259, 512, 394, 2709, 73850, 1471, 13486, 1213, 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 ]
[ 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, 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, 6571, 27489, 2536, 1634, 271, 14711, 6075, 512, 755, 21993, 1214, 997, 286, 4304, 6571, 27489, 2536, 1634, 7275, 286, 259, 284, 892, 6512, 746, 286, 369, 40776, 1213, 304, 13509, 1214, 3960, 489, 364, 24449, 40693, 11290, 310, 422, 2709, 3960, 673, 62076, 1471, 13486, 1213, 8, 489, 659, 2272, 29579, 871, 259, 512, 394, 2709, 73850, 1471, 13486, 1213, 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 ]
raghakot/keras-vis
vis/utils/utils.py
find_layer_idx
def find_layer_idx(model, layer_name): """Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise. """ layer_idx = None for idx, layer in enumerate(model.layers): if layer.name == layer_name: layer_idx = idx break if layer_idx is None: raise ValueError("No layer with name '{}' within the model".format(layer_name)) return layer_idx
python
def find_layer_idx(model, layer_name): """Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise. """ layer_idx = None for idx, layer in enumerate(model.layers): if layer.name == layer_name: layer_idx = idx break if layer_idx is None: raise ValueError("No layer with name '{}' within the model".format(layer_name)) return layer_idx
[ "def", "find_layer_idx", "(", "model", ",", "layer_name", ")", ":", "layer_idx", "=", "None", "for", "idx", ",", "layer", "in", "enumerate", "(", "model", ".", "layers", ")", ":", "if", "layer", ".", "name", "==", "layer_name", ":", "layer_idx", "=", "idx", "break", "if", "layer_idx", "is", "None", ":", "raise", "ValueError", "(", "\"No layer with name '{}' within the model\"", ".", "format", "(", "layer_name", ")", ")", "return", "layer_idx" ]
Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise.
[ "Looks", "up", "the", "layer", "index", "corresponding", "to", "layer_name", "from", "model", "." ]
train
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L136-L154
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise. ### Response: def find_layer_idx(model, layer_name): """Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise. """ layer_idx = None for idx, layer in enumerate(model.layers): if layer.name == layer_name: layer_idx = idx break if layer_idx is None: raise ValueError("No layer with name '{}' within the model".format(layer_name)) return layer_idx <|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, 59844, 709, 279, 6324, 1963, 12435, 311, 1595, 10546, 1292, 63, 505, 1595, 2590, 63438, 262, 18161, 512, 286, 1646, 25, 578, 1595, 7197, 300, 8399, 5777, 63, 2937, 627, 286, 6324, 1292, 25, 578, 836, 315, 279, 6324, 311, 19128, 382, 262, 5295, 512, 286, 578, 6324, 1963, 422, 1766, 13, 61411, 459, 4788, 6062, 382, 14711, 6075, 512, 755, 1505, 12969, 7406, 7790, 11, 6324, 1292, 997, 262, 4304, 59844, 709, 279, 6324, 1963, 12435, 311, 1595, 10546, 1292, 63, 505, 1595, 2590, 63438, 262, 18161, 512, 286, 1646, 25, 578, 1595, 7197, 300, 8399, 5777, 63, 2937, 627, 286, 6324, 1292, 25, 578, 836, 315, 279, 6324, 311, 19128, 382, 262, 5295, 512, 286, 578, 6324, 1963, 422, 1766, 13, 61411, 459, 4788, 6062, 627, 262, 3270, 262, 6324, 7406, 284, 2290, 198, 262, 369, 7335, 11, 6324, 304, 13555, 7790, 21680, 997, 286, 422, 6324, 2710, 624, 6324, 1292, 512, 310, 6324, 7406, 284, 7335, 198, 310, 1464, 271, 262, 422, 6324, 7406, 374, 2290, 512, 286, 4933, 15764, 446, 2822, 6324, 449, 836, 70522, 2949, 279, 1646, 3343, 2293, 33685, 1292, 1192, 262, 471, 6324, 7406, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 59844, 709, 279, 6324, 1963, 12435, 311, 1595, 10546, 1292, 63, 505, 1595, 2590, 63438, 262, 18161, 512, 286, 1646, 25, 578, 1595, 7197, 300, 8399, 5777, 63, 2937, 627, 286, 6324, 1292, 25, 578, 836, 315, 279, 6324, 311, 19128, 382, 262, 5295, 512, 286, 578, 6324, 1963, 422, 1766, 13, 61411, 459, 4788, 6062, 382, 14711, 6075, 512, 755, 1505, 12969, 7406, 7790, 11, 6324, 1292, 997, 262, 4304, 59844, 709, 279, 6324, 1963, 12435, 311, 1595, 10546, 1292, 63, 505, 1595, 2590, 63438, 262, 18161, 512, 286, 1646, 25, 578, 1595, 7197, 300, 8399, 5777, 63, 2937, 627, 286, 6324, 1292, 25, 578, 836, 315, 279, 6324, 311, 19128, 382, 262, 5295, 512, 286, 578, 6324, 1963, 422, 1766, 13, 61411, 459, 4788, 6062, 627, 262, 3270, 262, 6324, 7406, 284, 2290, 198, 262, 369, 7335, 11, 6324, 304, 13555, 7790, 21680, 997, 286, 422, 6324, 2710, 624, 6324, 1292, 512, 310, 6324, 7406, 284, 7335, 198, 310, 1464, 271, 262, 422, 6324, 7406, 374, 2290, 512, 286, 4933, 15764, 446, 2822, 6324, 449, 836, 70522, 2949, 279, 1646, 3343, 2293, 33685, 1292, 1192, 262, 471, 6324, 7406, 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 ]
acutesoftware/AIKIF
scripts/AI_CLI.py
AICLI.cmd_add
def cmd_add(self, txt): """ Enter add mode - all text entered now will be processed as adding information until cancelled """ self.show_output('Adding ', txt) self.raw.add(txt) print(self.raw) return 'Added ' + txt
python
def cmd_add(self, txt): """ Enter add mode - all text entered now will be processed as adding information until cancelled """ self.show_output('Adding ', txt) self.raw.add(txt) print(self.raw) return 'Added ' + txt
[ "def", "cmd_add", "(", "self", ",", "txt", ")", ":", "self", ".", "show_output", "(", "'Adding '", ",", "txt", ")", "self", ".", "raw", ".", "add", "(", "txt", ")", "print", "(", "self", ".", "raw", ")", "return", "'Added '", "+", "txt" ]
Enter add mode - all text entered now will be processed as adding information until cancelled
[ "Enter", "add", "mode", "-", "all", "text", "entered", "now", "will", "be", "processed", "as", "adding", "information", "until", "cancelled" ]
train
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/scripts/AI_CLI.py#L135-L143
<|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: Enter add mode - all text entered now will be processed as adding information until cancelled ### Response: def cmd_add(self, txt): """ Enter add mode - all text entered now will be processed as adding information until cancelled """ self.show_output('Adding ', txt) self.raw.add(txt) print(self.raw) return 'Added ' + txt <|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, 6403, 923, 3941, 482, 682, 1495, 10862, 1457, 690, 387, 720, 286, 15590, 439, 7999, 2038, 3156, 26765, 271, 14711, 6075, 512, 755, 5556, 2962, 1214, 11, 8091, 997, 286, 3270, 286, 11502, 923, 3941, 482, 682, 1495, 10862, 1457, 690, 387, 720, 286, 15590, 439, 7999, 2038, 3156, 26765, 198, 286, 3270, 286, 659, 5577, 7800, 493, 33408, 6752, 8091, 340, 286, 659, 18648, 1388, 27174, 340, 286, 1194, 1214, 18648, 340, 286, 471, 364, 19897, 364, 489, 8091, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6403, 923, 3941, 482, 682, 1495, 10862, 1457, 690, 387, 720, 286, 15590, 439, 7999, 2038, 3156, 26765, 271, 14711, 6075, 512, 755, 5556, 2962, 1214, 11, 8091, 997, 286, 3270, 286, 11502, 923, 3941, 482, 682, 1495, 10862, 1457, 690, 387, 720, 286, 15590, 439, 7999, 2038, 3156, 26765, 198, 286, 3270, 286, 659, 5577, 7800, 493, 33408, 6752, 8091, 340, 286, 659, 18648, 1388, 27174, 340, 286, 1194, 1214, 18648, 340, 286, 471, 364, 19897, 364, 489, 8091, 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 ]
googleapis/dialogflow-python-client-v2
samples/knowledge_base_management.py
list_knowledge_bases
def list_knowledge_bases(project_id): """Lists the Knowledge bases belonging to a project. Args: project_id: The GCP project linked with the agent.""" import dialogflow_v2beta1 as dialogflow client = dialogflow.KnowledgeBasesClient() project_path = client.project_path(project_id) print('Knowledge Bases for: {}'.format(project_id)) for knowledge_base in client.list_knowledge_bases(project_path): print(' - Display Name: {}'.format(knowledge_base.display_name)) print(' - Knowledge ID: {}\n'.format(knowledge_base.name))
python
def list_knowledge_bases(project_id): """Lists the Knowledge bases belonging to a project. Args: project_id: The GCP project linked with the agent.""" import dialogflow_v2beta1 as dialogflow client = dialogflow.KnowledgeBasesClient() project_path = client.project_path(project_id) print('Knowledge Bases for: {}'.format(project_id)) for knowledge_base in client.list_knowledge_bases(project_path): print(' - Display Name: {}'.format(knowledge_base.display_name)) print(' - Knowledge ID: {}\n'.format(knowledge_base.name))
[ "def", "list_knowledge_bases", "(", "project_id", ")", ":", "import", "dialogflow_v2beta1", "as", "dialogflow", "client", "=", "dialogflow", ".", "KnowledgeBasesClient", "(", ")", "project_path", "=", "client", ".", "project_path", "(", "project_id", ")", "print", "(", "'Knowledge Bases for: {}'", ".", "format", "(", "project_id", ")", ")", "for", "knowledge_base", "in", "client", ".", "list_knowledge_bases", "(", "project_path", ")", ":", "print", "(", "' - Display Name: {}'", ".", "format", "(", "knowledge_base", ".", "display_name", ")", ")", "print", "(", "' - Knowledge ID: {}\\n'", ".", "format", "(", "knowledge_base", ".", "name", ")", ")" ]
Lists the Knowledge bases belonging to a project. Args: project_id: The GCP project linked with the agent.
[ "Lists", "the", "Knowledge", "bases", "belonging", "to", "a", "project", "." ]
train
https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/knowledge_base_management.py#L35-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: Lists the Knowledge bases belonging to a project. Args: project_id: The GCP project linked with the agent. ### Response: def list_knowledge_bases(project_id): """Lists the Knowledge bases belonging to a project. Args: project_id: The GCP project linked with the agent.""" import dialogflow_v2beta1 as dialogflow client = dialogflow.KnowledgeBasesClient() project_path = client.project_path(project_id) print('Knowledge Bases for: {}'.format(project_id)) for knowledge_base in client.list_knowledge_bases(project_path): print(' - Display Name: {}'.format(knowledge_base.display_name)) print(' - Knowledge ID: {}\n'.format(knowledge_base.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, 38948, 279, 33025, 23963, 33152, 311, 264, 2447, 382, 262, 18161, 512, 286, 2447, 851, 25, 578, 480, 7269, 2447, 10815, 449, 279, 8479, 382, 14711, 6075, 512, 755, 1160, 4803, 52286, 97390, 21855, 851, 997, 262, 4304, 38948, 279, 33025, 23963, 33152, 311, 264, 2447, 382, 262, 18161, 512, 286, 2447, 851, 25, 578, 480, 7269, 2447, 10815, 449, 279, 8479, 14781, 262, 1179, 7402, 5072, 2325, 17, 19674, 16, 439, 7402, 5072, 198, 262, 3016, 284, 7402, 5072, 11606, 52286, 33, 2315, 3032, 746, 262, 2447, 2703, 284, 3016, 14844, 2703, 21855, 851, 696, 262, 1194, 493, 81434, 426, 2315, 369, 25, 26307, 2293, 21855, 851, 1192, 262, 369, 6677, 7806, 304, 3016, 6556, 4803, 52286, 97390, 21855, 2703, 997, 286, 1194, 493, 482, 10848, 4076, 25, 26307, 2293, 6097, 52286, 7806, 8344, 1292, 1192, 286, 1194, 493, 482, 33025, 3110, 25, 57157, 77, 4527, 2293, 6097, 52286, 7806, 2710, 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,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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 38948, 279, 33025, 23963, 33152, 311, 264, 2447, 382, 262, 18161, 512, 286, 2447, 851, 25, 578, 480, 7269, 2447, 10815, 449, 279, 8479, 382, 14711, 6075, 512, 755, 1160, 4803, 52286, 97390, 21855, 851, 997, 262, 4304, 38948, 279, 33025, 23963, 33152, 311, 264, 2447, 382, 262, 18161, 512, 286, 2447, 851, 25, 578, 480, 7269, 2447, 10815, 449, 279, 8479, 14781, 262, 1179, 7402, 5072, 2325, 17, 19674, 16, 439, 7402, 5072, 198, 262, 3016, 284, 7402, 5072, 11606, 52286, 33, 2315, 3032, 746, 262, 2447, 2703, 284, 3016, 14844, 2703, 21855, 851, 696, 262, 1194, 493, 81434, 426, 2315, 369, 25, 26307, 2293, 21855, 851, 1192, 262, 369, 6677, 7806, 304, 3016, 6556, 4803, 52286, 97390, 21855, 2703, 997, 286, 1194, 493, 482, 10848, 4076, 25, 26307, 2293, 6097, 52286, 7806, 8344, 1292, 1192, 286, 1194, 493, 482, 33025, 3110, 25, 57157, 77, 4527, 2293, 6097, 52286, 7806, 2710, 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 ]
daviddrysdale/python-phonenumbers
python/phonenumbers/phonenumberutil.py
_is_viable_phone_number
def _is_viable_phone_number(number): """Checks to see if a string could possibly be a phone number. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-number symbols have been removed, such as by the method _extract_possible_number. Arguments: number -- string to be checked for viability as a phone number Returns True if the number could be a phone number of some sort, otherwise False """ if len(number) < _MIN_LENGTH_FOR_NSN: return False match = fullmatch(_VALID_PHONE_NUMBER_PATTERN, number) return bool(match)
python
def _is_viable_phone_number(number): """Checks to see if a string could possibly be a phone number. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-number symbols have been removed, such as by the method _extract_possible_number. Arguments: number -- string to be checked for viability as a phone number Returns True if the number could be a phone number of some sort, otherwise False """ if len(number) < _MIN_LENGTH_FOR_NSN: return False match = fullmatch(_VALID_PHONE_NUMBER_PATTERN, number) return bool(match)
[ "def", "_is_viable_phone_number", "(", "number", ")", ":", "if", "len", "(", "number", ")", "<", "_MIN_LENGTH_FOR_NSN", ":", "return", "False", "match", "=", "fullmatch", "(", "_VALID_PHONE_NUMBER_PATTERN", ",", "number", ")", "return", "bool", "(", "match", ")" ]
Checks to see if a string could possibly be a phone number. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-number symbols have been removed, such as by the method _extract_possible_number. Arguments: number -- string to be checked for viability as a phone number Returns True if the number could be a phone number of some sort, otherwise False
[ "Checks", "to", "see", "if", "a", "string", "could", "possibly", "be", "a", "phone", "number", "." ]
train
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/phonenumberutil.py#L545-L563
<|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 to see if a string could possibly be a phone number. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-number symbols have been removed, such as by the method _extract_possible_number. Arguments: number -- string to be checked for viability as a phone number Returns True if the number could be a phone number of some sort, otherwise False ### Response: def _is_viable_phone_number(number): """Checks to see if a string could possibly be a phone number. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-number symbols have been removed, such as by the method _extract_possible_number. Arguments: number -- string to be checked for viability as a phone number Returns True if the number could be a phone number of some sort, otherwise False """ if len(number) < _MIN_LENGTH_FOR_NSN: return False match = fullmatch(_VALID_PHONE_NUMBER_PATTERN, number) return bool(match) <|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, 311, 1518, 422, 264, 925, 1436, 11000, 387, 264, 4641, 1396, 382, 262, 2468, 279, 4545, 11, 12621, 311, 1518, 430, 279, 925, 12302, 449, 520, 3325, 220, 17, 198, 262, 19016, 11, 32003, 904, 62603, 17037, 1766, 304, 4641, 5219, 13, 220, 1115, 198, 262, 1749, 1587, 539, 1397, 279, 1396, 311, 387, 30510, 304, 12178, 482, 719, 1587, 198, 262, 9855, 430, 6522, 2536, 26939, 18210, 617, 1027, 7108, 11, 1778, 439, 555, 279, 198, 262, 1749, 721, 24396, 72344, 5617, 382, 262, 28802, 512, 262, 1396, 1198, 925, 311, 387, 10273, 369, 68507, 439, 264, 4641, 1396, 271, 262, 5295, 3082, 422, 279, 1396, 1436, 387, 264, 4641, 1396, 315, 1063, 3460, 11, 6062, 198, 262, 3641, 271, 14711, 6075, 512, 755, 721, 285, 2325, 2205, 22942, 5617, 18401, 997, 262, 4304, 50920, 311, 1518, 422, 264, 925, 1436, 11000, 387, 264, 4641, 1396, 382, 262, 2468, 279, 4545, 11, 12621, 311, 1518, 430, 279, 925, 12302, 449, 520, 3325, 220, 17, 198, 262, 19016, 11, 32003, 904, 62603, 17037, 1766, 304, 4641, 5219, 13, 220, 1115, 198, 262, 1749, 1587, 539, 1397, 279, 1396, 311, 387, 30510, 304, 12178, 482, 719, 1587, 198, 262, 9855, 430, 6522, 2536, 26939, 18210, 617, 1027, 7108, 11, 1778, 439, 555, 279, 198, 262, 1749, 721, 24396, 72344, 5617, 382, 262, 28802, 512, 262, 1396, 1198, 925, 311, 387, 10273, 369, 68507, 439, 264, 4641, 1396, 271, 262, 5295, 3082, 422, 279, 1396, 1436, 387, 264, 4641, 1396, 315, 1063, 3460, 11, 6062, 198, 262, 3641, 198, 262, 3270, 262, 422, 2479, 18401, 8, 366, 721, 16818, 15373, 14856, 1635, 19503, 512, 286, 471, 3641, 198, 262, 2489, 284, 2539, 6481, 2551, 10250, 60804, 19925, 45327, 11, 1396, 340, 262, 471, 1845, 26473, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 311, 1518, 422, 264, 925, 1436, 11000, 387, 264, 4641, 1396, 382, 262, 2468, 279, 4545, 11, 12621, 311, 1518, 430, 279, 925, 12302, 449, 520, 3325, 220, 17, 198, 262, 19016, 11, 32003, 904, 62603, 17037, 1766, 304, 4641, 5219, 13, 220, 1115, 198, 262, 1749, 1587, 539, 1397, 279, 1396, 311, 387, 30510, 304, 12178, 482, 719, 1587, 198, 262, 9855, 430, 6522, 2536, 26939, 18210, 617, 1027, 7108, 11, 1778, 439, 555, 279, 198, 262, 1749, 721, 24396, 72344, 5617, 382, 262, 28802, 512, 262, 1396, 1198, 925, 311, 387, 10273, 369, 68507, 439, 264, 4641, 1396, 271, 262, 5295, 3082, 422, 279, 1396, 1436, 387, 264, 4641, 1396, 315, 1063, 3460, 11, 6062, 198, 262, 3641, 271, 14711, 6075, 512, 755, 721, 285, 2325, 2205, 22942, 5617, 18401, 997, 262, 4304, 50920, 311, 1518, 422, 264, 925, 1436, 11000, 387, 264, 4641, 1396, 382, 262, 2468, 279, 4545, 11, 12621, 311, 1518, 430, 279, 925, 12302, 449, 520, 3325, 220, 17, 198, 262, 19016, 11, 32003, 904, 62603, 17037, 1766, 304, 4641, 5219, 13, 220, 1115, 198, 262, 1749, 1587, 539, 1397, 279, 1396, 311, 387, 30510, 304, 12178, 482, 719, 1587, 198, 262, 9855, 430, 6522, 2536, 26939, 18210, 617, 1027, 7108, 11, 1778, 439, 555, 279, 198, 262, 1749, 721, 24396, 72344, 5617, 382, 262, 28802, 512, 262, 1396, 1198, 925, 311, 387, 10273, 369, 68507, 439, 264, 4641, 1396, 271, 262, 5295, 3082, 422, 279, 1396, 1436, 387, 264, 4641, 1396, 315, 1063, 3460, 11, 6062, 198, 262, 3641, 198, 262, 3270, 262, 422, 2479, 18401, 8, 366, 721, 16818, 15373, 14856, 1635, 19503, 512, 286, 471, 3641, 198, 262, 2489, 284, 2539, 6481, 2551, 10250, 60804, 19925, 45327, 11, 1396, 340, 262, 471, 1845, 26473, 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 ]
saltstack/salt
salt/key.py
Key.finger_all
def finger_all(self, hash_type=None): ''' Return fingerprints for all keys ''' if hash_type is None: hash_type = __opts__['hash_type'] ret = {} for status, keys in six.iteritems(self.all_keys()): ret[status] = {} for key in keys: if status == 'local': path = os.path.join(self.opts['pki_dir'], key) else: path = os.path.join(self.opts['pki_dir'], status, key) ret[status][key] = salt.utils.crypt.pem_finger(path, sum_type=hash_type) return ret
python
def finger_all(self, hash_type=None): ''' Return fingerprints for all keys ''' if hash_type is None: hash_type = __opts__['hash_type'] ret = {} for status, keys in six.iteritems(self.all_keys()): ret[status] = {} for key in keys: if status == 'local': path = os.path.join(self.opts['pki_dir'], key) else: path = os.path.join(self.opts['pki_dir'], status, key) ret[status][key] = salt.utils.crypt.pem_finger(path, sum_type=hash_type) return ret
[ "def", "finger_all", "(", "self", ",", "hash_type", "=", "None", ")", ":", "if", "hash_type", "is", "None", ":", "hash_type", "=", "__opts__", "[", "'hash_type'", "]", "ret", "=", "{", "}", "for", "status", ",", "keys", "in", "six", ".", "iteritems", "(", "self", ".", "all_keys", "(", ")", ")", ":", "ret", "[", "status", "]", "=", "{", "}", "for", "key", "in", "keys", ":", "if", "status", "==", "'local'", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opts", "[", "'pki_dir'", "]", ",", "key", ")", "else", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opts", "[", "'pki_dir'", "]", ",", "status", ",", "key", ")", "ret", "[", "status", "]", "[", "key", "]", "=", "salt", ".", "utils", ".", "crypt", ".", "pem_finger", "(", "path", ",", "sum_type", "=", "hash_type", ")", "return", "ret" ]
Return fingerprints for all keys
[ "Return", "fingerprints", "for", "all", "keys" ]
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L862-L878
<|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 fingerprints for all keys ### Response: def finger_all(self, hash_type=None): ''' Return fingerprints for all keys ''' if hash_type is None: hash_type = __opts__['hash_type'] ret = {} for status, keys in six.iteritems(self.all_keys()): ret[status] = {} for key in keys: if status == 'local': path = os.path.join(self.opts['pki_dir'], key) else: path = os.path.join(self.opts['pki_dir'], status, key) ret[status][key] = salt.utils.crypt.pem_finger(path, sum_type=hash_type) 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, 5715, 77777, 369, 682, 7039, 271, 14711, 6075, 512, 755, 14654, 5823, 1214, 11, 5286, 1857, 5980, 997, 286, 11414, 286, 3494, 77777, 369, 682, 7039, 198, 286, 11414, 286, 422, 5286, 1857, 374, 2290, 512, 310, 5286, 1857, 284, 1328, 10740, 565, 681, 8460, 1857, 16049, 286, 2160, 284, 5731, 286, 369, 2704, 11, 7039, 304, 4848, 58542, 1214, 7825, 12919, 34257, 310, 2160, 58, 2899, 60, 284, 5731, 310, 369, 1401, 304, 7039, 512, 394, 422, 2704, 624, 364, 2497, 3730, 504, 1853, 284, 2709, 3960, 5563, 1214, 57122, 681, 79, 6780, 4432, 4181, 1401, 340, 394, 775, 512, 504, 1853, 284, 2709, 3960, 5563, 1214, 57122, 681, 79, 6780, 4432, 4181, 2704, 11, 1401, 340, 394, 2160, 58, 2899, 1483, 798, 60, 284, 12290, 8576, 522, 3655, 50473, 766, 5248, 5698, 11, 2694, 1857, 28, 8460, 1857, 340, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 77777, 369, 682, 7039, 271, 14711, 6075, 512, 755, 14654, 5823, 1214, 11, 5286, 1857, 5980, 997, 286, 11414, 286, 3494, 77777, 369, 682, 7039, 198, 286, 11414, 286, 422, 5286, 1857, 374, 2290, 512, 310, 5286, 1857, 284, 1328, 10740, 565, 681, 8460, 1857, 16049, 286, 2160, 284, 5731, 286, 369, 2704, 11, 7039, 304, 4848, 58542, 1214, 7825, 12919, 34257, 310, 2160, 58, 2899, 60, 284, 5731, 310, 369, 1401, 304, 7039, 512, 394, 422, 2704, 624, 364, 2497, 3730, 504, 1853, 284, 2709, 3960, 5563, 1214, 57122, 681, 79, 6780, 4432, 4181, 1401, 340, 394, 775, 512, 504, 1853, 284, 2709, 3960, 5563, 1214, 57122, 681, 79, 6780, 4432, 4181, 2704, 11, 1401, 340, 394, 2160, 58, 2899, 1483, 798, 60, 284, 12290, 8576, 522, 3655, 50473, 766, 5248, 5698, 11, 2694, 1857, 28, 8460, 1857, 340, 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 ]
jldantas/libmft
libmft/api.py
Datastream.add_from_datastream
def add_from_datastream(self, source_ds): '''Add information from another datastream. Verifies if the datastream added is correct and copy the relevant fields if necessary.''' if source_ds.name != self.name: raise DataStreamError("Data from a different stream 'f{source_ds.name}' cannot be add to this stream") if self._data_runs is None: raise DataStreamError("Cannot add data to a resident datastream.") if self.cluster_count < source_ds.cluster_count: self.cluster_count = source_ds.cluster_count if self.size == 0 and source_ds.size: self.size = source_ds.size self.alloc_size = source_ds.alloc_size if source_ds._data_runs: self._data_runs += source_ds._data_runs self._data_runs_sorted = False
python
def add_from_datastream(self, source_ds): '''Add information from another datastream. Verifies if the datastream added is correct and copy the relevant fields if necessary.''' if source_ds.name != self.name: raise DataStreamError("Data from a different stream 'f{source_ds.name}' cannot be add to this stream") if self._data_runs is None: raise DataStreamError("Cannot add data to a resident datastream.") if self.cluster_count < source_ds.cluster_count: self.cluster_count = source_ds.cluster_count if self.size == 0 and source_ds.size: self.size = source_ds.size self.alloc_size = source_ds.alloc_size if source_ds._data_runs: self._data_runs += source_ds._data_runs self._data_runs_sorted = False
[ "def", "add_from_datastream", "(", "self", ",", "source_ds", ")", ":", "if", "source_ds", ".", "name", "!=", "self", ".", "name", ":", "raise", "DataStreamError", "(", "\"Data from a different stream 'f{source_ds.name}' cannot be add to this stream\"", ")", "if", "self", ".", "_data_runs", "is", "None", ":", "raise", "DataStreamError", "(", "\"Cannot add data to a resident datastream.\"", ")", "if", "self", ".", "cluster_count", "<", "source_ds", ".", "cluster_count", ":", "self", ".", "cluster_count", "=", "source_ds", ".", "cluster_count", "if", "self", ".", "size", "==", "0", "and", "source_ds", ".", "size", ":", "self", ".", "size", "=", "source_ds", ".", "size", "self", ".", "alloc_size", "=", "source_ds", ".", "alloc_size", "if", "source_ds", ".", "_data_runs", ":", "self", ".", "_data_runs", "+=", "source_ds", ".", "_data_runs", "self", ".", "_data_runs_sorted", "=", "False" ]
Add information from another datastream. Verifies if the datastream added is correct and copy the relevant fields if necessary.
[ "Add", "information", "from", "another", "datastream", ".", "Verifies", "if", "the", "datastream", "added", "is", "correct", "and", "copy", "the", "relevant", "fields", "if", "necessary", "." ]
train
https://github.com/jldantas/libmft/blob/65a988605fe7663b788bd81dcb52c0a4eaad1549/libmft/api.py#L429-L444
<|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 information from another datastream. Verifies if the datastream added is correct and copy the relevant fields if necessary. ### Response: def add_from_datastream(self, source_ds): '''Add information from another datastream. Verifies if the datastream added is correct and copy the relevant fields if necessary.''' if source_ds.name != self.name: raise DataStreamError("Data from a different stream 'f{source_ds.name}' cannot be add to this stream") if self._data_runs is None: raise DataStreamError("Cannot add data to a resident datastream.") if self.cluster_count < source_ds.cluster_count: self.cluster_count = source_ds.cluster_count if self.size == 0 and source_ds.size: self.size = source_ds.size self.alloc_size = source_ds.alloc_size if source_ds._data_runs: self._data_runs += source_ds._data_runs self._data_runs_sorted = False <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 2038, 505, 2500, 828, 4116, 13, 6383, 9803, 422, 279, 828, 4116, 198, 286, 3779, 374, 4495, 323, 3048, 279, 9959, 5151, 422, 5995, 382, 14711, 6075, 512, 755, 923, 5791, 1807, 4116, 1214, 11, 2592, 36462, 997, 286, 11712, 2261, 2038, 505, 2500, 828, 4116, 13, 6383, 9803, 422, 279, 828, 4116, 198, 286, 3779, 374, 4495, 323, 3048, 279, 9959, 5151, 422, 5995, 88785, 286, 422, 2592, 36462, 2710, 976, 659, 2710, 512, 310, 4933, 2956, 3103, 1480, 446, 1061, 505, 264, 2204, 4365, 364, 69, 90, 2484, 36462, 2710, 11923, 4250, 387, 923, 311, 420, 4365, 1158, 286, 422, 659, 1462, 695, 68452, 374, 2290, 512, 310, 4933, 2956, 3103, 1480, 446, 17902, 923, 828, 311, 264, 19504, 828, 4116, 32325, 286, 422, 659, 41601, 3259, 366, 2592, 36462, 41601, 3259, 512, 310, 659, 41601, 3259, 284, 2592, 36462, 41601, 3259, 198, 286, 422, 659, 2546, 624, 220, 15, 323, 2592, 36462, 2546, 512, 310, 659, 2546, 284, 2592, 36462, 2546, 198, 310, 659, 79324, 2424, 284, 2592, 36462, 79324, 2424, 198, 286, 422, 2592, 36462, 1462, 695, 68452, 512, 310, 659, 1462, 695, 68452, 1447, 2592, 36462, 1462, 695, 68452, 198, 310, 659, 1462, 695, 68452, 42377, 284, 3641, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 2038, 505, 2500, 828, 4116, 13, 6383, 9803, 422, 279, 828, 4116, 198, 286, 3779, 374, 4495, 323, 3048, 279, 9959, 5151, 422, 5995, 382, 14711, 6075, 512, 755, 923, 5791, 1807, 4116, 1214, 11, 2592, 36462, 997, 286, 11712, 2261, 2038, 505, 2500, 828, 4116, 13, 6383, 9803, 422, 279, 828, 4116, 198, 286, 3779, 374, 4495, 323, 3048, 279, 9959, 5151, 422, 5995, 88785, 286, 422, 2592, 36462, 2710, 976, 659, 2710, 512, 310, 4933, 2956, 3103, 1480, 446, 1061, 505, 264, 2204, 4365, 364, 69, 90, 2484, 36462, 2710, 11923, 4250, 387, 923, 311, 420, 4365, 1158, 286, 422, 659, 1462, 695, 68452, 374, 2290, 512, 310, 4933, 2956, 3103, 1480, 446, 17902, 923, 828, 311, 264, 19504, 828, 4116, 32325, 286, 422, 659, 41601, 3259, 366, 2592, 36462, 41601, 3259, 512, 310, 659, 41601, 3259, 284, 2592, 36462, 41601, 3259, 198, 286, 422, 659, 2546, 624, 220, 15, 323, 2592, 36462, 2546, 512, 310, 659, 2546, 284, 2592, 36462, 2546, 198, 310, 659, 79324, 2424, 284, 2592, 36462, 79324, 2424, 198, 286, 422, 2592, 36462, 1462, 695, 68452, 512, 310, 659, 1462, 695, 68452, 1447, 2592, 36462, 1462, 695, 68452, 198, 310, 659, 1462, 695, 68452, 42377, 284, 3641, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
jeroyang/cateye
cateye/cateye.py
correct
def correct(tokens, term_freq): """ Correct a list of tokens, according to the term_freq """ log = [] output = [] for token in tokens: corrected = _correct(token, term_freq) if corrected != token: log.append((token, corrected)) output.append(corrected) return output, log
python
def correct(tokens, term_freq): """ Correct a list of tokens, according to the term_freq """ log = [] output = [] for token in tokens: corrected = _correct(token, term_freq) if corrected != token: log.append((token, corrected)) output.append(corrected) return output, log
[ "def", "correct", "(", "tokens", ",", "term_freq", ")", ":", "log", "=", "[", "]", "output", "=", "[", "]", "for", "token", "in", "tokens", ":", "corrected", "=", "_correct", "(", "token", ",", "term_freq", ")", "if", "corrected", "!=", "token", ":", "log", ".", "append", "(", "(", "token", ",", "corrected", ")", ")", "output", ".", "append", "(", "corrected", ")", "return", "output", ",", "log" ]
Correct a list of tokens, according to the term_freq
[ "Correct", "a", "list", "of", "tokens", "according", "to", "the", "term_freq" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L248-L259
<|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: Correct a list of tokens, according to the term_freq ### Response: def correct(tokens, term_freq): """ Correct a list of tokens, according to the term_freq """ log = [] output = [] for token in tokens: corrected = _correct(token, term_freq) if corrected != token: log.append((token, corrected)) output.append(corrected) return output, log <|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, 34192, 264, 1160, 315, 11460, 11, 4184, 311, 279, 4751, 22543, 271, 14711, 6075, 512, 755, 4495, 35152, 11, 4751, 22543, 997, 262, 3270, 262, 41070, 264, 1160, 315, 11460, 11, 4184, 311, 279, 4751, 22543, 198, 262, 3270, 262, 1515, 284, 4260, 262, 2612, 284, 4260, 262, 369, 4037, 304, 11460, 512, 286, 37065, 284, 721, 20523, 13577, 11, 4751, 22543, 340, 286, 422, 37065, 976, 4037, 512, 310, 1515, 2102, 1209, 5963, 11, 37065, 1192, 286, 2612, 2102, 89064, 291, 340, 262, 471, 2612, 11, 1515, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 34192, 264, 1160, 315, 11460, 11, 4184, 311, 279, 4751, 22543, 271, 14711, 6075, 512, 755, 4495, 35152, 11, 4751, 22543, 997, 262, 3270, 262, 41070, 264, 1160, 315, 11460, 11, 4184, 311, 279, 4751, 22543, 198, 262, 3270, 262, 1515, 284, 4260, 262, 2612, 284, 4260, 262, 369, 4037, 304, 11460, 512, 286, 37065, 284, 721, 20523, 13577, 11, 4751, 22543, 340, 286, 422, 37065, 976, 4037, 512, 310, 1515, 2102, 1209, 5963, 11, 37065, 1192, 286, 2612, 2102, 89064, 291, 340, 262, 471, 2612, 11, 1515, 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 ]
cmbruns/pyopenvr
src/openvr/__init__.py
IVROverlay.getOverlayTransformTrackedDeviceComponent
def getOverlayTransformTrackedDeviceComponent(self, ulOverlayHandle, pchComponentName, unComponentNameSize): """Gets the transform information when the overlay is rendering on a component.""" fn = self.function_table.getOverlayTransformTrackedDeviceComponent punDeviceIndex = TrackedDeviceIndex_t() result = fn(ulOverlayHandle, byref(punDeviceIndex), pchComponentName, unComponentNameSize) return result, punDeviceIndex
python
def getOverlayTransformTrackedDeviceComponent(self, ulOverlayHandle, pchComponentName, unComponentNameSize): """Gets the transform information when the overlay is rendering on a component.""" fn = self.function_table.getOverlayTransformTrackedDeviceComponent punDeviceIndex = TrackedDeviceIndex_t() result = fn(ulOverlayHandle, byref(punDeviceIndex), pchComponentName, unComponentNameSize) return result, punDeviceIndex
[ "def", "getOverlayTransformTrackedDeviceComponent", "(", "self", ",", "ulOverlayHandle", ",", "pchComponentName", ",", "unComponentNameSize", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getOverlayTransformTrackedDeviceComponent", "punDeviceIndex", "=", "TrackedDeviceIndex_t", "(", ")", "result", "=", "fn", "(", "ulOverlayHandle", ",", "byref", "(", "punDeviceIndex", ")", ",", "pchComponentName", ",", "unComponentNameSize", ")", "return", "result", ",", "punDeviceIndex" ]
Gets the transform information when the overlay is rendering on a component.
[ "Gets", "the", "transform", "information", "when", "the", "overlay", "is", "rendering", "on", "a", "component", "." ]
train
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L4888-L4894
<|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 the transform information when the overlay is rendering on a component. ### Response: def getOverlayTransformTrackedDeviceComponent(self, ulOverlayHandle, pchComponentName, unComponentNameSize): """Gets the transform information when the overlay is rendering on a component.""" fn = self.function_table.getOverlayTransformTrackedDeviceComponent punDeviceIndex = TrackedDeviceIndex_t() result = fn(ulOverlayHandle, byref(punDeviceIndex), pchComponentName, unComponentNameSize) return result, punDeviceIndex <|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, 279, 5276, 2038, 994, 279, 25652, 374, 21568, 389, 264, 3777, 382, 14711, 6075, 512, 755, 636, 33855, 9140, 1305, 11440, 7130, 2238, 1214, 11, 8725, 33855, 7144, 11, 281, 331, 2238, 678, 11, 653, 2238, 678, 1730, 997, 286, 4304, 50458, 279, 5276, 2038, 994, 279, 25652, 374, 21568, 389, 264, 3777, 30284, 286, 5279, 284, 659, 20687, 5350, 673, 33855, 9140, 1305, 11440, 7130, 2238, 198, 286, 8474, 7130, 1581, 284, 1183, 11440, 7130, 1581, 530, 746, 286, 1121, 284, 5279, 7, 360, 33855, 7144, 11, 555, 1116, 1319, 359, 7130, 1581, 705, 281, 331, 2238, 678, 11, 653, 2238, 678, 1730, 340, 286, 471, 1121, 11, 8474, 7130, 1581, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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, 304, 6498, 382, 14711, 5546, 512, 50458, 279, 5276, 2038, 994, 279, 25652, 374, 21568, 389, 264, 3777, 382, 14711, 6075, 512, 755, 636, 33855, 9140, 1305, 11440, 7130, 2238, 1214, 11, 8725, 33855, 7144, 11, 281, 331, 2238, 678, 11, 653, 2238, 678, 1730, 997, 286, 4304, 50458, 279, 5276, 2038, 994, 279, 25652, 374, 21568, 389, 264, 3777, 30284, 286, 5279, 284, 659, 20687, 5350, 673, 33855, 9140, 1305, 11440, 7130, 2238, 198, 286, 8474, 7130, 1581, 284, 1183, 11440, 7130, 1581, 530, 746, 286, 1121, 284, 5279, 7, 360, 33855, 7144, 11, 555, 1116, 1319, 359, 7130, 1581, 705, 281, 331, 2238, 678, 11, 653, 2238, 678, 1730, 340, 286, 471, 1121, 11, 8474, 7130, 1581, 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 ]
lambdamusic/Ontospy
ontospy/ontodocs/misc/scripts/export_all.py
cli_run_viz
def cli_run_viz(source=None, outputpath="", theme="", verbose=False): """ This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template.. @todo allow to pass a custom folder .. > python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random """ if outputpath: if not (os.path.exists(outputpath)) or not (os.path.isdir(outputpath)): click.secho( "WARNING: the -o option must include a valid directory path.", fg="red") sys.exit(0) else: from os.path import expanduser home = expanduser("~") outputpath = os.path.join(home, "ontospy-viz-multi") if source: source_folder = source[0] if not os.path.isdir(source_folder): click.secho( "WARNING: '%s' is not a valid directory path." % source_folder, fg="red") sys.exit(0) files_list = [ f for f in os.listdir(source_folder) if os.path.isfile(os.path.join(source_folder, f)) ] click.secho( "Exporting the directory: '%s'" % source_folder, fg="green") click.secho("----------", fg="green") else: click.secho( "Exporting the local library: '%s'" % get_home_location(), fg="green") click.secho("----------", fg="green") files_list = get_localontologies() source_folder = get_home_location() report_pages = [] for onto_name in files_list: full_uri = os.path.join(source_folder, onto_name) if theme: if theme == "random": _theme = random_theme() else: _theme = theme else: _theme = BOOTSWATCH_THEME_DEFAULT click.secho("Onto: <%s> Theme: '%s'" % (onto_name, _theme), fg="green") printDebug("Loading graph...", dim=True) g = Ontospy(os.path.join(source_folder, onto_name), verbose=verbose) if g.sources: # if Ontospy graph has no valid 'sources' = file passed was not valid RDF printDebug("Building visualization...", dim=True) onto_name_safe = slugify(unicode(onto_name)) onto_outputpath = os.path.join(outputpath, onto_name_safe) # note: single static files output path static_outputpath = os.path.join(outputpath, "static") # v = KompleteViz(g, theme=_theme) v = KompleteVizMultiModel( g, theme=_theme, static_url="../static/", output_path_static=static_outputpath) try: # note: onto_outputpath is wiped out each time as part of the build url = v.build(onto_outputpath) report_pages.append( "<a href='%s/index.html' target='_blank'>%s</a> ('%s' theme)<br />" % (onto_name_safe, onto_name, _theme)) except: e = sys.exc_info()[0] printDebug("Error: " + str(e), "red") continue # generate a report page report_path = os.path.join(outputpath, "index.html") html = """ <html> <head> <style media="screen"> a {font-size: 20px; padding: 15px; text-transform: capitalize; text-decoration: none;} a:hover {text-decoration: underline;} </style> </head> <body> <h1>Ontospy-generated documentation:</h1> %s </body> </html> """ with open(report_path, "w") as text_file: text_file.write(html % ("".join([x for x in report_pages]))) # open report webbrowser.open("file:///" + report_path) raise SystemExit(1)
python
def cli_run_viz(source=None, outputpath="", theme="", verbose=False): """ This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template.. @todo allow to pass a custom folder .. > python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random """ if outputpath: if not (os.path.exists(outputpath)) or not (os.path.isdir(outputpath)): click.secho( "WARNING: the -o option must include a valid directory path.", fg="red") sys.exit(0) else: from os.path import expanduser home = expanduser("~") outputpath = os.path.join(home, "ontospy-viz-multi") if source: source_folder = source[0] if not os.path.isdir(source_folder): click.secho( "WARNING: '%s' is not a valid directory path." % source_folder, fg="red") sys.exit(0) files_list = [ f for f in os.listdir(source_folder) if os.path.isfile(os.path.join(source_folder, f)) ] click.secho( "Exporting the directory: '%s'" % source_folder, fg="green") click.secho("----------", fg="green") else: click.secho( "Exporting the local library: '%s'" % get_home_location(), fg="green") click.secho("----------", fg="green") files_list = get_localontologies() source_folder = get_home_location() report_pages = [] for onto_name in files_list: full_uri = os.path.join(source_folder, onto_name) if theme: if theme == "random": _theme = random_theme() else: _theme = theme else: _theme = BOOTSWATCH_THEME_DEFAULT click.secho("Onto: <%s> Theme: '%s'" % (onto_name, _theme), fg="green") printDebug("Loading graph...", dim=True) g = Ontospy(os.path.join(source_folder, onto_name), verbose=verbose) if g.sources: # if Ontospy graph has no valid 'sources' = file passed was not valid RDF printDebug("Building visualization...", dim=True) onto_name_safe = slugify(unicode(onto_name)) onto_outputpath = os.path.join(outputpath, onto_name_safe) # note: single static files output path static_outputpath = os.path.join(outputpath, "static") # v = KompleteViz(g, theme=_theme) v = KompleteVizMultiModel( g, theme=_theme, static_url="../static/", output_path_static=static_outputpath) try: # note: onto_outputpath is wiped out each time as part of the build url = v.build(onto_outputpath) report_pages.append( "<a href='%s/index.html' target='_blank'>%s</a> ('%s' theme)<br />" % (onto_name_safe, onto_name, _theme)) except: e = sys.exc_info()[0] printDebug("Error: " + str(e), "red") continue # generate a report page report_path = os.path.join(outputpath, "index.html") html = """ <html> <head> <style media="screen"> a {font-size: 20px; padding: 15px; text-transform: capitalize; text-decoration: none;} a:hover {text-decoration: underline;} </style> </head> <body> <h1>Ontospy-generated documentation:</h1> %s </body> </html> """ with open(report_path, "w") as text_file: text_file.write(html % ("".join([x for x in report_pages]))) # open report webbrowser.open("file:///" + report_path) raise SystemExit(1)
[ "def", "cli_run_viz", "(", "source", "=", "None", ",", "outputpath", "=", "\"\"", ",", "theme", "=", "\"\"", ",", "verbose", "=", "False", ")", ":", "if", "outputpath", ":", "if", "not", "(", "os", ".", "path", ".", "exists", "(", "outputpath", ")", ")", "or", "not", "(", "os", ".", "path", ".", "isdir", "(", "outputpath", ")", ")", ":", "click", ".", "secho", "(", "\"WARNING: the -o option must include a valid directory path.\"", ",", "fg", "=", "\"red\"", ")", "sys", ".", "exit", "(", "0", ")", "else", ":", "from", "os", ".", "path", "import", "expanduser", "home", "=", "expanduser", "(", "\"~\"", ")", "outputpath", "=", "os", ".", "path", ".", "join", "(", "home", ",", "\"ontospy-viz-multi\"", ")", "if", "source", ":", "source_folder", "=", "source", "[", "0", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "source_folder", ")", ":", "click", ".", "secho", "(", "\"WARNING: '%s' is not a valid directory path.\"", "%", "source_folder", ",", "fg", "=", "\"red\"", ")", "sys", ".", "exit", "(", "0", ")", "files_list", "=", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "source_folder", ")", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "source_folder", ",", "f", ")", ")", "]", "click", ".", "secho", "(", "\"Exporting the directory: '%s'\"", "%", "source_folder", ",", "fg", "=", "\"green\"", ")", "click", ".", "secho", "(", "\"----------\"", ",", "fg", "=", "\"green\"", ")", "else", ":", "click", ".", "secho", "(", "\"Exporting the local library: '%s'\"", "%", "get_home_location", "(", ")", ",", "fg", "=", "\"green\"", ")", "click", ".", "secho", "(", "\"----------\"", ",", "fg", "=", "\"green\"", ")", "files_list", "=", "get_localontologies", "(", ")", "source_folder", "=", "get_home_location", "(", ")", "report_pages", "=", "[", "]", "for", "onto_name", "in", "files_list", ":", "full_uri", "=", "os", ".", "path", ".", "join", "(", "source_folder", ",", "onto_name", ")", "if", "theme", ":", "if", "theme", "==", "\"random\"", ":", "_theme", "=", "random_theme", "(", ")", "else", ":", "_theme", "=", "theme", "else", ":", "_theme", "=", "BOOTSWATCH_THEME_DEFAULT", "click", ".", "secho", "(", "\"Onto: <%s> Theme: '%s'\"", "%", "(", "onto_name", ",", "_theme", ")", ",", "fg", "=", "\"green\"", ")", "printDebug", "(", "\"Loading graph...\"", ",", "dim", "=", "True", ")", "g", "=", "Ontospy", "(", "os", ".", "path", ".", "join", "(", "source_folder", ",", "onto_name", ")", ",", "verbose", "=", "verbose", ")", "if", "g", ".", "sources", ":", "# if Ontospy graph has no valid 'sources' = file passed was not valid RDF", "printDebug", "(", "\"Building visualization...\"", ",", "dim", "=", "True", ")", "onto_name_safe", "=", "slugify", "(", "unicode", "(", "onto_name", ")", ")", "onto_outputpath", "=", "os", ".", "path", ".", "join", "(", "outputpath", ",", "onto_name_safe", ")", "# note: single static files output path", "static_outputpath", "=", "os", ".", "path", ".", "join", "(", "outputpath", ",", "\"static\"", ")", "# v = KompleteViz(g, theme=_theme)", "v", "=", "KompleteVizMultiModel", "(", "g", ",", "theme", "=", "_theme", ",", "static_url", "=", "\"../static/\"", ",", "output_path_static", "=", "static_outputpath", ")", "try", ":", "# note: onto_outputpath is wiped out each time as part of the build", "url", "=", "v", ".", "build", "(", "onto_outputpath", ")", "report_pages", ".", "append", "(", "\"<a href='%s/index.html' target='_blank'>%s</a> ('%s' theme)<br />\"", "%", "(", "onto_name_safe", ",", "onto_name", ",", "_theme", ")", ")", "except", ":", "e", "=", "sys", ".", "exc_info", "(", ")", "[", "0", "]", "printDebug", "(", "\"Error: \"", "+", "str", "(", "e", ")", ",", "\"red\"", ")", "continue", "# generate a report page", "report_path", "=", "os", ".", "path", ".", "join", "(", "outputpath", ",", "\"index.html\"", ")", "html", "=", "\"\"\"\n<html>\n<head>\n <style media=\"screen\">\n a {font-size: 20px; padding: 15px; text-transform: capitalize; text-decoration: none;}\n a:hover {text-decoration: underline;}\n </style>\n</head>\n<body>\n<h1>Ontospy-generated documentation:</h1>\n%s\n</body>\n</html>\n \"\"\"", "with", "open", "(", "report_path", ",", "\"w\"", ")", "as", "text_file", ":", "text_file", ".", "write", "(", "html", "%", "(", "\"\"", ".", "join", "(", "[", "x", "for", "x", "in", "report_pages", "]", ")", ")", ")", "# open report", "webbrowser", ".", "open", "(", "\"file:///\"", "+", "report_path", ")", "raise", "SystemExit", "(", "1", ")" ]
This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template.. @todo allow to pass a custom folder .. > python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random
[ "This", "application", "is", "a", "wrapper", "on", "the", "main", "ontospy", "-", "viz", "script", ".", "It", "generates", "docs", "for", "all", "models", "in", "the", "local", "library", ".", "Using", "the", "Complex", "-", "html", "template", "..", "@todo", "allow", "to", "pass", "a", "custom", "folder", ".." ]
train
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/ontodocs/misc/scripts/export_all.py#L37-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: This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template.. @todo allow to pass a custom folder .. > python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random ### Response: def cli_run_viz(source=None, outputpath="", theme="", verbose=False): """ This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template.. @todo allow to pass a custom folder .. > python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random """ if outputpath: if not (os.path.exists(outputpath)) or not (os.path.isdir(outputpath)): click.secho( "WARNING: the -o option must include a valid directory path.", fg="red") sys.exit(0) else: from os.path import expanduser home = expanduser("~") outputpath = os.path.join(home, "ontospy-viz-multi") if source: source_folder = source[0] if not os.path.isdir(source_folder): click.secho( "WARNING: '%s' is not a valid directory path." % source_folder, fg="red") sys.exit(0) files_list = [ f for f in os.listdir(source_folder) if os.path.isfile(os.path.join(source_folder, f)) ] click.secho( "Exporting the directory: '%s'" % source_folder, fg="green") click.secho("----------", fg="green") else: click.secho( "Exporting the local library: '%s'" % get_home_location(), fg="green") click.secho("----------", fg="green") files_list = get_localontologies() source_folder = get_home_location() report_pages = [] for onto_name in files_list: full_uri = os.path.join(source_folder, onto_name) if theme: if theme == "random": _theme = random_theme() else: _theme = theme else: _theme = BOOTSWATCH_THEME_DEFAULT click.secho("Onto: <%s> Theme: '%s'" % (onto_name, _theme), fg="green") printDebug("Loading graph...", dim=True) g = Ontospy(os.path.join(source_folder, onto_name), verbose=verbose) if g.sources: # if Ontospy graph has no valid 'sources' = file passed was not valid RDF printDebug("Building visualization...", dim=True) onto_name_safe = slugify(unicode(onto_name)) onto_outputpath = os.path.join(outputpath, onto_name_safe) # note: single static files output path static_outputpath = os.path.join(outputpath, "static") # v = KompleteViz(g, theme=_theme) v = KompleteVizMultiModel( g, theme=_theme, static_url="../static/", output_path_static=static_outputpath) try: # note: onto_outputpath is wiped out each time as part of the build url = v.build(onto_outputpath) report_pages.append( "<a href='%s/index.html' target='_blank'>%s</a> ('%s' theme)<br />" % (onto_name_safe, onto_name, _theme)) except: e = sys.exc_info()[0] printDebug("Error: " + str(e), "red") continue # generate a report page report_path = os.path.join(outputpath, "index.html") html = """ <html> <head> <style media="screen"> a {font-size: 20px; padding: 15px; text-transform: capitalize; text-decoration: none;} a:hover {text-decoration: underline;} </style> </head> <body> <h1>Ontospy-generated documentation:</h1> %s </body> </html> """ with open(report_path, "w") as text_file: text_file.write(html % ("".join([x for x in report_pages]))) # open report webbrowser.open("file:///" + report_path) raise SystemExit(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, 2028, 3851, 374, 264, 13564, 389, 279, 1925, 14848, 437, 3368, 8437, 450, 5429, 13, 1102, 27983, 27437, 369, 682, 4211, 304, 279, 2254, 6875, 13, 12362, 279, 22872, 54868, 3896, 35047, 31, 17825, 2187, 311, 1522, 264, 2587, 8695, 60582, 29, 10344, 482, 76, 14848, 437, 3368, 3211, 450, 516, 25207, 42559, 5823, 482, 78, 42595, 24514, 12986, 14, 1198, 9224, 4288, 271, 14711, 6075, 512, 755, 22059, 14334, 2325, 450, 12719, 5980, 11, 2612, 2398, 46563, 7057, 46563, 14008, 5725, 997, 262, 3270, 2028, 3851, 374, 264, 13564, 389, 279, 1925, 14848, 437, 3368, 8437, 450, 5429, 13, 1102, 27983, 27437, 369, 682, 4211, 304, 279, 2254, 6875, 13, 12362, 279, 22872, 54868, 3896, 35047, 31, 17825, 2187, 311, 1522, 264, 2587, 8695, 60582, 29, 10344, 482, 76, 14848, 437, 3368, 3211, 450, 516, 25207, 42559, 5823, 482, 78, 42595, 24514, 12986, 14, 1198, 9224, 4288, 271, 15425, 262, 422, 2612, 2398, 512, 286, 422, 539, 320, 437, 3960, 12347, 11304, 2398, 595, 477, 539, 320, 437, 3960, 49261, 11304, 2398, 10162, 310, 4299, 4624, 971, 1021, 394, 330, 33804, 25, 279, 482, 78, 3072, 2011, 2997, 264, 2764, 6352, 1853, 10560, 394, 30899, 429, 1171, 1158, 310, 5826, 13955, 7, 15, 340, 262, 775, 512, 286, 505, 2709, 3960, 1179, 9407, 882, 198, 286, 2162, 284, 9407, 882, 82112, 1158, 286, 2612, 2398, 284, 2709, 3960, 5563, 64294, 11, 330, 546, 437, 3368, 8437, 450, 96769, 5240, 262, 422, 2592, 512, 286, 2592, 15626, 284, 2592, 58, 15, 933, 286, 422, 539, 2709, 3960, 49261, 12719, 15626, 997, 310, 4299, 4624, 971, 1021, 394, 330, 33804, 25, 7832, 82, 6, 374, 539, 264, 2764, 6352, 1853, 1210, 1034, 2592, 15626, 345, 394, 30899, 429, 1171, 1158, 310, 5826, 13955, 7, 15, 696, 286, 3626, 2062, 284, 2330, 310, 282, 369, 282, 304, 2709, 33576, 12719, 15626, 340, 310, 422, 2709, 3960, 40047, 9835, 3960, 5563, 12719, 15626, 11, 282, 1192, 286, 5243, 286, 4299, 4624, 971, 1021, 310, 330, 17321, 287, 279, 6352, 25, 7832, 82, 15260, 1034, 2592, 15626, 11, 30899, 429, 13553, 1158, 286, 4299, 4624, 971, 446, 15700, 498, 30899, 429, 13553, 5240, 262, 775, 512, 286, 4299, 4624, 971, 1021, 310, 330, 17321, 287, 279, 2254, 6875, 25, 7832, 82, 15260, 1034, 636, 22389, 13427, 3227, 310, 30899, 429, 13553, 1158, 286, 4299, 4624, 971, 446, 15700, 498, 30899, 429, 13553, 1158, 286, 3626, 2062, 284, 636, 13876, 546, 9268, 746, 286, 2592, 15626, 284, 636, 22389, 13427, 2892, 262, 1934, 22391, 284, 14941, 262, 369, 8800, 1292, 304, 3626, 2062, 1473, 286, 2539, 15943, 284, 2709, 3960, 5563, 12719, 15626, 11, 8800, 1292, 340, 286, 422, 7057, 512, 310, 422, 7057, 624, 330, 11719, 4764, 394, 721, 9224, 284, 4288, 20455, 746, 310, 775, 512, 394, 721, 9224, 284, 7057, 198, 286, 775, 512, 310 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 3851, 374, 264, 13564, 389, 279, 1925, 14848, 437, 3368, 8437, 450, 5429, 13, 1102, 27983, 27437, 369, 682, 4211, 304, 279, 2254, 6875, 13, 12362, 279, 22872, 54868, 3896, 35047, 31, 17825, 2187, 311, 1522, 264, 2587, 8695, 60582, 29, 10344, 482, 76, 14848, 437, 3368, 3211, 450, 516, 25207, 42559, 5823, 482, 78, 42595, 24514, 12986, 14, 1198, 9224, 4288, 271, 14711, 6075, 512, 755, 22059, 14334, 2325, 450, 12719, 5980, 11, 2612, 2398, 46563, 7057, 46563, 14008, 5725, 997, 262, 3270, 2028, 3851, 374, 264, 13564, 389, 279, 1925, 14848, 437, 3368, 8437, 450, 5429, 13, 1102, 27983, 27437, 369, 682, 4211, 304, 279, 2254, 6875, 13, 12362, 279, 22872, 54868, 3896, 35047, 31, 17825, 2187, 311, 1522, 264, 2587, 8695, 60582, 29, 10344, 482, 76, 14848, 437, 3368, 3211, 450, 516, 25207, 42559, 5823, 482, 78, 42595, 24514, 12986, 14, 1198, 9224, 4288, 271, 15425, 262, 422, 2612, 2398, 512, 286, 422, 539, 320, 437, 3960, 12347, 11304, 2398, 595, 477, 539, 320, 437, 3960, 49261, 11304, 2398, 10162, 310, 4299, 4624, 971, 1021, 394, 330, 33804, 25, 279, 482, 78, 3072, 2011, 2997, 264, 2764, 6352, 1853, 10560, 394, 30899, 429, 1171, 1158, 310, 5826, 13955, 7, 15, 340, 262, 775, 512, 286, 505, 2709, 3960, 1179, 9407, 882, 198, 286, 2162, 284, 9407, 882, 82112, 1158, 286, 2612, 2398, 284, 2709, 3960, 5563, 64294, 11, 330, 546, 437, 3368, 8437, 450, 96769, 5240, 262, 422, 2592, 512, 286, 2592, 15626, 284, 2592, 58, 15, 933, 286, 422, 539, 2709, 3960, 49261, 12719, 15626, 997, 310, 4299, 4624, 971, 1021, 394, 330, 33804, 25, 7832, 82, 6, 374, 539, 264, 2764, 6352, 1853, 1210, 1034, 2592, 15626, 345, 394, 30899, 429, 1171, 1158, 310, 5826, 13955, 7, 15, 696, 286, 3626, 2062, 284, 2330, 310, 282, 369, 282, 304, 2709, 33576, 12719, 15626, 340, 310, 422, 2709, 3960, 40047, 9835, 3960, 5563, 12719, 15626, 11, 282, 1192, 286, 5243, 286, 4299, 4624, 971, 1021, 310, 330, 17321, 287, 279, 6352, 25, 7832, 82, 15260, 1034, 2592, 15626, 11, 30899, 429, 13553, 1158, 286, 4299, 4624, 971, 446, 15700, 498, 30899, 429, 13553, 5240, 262, 775, 512, 286, 4299, 4624, 971, 1021, 310, 330, 17321, 287, 279, 2254, 6875, 25, 7832, 82, 15260, 1034, 636, 22389, 13427, 3227, 310, 30899, 429, 13553, 1158, 286, 4299, 4624, 971, 446, 15700, 498, 30899, 429, 13553, 1158, 286, 3626, 2062, 284, 636, 13876, 546, 9268, 746, 286, 2592, 15626, 284, 636, 22389, 13427, 2892, 262, 1934, 22391, 284, 14941, 262, 369, 8800, 1292, 304, 3626, 2062, 1473, 286, 2539, 15943, 284, 2709, 3960, 5563, 12719, 15626, 11, 8800, 1292, 340, 286, 422, 7057, 512, 310, 422, 7057, 624, 330, 11719, 4764, 394, 721, 9224, 284, 4288, 20455, 746, 310, 775, 512, 394, 721, 9224, 284, 7057, 198, 286, 775, 512, 310 ]
bcbio/bcbio-nextgen
bcbio/heterogeneity/bubbletree.py
_is_possible_loh
def _is_possible_loh(rec, vcf_rec, params, somatic_info, use_status=False, max_normal_depth=None): """Check if the VCF record is a het in the normal with sufficient support. Only returns SNPs, since indels tend to have less precise frequency measurements. """ if _is_biallelic_snp(rec) and _passes_plus_germline(rec, use_status=use_status): stats = _tumor_normal_stats(rec, somatic_info, vcf_rec) depths = [tz.get_in([x, "depth"], stats) for x in ["normal", "tumor"]] depths = [d for d in depths if d is not None] normal_freq = tz.get_in(["normal", "freq"], stats) tumor_freq = tz.get_in(["tumor", "freq"], stats) if all([d > params["min_depth"] for d in depths]): if max_normal_depth and tz.get_in(["normal", "depth"], stats, 0) > max_normal_depth: return None if normal_freq is not None: if normal_freq >= params["min_freq"] and normal_freq <= params["max_freq"]: return stats elif (tumor_freq >= params["tumor_only"]["min_freq"] and tumor_freq <= params["tumor_only"]["max_freq"]): if (vcf_rec and not _has_population_germline(vcf_rec)) or is_population_germline(rec): return stats
python
def _is_possible_loh(rec, vcf_rec, params, somatic_info, use_status=False, max_normal_depth=None): """Check if the VCF record is a het in the normal with sufficient support. Only returns SNPs, since indels tend to have less precise frequency measurements. """ if _is_biallelic_snp(rec) and _passes_plus_germline(rec, use_status=use_status): stats = _tumor_normal_stats(rec, somatic_info, vcf_rec) depths = [tz.get_in([x, "depth"], stats) for x in ["normal", "tumor"]] depths = [d for d in depths if d is not None] normal_freq = tz.get_in(["normal", "freq"], stats) tumor_freq = tz.get_in(["tumor", "freq"], stats) if all([d > params["min_depth"] for d in depths]): if max_normal_depth and tz.get_in(["normal", "depth"], stats, 0) > max_normal_depth: return None if normal_freq is not None: if normal_freq >= params["min_freq"] and normal_freq <= params["max_freq"]: return stats elif (tumor_freq >= params["tumor_only"]["min_freq"] and tumor_freq <= params["tumor_only"]["max_freq"]): if (vcf_rec and not _has_population_germline(vcf_rec)) or is_population_germline(rec): return stats
[ "def", "_is_possible_loh", "(", "rec", ",", "vcf_rec", ",", "params", ",", "somatic_info", ",", "use_status", "=", "False", ",", "max_normal_depth", "=", "None", ")", ":", "if", "_is_biallelic_snp", "(", "rec", ")", "and", "_passes_plus_germline", "(", "rec", ",", "use_status", "=", "use_status", ")", ":", "stats", "=", "_tumor_normal_stats", "(", "rec", ",", "somatic_info", ",", "vcf_rec", ")", "depths", "=", "[", "tz", ".", "get_in", "(", "[", "x", ",", "\"depth\"", "]", ",", "stats", ")", "for", "x", "in", "[", "\"normal\"", ",", "\"tumor\"", "]", "]", "depths", "=", "[", "d", "for", "d", "in", "depths", "if", "d", "is", "not", "None", "]", "normal_freq", "=", "tz", ".", "get_in", "(", "[", "\"normal\"", ",", "\"freq\"", "]", ",", "stats", ")", "tumor_freq", "=", "tz", ".", "get_in", "(", "[", "\"tumor\"", ",", "\"freq\"", "]", ",", "stats", ")", "if", "all", "(", "[", "d", ">", "params", "[", "\"min_depth\"", "]", "for", "d", "in", "depths", "]", ")", ":", "if", "max_normal_depth", "and", "tz", ".", "get_in", "(", "[", "\"normal\"", ",", "\"depth\"", "]", ",", "stats", ",", "0", ")", ">", "max_normal_depth", ":", "return", "None", "if", "normal_freq", "is", "not", "None", ":", "if", "normal_freq", ">=", "params", "[", "\"min_freq\"", "]", "and", "normal_freq", "<=", "params", "[", "\"max_freq\"", "]", ":", "return", "stats", "elif", "(", "tumor_freq", ">=", "params", "[", "\"tumor_only\"", "]", "[", "\"min_freq\"", "]", "and", "tumor_freq", "<=", "params", "[", "\"tumor_only\"", "]", "[", "\"max_freq\"", "]", ")", ":", "if", "(", "vcf_rec", "and", "not", "_has_population_germline", "(", "vcf_rec", ")", ")", "or", "is_population_germline", "(", "rec", ")", ":", "return", "stats" ]
Check if the VCF record is a het in the normal with sufficient support. Only returns SNPs, since indels tend to have less precise frequency measurements.
[ "Check", "if", "the", "VCF", "record", "is", "a", "het", "in", "the", "normal", "with", "sufficient", "support", "." ]
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L358-L378
<|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: Check if the VCF record is a het in the normal with sufficient support. Only returns SNPs, since indels tend to have less precise frequency measurements. ### Response: def _is_possible_loh(rec, vcf_rec, params, somatic_info, use_status=False, max_normal_depth=None): """Check if the VCF record is a het in the normal with sufficient support. Only returns SNPs, since indels tend to have less precise frequency measurements. """ if _is_biallelic_snp(rec) and _passes_plus_germline(rec, use_status=use_status): stats = _tumor_normal_stats(rec, somatic_info, vcf_rec) depths = [tz.get_in([x, "depth"], stats) for x in ["normal", "tumor"]] depths = [d for d in depths if d is not None] normal_freq = tz.get_in(["normal", "freq"], stats) tumor_freq = tz.get_in(["tumor", "freq"], stats) if all([d > params["min_depth"] for d in depths]): if max_normal_depth and tz.get_in(["normal", "depth"], stats, 0) > max_normal_depth: return None if normal_freq is not None: if normal_freq >= params["min_freq"] and normal_freq <= params["max_freq"]: return stats elif (tumor_freq >= params["tumor_only"]["min_freq"] and tumor_freq <= params["tumor_only"]["max_freq"]): if (vcf_rec and not _has_population_germline(vcf_rec)) or is_population_germline(rec): return stats <|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, 4061, 422, 279, 650, 9847, 3335, 374, 264, 9194, 304, 279, 4725, 449, 14343, 1862, 382, 262, 8442, 4780, 18407, 21051, 11, 2533, 1280, 2053, 8541, 311, 617, 2753, 24473, 11900, 22323, 382, 14711, 6075, 512, 755, 721, 285, 72344, 5677, 71, 21285, 11, 348, 9991, 7225, 11, 3712, 11, 1794, 780, 3186, 11, 1005, 4878, 5725, 11, 1973, 14300, 19601, 5980, 997, 262, 4304, 4061, 422, 279, 650, 9847, 3335, 374, 264, 9194, 304, 279, 4725, 449, 14343, 1862, 382, 262, 8442, 4780, 18407, 21051, 11, 2533, 1280, 2053, 8541, 311, 617, 2753, 24473, 11900, 22323, 627, 262, 3270, 262, 422, 721, 285, 890, 532, 273, 416, 646, 6331, 21285, 8, 323, 721, 95423, 29143, 62, 1414, 1029, 483, 21285, 11, 1005, 4878, 28, 817, 4878, 997, 286, 10691, 284, 721, 83, 69361, 14300, 15743, 21285, 11, 1794, 780, 3186, 11, 348, 9991, 7225, 340, 286, 43957, 284, 510, 38692, 673, 1265, 2625, 87, 11, 330, 18021, 8073, 10691, 8, 369, 865, 304, 4482, 8416, 498, 330, 83, 69361, 84763, 286, 43957, 284, 510, 67, 369, 294, 304, 43957, 422, 294, 374, 539, 2290, 933, 286, 4725, 22543, 284, 43628, 673, 1265, 19605, 8416, 498, 330, 34640, 8073, 10691, 340, 286, 36254, 22543, 284, 43628, 673, 1265, 19605, 83, 69361, 498, 330, 34640, 8073, 10691, 340, 286, 422, 682, 2625, 67, 871, 3712, 1204, 1083, 19601, 1365, 369, 294, 304, 43957, 22953, 310, 422, 1973, 14300, 19601, 323, 43628, 673, 1265, 19605, 8416, 498, 330, 18021, 8073, 10691, 11, 220, 15, 8, 871, 1973, 14300, 19601, 512, 394, 471, 2290, 198, 310, 422, 4725, 22543, 374, 539, 2290, 512, 394, 422, 4725, 22543, 2669, 3712, 1204, 1083, 22543, 1365, 323, 4725, 22543, 2717, 3712, 1204, 2880, 22543, 34834, 504, 471, 10691, 198, 310, 4508, 320, 83, 69361, 22543, 2669, 3712, 1204, 83, 69361, 18917, 11264, 1083, 22543, 1365, 323, 198, 504, 36254, 22543, 2717, 3712, 1204, 83, 69361, 18917, 11264, 2880, 22543, 1365, 997, 394, 422, 320, 7513, 69, 7225, 323, 539, 721, 4752, 75672, 62, 1414, 1029, 483, 3832, 9991, 7225, 595, 477, 374, 75672, 62, 1414, 1029, 483, 21285, 997, 504, 471, 10691, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4061, 422, 279, 650, 9847, 3335, 374, 264, 9194, 304, 279, 4725, 449, 14343, 1862, 382, 262, 8442, 4780, 18407, 21051, 11, 2533, 1280, 2053, 8541, 311, 617, 2753, 24473, 11900, 22323, 382, 14711, 6075, 512, 755, 721, 285, 72344, 5677, 71, 21285, 11, 348, 9991, 7225, 11, 3712, 11, 1794, 780, 3186, 11, 1005, 4878, 5725, 11, 1973, 14300, 19601, 5980, 997, 262, 4304, 4061, 422, 279, 650, 9847, 3335, 374, 264, 9194, 304, 279, 4725, 449, 14343, 1862, 382, 262, 8442, 4780, 18407, 21051, 11, 2533, 1280, 2053, 8541, 311, 617, 2753, 24473, 11900, 22323, 627, 262, 3270, 262, 422, 721, 285, 890, 532, 273, 416, 646, 6331, 21285, 8, 323, 721, 95423, 29143, 62, 1414, 1029, 483, 21285, 11, 1005, 4878, 28, 817, 4878, 997, 286, 10691, 284, 721, 83, 69361, 14300, 15743, 21285, 11, 1794, 780, 3186, 11, 348, 9991, 7225, 340, 286, 43957, 284, 510, 38692, 673, 1265, 2625, 87, 11, 330, 18021, 8073, 10691, 8, 369, 865, 304, 4482, 8416, 498, 330, 83, 69361, 84763, 286, 43957, 284, 510, 67, 369, 294, 304, 43957, 422, 294, 374, 539, 2290, 933, 286, 4725, 22543, 284, 43628, 673, 1265, 19605, 8416, 498, 330, 34640, 8073, 10691, 340, 286, 36254, 22543, 284, 43628, 673, 1265, 19605, 83, 69361, 498, 330, 34640, 8073, 10691, 340, 286, 422, 682, 2625, 67, 871, 3712, 1204, 1083, 19601, 1365, 369, 294, 304, 43957, 22953, 310, 422, 1973, 14300, 19601, 323, 43628, 673, 1265, 19605, 8416, 498, 330, 18021, 8073, 10691, 11, 220, 15, 8, 871, 1973, 14300, 19601, 512, 394, 471, 2290, 198, 310, 422, 4725, 22543, 374, 539, 2290, 512, 394, 422, 4725, 22543, 2669, 3712, 1204, 1083, 22543, 1365, 323, 4725, 22543, 2717, 3712, 1204, 2880, 22543, 34834, 504, 471, 10691, 198, 310, 4508, 320, 83, 69361, 22543, 2669, 3712, 1204, 83, 69361, 18917, 11264, 1083, 22543, 1365, 323, 198, 504, 36254, 22543, 2717, 3712, 1204, 83, 69361, 18917, 11264, 2880, 22543, 1365, 997, 394, 422, 320, 7513, 69, 7225, 323, 539, 721, 4752, 75672, 62, 1414, 1029, 483, 3832, 9991, 7225, 595, 477, 374, 75672, 62, 1414, 1029, 483, 21285, 997, 504, 471, 10691, 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 ]
kmarekspartz/props
props/__init__.py
one_of
def one_of(*generators): """ Generates an arbitrary value of one of the specified generators. This is a class factory, it makes a class which is a closure around the specified generators. """ class OneOfGenerators(ArbitraryInterface): """ A closure class around the generators specified above, which generates one of the generators. """ @classmethod def arbitrary(cls): """ Generate one of the enclosed generators. """ return arbitrary(random.choice(generators)) OneOfGenerators.__name__ = ''.join([ 'one_of(', ', '.join(generator.__name__ for generator in generators), ')' ]) return OneOfGenerators
python
def one_of(*generators): """ Generates an arbitrary value of one of the specified generators. This is a class factory, it makes a class which is a closure around the specified generators. """ class OneOfGenerators(ArbitraryInterface): """ A closure class around the generators specified above, which generates one of the generators. """ @classmethod def arbitrary(cls): """ Generate one of the enclosed generators. """ return arbitrary(random.choice(generators)) OneOfGenerators.__name__ = ''.join([ 'one_of(', ', '.join(generator.__name__ for generator in generators), ')' ]) return OneOfGenerators
[ "def", "one_of", "(", "*", "generators", ")", ":", "class", "OneOfGenerators", "(", "ArbitraryInterface", ")", ":", "\"\"\"\n A closure class around the generators specified above, which\n generates one of the generators.\n \"\"\"", "@", "classmethod", "def", "arbitrary", "(", "cls", ")", ":", "\"\"\"\n Generate one of the enclosed generators.\n \"\"\"", "return", "arbitrary", "(", "random", ".", "choice", "(", "generators", ")", ")", "OneOfGenerators", ".", "__name__", "=", "''", ".", "join", "(", "[", "'one_of('", ",", "', '", ".", "join", "(", "generator", ".", "__name__", "for", "generator", "in", "generators", ")", ",", "')'", "]", ")", "return", "OneOfGenerators" ]
Generates an arbitrary value of one of the specified generators. This is a class factory, it makes a class which is a closure around the specified generators.
[ "Generates", "an", "arbitrary", "value", "of", "one", "of", "the", "specified", "generators", ".", "This", "is", "a", "class", "factory", "it", "makes", "a", "class", "which", "is", "a", "closure", "around", "the", "specified", "generators", "." ]
train
https://github.com/kmarekspartz/props/blob/a766cdbe6f7be846f602553280770546f124a91d/props/__init__.py#L194-L218
<|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: Generates an arbitrary value of one of the specified generators. This is a class factory, it makes a class which is a closure around the specified generators. ### Response: def one_of(*generators): """ Generates an arbitrary value of one of the specified generators. This is a class factory, it makes a class which is a closure around the specified generators. """ class OneOfGenerators(ArbitraryInterface): """ A closure class around the generators specified above, which generates one of the generators. """ @classmethod def arbitrary(cls): """ Generate one of the enclosed generators. """ return arbitrary(random.choice(generators)) OneOfGenerators.__name__ = ''.join([ 'one_of(', ', '.join(generator.__name__ for generator in generators), ')' ]) return OneOfGenerators <|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, 5648, 988, 459, 25142, 907, 315, 832, 315, 279, 5300, 44163, 627, 262, 1115, 374, 264, 538, 8803, 11, 433, 3727, 264, 538, 902, 374, 264, 22722, 2212, 279, 198, 262, 5300, 44163, 382, 14711, 6075, 512, 755, 832, 3659, 4163, 7642, 3046, 997, 262, 3270, 262, 53592, 459, 25142, 907, 315, 832, 315, 279, 5300, 44163, 627, 262, 1115, 374, 264, 538, 8803, 11, 433, 3727, 264, 538, 902, 374, 264, 22722, 2212, 279, 198, 262, 5300, 44163, 627, 262, 12713, 262, 538, 3861, 2173, 5648, 3046, 4444, 81, 88951, 5160, 997, 286, 3270, 286, 362, 22722, 538, 2212, 279, 44163, 5300, 3485, 11, 902, 198, 286, 27983, 832, 315, 279, 44163, 627, 286, 12713, 286, 571, 27853, 198, 286, 711, 25142, 21024, 997, 310, 3270, 310, 20400, 832, 315, 279, 44910, 44163, 627, 310, 3270, 310, 471, 25142, 26167, 30365, 3348, 804, 3046, 4489, 262, 3861, 2173, 5648, 3046, 4952, 609, 565, 284, 43963, 6115, 9133, 286, 364, 606, 3659, 14067, 6752, 6389, 6115, 59153, 4952, 609, 565, 369, 14143, 304, 44163, 1350, 286, 17081, 1270, 262, 24371, 262, 471, 3861, 2173, 5648, 3046, 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,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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 5648, 988, 459, 25142, 907, 315, 832, 315, 279, 5300, 44163, 627, 262, 1115, 374, 264, 538, 8803, 11, 433, 3727, 264, 538, 902, 374, 264, 22722, 2212, 279, 198, 262, 5300, 44163, 382, 14711, 6075, 512, 755, 832, 3659, 4163, 7642, 3046, 997, 262, 3270, 262, 53592, 459, 25142, 907, 315, 832, 315, 279, 5300, 44163, 627, 262, 1115, 374, 264, 538, 8803, 11, 433, 3727, 264, 538, 902, 374, 264, 22722, 2212, 279, 198, 262, 5300, 44163, 627, 262, 12713, 262, 538, 3861, 2173, 5648, 3046, 4444, 81, 88951, 5160, 997, 286, 3270, 286, 362, 22722, 538, 2212, 279, 44163, 5300, 3485, 11, 902, 198, 286, 27983, 832, 315, 279, 44163, 627, 286, 12713, 286, 571, 27853, 198, 286, 711, 25142, 21024, 997, 310, 3270, 310, 20400, 832, 315, 279, 44910, 44163, 627, 310, 3270, 310, 471, 25142, 26167, 30365, 3348, 804, 3046, 4489, 262, 3861, 2173, 5648, 3046, 4952, 609, 565, 284, 43963, 6115, 9133, 286, 364, 606, 3659, 14067, 6752, 6389, 6115, 59153, 4952, 609, 565, 369, 14143, 304, 44163, 1350, 286, 17081, 1270, 262, 24371, 262, 471, 3861, 2173, 5648, 3046, 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 ]
blockstack/blockstack-core
blockstack/lib/nameset/db.py
namedb_get_names_owned_by_address
def namedb_get_names_owned_by_address( cur, address, current_block ): """ Get the list of non-expired, non-revoked names owned by an address. Only works if there is a *singular* address for the name. """ unexpired_fragment, unexpired_args = namedb_select_where_unexpired_names( current_block ) select_query = "SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id " + \ "WHERE name_records.address = ? AND name_records.revoked = 0 AND " + unexpired_fragment + ";" args = (address,) + unexpired_args name_rows = namedb_query_execute( cur, select_query, args ) names = [] for name_row in name_rows: names.append( name_row['name'] ) if len(names) == 0: return None else: return names
python
def namedb_get_names_owned_by_address( cur, address, current_block ): """ Get the list of non-expired, non-revoked names owned by an address. Only works if there is a *singular* address for the name. """ unexpired_fragment, unexpired_args = namedb_select_where_unexpired_names( current_block ) select_query = "SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id " + \ "WHERE name_records.address = ? AND name_records.revoked = 0 AND " + unexpired_fragment + ";" args = (address,) + unexpired_args name_rows = namedb_query_execute( cur, select_query, args ) names = [] for name_row in name_rows: names.append( name_row['name'] ) if len(names) == 0: return None else: return names
[ "def", "namedb_get_names_owned_by_address", "(", "cur", ",", "address", ",", "current_block", ")", ":", "unexpired_fragment", ",", "unexpired_args", "=", "namedb_select_where_unexpired_names", "(", "current_block", ")", "select_query", "=", "\"SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id \"", "+", "\"WHERE name_records.address = ? AND name_records.revoked = 0 AND \"", "+", "unexpired_fragment", "+", "\";\"", "args", "=", "(", "address", ",", ")", "+", "unexpired_args", "name_rows", "=", "namedb_query_execute", "(", "cur", ",", "select_query", ",", "args", ")", "names", "=", "[", "]", "for", "name_row", "in", "name_rows", ":", "names", ".", "append", "(", "name_row", "[", "'name'", "]", ")", "if", "len", "(", "names", ")", "==", "0", ":", "return", "None", "else", ":", "return", "names" ]
Get the list of non-expired, non-revoked names owned by an address. Only works if there is a *singular* address for the name.
[ "Get", "the", "list", "of", "non", "-", "expired", "non", "-", "revoked", "names", "owned", "by", "an", "address", ".", "Only", "works", "if", "there", "is", "a", "*", "singular", "*", "address", "for", "the", "name", "." ]
train
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/db.py#L2245-L2266
<|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 non-expired, non-revoked names owned by an address. Only works if there is a *singular* address for the name. ### Response: def namedb_get_names_owned_by_address( cur, address, current_block ): """ Get the list of non-expired, non-revoked names owned by an address. Only works if there is a *singular* address for the name. """ unexpired_fragment, unexpired_args = namedb_select_where_unexpired_names( current_block ) select_query = "SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id " + \ "WHERE name_records.address = ? AND name_records.revoked = 0 AND " + unexpired_fragment + ";" args = (address,) + unexpired_args name_rows = namedb_query_execute( cur, select_query, args ) names = [] for name_row in name_rows: names.append( name_row['name'] ) if len(names) == 0: return None else: return names <|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, 2536, 18882, 2757, 11, 2536, 5621, 85, 11059, 5144, 13234, 555, 459, 2686, 627, 262, 8442, 4375, 422, 1070, 374, 264, 353, 93409, 9, 2686, 369, 279, 836, 382, 14711, 6075, 512, 755, 7086, 65, 3138, 9366, 53073, 3795, 6886, 7, 2917, 11, 2686, 11, 1510, 7258, 21711, 262, 3270, 262, 2175, 279, 1160, 315, 2536, 18882, 2757, 11, 2536, 5621, 85, 11059, 5144, 13234, 555, 459, 2686, 627, 262, 8442, 4375, 422, 1070, 374, 264, 353, 93409, 9, 2686, 369, 279, 836, 627, 262, 12713, 262, 653, 76632, 44112, 11, 653, 76632, 8550, 284, 7086, 65, 13350, 37914, 5012, 76632, 9366, 7, 1510, 7258, 5235, 262, 3373, 5857, 284, 330, 4963, 836, 4393, 836, 32379, 13369, 59191, 6328, 836, 32379, 51509, 851, 284, 59191, 51509, 851, 330, 489, 3120, 4391, 330, 27611, 836, 32379, 14111, 284, 949, 3651, 836, 32379, 70473, 11059, 284, 220, 15, 3651, 330, 489, 653, 76632, 44112, 489, 19500, 702, 262, 2897, 284, 320, 5102, 47121, 489, 653, 76632, 8550, 271, 262, 836, 11189, 284, 7086, 65, 5857, 45429, 7, 2917, 11, 3373, 5857, 11, 2897, 5235, 262, 5144, 284, 4260, 262, 369, 836, 8698, 304, 836, 11189, 512, 286, 5144, 2102, 7, 836, 8698, 681, 609, 663, 5235, 262, 422, 2479, 41501, 8, 624, 220, 15, 512, 286, 471, 2290, 720, 262, 775, 512, 286, 471, 5144, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1991, 279, 1160, 315, 2536, 18882, 2757, 11, 2536, 5621, 85, 11059, 5144, 13234, 555, 459, 2686, 627, 262, 8442, 4375, 422, 1070, 374, 264, 353, 93409, 9, 2686, 369, 279, 836, 382, 14711, 6075, 512, 755, 7086, 65, 3138, 9366, 53073, 3795, 6886, 7, 2917, 11, 2686, 11, 1510, 7258, 21711, 262, 3270, 262, 2175, 279, 1160, 315, 2536, 18882, 2757, 11, 2536, 5621, 85, 11059, 5144, 13234, 555, 459, 2686, 627, 262, 8442, 4375, 422, 1070, 374, 264, 353, 93409, 9, 2686, 369, 279, 836, 627, 262, 12713, 262, 653, 76632, 44112, 11, 653, 76632, 8550, 284, 7086, 65, 13350, 37914, 5012, 76632, 9366, 7, 1510, 7258, 5235, 262, 3373, 5857, 284, 330, 4963, 836, 4393, 836, 32379, 13369, 59191, 6328, 836, 32379, 51509, 851, 284, 59191, 51509, 851, 330, 489, 3120, 4391, 330, 27611, 836, 32379, 14111, 284, 949, 3651, 836, 32379, 70473, 11059, 284, 220, 15, 3651, 330, 489, 653, 76632, 44112, 489, 19500, 702, 262, 2897, 284, 320, 5102, 47121, 489, 653, 76632, 8550, 271, 262, 836, 11189, 284, 7086, 65, 5857, 45429, 7, 2917, 11, 3373, 5857, 11, 2897, 5235, 262, 5144, 284, 4260, 262, 369, 836, 8698, 304, 836, 11189, 512, 286, 5144, 2102, 7, 836, 8698, 681, 609, 663, 5235, 262, 422, 2479, 41501, 8, 624, 220, 15, 512, 286, 471, 2290, 720, 262, 775, 512, 286, 471, 5144, 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 ]
IvanMalison/okcupyd
okcupyd/question.py
UserQuestion.get_answer_id_for_question
def get_answer_id_for_question(self, question): """Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That this method exists is admittedly somewhat weird. Unfortunately, it seems to be the only way to retrieve this information. """ assert question.id == self.id for answer_option in self.answer_options: if answer_option.text == question.their_answer: return answer_option.id
python
def get_answer_id_for_question(self, question): """Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That this method exists is admittedly somewhat weird. Unfortunately, it seems to be the only way to retrieve this information. """ assert question.id == self.id for answer_option in self.answer_options: if answer_option.text == question.their_answer: return answer_option.id
[ "def", "get_answer_id_for_question", "(", "self", ",", "question", ")", ":", "assert", "question", ".", "id", "==", "self", ".", "id", "for", "answer_option", "in", "self", ".", "answer_options", ":", "if", "answer_option", ".", "text", "==", "question", ".", "their_answer", ":", "return", "answer_option", ".", "id" ]
Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That this method exists is admittedly somewhat weird. Unfortunately, it seems to be the only way to retrieve this information.
[ "Get", "the", "answer_id", "corresponding", "to", "the", "answer", "given", "for", "question", "by", "looking", "at", "this", ":", "class", ":", "~", ".", "UserQuestion", "s", "answer_options", ".", "The", "given", ":", "class", ":", "~", ".", "Question", "instance", "must", "have", "the", "same", "id", "as", "this", ":", "class", ":", "~", ".", "UserQuestion", "." ]
train
https://github.com/IvanMalison/okcupyd/blob/46f4eaa9419098f6c299738ce148af55c64deb64/okcupyd/question.py#L148-L160
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That this method exists is admittedly somewhat weird. Unfortunately, it seems to be the only way to retrieve this information. ### Response: def get_answer_id_for_question(self, question): """Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That this method exists is admittedly somewhat weird. Unfortunately, it seems to be the only way to retrieve this information. """ assert question.id == self.id for answer_option in self.answer_options: if answer_option.text == question.their_answer: return answer_option.id <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 1991, 279, 4320, 851, 12435, 311, 279, 4320, 2728, 369, 3488, 198, 286, 555, 3411, 520, 420, 551, 1058, 78902, 13, 1502, 14924, 63, 6, 82, 4320, 8917, 627, 286, 578, 2728, 551, 1058, 78902, 13, 14924, 63, 2937, 2011, 617, 279, 1890, 887, 439, 420, 198, 286, 551, 1058, 78902, 13, 1502, 14924, 63438, 286, 3011, 420, 1749, 6866, 374, 79813, 14738, 16682, 13, 19173, 11, 433, 198, 286, 5084, 311, 387, 279, 1193, 1648, 311, 17622, 420, 2038, 382, 14711, 6075, 512, 755, 636, 29634, 851, 5595, 30015, 1214, 11, 3488, 997, 286, 4304, 1991, 279, 4320, 851, 12435, 311, 279, 4320, 2728, 369, 3488, 198, 286, 555, 3411, 520, 420, 551, 1058, 78902, 13, 1502, 14924, 63, 6, 82, 4320, 8917, 627, 286, 578, 2728, 551, 1058, 78902, 13, 14924, 63, 2937, 2011, 617, 279, 1890, 887, 439, 420, 198, 286, 551, 1058, 78902, 13, 1502, 14924, 63438, 286, 3011, 420, 1749, 6866, 374, 79813, 14738, 16682, 13, 19173, 11, 433, 198, 286, 5084, 311, 387, 279, 1193, 1648, 311, 17622, 420, 2038, 627, 286, 3270, 286, 2105, 3488, 1801, 624, 659, 1801, 198, 286, 369, 4320, 9869, 304, 659, 45627, 8917, 512, 310, 422, 4320, 9869, 2858, 624, 3488, 42901, 404, 29634, 512, 394, 471, 4320, 9869, 1801, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 4320, 851, 12435, 311, 279, 4320, 2728, 369, 3488, 198, 286, 555, 3411, 520, 420, 551, 1058, 78902, 13, 1502, 14924, 63, 6, 82, 4320, 8917, 627, 286, 578, 2728, 551, 1058, 78902, 13, 14924, 63, 2937, 2011, 617, 279, 1890, 887, 439, 420, 198, 286, 551, 1058, 78902, 13, 1502, 14924, 63438, 286, 3011, 420, 1749, 6866, 374, 79813, 14738, 16682, 13, 19173, 11, 433, 198, 286, 5084, 311, 387, 279, 1193, 1648, 311, 17622, 420, 2038, 382, 14711, 6075, 512, 755, 636, 29634, 851, 5595, 30015, 1214, 11, 3488, 997, 286, 4304, 1991, 279, 4320, 851, 12435, 311, 279, 4320, 2728, 369, 3488, 198, 286, 555, 3411, 520, 420, 551, 1058, 78902, 13, 1502, 14924, 63, 6, 82, 4320, 8917, 627, 286, 578, 2728, 551, 1058, 78902, 13, 14924, 63, 2937, 2011, 617, 279, 1890, 887, 439, 420, 198, 286, 551, 1058, 78902, 13, 1502, 14924, 63438, 286, 3011, 420, 1749, 6866, 374, 79813, 14738, 16682, 13, 19173, 11, 433, 198, 286, 5084, 311, 387, 279, 1193, 1648, 311, 17622, 420, 2038, 627, 286, 3270, 286, 2105, 3488, 1801, 624, 659, 1801, 198, 286, 369, 4320, 9869, 304, 659, 45627, 8917, 512, 310, 422, 4320, 9869, 2858, 624, 3488, 42901, 404, 29634, 512, 394, 471, 4320, 9869, 1801, 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 ]
inasafe/inasafe
safe/metadata/utilities.py
serialize_dictionary
def serialize_dictionary(dictionary): """Function to stringify a dictionary recursively. :param dictionary: The dictionary. :type dictionary: dict :return: The string. :rtype: basestring """ string_value = {} for k, v in list(dictionary.items()): if isinstance(v, QUrl): string_value[k] = v.toString() elif isinstance(v, (QDate, QDateTime)): string_value[k] = v.toString(Qt.ISODate) elif isinstance(v, datetime): string_value[k] = v.isoformat() elif isinstance(v, date): string_value[k] = v.isoformat() elif isinstance(v, dict): # Recursive call string_value[k] = serialize_dictionary(v) else: string_value[k] = v return string_value
python
def serialize_dictionary(dictionary): """Function to stringify a dictionary recursively. :param dictionary: The dictionary. :type dictionary: dict :return: The string. :rtype: basestring """ string_value = {} for k, v in list(dictionary.items()): if isinstance(v, QUrl): string_value[k] = v.toString() elif isinstance(v, (QDate, QDateTime)): string_value[k] = v.toString(Qt.ISODate) elif isinstance(v, datetime): string_value[k] = v.isoformat() elif isinstance(v, date): string_value[k] = v.isoformat() elif isinstance(v, dict): # Recursive call string_value[k] = serialize_dictionary(v) else: string_value[k] = v return string_value
[ "def", "serialize_dictionary", "(", "dictionary", ")", ":", "string_value", "=", "{", "}", "for", "k", ",", "v", "in", "list", "(", "dictionary", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "v", ",", "QUrl", ")", ":", "string_value", "[", "k", "]", "=", "v", ".", "toString", "(", ")", "elif", "isinstance", "(", "v", ",", "(", "QDate", ",", "QDateTime", ")", ")", ":", "string_value", "[", "k", "]", "=", "v", ".", "toString", "(", "Qt", ".", "ISODate", ")", "elif", "isinstance", "(", "v", ",", "datetime", ")", ":", "string_value", "[", "k", "]", "=", "v", ".", "isoformat", "(", ")", "elif", "isinstance", "(", "v", ",", "date", ")", ":", "string_value", "[", "k", "]", "=", "v", ".", "isoformat", "(", ")", "elif", "isinstance", "(", "v", ",", "dict", ")", ":", "# Recursive call", "string_value", "[", "k", "]", "=", "serialize_dictionary", "(", "v", ")", "else", ":", "string_value", "[", "k", "]", "=", "v", "return", "string_value" ]
Function to stringify a dictionary recursively. :param dictionary: The dictionary. :type dictionary: dict :return: The string. :rtype: basestring
[ "Function", "to", "stringify", "a", "dictionary", "recursively", "." ]
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata/utilities.py#L125-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: Function to stringify a dictionary recursively. :param dictionary: The dictionary. :type dictionary: dict :return: The string. :rtype: basestring ### Response: def serialize_dictionary(dictionary): """Function to stringify a dictionary recursively. :param dictionary: The dictionary. :type dictionary: dict :return: The string. :rtype: basestring """ string_value = {} for k, v in list(dictionary.items()): if isinstance(v, QUrl): string_value[k] = v.toString() elif isinstance(v, (QDate, QDateTime)): string_value[k] = v.toString(Qt.ISODate) elif isinstance(v, datetime): string_value[k] = v.isoformat() elif isinstance(v, date): string_value[k] = v.isoformat() elif isinstance(v, dict): # Recursive call string_value[k] = serialize_dictionary(v) else: string_value[k] = v return string_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, 5263, 311, 84266, 264, 11240, 53947, 382, 262, 551, 913, 11240, 25, 578, 11240, 627, 262, 551, 1337, 11240, 25, 6587, 271, 262, 551, 693, 25, 578, 925, 627, 262, 551, 33613, 25, 3122, 66140, 271, 14711, 6075, 512, 755, 25217, 43705, 74692, 997, 262, 4304, 5263, 311, 84266, 264, 11240, 53947, 382, 262, 551, 913, 11240, 25, 578, 11240, 627, 262, 551, 1337, 11240, 25, 6587, 271, 262, 551, 693, 25, 578, 925, 627, 262, 551, 33613, 25, 3122, 66140, 198, 262, 3270, 262, 925, 3220, 284, 5731, 262, 369, 597, 11, 348, 304, 1160, 74692, 9812, 34257, 286, 422, 11656, 3832, 11, 1229, 2934, 997, 310, 925, 3220, 6874, 60, 284, 348, 5180, 746, 286, 4508, 11656, 3832, 11, 320, 48, 1956, 11, 99824, 10162, 310, 925, 3220, 6874, 60, 284, 348, 5180, 23016, 11479, 46, 1956, 340, 286, 4508, 11656, 3832, 11, 9050, 997, 310, 925, 3220, 6874, 60, 284, 348, 65860, 2293, 746, 286, 4508, 11656, 3832, 11, 2457, 997, 310, 925, 3220, 6874, 60, 284, 348, 65860, 2293, 746, 286, 4508, 11656, 3832, 11, 6587, 997, 310, 674, 86996, 1650, 198, 310, 925, 3220, 6874, 60, 284, 25217, 43705, 3832, 340, 286, 775, 512, 310, 925, 3220, 6874, 60, 284, 348, 198, 262, 471, 925, 3220, 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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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 5263, 311, 84266, 264, 11240, 53947, 382, 262, 551, 913, 11240, 25, 578, 11240, 627, 262, 551, 1337, 11240, 25, 6587, 271, 262, 551, 693, 25, 578, 925, 627, 262, 551, 33613, 25, 3122, 66140, 271, 14711, 6075, 512, 755, 25217, 43705, 74692, 997, 262, 4304, 5263, 311, 84266, 264, 11240, 53947, 382, 262, 551, 913, 11240, 25, 578, 11240, 627, 262, 551, 1337, 11240, 25, 6587, 271, 262, 551, 693, 25, 578, 925, 627, 262, 551, 33613, 25, 3122, 66140, 198, 262, 3270, 262, 925, 3220, 284, 5731, 262, 369, 597, 11, 348, 304, 1160, 74692, 9812, 34257, 286, 422, 11656, 3832, 11, 1229, 2934, 997, 310, 925, 3220, 6874, 60, 284, 348, 5180, 746, 286, 4508, 11656, 3832, 11, 320, 48, 1956, 11, 99824, 10162, 310, 925, 3220, 6874, 60, 284, 348, 5180, 23016, 11479, 46, 1956, 340, 286, 4508, 11656, 3832, 11, 9050, 997, 310, 925, 3220, 6874, 60, 284, 348, 65860, 2293, 746, 286, 4508, 11656, 3832, 11, 2457, 997, 310, 925, 3220, 6874, 60, 284, 348, 65860, 2293, 746, 286, 4508, 11656, 3832, 11, 6587, 997, 310, 674, 86996, 1650, 198, 310, 925, 3220, 6874, 60, 284, 25217, 43705, 3832, 340, 286, 775, 512, 310, 925, 3220, 6874, 60, 284, 348, 198, 262, 471, 925, 3220, 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 ]
ethpm/py-ethpm
ethpm/utils/contract.py
validate_minimal_contract_factory_data
def validate_minimal_contract_factory_data(contract_data: Dict[str, str]) -> None: """ Validate that contract data in a package contains at least an "abi" and "deployment_bytecode" necessary to generate a deployable contract factory. """ if not all(key in contract_data.keys() for key in ("abi", "deployment_bytecode")): raise InsufficientAssetsError( "Minimum required contract data to generate a deployable " "contract factory (abi & deployment_bytecode) not found." )
python
def validate_minimal_contract_factory_data(contract_data: Dict[str, str]) -> None: """ Validate that contract data in a package contains at least an "abi" and "deployment_bytecode" necessary to generate a deployable contract factory. """ if not all(key in contract_data.keys() for key in ("abi", "deployment_bytecode")): raise InsufficientAssetsError( "Minimum required contract data to generate a deployable " "contract factory (abi & deployment_bytecode) not found." )
[ "def", "validate_minimal_contract_factory_data", "(", "contract_data", ":", "Dict", "[", "str", ",", "str", "]", ")", "->", "None", ":", "if", "not", "all", "(", "key", "in", "contract_data", ".", "keys", "(", ")", "for", "key", "in", "(", "\"abi\"", ",", "\"deployment_bytecode\"", ")", ")", ":", "raise", "InsufficientAssetsError", "(", "\"Minimum required contract data to generate a deployable \"", "\"contract factory (abi & deployment_bytecode) not found.\"", ")" ]
Validate that contract data in a package contains at least an "abi" and "deployment_bytecode" necessary to generate a deployable contract factory.
[ "Validate", "that", "contract", "data", "in", "a", "package", "contains", "at", "least", "an", "abi", "and", "deployment_bytecode", "necessary", "to", "generate", "a", "deployable", "contract", "factory", "." ]
train
https://github.com/ethpm/py-ethpm/blob/81ed58d7c636fe00c6770edeb0401812b1a5e8fc/ethpm/utils/contract.py#L10-L19
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Validate that contract data in a package contains at least an "abi" and "deployment_bytecode" necessary to generate a deployable contract factory. ### Response: def validate_minimal_contract_factory_data(contract_data: Dict[str, str]) -> None: """ Validate that contract data in a package contains at least an "abi" and "deployment_bytecode" necessary to generate a deployable contract factory. """ if not all(key in contract_data.keys() for key in ("abi", "deployment_bytecode")): raise InsufficientAssetsError( "Minimum required contract data to generate a deployable " "contract factory (abi & deployment_bytecode) not found." ) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 18409, 430, 5226, 828, 304, 264, 6462, 5727, 520, 3325, 459, 330, 26140, 1, 323, 198, 262, 330, 83313, 20317, 1889, 1, 5995, 311, 7068, 264, 10739, 481, 5226, 8803, 382, 14711, 6075, 512, 755, 9788, 7408, 2931, 52599, 25255, 1807, 85513, 1807, 25, 30226, 17752, 11, 610, 2526, 1492, 2290, 512, 262, 3270, 262, 24163, 430, 5226, 828, 304, 264, 6462, 5727, 520, 3325, 459, 330, 26140, 1, 323, 198, 262, 330, 83313, 20317, 1889, 1, 5995, 311, 7068, 264, 10739, 481, 5226, 8803, 627, 262, 3270, 262, 422, 539, 682, 4962, 304, 5226, 1807, 9301, 368, 369, 1401, 304, 3573, 26140, 498, 330, 83313, 20317, 1889, 2830, 512, 286, 4933, 9925, 27781, 27977, 1480, 1021, 310, 330, 29795, 2631, 5226, 828, 311, 7068, 264, 10739, 481, 6360, 310, 330, 20871, 8803, 320, 26140, 612, 24047, 20317, 1889, 8, 539, 1766, 10246, 286, 1763, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 5546, 512, 18409, 430, 5226, 828, 304, 264, 6462, 5727, 520, 3325, 459, 330, 26140, 1, 323, 198, 262, 330, 83313, 20317, 1889, 1, 5995, 311, 7068, 264, 10739, 481, 5226, 8803, 382, 14711, 6075, 512, 755, 9788, 7408, 2931, 52599, 25255, 1807, 85513, 1807, 25, 30226, 17752, 11, 610, 2526, 1492, 2290, 512, 262, 3270, 262, 24163, 430, 5226, 828, 304, 264, 6462, 5727, 520, 3325, 459, 330, 26140, 1, 323, 198, 262, 330, 83313, 20317, 1889, 1, 5995, 311, 7068, 264, 10739, 481, 5226, 8803, 627, 262, 3270, 262, 422, 539, 682, 4962, 304, 5226, 1807, 9301, 368, 369, 1401, 304, 3573, 26140, 498, 330, 83313, 20317, 1889, 2830, 512, 286, 4933, 9925, 27781, 27977, 1480, 1021, 310, 330, 29795, 2631, 5226, 828, 311, 7068, 264, 10739, 481, 6360, 310, 330, 20871, 8803, 320, 26140, 612, 24047, 20317, 1889, 8, 539, 1766, 10246, 286, 1763, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
thespacedoctor/astrocalc
astrocalc/distances/converter.py
converter.redshift_to_distance
def redshift_to_distance( self, z, WM=0.3, WV=0.7, H0=70.0): """*convert redshift to various distance measurements* **Key Arguments:** - ``z`` -- redshift measurement. - ``WM`` -- Omega_matter. Default *0.3* - ``WV`` -- Omega_vacuum. Default *0.7* - ``H0`` -- Hubble constant. (km s-1 Mpc-1) Default *70.0* **Return:** - ``results`` -- result dictionary including - ``dcmr_mpc`` -- co-moving radius distance - ``da_mpc`` -- angular distance - ``da_scale`` -- angular distance scale - ``dl_mpc`` -- luminosity distance (usually use this one) - ``dmod`` -- distance modulus (determined from luminosity distance) .. todo:: - replace convert_redshift_to_distance in all other code **Usage:** .. code-block:: python from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.27 mag # Luminousity Distance: 1795.16 Mpc # Angular Size Scale: 4.85 kpc/arcsec # Angular Size Distance: 999.76 Mpc # Comoving Radial Distance: 1339.68 Mpc from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343, WM=0.286, WV=0.714, H0=69.6 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.29 mag # Luminousity Distance: 1811.71 Mpc # Angular Size Scale: 4.89 kpc/arcsec # Angular Size Distance: 1008.97 Mpc # Comoving Radial Distance: 1352.03 Mpc """ self.log.info('starting the ``redshift_to_distance`` method') # VARIABLE h = H0 / 100.0 WR = 4.165E-5 / (h * h) # Omega_radiation WK = 1.0 - WM - WV - WR # Omega_curvature = 1 - Omega(Total) c = 299792.458 # speed of light (km/s) # Arbitrarily set the values of these variables to zero just so we can # define them. DCMR = 0.0 # comoving radial distance in units of c/H0 DCMR_Mpc = 0.0 # comoving radial distance in units of Mpc DA = 0.0 # angular size distance in units of c/H0 DA_Mpc = 0.0 # angular size distance in units of Mpc # scale at angular size distance in units of Kpc / arcsec DA_scale = 0.0 DL = 0.0 # luminosity distance in units of c/H0 DL_Mpc = 0.0 # luminosity distance in units of Mpc # Distance modulus determined from luminosity distance DMOD = 0.0 a = 0.0 # 1/(1+z), the scale factor of the Universe az = 1.0 / (1.0 + z) # 1/(1+z), for the given redshift # Compute the integral over a=1/(1+z) from az to 1 in n steps n = 1000 for i in range(n): a = az + (1.0 - az) * (i + 0.5) / n adot = math.sqrt(WK + (WM / a) + (WR / (math.pow(a, 2))) + (WV * math.pow(a, 2))) DCMR = DCMR + 1.0 / (a * adot) # comoving radial distance in units of c/H0 DCMR = (1.0 - az) * DCMR / n # comoving radial distance in units of Mpc DCMR_Mpc = (c / H0) * DCMR # Tangental comoving radial distance x = math.sqrt(abs(WK)) * DCMR if x > 0.1: if WK > 0.0: ratio = 0.5 * (math.exp(x) - math.exp(-x)) / x else: ratio = math.sin(x) / x else: y = math.pow(x, 2) if WK < 0.0: y = -y ratio = 1 + y / 6.0 + math.pow(y, 2) / 120.0 DA = az * ratio * DCMR # angular size distance in units of c/H0 DA_Mpc = (c / H0) * DA # angular size distance in units of Mpc # scale at angular size distance in units of Kpc / arcsec DA_scale = DA_Mpc / 206.264806 DL = DA / math.pow(az, 2) # luminosity distance in units of c/H0 DL_Mpc = (c / H0) * DL # luminosity distance in units of Mpc # Distance modulus determined from luminosity distance DMOD = 5 * math.log10(DL_Mpc * 1e6) - 5 # FIXING PRECISIONS # PRECISION TEST precision = len(repr(z).split(".")[-1]) DCMR_Mpc = "%0.*f" % (precision, DCMR_Mpc) DA_Mpc = "%0.*f" % (precision, DA_Mpc) DA_scale = "%0.*f" % (precision, DA_scale) DL_Mpc = "%0.*f" % (precision, DL_Mpc) DMOD = "%0.*f" % (precision, DMOD) z = "%0.*f" % (precision, z) results = \ { "dcmr_mpc": float(DCMR_Mpc), "da_mpc": float(DA_Mpc), "da_scale": float(DA_scale), "dl_mpc": float(DL_Mpc), "dmod": float(DMOD), "z": float(z) } self.log.info('completed the ``redshift_to_distance`` method') return results
python
def redshift_to_distance( self, z, WM=0.3, WV=0.7, H0=70.0): """*convert redshift to various distance measurements* **Key Arguments:** - ``z`` -- redshift measurement. - ``WM`` -- Omega_matter. Default *0.3* - ``WV`` -- Omega_vacuum. Default *0.7* - ``H0`` -- Hubble constant. (km s-1 Mpc-1) Default *70.0* **Return:** - ``results`` -- result dictionary including - ``dcmr_mpc`` -- co-moving radius distance - ``da_mpc`` -- angular distance - ``da_scale`` -- angular distance scale - ``dl_mpc`` -- luminosity distance (usually use this one) - ``dmod`` -- distance modulus (determined from luminosity distance) .. todo:: - replace convert_redshift_to_distance in all other code **Usage:** .. code-block:: python from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.27 mag # Luminousity Distance: 1795.16 Mpc # Angular Size Scale: 4.85 kpc/arcsec # Angular Size Distance: 999.76 Mpc # Comoving Radial Distance: 1339.68 Mpc from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343, WM=0.286, WV=0.714, H0=69.6 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.29 mag # Luminousity Distance: 1811.71 Mpc # Angular Size Scale: 4.89 kpc/arcsec # Angular Size Distance: 1008.97 Mpc # Comoving Radial Distance: 1352.03 Mpc """ self.log.info('starting the ``redshift_to_distance`` method') # VARIABLE h = H0 / 100.0 WR = 4.165E-5 / (h * h) # Omega_radiation WK = 1.0 - WM - WV - WR # Omega_curvature = 1 - Omega(Total) c = 299792.458 # speed of light (km/s) # Arbitrarily set the values of these variables to zero just so we can # define them. DCMR = 0.0 # comoving radial distance in units of c/H0 DCMR_Mpc = 0.0 # comoving radial distance in units of Mpc DA = 0.0 # angular size distance in units of c/H0 DA_Mpc = 0.0 # angular size distance in units of Mpc # scale at angular size distance in units of Kpc / arcsec DA_scale = 0.0 DL = 0.0 # luminosity distance in units of c/H0 DL_Mpc = 0.0 # luminosity distance in units of Mpc # Distance modulus determined from luminosity distance DMOD = 0.0 a = 0.0 # 1/(1+z), the scale factor of the Universe az = 1.0 / (1.0 + z) # 1/(1+z), for the given redshift # Compute the integral over a=1/(1+z) from az to 1 in n steps n = 1000 for i in range(n): a = az + (1.0 - az) * (i + 0.5) / n adot = math.sqrt(WK + (WM / a) + (WR / (math.pow(a, 2))) + (WV * math.pow(a, 2))) DCMR = DCMR + 1.0 / (a * adot) # comoving radial distance in units of c/H0 DCMR = (1.0 - az) * DCMR / n # comoving radial distance in units of Mpc DCMR_Mpc = (c / H0) * DCMR # Tangental comoving radial distance x = math.sqrt(abs(WK)) * DCMR if x > 0.1: if WK > 0.0: ratio = 0.5 * (math.exp(x) - math.exp(-x)) / x else: ratio = math.sin(x) / x else: y = math.pow(x, 2) if WK < 0.0: y = -y ratio = 1 + y / 6.0 + math.pow(y, 2) / 120.0 DA = az * ratio * DCMR # angular size distance in units of c/H0 DA_Mpc = (c / H0) * DA # angular size distance in units of Mpc # scale at angular size distance in units of Kpc / arcsec DA_scale = DA_Mpc / 206.264806 DL = DA / math.pow(az, 2) # luminosity distance in units of c/H0 DL_Mpc = (c / H0) * DL # luminosity distance in units of Mpc # Distance modulus determined from luminosity distance DMOD = 5 * math.log10(DL_Mpc * 1e6) - 5 # FIXING PRECISIONS # PRECISION TEST precision = len(repr(z).split(".")[-1]) DCMR_Mpc = "%0.*f" % (precision, DCMR_Mpc) DA_Mpc = "%0.*f" % (precision, DA_Mpc) DA_scale = "%0.*f" % (precision, DA_scale) DL_Mpc = "%0.*f" % (precision, DL_Mpc) DMOD = "%0.*f" % (precision, DMOD) z = "%0.*f" % (precision, z) results = \ { "dcmr_mpc": float(DCMR_Mpc), "da_mpc": float(DA_Mpc), "da_scale": float(DA_scale), "dl_mpc": float(DL_Mpc), "dmod": float(DMOD), "z": float(z) } self.log.info('completed the ``redshift_to_distance`` method') return results
[ "def", "redshift_to_distance", "(", "self", ",", "z", ",", "WM", "=", "0.3", ",", "WV", "=", "0.7", ",", "H0", "=", "70.0", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``redshift_to_distance`` method'", ")", "# VARIABLE", "h", "=", "H0", "/", "100.0", "WR", "=", "4.165E-5", "/", "(", "h", "*", "h", ")", "# Omega_radiation", "WK", "=", "1.0", "-", "WM", "-", "WV", "-", "WR", "# Omega_curvature = 1 - Omega(Total)", "c", "=", "299792.458", "# speed of light (km/s)", "# Arbitrarily set the values of these variables to zero just so we can", "# define them.", "DCMR", "=", "0.0", "# comoving radial distance in units of c/H0", "DCMR_Mpc", "=", "0.0", "# comoving radial distance in units of Mpc", "DA", "=", "0.0", "# angular size distance in units of c/H0", "DA_Mpc", "=", "0.0", "# angular size distance in units of Mpc", "# scale at angular size distance in units of Kpc / arcsec", "DA_scale", "=", "0.0", "DL", "=", "0.0", "# luminosity distance in units of c/H0", "DL_Mpc", "=", "0.0", "# luminosity distance in units of Mpc", "# Distance modulus determined from luminosity distance", "DMOD", "=", "0.0", "a", "=", "0.0", "# 1/(1+z), the scale factor of the Universe", "az", "=", "1.0", "/", "(", "1.0", "+", "z", ")", "# 1/(1+z), for the given redshift", "# Compute the integral over a=1/(1+z) from az to 1 in n steps", "n", "=", "1000", "for", "i", "in", "range", "(", "n", ")", ":", "a", "=", "az", "+", "(", "1.0", "-", "az", ")", "*", "(", "i", "+", "0.5", ")", "/", "n", "adot", "=", "math", ".", "sqrt", "(", "WK", "+", "(", "WM", "/", "a", ")", "+", "(", "WR", "/", "(", "math", ".", "pow", "(", "a", ",", "2", ")", ")", ")", "+", "(", "WV", "*", "math", ".", "pow", "(", "a", ",", "2", ")", ")", ")", "DCMR", "=", "DCMR", "+", "1.0", "/", "(", "a", "*", "adot", ")", "# comoving radial distance in units of c/H0", "DCMR", "=", "(", "1.0", "-", "az", ")", "*", "DCMR", "/", "n", "# comoving radial distance in units of Mpc", "DCMR_Mpc", "=", "(", "c", "/", "H0", ")", "*", "DCMR", "# Tangental comoving radial distance", "x", "=", "math", ".", "sqrt", "(", "abs", "(", "WK", ")", ")", "*", "DCMR", "if", "x", ">", "0.1", ":", "if", "WK", ">", "0.0", ":", "ratio", "=", "0.5", "*", "(", "math", ".", "exp", "(", "x", ")", "-", "math", ".", "exp", "(", "-", "x", ")", ")", "/", "x", "else", ":", "ratio", "=", "math", ".", "sin", "(", "x", ")", "/", "x", "else", ":", "y", "=", "math", ".", "pow", "(", "x", ",", "2", ")", "if", "WK", "<", "0.0", ":", "y", "=", "-", "y", "ratio", "=", "1", "+", "y", "/", "6.0", "+", "math", ".", "pow", "(", "y", ",", "2", ")", "/", "120.0", "DA", "=", "az", "*", "ratio", "*", "DCMR", "# angular size distance in units of c/H0", "DA_Mpc", "=", "(", "c", "/", "H0", ")", "*", "DA", "# angular size distance in units of Mpc", "# scale at angular size distance in units of Kpc / arcsec", "DA_scale", "=", "DA_Mpc", "/", "206.264806", "DL", "=", "DA", "/", "math", ".", "pow", "(", "az", ",", "2", ")", "# luminosity distance in units of c/H0", "DL_Mpc", "=", "(", "c", "/", "H0", ")", "*", "DL", "# luminosity distance in units of Mpc", "# Distance modulus determined from luminosity distance", "DMOD", "=", "5", "*", "math", ".", "log10", "(", "DL_Mpc", "*", "1e6", ")", "-", "5", "# FIXING PRECISIONS", "# PRECISION TEST", "precision", "=", "len", "(", "repr", "(", "z", ")", ".", "split", "(", "\".\"", ")", "[", "-", "1", "]", ")", "DCMR_Mpc", "=", "\"%0.*f\"", "%", "(", "precision", ",", "DCMR_Mpc", ")", "DA_Mpc", "=", "\"%0.*f\"", "%", "(", "precision", ",", "DA_Mpc", ")", "DA_scale", "=", "\"%0.*f\"", "%", "(", "precision", ",", "DA_scale", ")", "DL_Mpc", "=", "\"%0.*f\"", "%", "(", "precision", ",", "DL_Mpc", ")", "DMOD", "=", "\"%0.*f\"", "%", "(", "precision", ",", "DMOD", ")", "z", "=", "\"%0.*f\"", "%", "(", "precision", ",", "z", ")", "results", "=", "{", "\"dcmr_mpc\"", ":", "float", "(", "DCMR_Mpc", ")", ",", "\"da_mpc\"", ":", "float", "(", "DA_Mpc", ")", ",", "\"da_scale\"", ":", "float", "(", "DA_scale", ")", ",", "\"dl_mpc\"", ":", "float", "(", "DL_Mpc", ")", ",", "\"dmod\"", ":", "float", "(", "DMOD", ")", ",", "\"z\"", ":", "float", "(", "z", ")", "}", "self", ".", "log", ".", "info", "(", "'completed the ``redshift_to_distance`` method'", ")", "return", "results" ]
*convert redshift to various distance measurements* **Key Arguments:** - ``z`` -- redshift measurement. - ``WM`` -- Omega_matter. Default *0.3* - ``WV`` -- Omega_vacuum. Default *0.7* - ``H0`` -- Hubble constant. (km s-1 Mpc-1) Default *70.0* **Return:** - ``results`` -- result dictionary including - ``dcmr_mpc`` -- co-moving radius distance - ``da_mpc`` -- angular distance - ``da_scale`` -- angular distance scale - ``dl_mpc`` -- luminosity distance (usually use this one) - ``dmod`` -- distance modulus (determined from luminosity distance) .. todo:: - replace convert_redshift_to_distance in all other code **Usage:** .. code-block:: python from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.27 mag # Luminousity Distance: 1795.16 Mpc # Angular Size Scale: 4.85 kpc/arcsec # Angular Size Distance: 999.76 Mpc # Comoving Radial Distance: 1339.68 Mpc from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343, WM=0.286, WV=0.714, H0=69.6 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.29 mag # Luminousity Distance: 1811.71 Mpc # Angular Size Scale: 4.89 kpc/arcsec # Angular Size Distance: 1008.97 Mpc # Comoving Radial Distance: 1352.03 Mpc
[ "*", "convert", "redshift", "to", "various", "distance", "measurements", "*" ]
train
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/distances/converter.py#L113-L265
<|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 redshift to various distance measurements* **Key Arguments:** - ``z`` -- redshift measurement. - ``WM`` -- Omega_matter. Default *0.3* - ``WV`` -- Omega_vacuum. Default *0.7* - ``H0`` -- Hubble constant. (km s-1 Mpc-1) Default *70.0* **Return:** - ``results`` -- result dictionary including - ``dcmr_mpc`` -- co-moving radius distance - ``da_mpc`` -- angular distance - ``da_scale`` -- angular distance scale - ``dl_mpc`` -- luminosity distance (usually use this one) - ``dmod`` -- distance modulus (determined from luminosity distance) .. todo:: - replace convert_redshift_to_distance in all other code **Usage:** .. code-block:: python from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.27 mag # Luminousity Distance: 1795.16 Mpc # Angular Size Scale: 4.85 kpc/arcsec # Angular Size Distance: 999.76 Mpc # Comoving Radial Distance: 1339.68 Mpc from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343, WM=0.286, WV=0.714, H0=69.6 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.29 mag # Luminousity Distance: 1811.71 Mpc # Angular Size Scale: 4.89 kpc/arcsec # Angular Size Distance: 1008.97 Mpc # Comoving Radial Distance: 1352.03 Mpc ### Response: def redshift_to_distance( self, z, WM=0.3, WV=0.7, H0=70.0): """*convert redshift to various distance measurements* **Key Arguments:** - ``z`` -- redshift measurement. - ``WM`` -- Omega_matter. Default *0.3* - ``WV`` -- Omega_vacuum. Default *0.7* - ``H0`` -- Hubble constant. (km s-1 Mpc-1) Default *70.0* **Return:** - ``results`` -- result dictionary including - ``dcmr_mpc`` -- co-moving radius distance - ``da_mpc`` -- angular distance - ``da_scale`` -- angular distance scale - ``dl_mpc`` -- luminosity distance (usually use this one) - ``dmod`` -- distance modulus (determined from luminosity distance) .. todo:: - replace convert_redshift_to_distance in all other code **Usage:** .. code-block:: python from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.27 mag # Luminousity Distance: 1795.16 Mpc # Angular Size Scale: 4.85 kpc/arcsec # Angular Size Distance: 999.76 Mpc # Comoving Radial Distance: 1339.68 Mpc from astrocalc.distances import converter c = converter(log=log) dists = c.redshift_to_distance( z=0.343, WM=0.286, WV=0.714, H0=69.6 ) print "Distance Modulus: " + str(dists["dmod"]) + " mag" print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc" print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec" print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc" print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc" # OUTPUT : # Distance Modulus: 41.29 mag # Luminousity Distance: 1811.71 Mpc # Angular Size Scale: 4.89 kpc/arcsec # Angular Size Distance: 1008.97 Mpc # Comoving Radial Distance: 1352.03 Mpc """ self.log.info('starting the ``redshift_to_distance`` method') # VARIABLE h = H0 / 100.0 WR = 4.165E-5 / (h * h) # Omega_radiation WK = 1.0 - WM - WV - WR # Omega_curvature = 1 - Omega(Total) c = 299792.458 # speed of light (km/s) # Arbitrarily set the values of these variables to zero just so we can # define them. DCMR = 0.0 # comoving radial distance in units of c/H0 DCMR_Mpc = 0.0 # comoving radial distance in units of Mpc DA = 0.0 # angular size distance in units of c/H0 DA_Mpc = 0.0 # angular size distance in units of Mpc # scale at angular size distance in units of Kpc / arcsec DA_scale = 0.0 DL = 0.0 # luminosity distance in units of c/H0 DL_Mpc = 0.0 # luminosity distance in units of Mpc # Distance modulus determined from luminosity distance DMOD = 0.0 a = 0.0 # 1/(1+z), the scale factor of the Universe az = 1.0 / (1.0 + z) # 1/(1+z), for the given redshift # Compute the integral over a=1/(1+z) from az to 1 in n steps n = 1000 for i in range(n): a = az + (1.0 - az) * (i + 0.5) / n adot = math.sqrt(WK + (WM / a) + (WR / (math.pow(a, 2))) + (WV * math.pow(a, 2))) DCMR = DCMR + 1.0 / (a * adot) # comoving radial distance in units of c/H0 DCMR = (1.0 - az) * DCMR / n # comoving radial distance in units of Mpc DCMR_Mpc = (c / H0) * DCMR # Tangental comoving radial distance x = math.sqrt(abs(WK)) * DCMR if x > 0.1: if WK > 0.0: ratio = 0.5 * (math.exp(x) - math.exp(-x)) / x else: ratio = math.sin(x) / x else: y = math.pow(x, 2) if WK < 0.0: y = -y ratio = 1 + y / 6.0 + math.pow(y, 2) / 120.0 DA = az * ratio * DCMR # angular size distance in units of c/H0 DA_Mpc = (c / H0) * DA # angular size distance in units of Mpc # scale at angular size distance in units of Kpc / arcsec DA_scale = DA_Mpc / 206.264806 DL = DA / math.pow(az, 2) # luminosity distance in units of c/H0 DL_Mpc = (c / H0) * DL # luminosity distance in units of Mpc # Distance modulus determined from luminosity distance DMOD = 5 * math.log10(DL_Mpc * 1e6) - 5 # FIXING PRECISIONS # PRECISION TEST precision = len(repr(z).split(".")[-1]) DCMR_Mpc = "%0.*f" % (precision, DCMR_Mpc) DA_Mpc = "%0.*f" % (precision, DA_Mpc) DA_scale = "%0.*f" % (precision, DA_scale) DL_Mpc = "%0.*f" % (precision, DL_Mpc) DMOD = "%0.*f" % (precision, DMOD) z = "%0.*f" % (precision, z) results = \ { "dcmr_mpc": float(DCMR_Mpc), "da_mpc": float(DA_Mpc), "da_scale": float(DA_scale), "dl_mpc": float(DL_Mpc), "dmod": float(DMOD), "z": float(z) } self.log.info('completed the ``redshift_to_distance`` method') 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, 9, 14500, 2579, 13724, 311, 5370, 6138, 22323, 22242, 286, 3146, 1622, 28802, 25, 1035, 310, 482, 10103, 89, 14196, 1198, 2579, 13724, 19179, 627, 310, 482, 10103, 15565, 14196, 1198, 44409, 722, 1683, 13, 8058, 353, 15, 13, 18, 5736, 310, 482, 10103, 54, 53, 14196, 1198, 44409, 2325, 582, 21066, 13, 8058, 353, 15, 13, 22, 5736, 310, 482, 10103, 39, 15, 14196, 1198, 473, 14942, 6926, 13, 320, 16400, 274, 12, 16, 386, 4080, 12, 16, 8, 8058, 353, 2031, 13, 15, 22242, 286, 3146, 5715, 25, 1035, 310, 482, 10103, 8234, 14196, 1198, 1121, 11240, 2737, 198, 394, 482, 10103, 67, 6358, 81, 722, 4080, 14196, 1198, 1080, 86572, 10801, 6138, 198, 394, 482, 10103, 3315, 722, 4080, 14196, 1198, 20932, 6138, 198, 394, 482, 10103, 3315, 17142, 14196, 1198, 20932, 6138, 5569, 198, 394, 482, 10103, 8910, 722, 4080, 14196, 1198, 46058, 22828, 6138, 320, 44066, 1005, 420, 832, 340, 394, 482, 10103, 67, 2658, 14196, 1198, 6138, 75124, 320, 67, 47737, 505, 46058, 22828, 6138, 696, 286, 5354, 220, 12067, 66152, 394, 482, 8454, 5625, 27150, 13724, 2401, 20029, 304, 682, 1023, 2082, 271, 286, 3146, 15126, 25, 57277, 310, 5354, 2082, 9612, 487, 10344, 271, 394, 505, 47804, 27684, 39077, 3095, 1179, 28157, 198, 394, 272, 284, 28157, 12814, 84404, 340, 394, 1612, 82, 284, 272, 17787, 13724, 2401, 20029, 1021, 504, 1167, 28, 15, 13, 16522, 198, 394, 5235, 394, 1194, 330, 15121, 5768, 19990, 25, 330, 489, 610, 1528, 1705, 1204, 67, 2658, 14340, 489, 330, 4983, 702, 394, 1194, 330, 43, 10318, 788, 488, 32235, 25, 330, 489, 610, 1528, 1705, 1204, 8910, 722, 4080, 14340, 489, 330, 386, 4080, 702, 394, 1194, 330, 69459, 8645, 25635, 25, 330, 489, 610, 1528, 1705, 1204, 3315, 17142, 14340, 489, 330, 597, 4080, 14, 8362, 5132, 702, 394, 1194, 330, 69459, 8645, 32235, 25, 330, 489, 610, 1528, 1705, 1204, 3315, 722, 4080, 14340, 489, 330, 386, 4080, 702, 394, 1194, 330, 1110, 9308, 21254, 532, 32235, 25, 330, 489, 610, 1528, 1705, 1204, 67, 6358, 81, 722, 4080, 14340, 489, 330, 386, 4080, 1875, 394, 674, 32090, 6394, 394, 674, 32235, 5768, 19990, 25, 220, 3174, 13, 1544, 4983, 198, 394, 674, 445, 10318, 788, 488, 32235, 25, 220, 11128, 20, 13, 845, 386, 4080, 198, 394, 674, 29678, 8645, 25635, 25, 220, 19, 13, 5313, 597, 4080, 14, 8362, 5132, 198, 394, 674, 29678, 8645, 32235, 25, 220, 5500, 13, 4767, 386, 4080, 198, 394, 674, 1219, 9308, 21254, 532, 32235, 25, 220, 9423, 24, 13, 2614, 386, 4080, 271, 394, 505, 47804, 27684, 39077, 3095, 1179, 28157, 198, 394, 272, 284, 28157, 12814, 84404, 340, 394, 1612, 82, 284, 272, 17787, 13724, 2401, 20029, 1021, 504, 1167, 28, 15, 13, 16522, 345, 504, 24030, 28, 15, 13, 17361, 345, 504, 75525, 28 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 9, 14500, 2579, 13724, 311, 5370, 6138, 22323, 22242, 286, 3146, 1622, 28802, 25, 1035, 310, 482, 10103, 89, 14196, 1198, 2579, 13724, 19179, 627, 310, 482, 10103, 15565, 14196, 1198, 44409, 722, 1683, 13, 8058, 353, 15, 13, 18, 5736, 310, 482, 10103, 54, 53, 14196, 1198, 44409, 2325, 582, 21066, 13, 8058, 353, 15, 13, 22, 5736, 310, 482, 10103, 39, 15, 14196, 1198, 473, 14942, 6926, 13, 320, 16400, 274, 12, 16, 386, 4080, 12, 16, 8, 8058, 353, 2031, 13, 15, 22242, 286, 3146, 5715, 25, 1035, 310, 482, 10103, 8234, 14196, 1198, 1121, 11240, 2737, 198, 394, 482, 10103, 67, 6358, 81, 722, 4080, 14196, 1198, 1080, 86572, 10801, 6138, 198, 394, 482, 10103, 3315, 722, 4080, 14196, 1198, 20932, 6138, 198, 394, 482, 10103, 3315, 17142, 14196, 1198, 20932, 6138, 5569, 198, 394, 482, 10103, 8910, 722, 4080, 14196, 1198, 46058, 22828, 6138, 320, 44066, 1005, 420, 832, 340, 394, 482, 10103, 67, 2658, 14196, 1198, 6138, 75124, 320, 67, 47737, 505, 46058, 22828, 6138, 696, 286, 5354, 220, 12067, 66152, 394, 482, 8454, 5625, 27150, 13724, 2401, 20029, 304, 682, 1023, 2082, 271, 286, 3146, 15126, 25, 57277, 310, 5354, 2082, 9612, 487, 10344, 271, 394, 505, 47804, 27684, 39077, 3095, 1179, 28157, 198, 394, 272, 284, 28157, 12814, 84404, 340, 394, 1612, 82, 284, 272, 17787, 13724, 2401, 20029, 1021, 504, 1167, 28, 15, 13, 16522, 198, 394, 5235, 394, 1194, 330, 15121, 5768, 19990, 25, 330, 489, 610, 1528, 1705, 1204, 67, 2658, 14340, 489, 330, 4983, 702, 394, 1194, 330, 43, 10318, 788, 488, 32235, 25, 330, 489, 610, 1528, 1705, 1204, 8910, 722, 4080, 14340, 489, 330, 386, 4080, 702, 394, 1194, 330, 69459, 8645, 25635, 25, 330, 489, 610, 1528, 1705, 1204, 3315, 17142, 14340, 489, 330, 597, 4080, 14, 8362, 5132, 702, 394, 1194, 330, 69459, 8645, 32235, 25, 330, 489, 610, 1528, 1705, 1204, 3315, 722, 4080, 14340, 489, 330, 386, 4080, 702, 394, 1194, 330, 1110, 9308, 21254, 532, 32235, 25, 330, 489, 610, 1528, 1705, 1204, 67, 6358, 81, 722, 4080, 14340, 489, 330, 386, 4080, 1875, 394, 674, 32090, 6394, 394, 674, 32235, 5768, 19990, 25, 220, 3174, 13, 1544, 4983, 198, 394, 674, 445, 10318, 788, 488, 32235, 25, 220, 11128, 20, 13, 845, 386, 4080, 198, 394, 674, 29678, 8645, 25635, 25, 220, 19, 13, 5313, 597, 4080, 14, 8362, 5132, 198, 394, 674, 29678, 8645, 32235, 25, 220, 5500, 13, 4767, 386, 4080, 198, 394, 674, 1219, 9308, 21254, 532, 32235, 25, 220, 9423, 24, 13, 2614, 386, 4080, 271, 394, 505, 47804, 27684, 39077, 3095, 1179, 28157, 198, 394, 272, 284, 28157, 12814, 84404, 340, 394, 1612, 82, 284, 272, 17787, 13724, 2401, 20029, 1021, 504, 1167, 28, 15, 13, 16522, 345, 504, 24030, 28, 15, 13, 17361, 345, 504, 75525, 28 ]
sbg/sevenbridges-python
sevenbridges/http/client.py
config_vars
def config_vars(profiles, advance_access): """ Utility method to fetch config vars using ini section profile :param profiles: profile name. :param advance_access: advance_access flag. :return: """ for profile in profiles: try: config = Config(profile, advance_access=advance_access) url = config.api_endpoint token = config.auth_token proxies = config.proxies aa = config.advance_access return url, token, proxies, aa except Exception: pass return None, None, None, None
python
def config_vars(profiles, advance_access): """ Utility method to fetch config vars using ini section profile :param profiles: profile name. :param advance_access: advance_access flag. :return: """ for profile in profiles: try: config = Config(profile, advance_access=advance_access) url = config.api_endpoint token = config.auth_token proxies = config.proxies aa = config.advance_access return url, token, proxies, aa except Exception: pass return None, None, None, None
[ "def", "config_vars", "(", "profiles", ",", "advance_access", ")", ":", "for", "profile", "in", "profiles", ":", "try", ":", "config", "=", "Config", "(", "profile", ",", "advance_access", "=", "advance_access", ")", "url", "=", "config", ".", "api_endpoint", "token", "=", "config", ".", "auth_token", "proxies", "=", "config", ".", "proxies", "aa", "=", "config", ".", "advance_access", "return", "url", ",", "token", ",", "proxies", ",", "aa", "except", "Exception", ":", "pass", "return", "None", ",", "None", ",", "None", ",", "None" ]
Utility method to fetch config vars using ini section profile :param profiles: profile name. :param advance_access: advance_access flag. :return:
[ "Utility", "method", "to", "fetch", "config", "vars", "using", "ini", "section", "profile", ":", "param", "profiles", ":", "profile", "name", ".", ":", "param", "advance_access", ":", "advance_access", "flag", ".", ":", "return", ":" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/http/client.py#L63-L80
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Utility method to fetch config vars using ini section profile :param profiles: profile name. :param advance_access: advance_access flag. :return: ### Response: def config_vars(profiles, advance_access): """ Utility method to fetch config vars using ini section profile :param profiles: profile name. :param advance_access: advance_access flag. :return: """ for profile in profiles: try: config = Config(profile, advance_access=advance_access) url = config.api_endpoint token = config.auth_token proxies = config.proxies aa = config.advance_access return url, token, proxies, aa except Exception: pass return None, None, None, 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, 19750, 1749, 311, 7963, 2242, 20537, 1701, 17225, 3857, 5643, 198, 262, 551, 913, 21542, 25, 5643, 836, 627, 262, 551, 913, 12178, 13049, 25, 12178, 13049, 5292, 627, 262, 551, 693, 1473, 14711, 6075, 512, 755, 2242, 11416, 37706, 82, 11, 12178, 13049, 997, 262, 3270, 262, 26230, 1749, 311, 7963, 2242, 20537, 1701, 17225, 3857, 5643, 198, 262, 551, 913, 21542, 25, 5643, 836, 627, 262, 551, 913, 12178, 13049, 25, 12178, 13049, 5292, 627, 262, 551, 693, 512, 262, 3270, 262, 369, 5643, 304, 21542, 512, 286, 1456, 512, 310, 2242, 284, 5649, 37706, 11, 12178, 13049, 28, 60420, 13049, 340, 310, 2576, 284, 2242, 6314, 37799, 198, 310, 4037, 284, 2242, 9144, 6594, 198, 310, 60465, 284, 2242, 2776, 82034, 198, 310, 30109, 284, 2242, 81989, 13049, 198, 310, 471, 2576, 11, 4037, 11, 60465, 11, 30109, 198, 286, 3734, 4204, 512, 310, 1522, 198, 262, 471, 2290, 11, 2290, 11, 2290, 11, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 1749, 311, 7963, 2242, 20537, 1701, 17225, 3857, 5643, 198, 262, 551, 913, 21542, 25, 5643, 836, 627, 262, 551, 913, 12178, 13049, 25, 12178, 13049, 5292, 627, 262, 551, 693, 1473, 14711, 6075, 512, 755, 2242, 11416, 37706, 82, 11, 12178, 13049, 997, 262, 3270, 262, 26230, 1749, 311, 7963, 2242, 20537, 1701, 17225, 3857, 5643, 198, 262, 551, 913, 21542, 25, 5643, 836, 627, 262, 551, 913, 12178, 13049, 25, 12178, 13049, 5292, 627, 262, 551, 693, 512, 262, 3270, 262, 369, 5643, 304, 21542, 512, 286, 1456, 512, 310, 2242, 284, 5649, 37706, 11, 12178, 13049, 28, 60420, 13049, 340, 310, 2576, 284, 2242, 6314, 37799, 198, 310, 4037, 284, 2242, 9144, 6594, 198, 310, 60465, 284, 2242, 2776, 82034, 198, 310, 30109, 284, 2242, 81989, 13049, 198, 310, 471, 2576, 11, 4037, 11, 60465, 11, 30109, 198, 286, 3734, 4204, 512, 310, 1522, 198, 262, 471, 2290, 11, 2290, 11, 2290, 11, 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 ]
twilio/twilio-python
twilio/rest/video/v1/composition/__init__.py
CompositionList.page
def page(self, status=values.unset, date_created_after=values.unset, date_created_before=values.unset, room_sid=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of CompositionInstance records from the API. Request is executed immediately :param CompositionInstance.Status status: Only show Compositions with the given status. :param datetime date_created_after: Only show Compositions created on or after this ISO8601 date-time with timezone. :param datetime date_created_before: Only show Compositions created before this ISO8601 date-time with timezone. :param unicode room_sid: Only show Compositions with the given Room SID. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of CompositionInstance :rtype: twilio.rest.video.v1.composition.CompositionPage """ params = values.of({ 'Status': status, 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), 'RoomSid': room_sid, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return CompositionPage(self._version, response, self._solution)
python
def page(self, status=values.unset, date_created_after=values.unset, date_created_before=values.unset, room_sid=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of CompositionInstance records from the API. Request is executed immediately :param CompositionInstance.Status status: Only show Compositions with the given status. :param datetime date_created_after: Only show Compositions created on or after this ISO8601 date-time with timezone. :param datetime date_created_before: Only show Compositions created before this ISO8601 date-time with timezone. :param unicode room_sid: Only show Compositions with the given Room SID. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of CompositionInstance :rtype: twilio.rest.video.v1.composition.CompositionPage """ params = values.of({ 'Status': status, 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), 'RoomSid': room_sid, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return CompositionPage(self._version, response, self._solution)
[ "def", "page", "(", "self", ",", "status", "=", "values", ".", "unset", ",", "date_created_after", "=", "values", ".", "unset", ",", "date_created_before", "=", "values", ".", "unset", ",", "room_sid", "=", "values", ".", "unset", ",", "page_token", "=", "values", ".", "unset", ",", "page_number", "=", "values", ".", "unset", ",", "page_size", "=", "values", ".", "unset", ")", ":", "params", "=", "values", ".", "of", "(", "{", "'Status'", ":", "status", ",", "'DateCreatedAfter'", ":", "serialize", ".", "iso8601_datetime", "(", "date_created_after", ")", ",", "'DateCreatedBefore'", ":", "serialize", ".", "iso8601_datetime", "(", "date_created_before", ")", ",", "'RoomSid'", ":", "room_sid", ",", "'PageToken'", ":", "page_token", ",", "'Page'", ":", "page_number", ",", "'PageSize'", ":", "page_size", ",", "}", ")", "response", "=", "self", ".", "_version", ".", "page", "(", "'GET'", ",", "self", ".", "_uri", ",", "params", "=", "params", ",", ")", "return", "CompositionPage", "(", "self", ".", "_version", ",", "response", ",", "self", ".", "_solution", ")" ]
Retrieve a single page of CompositionInstance records from the API. Request is executed immediately :param CompositionInstance.Status status: Only show Compositions with the given status. :param datetime date_created_after: Only show Compositions created on or after this ISO8601 date-time with timezone. :param datetime date_created_before: Only show Compositions created before this ISO8601 date-time with timezone. :param unicode room_sid: Only show Compositions with the given Room SID. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of CompositionInstance :rtype: twilio.rest.video.v1.composition.CompositionPage
[ "Retrieve", "a", "single", "page", "of", "CompositionInstance", "records", "from", "the", "API", ".", "Request", "is", "executed", "immediately" ]
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/video/v1/composition/__init__.py#L104-L139
<|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 a single page of CompositionInstance records from the API. Request is executed immediately :param CompositionInstance.Status status: Only show Compositions with the given status. :param datetime date_created_after: Only show Compositions created on or after this ISO8601 date-time with timezone. :param datetime date_created_before: Only show Compositions created before this ISO8601 date-time with timezone. :param unicode room_sid: Only show Compositions with the given Room SID. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of CompositionInstance :rtype: twilio.rest.video.v1.composition.CompositionPage ### Response: def page(self, status=values.unset, date_created_after=values.unset, date_created_before=values.unset, room_sid=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of CompositionInstance records from the API. Request is executed immediately :param CompositionInstance.Status status: Only show Compositions with the given status. :param datetime date_created_after: Only show Compositions created on or after this ISO8601 date-time with timezone. :param datetime date_created_before: Only show Compositions created before this ISO8601 date-time with timezone. :param unicode room_sid: Only show Compositions with the given Room SID. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of CompositionInstance :rtype: twilio.rest.video.v1.composition.CompositionPage """ params = values.of({ 'Status': status, 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), 'RoomSid': room_sid, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return CompositionPage(self._version, response, self._solution) <|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, 264, 3254, 2199, 315, 68206, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 68206, 2584, 10761, 2704, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 2704, 627, 286, 551, 913, 9050, 2457, 28388, 20434, 25, 8442, 1501, 1219, 28536, 3549, 389, 477, 1306, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 9050, 2457, 28388, 24638, 25, 8442, 1501, 1219, 28536, 3549, 1603, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 27169, 3130, 54144, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 10637, 57121, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 68206, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 28720, 3211, 16, 916, 3571, 3034, 3571, 2732, 271, 14711, 6075, 512, 755, 2199, 1214, 11, 2704, 28, 3745, 6441, 751, 11, 2457, 28388, 20434, 28, 3745, 6441, 751, 345, 1835, 2457, 28388, 24638, 28, 3745, 6441, 751, 11, 3130, 54144, 28, 3745, 6441, 751, 345, 1835, 2199, 6594, 28, 3745, 6441, 751, 11, 2199, 5617, 28, 3745, 6441, 751, 345, 1835, 2199, 2424, 28, 3745, 6441, 751, 997, 286, 3270, 286, 32662, 264, 3254, 2199, 315, 68206, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 68206, 2584, 10761, 2704, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 2704, 627, 286, 551, 913, 9050, 2457, 28388, 20434, 25, 8442, 1501, 1219, 28536, 3549, 389, 477, 1306, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 9050, 2457, 28388, 24638, 25, 8442, 1501, 1219, 28536, 3549, 1603, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 27169, 3130, 54144, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 10637, 57121, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 68206, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 28720, 3211, 16, 916, 3571, 3034, 3571, 2732, 198, 286, 3270, 286, 3712, 284, 2819, 10440, 2313, 310, 364, 2583, 1232, 2704, 345, 310, 364, 1956, 11956, 6153, 1232, 25217, 65860, 18670, 16, 30043, 12237, 28388, 20434, 1350, 310, 364, 1956, 11956, 10438, 1232, 25217, 65860, 18670, 16, 30043, 12237, 28388, 24638, 1350, 310, 364, 14330, 68753, 1232, 3130, 54144, 345, 310, 364, 2732, 3404, 1232, 2199, 6594, 345 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 264, 3254, 2199, 315, 68206, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 68206, 2584, 10761, 2704, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 2704, 627, 286, 551, 913, 9050, 2457, 28388, 20434, 25, 8442, 1501, 1219, 28536, 3549, 389, 477, 1306, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 9050, 2457, 28388, 24638, 25, 8442, 1501, 1219, 28536, 3549, 1603, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 27169, 3130, 54144, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 10637, 57121, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 68206, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 28720, 3211, 16, 916, 3571, 3034, 3571, 2732, 271, 14711, 6075, 512, 755, 2199, 1214, 11, 2704, 28, 3745, 6441, 751, 11, 2457, 28388, 20434, 28, 3745, 6441, 751, 345, 1835, 2457, 28388, 24638, 28, 3745, 6441, 751, 11, 3130, 54144, 28, 3745, 6441, 751, 345, 1835, 2199, 6594, 28, 3745, 6441, 751, 11, 2199, 5617, 28, 3745, 6441, 751, 345, 1835, 2199, 2424, 28, 3745, 6441, 751, 997, 286, 3270, 286, 32662, 264, 3254, 2199, 315, 68206, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 68206, 2584, 10761, 2704, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 2704, 627, 286, 551, 913, 9050, 2457, 28388, 20434, 25, 8442, 1501, 1219, 28536, 3549, 389, 477, 1306, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 9050, 2457, 28388, 24638, 25, 8442, 1501, 1219, 28536, 3549, 1603, 420, 22705, 18670, 16, 2457, 7394, 449, 35057, 627, 286, 551, 913, 27169, 3130, 54144, 25, 8442, 1501, 1219, 28536, 449, 279, 2728, 10637, 57121, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 68206, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 28720, 3211, 16, 916, 3571, 3034, 3571, 2732, 198, 286, 3270, 286, 3712, 284, 2819, 10440, 2313, 310, 364, 2583, 1232, 2704, 345, 310, 364, 1956, 11956, 6153, 1232, 25217, 65860, 18670, 16, 30043, 12237, 28388, 20434, 1350, 310, 364, 1956, 11956, 10438, 1232, 25217, 65860, 18670, 16, 30043, 12237, 28388, 24638, 1350, 310, 364, 14330, 68753, 1232, 3130, 54144, 345, 310, 364, 2732, 3404, 1232, 2199, 6594, 345 ]
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedset.py
SortedSet.copy
def copy(self): """Create a shallow copy of the sorted set.""" return self._fromset(set(self._set), key=self._key)
python
def copy(self): """Create a shallow copy of the sorted set.""" return self._fromset(set(self._set), key=self._key)
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "_fromset", "(", "set", "(", "self", ".", "_set", ")", ",", "key", "=", "self", ".", "_key", ")" ]
Create a shallow copy of the sorted set.
[ "Create", "a", "shallow", "copy", "of", "the", "sorted", "set", "." ]
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedset.py#L168-L170
<|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 shallow copy of the sorted set. ### Response: def copy(self): """Create a shallow copy of the sorted set.""" return self._fromset(set(self._set), key=self._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, 4110, 264, 26682, 3048, 315, 279, 10839, 743, 382, 14711, 6075, 512, 755, 3048, 1214, 997, 286, 4304, 4110, 264, 26682, 3048, 315, 279, 10839, 743, 14781, 286, 471, 659, 1462, 1527, 751, 14505, 1214, 1462, 751, 705, 1401, 7822, 1462, 798, 340, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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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2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 4110, 264, 26682, 3048, 315, 279, 10839, 743, 382, 14711, 6075, 512, 755, 3048, 1214, 997, 286, 4304, 4110, 264, 26682, 3048, 315, 279, 10839, 743, 14781, 286, 471, 659, 1462, 1527, 751, 14505, 1214, 1462, 751, 705, 1401, 7822, 1462, 798, 340, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element
def find_element(self, by=By.ID, value=None): """ Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement """ if self.w3c: if by == By.ID: by = By.CSS_SELECTOR value = '[id="%s"]' % value elif by == By.TAG_NAME: by = By.CSS_SELECTOR elif by == By.CLASS_NAME: by = By.CSS_SELECTOR value = ".%s" % value elif by == By.NAME: by = By.CSS_SELECTOR value = '[name="%s"]' % value return self.execute(Command.FIND_ELEMENT, { 'using': by, 'value': value})['value']
python
def find_element(self, by=By.ID, value=None): """ Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement """ if self.w3c: if by == By.ID: by = By.CSS_SELECTOR value = '[id="%s"]' % value elif by == By.TAG_NAME: by = By.CSS_SELECTOR elif by == By.CLASS_NAME: by = By.CSS_SELECTOR value = ".%s" % value elif by == By.NAME: by = By.CSS_SELECTOR value = '[name="%s"]' % value return self.execute(Command.FIND_ELEMENT, { 'using': by, 'value': value})['value']
[ "def", "find_element", "(", "self", ",", "by", "=", "By", ".", "ID", ",", "value", "=", "None", ")", ":", "if", "self", ".", "w3c", ":", "if", "by", "==", "By", ".", "ID", ":", "by", "=", "By", ".", "CSS_SELECTOR", "value", "=", "'[id=\"%s\"]'", "%", "value", "elif", "by", "==", "By", ".", "TAG_NAME", ":", "by", "=", "By", ".", "CSS_SELECTOR", "elif", "by", "==", "By", ".", "CLASS_NAME", ":", "by", "=", "By", ".", "CSS_SELECTOR", "value", "=", "\".%s\"", "%", "value", "elif", "by", "==", "By", ".", "NAME", ":", "by", "=", "By", ".", "CSS_SELECTOR", "value", "=", "'[name=\"%s\"]'", "%", "value", "return", "self", ".", "execute", "(", "Command", ".", "FIND_ELEMENT", ",", "{", "'using'", ":", "by", ",", "'value'", ":", "value", "}", ")", "[", "'value'", "]" ]
Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement
[ "Find", "an", "element", "given", "a", "By", "strategy", "and", "locator", ".", "Prefer", "the", "find_element_by_", "*", "methods", "when", "possible", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L988-L1014
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement ### Response: def find_element(self, by=By.ID, value=None): """ Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement """ if self.w3c: if by == By.ID: by = By.CSS_SELECTOR value = '[id="%s"]' % value elif by == By.TAG_NAME: by = By.CSS_SELECTOR elif by == By.CLASS_NAME: by = By.CSS_SELECTOR value = ".%s" % value elif by == By.NAME: by = By.CSS_SELECTOR value = '[name="%s"]' % value return self.execute(Command.FIND_ELEMENT, { 'using': by, 'value': value})['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, 10086, 459, 2449, 2728, 264, 3296, 8446, 323, 48217, 13, 85568, 279, 1505, 8053, 3795, 46897, 5528, 994, 198, 286, 3284, 382, 286, 551, 15126, 512, 310, 3588, 271, 394, 2449, 284, 5696, 2725, 8053, 13590, 10111, 11, 364, 8134, 4713, 286, 551, 33613, 25, 40982, 271, 14711, 6075, 512, 755, 1505, 8053, 1214, 11, 555, 28, 1383, 10111, 11, 907, 5980, 997, 286, 3270, 286, 7531, 459, 2449, 2728, 264, 3296, 8446, 323, 48217, 13, 85568, 279, 1505, 8053, 3795, 46897, 5528, 994, 198, 286, 3284, 382, 286, 551, 15126, 512, 310, 3588, 271, 394, 2449, 284, 5696, 2725, 8053, 13590, 10111, 11, 364, 8134, 4713, 286, 551, 33613, 25, 40982, 198, 286, 3270, 286, 422, 659, 1444, 18, 66, 512, 310, 422, 555, 624, 3296, 10111, 512, 394, 555, 284, 3296, 83684, 73496, 198, 394, 907, 284, 18814, 307, 36320, 82, 1365, 6, 1034, 907, 198, 310, 4508, 555, 624, 3296, 59865, 4813, 512, 394, 555, 284, 3296, 83684, 73496, 198, 310, 4508, 555, 624, 3296, 95014, 4813, 512, 394, 555, 284, 3296, 83684, 73496, 198, 394, 907, 284, 6058, 4, 82, 1, 1034, 907, 198, 310, 4508, 555, 624, 3296, 50165, 512, 394, 555, 284, 3296, 83684, 73496, 198, 394, 907, 284, 18814, 609, 36320, 82, 1365, 6, 1034, 907, 198, 286, 471, 659, 7925, 42522, 1006, 5358, 28255, 11, 341, 310, 364, 985, 1232, 555, 345, 310, 364, 970, 1232, 907, 5525, 681, 970, 4532, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 10086, 459, 2449, 2728, 264, 3296, 8446, 323, 48217, 13, 85568, 279, 1505, 8053, 3795, 46897, 5528, 994, 198, 286, 3284, 382, 286, 551, 15126, 512, 310, 3588, 271, 394, 2449, 284, 5696, 2725, 8053, 13590, 10111, 11, 364, 8134, 4713, 286, 551, 33613, 25, 40982, 271, 14711, 6075, 512, 755, 1505, 8053, 1214, 11, 555, 28, 1383, 10111, 11, 907, 5980, 997, 286, 3270, 286, 7531, 459, 2449, 2728, 264, 3296, 8446, 323, 48217, 13, 85568, 279, 1505, 8053, 3795, 46897, 5528, 994, 198, 286, 3284, 382, 286, 551, 15126, 512, 310, 3588, 271, 394, 2449, 284, 5696, 2725, 8053, 13590, 10111, 11, 364, 8134, 4713, 286, 551, 33613, 25, 40982, 198, 286, 3270, 286, 422, 659, 1444, 18, 66, 512, 310, 422, 555, 624, 3296, 10111, 512, 394, 555, 284, 3296, 83684, 73496, 198, 394, 907, 284, 18814, 307, 36320, 82, 1365, 6, 1034, 907, 198, 310, 4508, 555, 624, 3296, 59865, 4813, 512, 394, 555, 284, 3296, 83684, 73496, 198, 310, 4508, 555, 624, 3296, 95014, 4813, 512, 394, 555, 284, 3296, 83684, 73496, 198, 394, 907, 284, 6058, 4, 82, 1, 1034, 907, 198, 310, 4508, 555, 624, 3296, 50165, 512, 394, 555, 284, 3296, 83684, 73496, 198, 394, 907, 284, 18814, 609, 36320, 82, 1365, 6, 1034, 907, 198, 286, 471, 659, 7925, 42522, 1006, 5358, 28255, 11, 341, 310, 364, 985, 1232, 555, 345, 310, 364, 970, 1232, 907, 5525, 681, 970, 4532, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
sanoma/django-arctic
arctic/templatetags/arctic_pagination_tags.py
arctic_paginate
def arctic_paginate(parser, token): """ Renders a Page object with pagination bar. Example:: {% arctic_paginate page_obj paginator=page_obj.paginator range=10 %} Named Parameters:: range - The size of the pagination bar (ie, if set to 10 then, at most, 10 page numbers will display at any given time) Defaults to None, which shows all pages. show_first_last - Accepts "true" or "false". Determines whether or not to show the first and last page links. Defaults to "false" """ bits = token.split_contents() if len(bits) < 2: raise TemplateSyntaxError( "'%s' takes at least one argument" " (Page object reference)" % bits[0] ) page = parser.compile_filter(bits[1]) kwargs = {} bits = bits[2:] kwarg_re = re.compile(r"(\w+)=(.+)") if len(bits): for bit in bits: match = kwarg_re.match(bit) if not match: raise TemplateSyntaxError( "Malformed arguments to bootstrap_pagination paginate tag" ) name, value = match.groups() kwargs[name] = parser.compile_filter(value) return PaginationNode(page, kwargs)
python
def arctic_paginate(parser, token): """ Renders a Page object with pagination bar. Example:: {% arctic_paginate page_obj paginator=page_obj.paginator range=10 %} Named Parameters:: range - The size of the pagination bar (ie, if set to 10 then, at most, 10 page numbers will display at any given time) Defaults to None, which shows all pages. show_first_last - Accepts "true" or "false". Determines whether or not to show the first and last page links. Defaults to "false" """ bits = token.split_contents() if len(bits) < 2: raise TemplateSyntaxError( "'%s' takes at least one argument" " (Page object reference)" % bits[0] ) page = parser.compile_filter(bits[1]) kwargs = {} bits = bits[2:] kwarg_re = re.compile(r"(\w+)=(.+)") if len(bits): for bit in bits: match = kwarg_re.match(bit) if not match: raise TemplateSyntaxError( "Malformed arguments to bootstrap_pagination paginate tag" ) name, value = match.groups() kwargs[name] = parser.compile_filter(value) return PaginationNode(page, kwargs)
[ "def", "arctic_paginate", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "bits", ")", "<", "2", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes at least one argument\"", "\" (Page object reference)\"", "%", "bits", "[", "0", "]", ")", "page", "=", "parser", ".", "compile_filter", "(", "bits", "[", "1", "]", ")", "kwargs", "=", "{", "}", "bits", "=", "bits", "[", "2", ":", "]", "kwarg_re", "=", "re", ".", "compile", "(", "r\"(\\w+)=(.+)\"", ")", "if", "len", "(", "bits", ")", ":", "for", "bit", "in", "bits", ":", "match", "=", "kwarg_re", ".", "match", "(", "bit", ")", "if", "not", "match", ":", "raise", "TemplateSyntaxError", "(", "\"Malformed arguments to bootstrap_pagination paginate tag\"", ")", "name", ",", "value", "=", "match", ".", "groups", "(", ")", "kwargs", "[", "name", "]", "=", "parser", ".", "compile_filter", "(", "value", ")", "return", "PaginationNode", "(", "page", ",", "kwargs", ")" ]
Renders a Page object with pagination bar. Example:: {% arctic_paginate page_obj paginator=page_obj.paginator range=10 %} Named Parameters:: range - The size of the pagination bar (ie, if set to 10 then, at most, 10 page numbers will display at any given time) Defaults to None, which shows all pages. show_first_last - Accepts "true" or "false". Determines whether or not to show the first and last page links. Defaults to "false"
[ "Renders", "a", "Page", "object", "with", "pagination", "bar", ".", "Example", "::", "{", "%", "arctic_paginate", "page_obj", "paginator", "=", "page_obj", ".", "paginator", "range", "=", "10", "%", "}", "Named", "Parameters", "::", "range", "-", "The", "size", "of", "the", "pagination", "bar", "(", "ie", "if", "set", "to", "10", "then", "at", "most", "10", "page", "numbers", "will", "display", "at", "any", "given", "time", ")", "Defaults", "to", "None", "which", "shows", "all", "pages", ".", "show_first_last", "-", "Accepts", "true", "or", "false", ".", "Determines", "whether", "or", "not", "to", "show", "the", "first", "and", "last", "page", "links", ".", "Defaults", "to", "false" ]
train
https://github.com/sanoma/django-arctic/blob/c81b092c2643ca220708bf3c586017d9175161f5/arctic/templatetags/arctic_pagination_tags.py#L153-L188
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Renders a Page object with pagination bar. Example:: {% arctic_paginate page_obj paginator=page_obj.paginator range=10 %} Named Parameters:: range - The size of the pagination bar (ie, if set to 10 then, at most, 10 page numbers will display at any given time) Defaults to None, which shows all pages. show_first_last - Accepts "true" or "false". Determines whether or not to show the first and last page links. Defaults to "false" ### Response: def arctic_paginate(parser, token): """ Renders a Page object with pagination bar. Example:: {% arctic_paginate page_obj paginator=page_obj.paginator range=10 %} Named Parameters:: range - The size of the pagination bar (ie, if set to 10 then, at most, 10 page numbers will display at any given time) Defaults to None, which shows all pages. show_first_last - Accepts "true" or "false". Determines whether or not to show the first and last page links. Defaults to "false" """ bits = token.split_contents() if len(bits) < 2: raise TemplateSyntaxError( "'%s' takes at least one argument" " (Page object reference)" % bits[0] ) page = parser.compile_filter(bits[1]) kwargs = {} bits = bits[2:] kwarg_re = re.compile(r"(\w+)=(.+)") if len(bits): for bit in bits: match = kwarg_re.match(bit) if not match: raise TemplateSyntaxError( "Malformed arguments to bootstrap_pagination paginate tag" ) name, value = match.groups() kwargs[name] = parser.compile_filter(value) return PaginationNode(page, kwargs) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 49, 14846, 264, 5874, 1665, 449, 29595, 3703, 627, 262, 13688, 50677, 286, 53361, 802, 26636, 52103, 3357, 2199, 7478, 70495, 28, 2964, 7478, 92384, 2134, 28, 605, 69014, 262, 41559, 13831, 50677, 286, 2134, 482, 578, 1404, 315, 279, 29595, 3703, 320, 648, 11, 422, 743, 311, 220, 605, 1243, 11, 520, 1455, 345, 394, 220, 605, 2199, 5219, 690, 3113, 520, 904, 2728, 892, 8, 37090, 311, 198, 394, 2290, 11, 902, 5039, 682, 6959, 627, 286, 1501, 13275, 12473, 482, 21496, 82, 330, 1904, 1, 477, 330, 3934, 3343, 53812, 3508, 477, 539, 198, 3586, 311, 1501, 279, 1176, 323, 1566, 2199, 7902, 13, 37090, 311, 198, 3586, 330, 3934, 1875, 14711, 6075, 512, 755, 802, 26636, 52103, 3357, 36435, 11, 4037, 997, 262, 3270, 262, 94833, 264, 5874, 1665, 449, 29595, 3703, 627, 262, 13688, 50677, 286, 53361, 802, 26636, 52103, 3357, 2199, 7478, 70495, 28, 2964, 7478, 92384, 2134, 28, 605, 69014, 262, 41559, 13831, 50677, 286, 2134, 482, 578, 1404, 315, 279, 29595, 3703, 320, 648, 11, 422, 743, 311, 220, 605, 1243, 11, 520, 1455, 345, 394, 220, 605, 2199, 5219, 690, 3113, 520, 904, 2728, 892, 8, 37090, 311, 198, 394, 2290, 11, 902, 5039, 682, 6959, 627, 286, 1501, 13275, 12473, 482, 21496, 82, 330, 1904, 1, 477, 330, 3934, 3343, 53812, 3508, 477, 539, 198, 3586, 311, 1501, 279, 1176, 323, 1566, 2199, 7902, 13, 37090, 311, 198, 3586, 330, 3934, 702, 262, 3270, 262, 9660, 284, 4037, 5402, 17096, 746, 262, 422, 2479, 70001, 8, 366, 220, 17, 512, 286, 4933, 14692, 34990, 1480, 1021, 310, 7326, 4, 82, 6, 5097, 520, 3325, 832, 5811, 702, 310, 330, 320, 2732, 1665, 5905, 10143, 1034, 9660, 58, 15, 933, 286, 1763, 262, 2199, 284, 6871, 19458, 8901, 70001, 58, 16, 2608, 262, 16901, 284, 5731, 262, 9660, 284, 9660, 58, 17, 65731, 262, 30625, 867, 1311, 284, 312, 19458, 2666, 1, 11781, 86, 37297, 4640, 13, 37297, 5240, 262, 422, 2479, 70001, 997, 286, 369, 2766, 304, 9660, 512, 310, 2489, 284, 30625, 867, 1311, 11319, 55772, 340, 310, 422, 539, 2489, 512, 394, 4933, 14692, 34990, 1480, 1021, 504, 330, 30700, 10365, 6105, 311, 28023, 83331, 83074, 4877, 702, 394, 1763, 310, 836, 11, 907, 284, 2489, 41721, 746, 310, 16901, 11174, 60, 284, 6871, 19458, 8901, 3764, 696, 262, 471, 45998, 1997, 12293, 11, 16901, 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 ]
[ 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, 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, 49, 14846, 264, 5874, 1665, 449, 29595, 3703, 627, 262, 13688, 50677, 286, 53361, 802, 26636, 52103, 3357, 2199, 7478, 70495, 28, 2964, 7478, 92384, 2134, 28, 605, 69014, 262, 41559, 13831, 50677, 286, 2134, 482, 578, 1404, 315, 279, 29595, 3703, 320, 648, 11, 422, 743, 311, 220, 605, 1243, 11, 520, 1455, 345, 394, 220, 605, 2199, 5219, 690, 3113, 520, 904, 2728, 892, 8, 37090, 311, 198, 394, 2290, 11, 902, 5039, 682, 6959, 627, 286, 1501, 13275, 12473, 482, 21496, 82, 330, 1904, 1, 477, 330, 3934, 3343, 53812, 3508, 477, 539, 198, 3586, 311, 1501, 279, 1176, 323, 1566, 2199, 7902, 13, 37090, 311, 198, 3586, 330, 3934, 1875, 14711, 6075, 512, 755, 802, 26636, 52103, 3357, 36435, 11, 4037, 997, 262, 3270, 262, 94833, 264, 5874, 1665, 449, 29595, 3703, 627, 262, 13688, 50677, 286, 53361, 802, 26636, 52103, 3357, 2199, 7478, 70495, 28, 2964, 7478, 92384, 2134, 28, 605, 69014, 262, 41559, 13831, 50677, 286, 2134, 482, 578, 1404, 315, 279, 29595, 3703, 320, 648, 11, 422, 743, 311, 220, 605, 1243, 11, 520, 1455, 345, 394, 220, 605, 2199, 5219, 690, 3113, 520, 904, 2728, 892, 8, 37090, 311, 198, 394, 2290, 11, 902, 5039, 682, 6959, 627, 286, 1501, 13275, 12473, 482, 21496, 82, 330, 1904, 1, 477, 330, 3934, 3343, 53812, 3508, 477, 539, 198, 3586, 311, 1501, 279, 1176, 323, 1566, 2199, 7902, 13, 37090, 311, 198, 3586, 330, 3934, 702, 262, 3270, 262, 9660, 284, 4037, 5402, 17096, 746, 262, 422, 2479, 70001, 8, 366, 220, 17, 512, 286, 4933, 14692, 34990, 1480, 1021, 310, 7326, 4, 82, 6, 5097, 520, 3325, 832, 5811, 702, 310, 330, 320, 2732, 1665, 5905, 10143, 1034, 9660, 58, 15, 933, 286, 1763, 262, 2199, 284, 6871, 19458, 8901, 70001, 58, 16, 2608, 262, 16901, 284, 5731, 262, 9660, 284, 9660, 58, 17, 65731, 262, 30625, 867, 1311, 284, 312, 19458, 2666, 1, 11781, 86, 37297, 4640, 13, 37297, 5240, 262, 422, 2479, 70001, 997, 286, 369, 2766, 304, 9660, 512, 310, 2489, 284, 30625, 867, 1311, 11319, 55772, 340, 310, 422, 539, 2489, 512, 394, 4933, 14692, 34990, 1480, 1021, 504, 330, 30700, 10365, 6105, 311, 28023, 83331, 83074, 4877, 702, 394, 1763, 310, 836, 11, 907, 284, 2489, 41721, 746, 310, 16901, 11174, 60, 284, 6871, 19458, 8901, 3764, 696, 262, 471, 45998, 1997, 12293, 11, 16901, 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 ]
SpamScope/mail-parser
mailparser/mailparser.py
MailParser.from_string
def from_string(cls, s): """ Init a new object from a string. Args: s (string): raw email Returns: Instance of MailParser """ log.debug("Parsing email from string") message = email.message_from_string(s) return cls(message)
python
def from_string(cls, s): """ Init a new object from a string. Args: s (string): raw email Returns: Instance of MailParser """ log.debug("Parsing email from string") message = email.message_from_string(s) return cls(message)
[ "def", "from_string", "(", "cls", ",", "s", ")", ":", "log", ".", "debug", "(", "\"Parsing email from string\"", ")", "message", "=", "email", ".", "message_from_string", "(", "s", ")", "return", "cls", "(", "message", ")" ]
Init a new object from a string. Args: s (string): raw email Returns: Instance of MailParser
[ "Init", "a", "new", "object", "from", "a", "string", "." ]
train
https://github.com/SpamScope/mail-parser/blob/814b56d0b803feab9dea04f054b802ce138097e2/mailparser/mailparser.py#L207-L220
<|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: Init a new object from a string. Args: s (string): raw email Returns: Instance of MailParser ### Response: def from_string(cls, s): """ Init a new object from a string. Args: s (string): raw email Returns: Instance of MailParser """ log.debug("Parsing email from string") message = email.message_from_string(s) return cls(message) <|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, 3888, 264, 502, 1665, 505, 264, 925, 382, 286, 18161, 512, 310, 274, 320, 928, 1680, 7257, 2613, 271, 286, 5295, 512, 310, 19840, 315, 15219, 6707, 271, 14711, 6075, 512, 755, 505, 3991, 21024, 11, 274, 997, 286, 3270, 286, 16065, 264, 502, 1665, 505, 264, 925, 382, 286, 18161, 512, 310, 274, 320, 928, 1680, 7257, 2613, 271, 286, 5295, 512, 310, 19840, 315, 15219, 6707, 198, 286, 12713, 286, 1515, 8042, 446, 69939, 2613, 505, 925, 1158, 286, 1984, 284, 2613, 6837, 5791, 3991, 1161, 340, 286, 471, 13082, 7483, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 3888, 264, 502, 1665, 505, 264, 925, 382, 286, 18161, 512, 310, 274, 320, 928, 1680, 7257, 2613, 271, 286, 5295, 512, 310, 19840, 315, 15219, 6707, 271, 14711, 6075, 512, 755, 505, 3991, 21024, 11, 274, 997, 286, 3270, 286, 16065, 264, 502, 1665, 505, 264, 925, 382, 286, 18161, 512, 310, 274, 320, 928, 1680, 7257, 2613, 271, 286, 5295, 512, 310, 19840, 315, 15219, 6707, 198, 286, 12713, 286, 1515, 8042, 446, 69939, 2613, 505, 925, 1158, 286, 1984, 284, 2613, 6837, 5791, 3991, 1161, 340, 286, 471, 13082, 7483, 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 ]
Metatab/metapack
metapack/package/core.py
PackageBuilder.create_nv_link
def create_nv_link(self): """After a save(), write a link to the saved file using a non-versioned name""" from os.path import abspath, islink from os import unlink, symlink nv_name = self.doc.as_version(None) from_path = abspath(self._last_write_path or self.package_path.path) to_path = join(dirname(from_path), nv_name + self.type_suffix) if islink(to_path): unlink(to_path) symlink(from_path, to_path)
python
def create_nv_link(self): """After a save(), write a link to the saved file using a non-versioned name""" from os.path import abspath, islink from os import unlink, symlink nv_name = self.doc.as_version(None) from_path = abspath(self._last_write_path or self.package_path.path) to_path = join(dirname(from_path), nv_name + self.type_suffix) if islink(to_path): unlink(to_path) symlink(from_path, to_path)
[ "def", "create_nv_link", "(", "self", ")", ":", "from", "os", ".", "path", "import", "abspath", ",", "islink", "from", "os", "import", "unlink", ",", "symlink", "nv_name", "=", "self", ".", "doc", ".", "as_version", "(", "None", ")", "from_path", "=", "abspath", "(", "self", ".", "_last_write_path", "or", "self", ".", "package_path", ".", "path", ")", "to_path", "=", "join", "(", "dirname", "(", "from_path", ")", ",", "nv_name", "+", "self", ".", "type_suffix", ")", "if", "islink", "(", "to_path", ")", ":", "unlink", "(", "to_path", ")", "symlink", "(", "from_path", ",", "to_path", ")" ]
After a save(), write a link to the saved file using a non-versioned name
[ "After", "a", "save", "()", "write", "a", "link", "to", "the", "saved", "file", "using", "a", "non", "-", "versioned", "name" ]
train
https://github.com/Metatab/metapack/blob/8365f221fbeaa3c0be9091f2eaf3447fd8e2e8d6/metapack/package/core.py#L587-L601
<|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: After a save(), write a link to the saved file using a non-versioned name ### Response: def create_nv_link(self): """After a save(), write a link to the saved file using a non-versioned name""" from os.path import abspath, islink from os import unlink, symlink nv_name = self.doc.as_version(None) from_path = abspath(self._last_write_path or self.package_path.path) to_path = join(dirname(from_path), nv_name + self.type_suffix) if islink(to_path): unlink(to_path) symlink(from_path, to_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, 6153, 264, 3665, 1535, 3350, 264, 2723, 311, 279, 6924, 1052, 1701, 264, 2536, 46467, 291, 836, 271, 14711, 6075, 512, 755, 1893, 80530, 7381, 1214, 997, 286, 4304, 6153, 264, 3665, 1535, 3350, 264, 2723, 311, 279, 6924, 1052, 1701, 264, 2536, 46467, 291, 836, 7275, 286, 505, 2709, 3960, 1179, 671, 31189, 11, 374, 2125, 198, 286, 505, 2709, 1179, 48579, 11, 84321, 271, 286, 32540, 1292, 284, 659, 24595, 5470, 9625, 27815, 696, 286, 505, 2703, 284, 220, 671, 31189, 1214, 1462, 4354, 9344, 2703, 477, 659, 49728, 2703, 3960, 696, 286, 311, 2703, 284, 5249, 39902, 17450, 2703, 705, 32540, 1292, 489, 659, 4957, 38251, 696, 286, 422, 374, 2125, 12464, 2703, 997, 310, 48579, 12464, 2703, 696, 286, 84321, 17450, 2703, 11, 311, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6153, 264, 3665, 1535, 3350, 264, 2723, 311, 279, 6924, 1052, 1701, 264, 2536, 46467, 291, 836, 271, 14711, 6075, 512, 755, 1893, 80530, 7381, 1214, 997, 286, 4304, 6153, 264, 3665, 1535, 3350, 264, 2723, 311, 279, 6924, 1052, 1701, 264, 2536, 46467, 291, 836, 7275, 286, 505, 2709, 3960, 1179, 671, 31189, 11, 374, 2125, 198, 286, 505, 2709, 1179, 48579, 11, 84321, 271, 286, 32540, 1292, 284, 659, 24595, 5470, 9625, 27815, 696, 286, 505, 2703, 284, 220, 671, 31189, 1214, 1462, 4354, 9344, 2703, 477, 659, 49728, 2703, 3960, 696, 286, 311, 2703, 284, 5249, 39902, 17450, 2703, 705, 32540, 1292, 489, 659, 4957, 38251, 696, 286, 422, 374, 2125, 12464, 2703, 997, 310, 48579, 12464, 2703, 696, 286, 84321, 17450, 2703, 11, 311, 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 ]
KnightConan/sspdatatables
src/sspdatatables/templatetags/form_field.py
get_form_bound_field
def get_form_bound_field(form, field_name): """ Intends to get the bound field from the form regarding the field name :param form: Django Form: django form instance :param field_name: str: name of the field in form instance :return: Django Form bound field """ field = form.fields[field_name] field = field.get_bound_field(form, field_name) return field
python
def get_form_bound_field(form, field_name): """ Intends to get the bound field from the form regarding the field name :param form: Django Form: django form instance :param field_name: str: name of the field in form instance :return: Django Form bound field """ field = form.fields[field_name] field = field.get_bound_field(form, field_name) return field
[ "def", "get_form_bound_field", "(", "form", ",", "field_name", ")", ":", "field", "=", "form", ".", "fields", "[", "field_name", "]", "field", "=", "field", ".", "get_bound_field", "(", "form", ",", "field_name", ")", "return", "field" ]
Intends to get the bound field from the form regarding the field name :param form: Django Form: django form instance :param field_name: str: name of the field in form instance :return: Django Form bound field
[ "Intends", "to", "get", "the", "bound", "field", "from", "the", "form", "regarding", "the", "field", "name" ]
train
https://github.com/KnightConan/sspdatatables/blob/1179a11358734e5e472e5eee703e8d34fa49e9bf/src/sspdatatables/templatetags/form_field.py#L10-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: Intends to get the bound field from the form regarding the field name :param form: Django Form: django form instance :param field_name: str: name of the field in form instance :return: Django Form bound field ### Response: def get_form_bound_field(form, field_name): """ Intends to get the bound field from the form regarding the field name :param form: Django Form: django form instance :param field_name: str: name of the field in form instance :return: Django Form bound field """ field = form.fields[field_name] field = field.get_bound_field(form, field_name) return field <|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, 1090, 1438, 311, 636, 279, 6965, 2115, 505, 279, 1376, 9002, 279, 2115, 836, 271, 262, 551, 913, 1376, 25, 53704, 3459, 25, 8426, 1376, 2937, 198, 262, 551, 913, 2115, 1292, 25, 610, 25, 836, 315, 279, 2115, 304, 1376, 2937, 198, 262, 551, 693, 25, 53704, 3459, 6965, 2115, 271, 14711, 6075, 512, 755, 636, 8074, 20012, 5121, 17178, 11, 2115, 1292, 997, 262, 3270, 262, 1357, 1438, 311, 636, 279, 6965, 2115, 505, 279, 1376, 9002, 279, 2115, 836, 271, 262, 551, 913, 1376, 25, 53704, 3459, 25, 8426, 1376, 2937, 198, 262, 551, 913, 2115, 1292, 25, 610, 25, 836, 315, 279, 2115, 304, 1376, 2937, 198, 262, 551, 693, 25, 53704, 3459, 6965, 2115, 198, 262, 3270, 262, 2115, 284, 1376, 13216, 39740, 1292, 933, 262, 2115, 284, 2115, 673, 20012, 5121, 17178, 11, 2115, 1292, 340, 262, 471, 2115, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 1090, 1438, 311, 636, 279, 6965, 2115, 505, 279, 1376, 9002, 279, 2115, 836, 271, 262, 551, 913, 1376, 25, 53704, 3459, 25, 8426, 1376, 2937, 198, 262, 551, 913, 2115, 1292, 25, 610, 25, 836, 315, 279, 2115, 304, 1376, 2937, 198, 262, 551, 693, 25, 53704, 3459, 6965, 2115, 271, 14711, 6075, 512, 755, 636, 8074, 20012, 5121, 17178, 11, 2115, 1292, 997, 262, 3270, 262, 1357, 1438, 311, 636, 279, 6965, 2115, 505, 279, 1376, 9002, 279, 2115, 836, 271, 262, 551, 913, 1376, 25, 53704, 3459, 25, 8426, 1376, 2937, 198, 262, 551, 913, 2115, 1292, 25, 610, 25, 836, 315, 279, 2115, 304, 1376, 2937, 198, 262, 551, 693, 25, 53704, 3459, 6965, 2115, 198, 262, 3270, 262, 2115, 284, 1376, 13216, 39740, 1292, 933, 262, 2115, 284, 2115, 673, 20012, 5121, 17178, 11, 2115, 1292, 340, 262, 471, 2115, 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 ]
dnanexus/dx-toolkit
src/python/dxpy/bindings/dxjob.py
DXJob.wait_on_done
def wait_on_done(self, interval=2, timeout=3600*24*7, **kwargs): ''' :param interval: Number of seconds between queries to the job's state :type interval: integer :param timeout: Maximum amount of time to wait, in seconds, until the job is done running :type timeout: integer :raises: :exc:`~dxpy.exceptions.DXError` if the timeout is reached before the job has finished running, or :exc:`dxpy.exceptions.DXJobFailureError` if the job fails Waits until the job has finished running. ''' elapsed = 0 while True: state = self._get_state(**kwargs) if state == "done": break if state == "failed": desc = self.describe(**kwargs) err_msg = "Job has failed because of {failureReason}: {failureMessage}".format(**desc) if desc.get("failureFrom") != None and desc["failureFrom"]["id"] != desc["id"]: err_msg += " (failure from {id})".format(id=desc['failureFrom']['id']) raise DXJobFailureError(err_msg) if state == "terminated": raise DXJobFailureError("Job was terminated.") if elapsed >= timeout or elapsed < 0: raise DXJobFailureError("Reached timeout while waiting for the job to finish") time.sleep(interval) elapsed += interval
python
def wait_on_done(self, interval=2, timeout=3600*24*7, **kwargs): ''' :param interval: Number of seconds between queries to the job's state :type interval: integer :param timeout: Maximum amount of time to wait, in seconds, until the job is done running :type timeout: integer :raises: :exc:`~dxpy.exceptions.DXError` if the timeout is reached before the job has finished running, or :exc:`dxpy.exceptions.DXJobFailureError` if the job fails Waits until the job has finished running. ''' elapsed = 0 while True: state = self._get_state(**kwargs) if state == "done": break if state == "failed": desc = self.describe(**kwargs) err_msg = "Job has failed because of {failureReason}: {failureMessage}".format(**desc) if desc.get("failureFrom") != None and desc["failureFrom"]["id"] != desc["id"]: err_msg += " (failure from {id})".format(id=desc['failureFrom']['id']) raise DXJobFailureError(err_msg) if state == "terminated": raise DXJobFailureError("Job was terminated.") if elapsed >= timeout or elapsed < 0: raise DXJobFailureError("Reached timeout while waiting for the job to finish") time.sleep(interval) elapsed += interval
[ "def", "wait_on_done", "(", "self", ",", "interval", "=", "2", ",", "timeout", "=", "3600", "*", "24", "*", "7", ",", "*", "*", "kwargs", ")", ":", "elapsed", "=", "0", "while", "True", ":", "state", "=", "self", ".", "_get_state", "(", "*", "*", "kwargs", ")", "if", "state", "==", "\"done\"", ":", "break", "if", "state", "==", "\"failed\"", ":", "desc", "=", "self", ".", "describe", "(", "*", "*", "kwargs", ")", "err_msg", "=", "\"Job has failed because of {failureReason}: {failureMessage}\"", ".", "format", "(", "*", "*", "desc", ")", "if", "desc", ".", "get", "(", "\"failureFrom\"", ")", "!=", "None", "and", "desc", "[", "\"failureFrom\"", "]", "[", "\"id\"", "]", "!=", "desc", "[", "\"id\"", "]", ":", "err_msg", "+=", "\" (failure from {id})\"", ".", "format", "(", "id", "=", "desc", "[", "'failureFrom'", "]", "[", "'id'", "]", ")", "raise", "DXJobFailureError", "(", "err_msg", ")", "if", "state", "==", "\"terminated\"", ":", "raise", "DXJobFailureError", "(", "\"Job was terminated.\"", ")", "if", "elapsed", ">=", "timeout", "or", "elapsed", "<", "0", ":", "raise", "DXJobFailureError", "(", "\"Reached timeout while waiting for the job to finish\"", ")", "time", ".", "sleep", "(", "interval", ")", "elapsed", "+=", "interval" ]
:param interval: Number of seconds between queries to the job's state :type interval: integer :param timeout: Maximum amount of time to wait, in seconds, until the job is done running :type timeout: integer :raises: :exc:`~dxpy.exceptions.DXError` if the timeout is reached before the job has finished running, or :exc:`dxpy.exceptions.DXJobFailureError` if the job fails Waits until the job has finished running.
[ ":", "param", "interval", ":", "Number", "of", "seconds", "between", "queries", "to", "the", "job", "s", "state", ":", "type", "interval", ":", "integer", ":", "param", "timeout", ":", "Maximum", "amount", "of", "time", "to", "wait", "in", "seconds", "until", "the", "job", "is", "done", "running", ":", "type", "timeout", ":", "integer", ":", "raises", ":", ":", "exc", ":", "~dxpy", ".", "exceptions", ".", "DXError", "if", "the", "timeout", "is", "reached", "before", "the", "job", "has", "finished", "running", "or", ":", "exc", ":", "dxpy", ".", "exceptions", ".", "DXJobFailureError", "if", "the", "job", "fails" ]
train
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxjob.py#L262-L291
<|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 interval: Number of seconds between queries to the job's state :type interval: integer :param timeout: Maximum amount of time to wait, in seconds, until the job is done running :type timeout: integer :raises: :exc:`~dxpy.exceptions.DXError` if the timeout is reached before the job has finished running, or :exc:`dxpy.exceptions.DXJobFailureError` if the job fails Waits until the job has finished running. ### Response: def wait_on_done(self, interval=2, timeout=3600*24*7, **kwargs): ''' :param interval: Number of seconds between queries to the job's state :type interval: integer :param timeout: Maximum amount of time to wait, in seconds, until the job is done running :type timeout: integer :raises: :exc:`~dxpy.exceptions.DXError` if the timeout is reached before the job has finished running, or :exc:`dxpy.exceptions.DXJobFailureError` if the job fails Waits until the job has finished running. ''' elapsed = 0 while True: state = self._get_state(**kwargs) if state == "done": break if state == "failed": desc = self.describe(**kwargs) err_msg = "Job has failed because of {failureReason}: {failureMessage}".format(**desc) if desc.get("failureFrom") != None and desc["failureFrom"]["id"] != desc["id"]: err_msg += " (failure from {id})".format(id=desc['failureFrom']['id']) raise DXJobFailureError(err_msg) if state == "terminated": raise DXJobFailureError("Job was terminated.") if elapsed >= timeout or elapsed < 0: raise DXJobFailureError("Reached timeout while waiting for the job to finish") time.sleep(interval) elapsed += interval <|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, 10074, 25, 5742, 315, 6622, 1990, 20126, 311, 279, 2683, 596, 1614, 198, 286, 551, 1337, 10074, 25, 7698, 198, 286, 551, 913, 9829, 25, 27697, 3392, 315, 892, 311, 3868, 11, 304, 6622, 11, 3156, 279, 2683, 374, 2884, 4401, 198, 286, 551, 1337, 9829, 25, 7698, 198, 286, 551, 33371, 25, 551, 40541, 78902, 13009, 3368, 26744, 920, 55, 1480, 63, 422, 279, 9829, 374, 8813, 1603, 279, 2683, 706, 8220, 4401, 11, 477, 551, 40541, 19258, 13009, 3368, 26744, 920, 55, 12524, 17965, 1480, 63, 422, 279, 2683, 14865, 271, 286, 29614, 1220, 3156, 279, 2683, 706, 8220, 4401, 382, 14711, 6075, 512, 755, 3868, 4570, 25391, 1214, 11, 10074, 28, 17, 11, 9829, 28, 6843, 15, 9, 1187, 9, 22, 11, 3146, 9872, 997, 286, 11414, 286, 551, 913, 10074, 25, 5742, 315, 6622, 1990, 20126, 311, 279, 2683, 596, 1614, 198, 286, 551, 1337, 10074, 25, 7698, 198, 286, 551, 913, 9829, 25, 27697, 3392, 315, 892, 311, 3868, 11, 304, 6622, 11, 3156, 279, 2683, 374, 2884, 4401, 198, 286, 551, 1337, 9829, 25, 7698, 198, 286, 551, 33371, 25, 551, 40541, 78902, 13009, 3368, 26744, 920, 55, 1480, 63, 422, 279, 9829, 374, 8813, 1603, 279, 2683, 706, 8220, 4401, 11, 477, 551, 40541, 19258, 13009, 3368, 26744, 920, 55, 12524, 17965, 1480, 63, 422, 279, 2683, 14865, 271, 286, 29614, 1220, 3156, 279, 2683, 706, 8220, 4401, 627, 286, 45832, 286, 26401, 284, 220, 15, 198, 286, 1418, 3082, 512, 310, 1614, 284, 659, 1462, 456, 4486, 22551, 9872, 340, 310, 422, 1614, 624, 330, 10655, 4764, 394, 1464, 198, 310, 422, 1614, 624, 330, 16479, 4764, 394, 6697, 284, 659, 43065, 22551, 9872, 340, 394, 1886, 6619, 284, 330, 12524, 706, 4745, 1606, 315, 314, 30039, 26197, 16487, 314, 30039, 2097, 22664, 2293, 22551, 8784, 340, 394, 422, 6697, 673, 446, 30039, 3915, 909, 976, 2290, 323, 6697, 1204, 30039, 3915, 11264, 307, 1365, 976, 6697, 1204, 307, 34834, 504, 1886, 6619, 1447, 330, 320, 30039, 505, 314, 307, 5525, 3343, 2293, 3809, 28, 8784, 681, 30039, 3915, 4274, 307, 7519, 394, 4933, 31908, 12524, 17965, 1480, 4052, 6619, 340, 310, 422, 1614, 624, 330, 69759, 4764, 394, 4933, 31908, 12524, 17965, 1480, 446, 12524, 574, 32372, 32325, 310, 422, 26401, 2669, 9829, 477, 26401, 366, 220, 15, 512, 394, 4933, 31908, 12524, 17965, 1480, 446, 99626, 9829, 1418, 8748, 369, 279, 2683, 311, 6381, 5240, 310, 892, 11365, 56198, 340, 310, 26401, 1447, 10074, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 10074, 25, 5742, 315, 6622, 1990, 20126, 311, 279, 2683, 596, 1614, 198, 286, 551, 1337, 10074, 25, 7698, 198, 286, 551, 913, 9829, 25, 27697, 3392, 315, 892, 311, 3868, 11, 304, 6622, 11, 3156, 279, 2683, 374, 2884, 4401, 198, 286, 551, 1337, 9829, 25, 7698, 198, 286, 551, 33371, 25, 551, 40541, 78902, 13009, 3368, 26744, 920, 55, 1480, 63, 422, 279, 9829, 374, 8813, 1603, 279, 2683, 706, 8220, 4401, 11, 477, 551, 40541, 19258, 13009, 3368, 26744, 920, 55, 12524, 17965, 1480, 63, 422, 279, 2683, 14865, 271, 286, 29614, 1220, 3156, 279, 2683, 706, 8220, 4401, 382, 14711, 6075, 512, 755, 3868, 4570, 25391, 1214, 11, 10074, 28, 17, 11, 9829, 28, 6843, 15, 9, 1187, 9, 22, 11, 3146, 9872, 997, 286, 11414, 286, 551, 913, 10074, 25, 5742, 315, 6622, 1990, 20126, 311, 279, 2683, 596, 1614, 198, 286, 551, 1337, 10074, 25, 7698, 198, 286, 551, 913, 9829, 25, 27697, 3392, 315, 892, 311, 3868, 11, 304, 6622, 11, 3156, 279, 2683, 374, 2884, 4401, 198, 286, 551, 1337, 9829, 25, 7698, 198, 286, 551, 33371, 25, 551, 40541, 78902, 13009, 3368, 26744, 920, 55, 1480, 63, 422, 279, 9829, 374, 8813, 1603, 279, 2683, 706, 8220, 4401, 11, 477, 551, 40541, 19258, 13009, 3368, 26744, 920, 55, 12524, 17965, 1480, 63, 422, 279, 2683, 14865, 271, 286, 29614, 1220, 3156, 279, 2683, 706, 8220, 4401, 627, 286, 45832, 286, 26401, 284, 220, 15, 198, 286, 1418, 3082, 512, 310, 1614, 284, 659, 1462, 456, 4486, 22551, 9872, 340, 310, 422, 1614, 624, 330, 10655, 4764, 394, 1464, 198, 310, 422, 1614, 624, 330, 16479, 4764, 394, 6697, 284, 659, 43065, 22551, 9872, 340, 394, 1886, 6619, 284, 330, 12524, 706, 4745, 1606, 315, 314, 30039, 26197, 16487, 314, 30039, 2097, 22664, 2293, 22551, 8784, 340, 394, 422, 6697, 673, 446, 30039, 3915, 909, 976, 2290, 323, 6697, 1204, 30039, 3915, 11264, 307, 1365, 976, 6697, 1204, 307, 34834, 504, 1886, 6619, 1447, 330, 320, 30039, 505, 314, 307, 5525, 3343, 2293, 3809, 28, 8784, 681, 30039, 3915, 4274, 307, 7519, 394, 4933, 31908, 12524, 17965, 1480, 4052, 6619, 340, 310, 422, 1614, 624, 330, 69759, 4764, 394, 4933, 31908, 12524, 17965, 1480, 446, 12524, 574, 32372, 32325, 310, 422, 26401, 2669, 9829, 477, 26401, 366, 220, 15, 512, 394, 4933, 31908, 12524, 17965, 1480, 446, 99626, 9829, 1418, 8748, 369, 279, 2683, 311, 6381, 5240, 310, 892, 11365, 56198, 340, 310, 26401, 1447, 10074, 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 ]
googlesamples/assistant-sdk-python
google-assistant-sdk/googlesamples/assistant/grpc/audio_helpers.py
ConversationStream.stop_recording
def stop_recording(self): """Stop recording from the audio source.""" self._stop_recording.set() with self._source_lock: self._source.stop() self._recording = False
python
def stop_recording(self): """Stop recording from the audio source.""" self._stop_recording.set() with self._source_lock: self._source.stop() self._recording = False
[ "def", "stop_recording", "(", "self", ")", ":", "self", ".", "_stop_recording", ".", "set", "(", ")", "with", "self", ".", "_source_lock", ":", "self", ".", "_source", ".", "stop", "(", ")", "self", ".", "_recording", "=", "False" ]
Stop recording from the audio source.
[ "Stop", "recording", "from", "the", "audio", "source", "." ]
train
https://github.com/googlesamples/assistant-sdk-python/blob/84995692f35be8e085de8dfa7032039a13ae3fab/google-assistant-sdk/googlesamples/assistant/grpc/audio_helpers.py#L281-L286
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Stop recording from the audio source. ### Response: def stop_recording(self): """Stop recording from the audio source.""" self._stop_recording.set() with self._source_lock: self._source.stop() self._recording = False <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10903, 14975, 505, 279, 7855, 2592, 382, 14711, 6075, 512, 755, 3009, 7225, 2745, 1214, 997, 286, 4304, 10903, 14975, 505, 279, 7855, 2592, 14781, 286, 659, 1462, 9684, 7225, 2745, 995, 746, 286, 449, 659, 1462, 2484, 10019, 512, 310, 659, 1462, 2484, 13530, 746, 286, 659, 1462, 2827, 2745, 284, 3641, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10903, 14975, 505, 279, 7855, 2592, 382, 14711, 6075, 512, 755, 3009, 7225, 2745, 1214, 997, 286, 4304, 10903, 14975, 505, 279, 7855, 2592, 14781, 286, 659, 1462, 9684, 7225, 2745, 995, 746, 286, 449, 659, 1462, 2484, 10019, 512, 310, 659, 1462, 2484, 13530, 746, 286, 659, 1462, 2827, 2745, 284, 3641, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
PmagPy/PmagPy
SPD/lib/lib_arai_plot_statistics.py
fancy_SCAT
def fancy_SCAT(points, low_bound, high_bound, x_max, y_max): """ runs SCAT test and returns 'Pass' or 'Fail' """ # iterate through all relevant points and see if any of them fall outside of your SCAT box # {'points_arai': [(x,y),(x,y)], 'points_ptrm': [(x,y),(x,y)], ...} SCAT = 'Pass' SCATs = {'SCAT_arai': 'Pass', 'SCAT_ptrm': 'Pass', 'SCAT_tail': 'Pass'} for point_type in points: #print 'point_type', point_type for point in points[point_type]: #print 'point', point result = in_SCAT_box(point[0], point[1], low_bound, high_bound, x_max, y_max) if not result: # print "SCAT TEST FAILED" x = 'SCAT' + point_type[6:] #print 'lib point type', point_type #print 'xxxx', x SCATs[x] = 'Fail' SCAT = 'Fail' return SCAT, SCATs
python
def fancy_SCAT(points, low_bound, high_bound, x_max, y_max): """ runs SCAT test and returns 'Pass' or 'Fail' """ # iterate through all relevant points and see if any of them fall outside of your SCAT box # {'points_arai': [(x,y),(x,y)], 'points_ptrm': [(x,y),(x,y)], ...} SCAT = 'Pass' SCATs = {'SCAT_arai': 'Pass', 'SCAT_ptrm': 'Pass', 'SCAT_tail': 'Pass'} for point_type in points: #print 'point_type', point_type for point in points[point_type]: #print 'point', point result = in_SCAT_box(point[0], point[1], low_bound, high_bound, x_max, y_max) if not result: # print "SCAT TEST FAILED" x = 'SCAT' + point_type[6:] #print 'lib point type', point_type #print 'xxxx', x SCATs[x] = 'Fail' SCAT = 'Fail' return SCAT, SCATs
[ "def", "fancy_SCAT", "(", "points", ",", "low_bound", ",", "high_bound", ",", "x_max", ",", "y_max", ")", ":", "# iterate through all relevant points and see if any of them fall outside of your SCAT box", "# {'points_arai': [(x,y),(x,y)], 'points_ptrm': [(x,y),(x,y)], ...}", "SCAT", "=", "'Pass'", "SCATs", "=", "{", "'SCAT_arai'", ":", "'Pass'", ",", "'SCAT_ptrm'", ":", "'Pass'", ",", "'SCAT_tail'", ":", "'Pass'", "}", "for", "point_type", "in", "points", ":", "#print 'point_type', point_type", "for", "point", "in", "points", "[", "point_type", "]", ":", "#print 'point', point", "result", "=", "in_SCAT_box", "(", "point", "[", "0", "]", ",", "point", "[", "1", "]", ",", "low_bound", ",", "high_bound", ",", "x_max", ",", "y_max", ")", "if", "not", "result", ":", "# print \"SCAT TEST FAILED\"", "x", "=", "'SCAT'", "+", "point_type", "[", "6", ":", "]", "#print 'lib point type', point_type", "#print 'xxxx', x", "SCATs", "[", "x", "]", "=", "'Fail'", "SCAT", "=", "'Fail'", "return", "SCAT", ",", "SCATs" ]
runs SCAT test and returns 'Pass' or 'Fail'
[ "runs", "SCAT", "test", "and", "returns", "Pass", "or", "Fail" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_arai_plot_statistics.py#L196-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: runs SCAT test and returns 'Pass' or 'Fail' ### Response: def fancy_SCAT(points, low_bound, high_bound, x_max, y_max): """ runs SCAT test and returns 'Pass' or 'Fail' """ # iterate through all relevant points and see if any of them fall outside of your SCAT box # {'points_arai': [(x,y),(x,y)], 'points_ptrm': [(x,y),(x,y)], ...} SCAT = 'Pass' SCATs = {'SCAT_arai': 'Pass', 'SCAT_ptrm': 'Pass', 'SCAT_tail': 'Pass'} for point_type in points: #print 'point_type', point_type for point in points[point_type]: #print 'point', point result = in_SCAT_box(point[0], point[1], low_bound, high_bound, x_max, y_max) if not result: # print "SCAT TEST FAILED" x = 'SCAT' + point_type[6:] #print 'lib point type', point_type #print 'xxxx', x SCATs[x] = 'Fail' SCAT = 'Fail' return SCAT, SCATs <|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, 54410, 7683, 835, 1296, 323, 4780, 364, 12465, 6, 477, 364, 20094, 3961, 14711, 6075, 512, 755, 27555, 12300, 835, 33550, 11, 3428, 20012, 11, 1579, 20012, 11, 865, 6479, 11, 379, 6479, 997, 262, 3270, 262, 8640, 7683, 835, 1296, 323, 4780, 364, 12465, 6, 477, 364, 20094, 1270, 262, 3270, 262, 674, 30729, 1555, 682, 9959, 3585, 323, 1518, 422, 904, 315, 1124, 4498, 4994, 315, 701, 7683, 835, 3830, 198, 262, 674, 5473, 7862, 26927, 2192, 1232, 18305, 87, 7509, 24457, 87, 7509, 26090, 364, 7862, 4446, 76, 1232, 18305, 87, 7509, 24457, 87, 7509, 26090, 2564, 534, 262, 7683, 835, 284, 364, 12465, 1270, 262, 7683, 835, 82, 284, 5473, 3624, 835, 26927, 2192, 1232, 364, 12465, 518, 364, 3624, 835, 4446, 76, 1232, 364, 12465, 518, 364, 3624, 835, 36571, 1232, 364, 12465, 16823, 262, 369, 1486, 1857, 304, 3585, 512, 286, 674, 1374, 364, 2837, 1857, 518, 1486, 1857, 198, 286, 369, 1486, 304, 3585, 58, 2837, 1857, 10556, 310, 674, 1374, 364, 2837, 518, 1486, 198, 310, 1121, 284, 304, 12300, 835, 10404, 20848, 58, 15, 1145, 1486, 58, 16, 1145, 3428, 20012, 11, 1579, 20012, 11, 865, 6479, 11, 379, 6479, 340, 310, 422, 539, 1121, 512, 2342, 674, 1194, 330, 3624, 835, 13916, 50771, 702, 394, 865, 284, 364, 3624, 835, 6, 489, 1486, 1857, 58, 21, 25106, 394, 674, 1374, 364, 2808, 1486, 955, 518, 1486, 1857, 198, 394, 674, 1374, 364, 19023, 518, 865, 198, 394, 7683, 835, 82, 8487, 60, 284, 364, 20094, 1270, 394, 7683, 835, 284, 364, 20094, 1270, 262, 471, 7683, 835, 11, 7683, 835, 82, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128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 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 54410, 7683, 835, 1296, 323, 4780, 364, 12465, 6, 477, 364, 20094, 3961, 14711, 6075, 512, 755, 27555, 12300, 835, 33550, 11, 3428, 20012, 11, 1579, 20012, 11, 865, 6479, 11, 379, 6479, 997, 262, 3270, 262, 8640, 7683, 835, 1296, 323, 4780, 364, 12465, 6, 477, 364, 20094, 1270, 262, 3270, 262, 674, 30729, 1555, 682, 9959, 3585, 323, 1518, 422, 904, 315, 1124, 4498, 4994, 315, 701, 7683, 835, 3830, 198, 262, 674, 5473, 7862, 26927, 2192, 1232, 18305, 87, 7509, 24457, 87, 7509, 26090, 364, 7862, 4446, 76, 1232, 18305, 87, 7509, 24457, 87, 7509, 26090, 2564, 534, 262, 7683, 835, 284, 364, 12465, 1270, 262, 7683, 835, 82, 284, 5473, 3624, 835, 26927, 2192, 1232, 364, 12465, 518, 364, 3624, 835, 4446, 76, 1232, 364, 12465, 518, 364, 3624, 835, 36571, 1232, 364, 12465, 16823, 262, 369, 1486, 1857, 304, 3585, 512, 286, 674, 1374, 364, 2837, 1857, 518, 1486, 1857, 198, 286, 369, 1486, 304, 3585, 58, 2837, 1857, 10556, 310, 674, 1374, 364, 2837, 518, 1486, 198, 310, 1121, 284, 304, 12300, 835, 10404, 20848, 58, 15, 1145, 1486, 58, 16, 1145, 3428, 20012, 11, 1579, 20012, 11, 865, 6479, 11, 379, 6479, 340, 310, 422, 539, 1121, 512, 2342, 674, 1194, 330, 3624, 835, 13916, 50771, 702, 394, 865, 284, 364, 3624, 835, 6, 489, 1486, 1857, 58, 21, 25106, 394, 674, 1374, 364, 2808, 1486, 955, 518, 1486, 1857, 198, 394, 674, 1374, 364, 19023, 518, 865, 198, 394, 7683, 835, 82, 8487, 60, 284, 364, 20094, 1270, 394, 7683, 835, 284, 364, 20094, 1270, 262, 471, 7683, 835, 11, 7683, 835, 82, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
BetterWorks/django-anonymizer
anonymizer/base.py
DjangoFaker.date
def date(self, field=None, val=None): """ Like datetime, but truncated to be a date only """ return self.datetime(field=field, val=val).date()
python
def date(self, field=None, val=None): """ Like datetime, but truncated to be a date only """ return self.datetime(field=field, val=val).date()
[ "def", "date", "(", "self", ",", "field", "=", "None", ",", "val", "=", "None", ")", ":", "return", "self", ".", "datetime", "(", "field", "=", "field", ",", "val", "=", "val", ")", ".", "date", "(", ")" ]
Like datetime, but truncated to be a date only
[ "Like", "datetime", "but", "truncated", "to", "be", "a", "date", "only" ]
train
https://github.com/BetterWorks/django-anonymizer/blob/2d25bb6e8b5e4230c58031c4b6d10cc536669b3e/anonymizer/base.py#L135-L139
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Like datetime, but truncated to be a date only ### Response: def date(self, field=None, val=None): """ Like datetime, but truncated to be a date only """ return self.datetime(field=field, val=val).date() <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 13246, 9050, 11, 719, 60856, 311, 387, 264, 2457, 1193, 271, 14711, 6075, 512, 755, 2457, 1214, 11, 2115, 5980, 11, 1062, 5980, 997, 286, 3270, 286, 9086, 9050, 11, 719, 60856, 311, 387, 264, 2457, 1193, 198, 286, 3270, 286, 471, 659, 20296, 15944, 28, 2630, 11, 1062, 88629, 570, 1045, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 13246, 9050, 11, 719, 60856, 311, 387, 264, 2457, 1193, 271, 14711, 6075, 512, 755, 2457, 1214, 11, 2115, 5980, 11, 1062, 5980, 997, 286, 3270, 286, 9086, 9050, 11, 719, 60856, 311, 387, 264, 2457, 1193, 198, 286, 3270, 286, 471, 659, 20296, 15944, 28, 2630, 11, 1062, 88629, 570, 1045, 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 ]
aliyun/aliyun-log-python-sdk
aliyun/log/logclient.py
LogClient.get_begin_cursor
def get_begin_cursor(self, project_name, logstore_name, shard_id): """ Get begin cursor from log service for batch pull logs Unsuccessful opertaion will cause an LogException. :type project_name: string :param project_name: the Project name :type logstore_name: string :param logstore_name: the logstore name :type shard_id: int :param shard_id: the shard id :return: GetLogsResponse :raise: LogException """ return self.get_cursor(project_name, logstore_name, shard_id, "begin")
python
def get_begin_cursor(self, project_name, logstore_name, shard_id): """ Get begin cursor from log service for batch pull logs Unsuccessful opertaion will cause an LogException. :type project_name: string :param project_name: the Project name :type logstore_name: string :param logstore_name: the logstore name :type shard_id: int :param shard_id: the shard id :return: GetLogsResponse :raise: LogException """ return self.get_cursor(project_name, logstore_name, shard_id, "begin")
[ "def", "get_begin_cursor", "(", "self", ",", "project_name", ",", "logstore_name", ",", "shard_id", ")", ":", "return", "self", ".", "get_cursor", "(", "project_name", ",", "logstore_name", ",", "shard_id", ",", "\"begin\"", ")" ]
Get begin cursor from log service for batch pull logs Unsuccessful opertaion will cause an LogException. :type project_name: string :param project_name: the Project name :type logstore_name: string :param logstore_name: the logstore name :type shard_id: int :param shard_id: the shard id :return: GetLogsResponse :raise: LogException
[ "Get", "begin", "cursor", "from", "log", "service", "for", "batch", "pull", "logs", "Unsuccessful", "opertaion", "will", "cause", "an", "LogException", ".", ":", "type", "project_name", ":", "string", ":", "param", "project_name", ":", "the", "Project", "name", ":", "type", "logstore_name", ":", "string", ":", "param", "logstore_name", ":", "the", "logstore", "name", ":", "type", "shard_id", ":", "int", ":", "param", "shard_id", ":", "the", "shard", "id", ":", "return", ":", "GetLogsResponse", ":", "raise", ":", "LogException" ]
train
https://github.com/aliyun/aliyun-log-python-sdk/blob/ac383db0a16abf1e5ef7df36074374184b43516e/aliyun/log/logclient.py#L749-L766
<|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 begin cursor from log service for batch pull logs Unsuccessful opertaion will cause an LogException. :type project_name: string :param project_name: the Project name :type logstore_name: string :param logstore_name: the logstore name :type shard_id: int :param shard_id: the shard id :return: GetLogsResponse :raise: LogException ### Response: def get_begin_cursor(self, project_name, logstore_name, shard_id): """ Get begin cursor from log service for batch pull logs Unsuccessful opertaion will cause an LogException. :type project_name: string :param project_name: the Project name :type logstore_name: string :param logstore_name: the logstore name :type shard_id: int :param shard_id: the shard id :return: GetLogsResponse :raise: LogException """ return self.get_cursor(project_name, logstore_name, shard_id, "begin") <|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, 3240, 8291, 505, 1515, 2532, 369, 7309, 6958, 18929, 319, 286, 1252, 32050, 1200, 23463, 290, 690, 5353, 459, 2905, 1378, 18304, 286, 551, 1337, 2447, 1292, 25, 925, 319, 286, 551, 913, 2447, 1292, 25, 279, 5907, 836, 24226, 286, 551, 1337, 1515, 4412, 1292, 25, 925, 319, 286, 551, 913, 1515, 4412, 1292, 25, 279, 1515, 4412, 836, 881, 286, 551, 1337, 53169, 851, 25, 528, 319, 286, 551, 913, 53169, 851, 25, 279, 53169, 887, 881, 286, 551, 693, 25, 2175, 52153, 2647, 44105, 286, 551, 19223, 25, 2905, 1378, 271, 14711, 6075, 512, 755, 636, 24223, 29701, 1214, 11, 2447, 1292, 11, 1515, 4412, 1292, 11, 53169, 851, 5903, 286, 4304, 2175, 3240, 8291, 505, 1515, 2532, 369, 7309, 6958, 18929, 319, 286, 1252, 32050, 1200, 23463, 290, 690, 5353, 459, 2905, 1378, 18304, 286, 551, 1337, 2447, 1292, 25, 925, 319, 286, 551, 913, 2447, 1292, 25, 279, 5907, 836, 24226, 286, 551, 1337, 1515, 4412, 1292, 25, 925, 319, 286, 551, 913, 1515, 4412, 1292, 25, 279, 1515, 4412, 836, 881, 286, 551, 1337, 53169, 851, 25, 528, 319, 286, 551, 913, 53169, 851, 25, 279, 53169, 887, 881, 286, 551, 693, 25, 2175, 52153, 2647, 44105, 286, 551, 19223, 25, 2905, 1378, 319, 286, 26547, 286, 471, 659, 673, 29701, 21855, 1292, 11, 1515, 4412, 1292, 11, 53169, 851, 11, 330, 7413, 1158, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 30151, 512, 2675, 527, 264, 19903, 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, 3240, 8291, 505, 1515, 2532, 369, 7309, 6958, 18929, 319, 286, 1252, 32050, 1200, 23463, 290, 690, 5353, 459, 2905, 1378, 18304, 286, 551, 1337, 2447, 1292, 25, 925, 319, 286, 551, 913, 2447, 1292, 25, 279, 5907, 836, 24226, 286, 551, 1337, 1515, 4412, 1292, 25, 925, 319, 286, 551, 913, 1515, 4412, 1292, 25, 279, 1515, 4412, 836, 881, 286, 551, 1337, 53169, 851, 25, 528, 319, 286, 551, 913, 53169, 851, 25, 279, 53169, 887, 881, 286, 551, 693, 25, 2175, 52153, 2647, 44105, 286, 551, 19223, 25, 2905, 1378, 271, 14711, 6075, 512, 755, 636, 24223, 29701, 1214, 11, 2447, 1292, 11, 1515, 4412, 1292, 11, 53169, 851, 5903, 286, 4304, 2175, 3240, 8291, 505, 1515, 2532, 369, 7309, 6958, 18929, 319, 286, 1252, 32050, 1200, 23463, 290, 690, 5353, 459, 2905, 1378, 18304, 286, 551, 1337, 2447, 1292, 25, 925, 319, 286, 551, 913, 2447, 1292, 25, 279, 5907, 836, 24226, 286, 551, 1337, 1515, 4412, 1292, 25, 925, 319, 286, 551, 913, 1515, 4412, 1292, 25, 279, 1515, 4412, 836, 881, 286, 551, 1337, 53169, 851, 25, 528, 319, 286, 551, 913, 53169, 851, 25, 279, 53169, 887, 881, 286, 551, 693, 25, 2175, 52153, 2647, 44105, 286, 551, 19223, 25, 2905, 1378, 319, 286, 26547, 286, 471, 659, 673, 29701, 21855, 1292, 11, 1515, 4412, 1292, 11, 53169, 851, 11, 330, 7413, 1158, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xmlNode.newNs
def newNs(self, href, prefix): """Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing one present on this node. We use href==None in the case of an element creation where the namespace was not defined. """ ret = libxml2mod.xmlNewNs(self._o, href, prefix) if ret is None:raise treeError('xmlNewNs() failed') __tmp = xmlNs(_obj=ret) return __tmp
python
def newNs(self, href, prefix): """Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing one present on this node. We use href==None in the case of an element creation where the namespace was not defined. """ ret = libxml2mod.xmlNewNs(self._o, href, prefix) if ret is None:raise treeError('xmlNewNs() failed') __tmp = xmlNs(_obj=ret) return __tmp
[ "def", "newNs", "(", "self", ",", "href", ",", "prefix", ")", ":", "ret", "=", "libxml2mod", ".", "xmlNewNs", "(", "self", ".", "_o", ",", "href", ",", "prefix", ")", "if", "ret", "is", "None", ":", "raise", "treeError", "(", "'xmlNewNs() failed'", ")", "__tmp", "=", "xmlNs", "(", "_obj", "=", "ret", ")", "return", "__tmp" ]
Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing one present on this node. We use href==None in the case of an element creation where the namespace was not defined.
[ "Creation", "of", "a", "new", "Namespace", ".", "This", "function", "will", "refuse", "to", "create", "a", "namespace", "with", "a", "similar", "prefix", "than", "an", "existing", "one", "present", "on", "this", "node", ".", "We", "use", "href", "==", "None", "in", "the", "case", "of", "an", "element", "creation", "where", "the", "namespace", "was", "not", "defined", "." ]
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L3363-L3371
<|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: Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing one present on this node. We use href==None in the case of an element creation where the namespace was not defined. ### Response: def newNs(self, href, prefix): """Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing one present on this node. We use href==None in the case of an element creation where the namespace was not defined. """ ret = libxml2mod.xmlNewNs(self._o, href, prefix) if ret is None:raise treeError('xmlNewNs() failed') __tmp = xmlNs(_obj=ret) return __tmp <|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, 33801, 315, 264, 502, 43062, 13, 1115, 734, 690, 26122, 311, 198, 692, 1893, 264, 4573, 449, 264, 4528, 9436, 1109, 459, 6484, 198, 692, 832, 3118, 389, 420, 2494, 13, 1226, 1005, 1839, 419, 4155, 304, 279, 1162, 315, 198, 1881, 459, 2449, 9886, 1405, 279, 4573, 574, 539, 4613, 382, 14711, 6075, 512, 755, 502, 48460, 1214, 11, 1839, 11, 9436, 997, 286, 4304, 33801, 315, 264, 502, 43062, 13, 1115, 734, 690, 26122, 311, 198, 692, 1893, 264, 4573, 449, 264, 4528, 9436, 1109, 459, 6484, 198, 692, 832, 3118, 389, 420, 2494, 13, 1226, 1005, 1839, 419, 4155, 304, 279, 1162, 315, 198, 1881, 459, 2449, 9886, 1405, 279, 4573, 574, 539, 4613, 13, 3270, 286, 2160, 284, 3127, 6591, 17, 2658, 9205, 3648, 48460, 1214, 1462, 78, 11, 1839, 11, 9436, 340, 286, 422, 2160, 374, 2290, 25, 19223, 5021, 1480, 493, 6591, 3648, 48460, 368, 4745, 1329, 286, 1328, 5284, 284, 8562, 48460, 2551, 2347, 28, 2171, 340, 286, 471, 1328, 5284, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 33801, 315, 264, 502, 43062, 13, 1115, 734, 690, 26122, 311, 198, 692, 1893, 264, 4573, 449, 264, 4528, 9436, 1109, 459, 6484, 198, 692, 832, 3118, 389, 420, 2494, 13, 1226, 1005, 1839, 419, 4155, 304, 279, 1162, 315, 198, 1881, 459, 2449, 9886, 1405, 279, 4573, 574, 539, 4613, 382, 14711, 6075, 512, 755, 502, 48460, 1214, 11, 1839, 11, 9436, 997, 286, 4304, 33801, 315, 264, 502, 43062, 13, 1115, 734, 690, 26122, 311, 198, 692, 1893, 264, 4573, 449, 264, 4528, 9436, 1109, 459, 6484, 198, 692, 832, 3118, 389, 420, 2494, 13, 1226, 1005, 1839, 419, 4155, 304, 279, 1162, 315, 198, 1881, 459, 2449, 9886, 1405, 279, 4573, 574, 539, 4613, 13, 3270, 286, 2160, 284, 3127, 6591, 17, 2658, 9205, 3648, 48460, 1214, 1462, 78, 11, 1839, 11, 9436, 340, 286, 422, 2160, 374, 2290, 25, 19223, 5021, 1480, 493, 6591, 3648, 48460, 368, 4745, 1329, 286, 1328, 5284, 284, 8562, 48460, 2551, 2347, 28, 2171, 340, 286, 471, 1328, 5284, 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 ]
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
WorkUnitProvider.get_workunit
def get_workunit(self, ignore_list=None): """ Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been processed. A lock on it has been acquired. Raises: NoAvailableWorkException There is no more work available. """ if ignore_list is None: ignore_list = [] potential_files = self.get_potential_files(ignore_list) while len(potential_files) > 0: potential_file = self.select_potential_file(potential_files) potential_files.remove(potential_file) if self._filter(potential_file): continue if self.directory_context.get_file_size(potential_file) == 0: continue if self.progress_manager.is_done(potential_file): self._done.append(potential_file) continue else: try: self.progress_manager.lock(potential_file) except FileLockedException: continue self._already_fetched.append(potential_file) return self.builder.build_workunit( self.directory_context.get_full_path(potential_file)) logger.info("No eligible workunits remain to be fetched.") raise NoAvailableWorkException()
python
def get_workunit(self, ignore_list=None): """ Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been processed. A lock on it has been acquired. Raises: NoAvailableWorkException There is no more work available. """ if ignore_list is None: ignore_list = [] potential_files = self.get_potential_files(ignore_list) while len(potential_files) > 0: potential_file = self.select_potential_file(potential_files) potential_files.remove(potential_file) if self._filter(potential_file): continue if self.directory_context.get_file_size(potential_file) == 0: continue if self.progress_manager.is_done(potential_file): self._done.append(potential_file) continue else: try: self.progress_manager.lock(potential_file) except FileLockedException: continue self._already_fetched.append(potential_file) return self.builder.build_workunit( self.directory_context.get_full_path(potential_file)) logger.info("No eligible workunits remain to be fetched.") raise NoAvailableWorkException()
[ "def", "get_workunit", "(", "self", ",", "ignore_list", "=", "None", ")", ":", "if", "ignore_list", "is", "None", ":", "ignore_list", "=", "[", "]", "potential_files", "=", "self", ".", "get_potential_files", "(", "ignore_list", ")", "while", "len", "(", "potential_files", ")", ">", "0", ":", "potential_file", "=", "self", ".", "select_potential_file", "(", "potential_files", ")", "potential_files", ".", "remove", "(", "potential_file", ")", "if", "self", ".", "_filter", "(", "potential_file", ")", ":", "continue", "if", "self", ".", "directory_context", ".", "get_file_size", "(", "potential_file", ")", "==", "0", ":", "continue", "if", "self", ".", "progress_manager", ".", "is_done", "(", "potential_file", ")", ":", "self", ".", "_done", ".", "append", "(", "potential_file", ")", "continue", "else", ":", "try", ":", "self", ".", "progress_manager", ".", "lock", "(", "potential_file", ")", "except", "FileLockedException", ":", "continue", "self", ".", "_already_fetched", ".", "append", "(", "potential_file", ")", "return", "self", ".", "builder", ".", "build_workunit", "(", "self", ".", "directory_context", ".", "get_full_path", "(", "potential_file", ")", ")", "logger", ".", "info", "(", "\"No eligible workunits remain to be fetched.\"", ")", "raise", "NoAvailableWorkException", "(", ")" ]
Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been processed. A lock on it has been acquired. Raises: NoAvailableWorkException There is no more work available.
[ "Gets", "a", "new", "unit", "of", "work", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L579-L625
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been processed. A lock on it has been acquired. Raises: NoAvailableWorkException There is no more work available. ### Response: def get_workunit(self, ignore_list=None): """ Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been processed. A lock on it has been acquired. Raises: NoAvailableWorkException There is no more work available. """ if ignore_list is None: ignore_list = [] potential_files = self.get_potential_files(ignore_list) while len(potential_files) > 0: potential_file = self.select_potential_file(potential_files) potential_files.remove(potential_file) if self._filter(potential_file): continue if self.directory_context.get_file_size(potential_file) == 0: continue if self.progress_manager.is_done(potential_file): self._done.append(potential_file) continue else: try: self.progress_manager.lock(potential_file) except FileLockedException: continue self._already_fetched.append(potential_file) return self.builder.build_workunit( self.directory_context.get_full_path(potential_file)) logger.info("No eligible workunits remain to be fetched.") raise NoAvailableWorkException() <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 50458, 264, 502, 5089, 315, 990, 382, 286, 18161, 512, 692, 10240, 2062, 25, 1160, 4293, 340, 310, 362, 1160, 315, 41640, 902, 1288, 387, 12305, 13, 220, 37090, 311, 2290, 382, 286, 5295, 512, 692, 502, 11757, 3928, 25, 5664, 4665, 198, 310, 362, 502, 5089, 315, 990, 430, 706, 539, 3686, 1027, 15590, 13, 220, 362, 5409, 389, 198, 310, 433, 706, 1027, 19426, 382, 286, 61411, 512, 692, 2360, 16892, 6919, 1378, 198, 310, 2684, 374, 912, 810, 990, 2561, 382, 14711, 6075, 512, 755, 636, 11757, 3928, 1214, 11, 10240, 2062, 5980, 997, 286, 3270, 286, 10523, 264, 502, 5089, 315, 990, 382, 286, 18161, 512, 692, 10240, 2062, 25, 1160, 4293, 340, 310, 362, 1160, 315, 41640, 902, 1288, 387, 12305, 13, 220, 37090, 311, 2290, 382, 286, 5295, 512, 692, 502, 11757, 3928, 25, 5664, 4665, 198, 310, 362, 502, 5089, 315, 990, 430, 706, 539, 3686, 1027, 15590, 13, 220, 362, 5409, 389, 198, 310, 433, 706, 1027, 19426, 382, 286, 61411, 512, 692, 2360, 16892, 6919, 1378, 198, 310, 2684, 374, 912, 810, 990, 2561, 627, 286, 3270, 286, 422, 10240, 2062, 374, 2290, 512, 310, 10240, 2062, 284, 14941, 286, 4754, 11171, 284, 659, 673, 59052, 2335, 11171, 97526, 2062, 696, 286, 1418, 2479, 1319, 354, 2335, 11171, 8, 871, 220, 15, 512, 310, 4754, 2517, 284, 659, 9911, 59052, 2335, 2517, 1319, 354, 2335, 11171, 340, 310, 4754, 11171, 4955, 1319, 354, 2335, 2517, 340, 310, 422, 659, 1462, 5428, 1319, 354, 2335, 2517, 997, 394, 3136, 271, 310, 422, 659, 61037, 8634, 673, 2517, 2424, 1319, 354, 2335, 2517, 8, 624, 220, 15, 512, 394, 3136, 271, 310, 422, 659, 29027, 12418, 2124, 25391, 1319, 354, 2335, 2517, 997, 394, 659, 1462, 10655, 2102, 1319, 354, 2335, 2517, 340, 394, 3136, 198, 310, 775, 512, 394, 1456, 512, 504, 659, 29027, 12418, 21679, 1319, 354, 2335, 2517, 340, 394, 3734, 2958, 12258, 19357, 512, 504, 3136, 271, 394, 659, 1462, 46584, 766, 37880, 2102, 1319, 354, 2335, 2517, 340, 394, 471, 659, 24117, 13542, 11757, 3928, 1021, 504, 659, 61037, 8634, 673, 16776, 2703, 1319, 354, 2335, 2517, 4489, 286, 6050, 5506, 446, 2822, 17446, 990, 26726, 7293, 311, 387, 42542, 32325, 286, 4933, 2360, 16892, 6919, 1378, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 50458, 264, 502, 5089, 315, 990, 382, 286, 18161, 512, 692, 10240, 2062, 25, 1160, 4293, 340, 310, 362, 1160, 315, 41640, 902, 1288, 387, 12305, 13, 220, 37090, 311, 2290, 382, 286, 5295, 512, 692, 502, 11757, 3928, 25, 5664, 4665, 198, 310, 362, 502, 5089, 315, 990, 430, 706, 539, 3686, 1027, 15590, 13, 220, 362, 5409, 389, 198, 310, 433, 706, 1027, 19426, 382, 286, 61411, 512, 692, 2360, 16892, 6919, 1378, 198, 310, 2684, 374, 912, 810, 990, 2561, 382, 14711, 6075, 512, 755, 636, 11757, 3928, 1214, 11, 10240, 2062, 5980, 997, 286, 3270, 286, 10523, 264, 502, 5089, 315, 990, 382, 286, 18161, 512, 692, 10240, 2062, 25, 1160, 4293, 340, 310, 362, 1160, 315, 41640, 902, 1288, 387, 12305, 13, 220, 37090, 311, 2290, 382, 286, 5295, 512, 692, 502, 11757, 3928, 25, 5664, 4665, 198, 310, 362, 502, 5089, 315, 990, 430, 706, 539, 3686, 1027, 15590, 13, 220, 362, 5409, 389, 198, 310, 433, 706, 1027, 19426, 382, 286, 61411, 512, 692, 2360, 16892, 6919, 1378, 198, 310, 2684, 374, 912, 810, 990, 2561, 627, 286, 3270, 286, 422, 10240, 2062, 374, 2290, 512, 310, 10240, 2062, 284, 14941, 286, 4754, 11171, 284, 659, 673, 59052, 2335, 11171, 97526, 2062, 696, 286, 1418, 2479, 1319, 354, 2335, 11171, 8, 871, 220, 15, 512, 310, 4754, 2517, 284, 659, 9911, 59052, 2335, 2517, 1319, 354, 2335, 11171, 340, 310, 4754, 11171, 4955, 1319, 354, 2335, 2517, 340, 310, 422, 659, 1462, 5428, 1319, 354, 2335, 2517, 997, 394, 3136, 271, 310, 422, 659, 61037, 8634, 673, 2517, 2424, 1319, 354, 2335, 2517, 8, 624, 220, 15, 512, 394, 3136, 271, 310, 422, 659, 29027, 12418, 2124, 25391, 1319, 354, 2335, 2517, 997, 394, 659, 1462, 10655, 2102, 1319, 354, 2335, 2517, 340, 394, 3136, 198, 310, 775, 512, 394, 1456, 512, 504, 659, 29027, 12418, 21679, 1319, 354, 2335, 2517, 340, 394, 3734, 2958, 12258, 19357, 512, 504, 3136, 271, 394, 659, 1462, 46584, 766, 37880, 2102, 1319, 354, 2335, 2517, 340, 394, 471, 659, 24117, 13542, 11757, 3928, 1021, 504, 659, 61037, 8634, 673, 16776, 2703, 1319, 354, 2335, 2517, 4489, 286, 6050, 5506, 446, 2822, 17446, 990, 26726, 7293, 311, 387, 42542, 32325, 286, 4933, 2360, 16892, 6919, 1378, 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 ]
basler/pypylon
scripts/builddoxy2swig/doxy2swig/doxy2swig.py
Doxy2SWIG.handle_typical_memberdefs_no_overload
def handle_typical_memberdefs_no_overload(self, signature, memberdef_nodes): """Produce standard documentation for memberdef_nodes.""" for n in memberdef_nodes: self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) if self.with_function_signature: self.add_line_with_subsequent_indent(self.get_function_signature(n)) self.subnode_parse(n, pieces=[], ignore=['definition', 'name']) self.add_text(['";', '\n'])
python
def handle_typical_memberdefs_no_overload(self, signature, memberdef_nodes): """Produce standard documentation for memberdef_nodes.""" for n in memberdef_nodes: self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) if self.with_function_signature: self.add_line_with_subsequent_indent(self.get_function_signature(n)) self.subnode_parse(n, pieces=[], ignore=['definition', 'name']) self.add_text(['";', '\n'])
[ "def", "handle_typical_memberdefs_no_overload", "(", "self", ",", "signature", ",", "memberdef_nodes", ")", ":", "for", "n", "in", "memberdef_nodes", ":", "self", ".", "add_text", "(", "[", "'\\n'", ",", "'%feature(\"docstring\") '", ",", "signature", ",", "' \"'", ",", "'\\n'", "]", ")", "if", "self", ".", "with_function_signature", ":", "self", ".", "add_line_with_subsequent_indent", "(", "self", ".", "get_function_signature", "(", "n", ")", ")", "self", ".", "subnode_parse", "(", "n", ",", "pieces", "=", "[", "]", ",", "ignore", "=", "[", "'definition'", ",", "'name'", "]", ")", "self", ".", "add_text", "(", "[", "'\";'", ",", "'\\n'", "]", ")" ]
Produce standard documentation for memberdef_nodes.
[ "Produce", "standard", "documentation", "for", "memberdef_nodes", "." ]
train
https://github.com/basler/pypylon/blob/d3510fa419b1c2b17f3f0b80a5fbb720c7b84008/scripts/builddoxy2swig/doxy2swig/doxy2swig.py#L431-L438
<|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: Produce standard documentation for memberdef_nodes. ### Response: def handle_typical_memberdefs_no_overload(self, signature, memberdef_nodes): """Produce standard documentation for memberdef_nodes.""" for n in memberdef_nodes: self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) if self.with_function_signature: self.add_line_with_subsequent_indent(self.get_function_signature(n)) self.subnode_parse(n, pieces=[], ignore=['definition', 'name']) self.add_text(['";', '\n']) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 1360, 13677, 5410, 9904, 369, 4562, 755, 15242, 382, 14711, 6075, 512, 755, 3790, 43211, 950, 19951, 49585, 6673, 15793, 1096, 1214, 11, 12223, 11, 4562, 755, 15242, 997, 286, 4304, 1360, 13677, 5410, 9904, 369, 4562, 755, 15242, 14781, 286, 369, 308, 304, 4562, 755, 15242, 512, 310, 659, 1388, 4424, 6561, 59, 77, 518, 7832, 13043, 446, 5349, 928, 909, 6752, 12223, 11, 364, 28838, 5307, 77, 7519, 310, 422, 659, 18662, 9353, 40959, 512, 394, 659, 1388, 6665, 6753, 5341, 72457, 70145, 1214, 673, 9353, 40959, 1471, 1192, 310, 659, 4407, 3593, 21715, 1471, 11, 9863, 67321, 10240, 14314, 18881, 518, 364, 609, 7519, 310, 659, 1388, 4424, 6561, 5233, 518, 5307, 77, 7519, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 1360, 13677, 5410, 9904, 369, 4562, 755, 15242, 382, 14711, 6075, 512, 755, 3790, 43211, 950, 19951, 49585, 6673, 15793, 1096, 1214, 11, 12223, 11, 4562, 755, 15242, 997, 286, 4304, 1360, 13677, 5410, 9904, 369, 4562, 755, 15242, 14781, 286, 369, 308, 304, 4562, 755, 15242, 512, 310, 659, 1388, 4424, 6561, 59, 77, 518, 7832, 13043, 446, 5349, 928, 909, 6752, 12223, 11, 364, 28838, 5307, 77, 7519, 310, 422, 659, 18662, 9353, 40959, 512, 394, 659, 1388, 6665, 6753, 5341, 72457, 70145, 1214, 673, 9353, 40959, 1471, 1192, 310, 659, 4407, 3593, 21715, 1471, 11, 9863, 67321, 10240, 14314, 18881, 518, 364, 609, 7519, 310, 659, 1388, 4424, 6561, 5233, 518, 5307, 77, 7519, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
phaethon/kamene
kamene/packet.py
ls
def ls(obj=None): """List available layers, or infos on a given layer""" if obj is None: import builtins all = builtins.__dict__.copy() all.update(globals()) objlst = sorted(conf.layers, key=lambda x:x.__name__) for o in objlst: print("%-10s : %s" %(o.__name__,o.name)) else: if isinstance(obj, type) and issubclass(obj, Packet): for f in obj.fields_desc: print("%-10s : %-20s = (%s)" % (f.name, f.__class__.__name__, repr(f.default))) elif isinstance(obj, Packet): for f in obj.fields_desc: print("%-10s : %-20s = %-15s (%s)" % (f.name, f.__class__.__name__, repr(getattr(obj,f.name)), repr(f.default))) if not isinstance(obj.payload, NoPayload): print("--") ls(obj.payload) else: print("Not a packet class. Type 'ls()' to list packet classes.")
python
def ls(obj=None): """List available layers, or infos on a given layer""" if obj is None: import builtins all = builtins.__dict__.copy() all.update(globals()) objlst = sorted(conf.layers, key=lambda x:x.__name__) for o in objlst: print("%-10s : %s" %(o.__name__,o.name)) else: if isinstance(obj, type) and issubclass(obj, Packet): for f in obj.fields_desc: print("%-10s : %-20s = (%s)" % (f.name, f.__class__.__name__, repr(f.default))) elif isinstance(obj, Packet): for f in obj.fields_desc: print("%-10s : %-20s = %-15s (%s)" % (f.name, f.__class__.__name__, repr(getattr(obj,f.name)), repr(f.default))) if not isinstance(obj.payload, NoPayload): print("--") ls(obj.payload) else: print("Not a packet class. Type 'ls()' to list packet classes.")
[ "def", "ls", "(", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "import", "builtins", "all", "=", "builtins", ".", "__dict__", ".", "copy", "(", ")", "all", ".", "update", "(", "globals", "(", ")", ")", "objlst", "=", "sorted", "(", "conf", ".", "layers", ",", "key", "=", "lambda", "x", ":", "x", ".", "__name__", ")", "for", "o", "in", "objlst", ":", "print", "(", "\"%-10s : %s\"", "%", "(", "o", ".", "__name__", ",", "o", ".", "name", ")", ")", "else", ":", "if", "isinstance", "(", "obj", ",", "type", ")", "and", "issubclass", "(", "obj", ",", "Packet", ")", ":", "for", "f", "in", "obj", ".", "fields_desc", ":", "print", "(", "\"%-10s : %-20s = (%s)\"", "%", "(", "f", ".", "name", ",", "f", ".", "__class__", ".", "__name__", ",", "repr", "(", "f", ".", "default", ")", ")", ")", "elif", "isinstance", "(", "obj", ",", "Packet", ")", ":", "for", "f", "in", "obj", ".", "fields_desc", ":", "print", "(", "\"%-10s : %-20s = %-15s (%s)\"", "%", "(", "f", ".", "name", ",", "f", ".", "__class__", ".", "__name__", ",", "repr", "(", "getattr", "(", "obj", ",", "f", ".", "name", ")", ")", ",", "repr", "(", "f", ".", "default", ")", ")", ")", "if", "not", "isinstance", "(", "obj", ".", "payload", ",", "NoPayload", ")", ":", "print", "(", "\"--\"", ")", "ls", "(", "obj", ".", "payload", ")", "else", ":", "print", "(", "\"Not a packet class. Type 'ls()' to list packet classes.\"", ")" ]
List available layers, or infos on a given layer
[ "List", "available", "layers", "or", "infos", "on", "a", "given", "layer" ]
train
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/packet.py#L1250-L1273
<|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 available layers, or infos on a given layer ### Response: def ls(obj=None): """List available layers, or infos on a given layer""" if obj is None: import builtins all = builtins.__dict__.copy() all.update(globals()) objlst = sorted(conf.layers, key=lambda x:x.__name__) for o in objlst: print("%-10s : %s" %(o.__name__,o.name)) else: if isinstance(obj, type) and issubclass(obj, Packet): for f in obj.fields_desc: print("%-10s : %-20s = (%s)" % (f.name, f.__class__.__name__, repr(f.default))) elif isinstance(obj, Packet): for f in obj.fields_desc: print("%-10s : %-20s = %-15s (%s)" % (f.name, f.__class__.__name__, repr(getattr(obj,f.name)), repr(f.default))) if not isinstance(obj.payload, NoPayload): print("--") ls(obj.payload) else: print("Not a packet class. Type 'ls()' to list packet classes.") <|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, 220, 2561, 13931, 11, 477, 45244, 389, 264, 2728, 6324, 271, 14711, 6075, 512, 755, 20170, 6922, 5980, 997, 262, 4304, 861, 220, 2561, 13931, 11, 477, 45244, 389, 264, 2728, 6324, 7275, 262, 422, 2909, 374, 2290, 512, 1827, 286, 1179, 5918, 1354, 198, 286, 682, 284, 5918, 1354, 4952, 8644, 19247, 8728, 746, 286, 682, 5430, 3348, 17027, 2455, 286, 2909, 37787, 284, 10839, 30979, 21680, 11, 1401, 28604, 865, 36354, 4952, 609, 24010, 286, 369, 297, 304, 2909, 37787, 512, 310, 1194, 4530, 12, 605, 82, 551, 1034, 82, 1, 21921, 78, 4952, 609, 10662, 78, 2710, 1192, 262, 775, 512, 286, 422, 11656, 6922, 11, 955, 8, 323, 374, 100217, 6922, 11, 29989, 997, 310, 369, 282, 304, 2909, 13216, 11229, 512, 394, 1194, 4530, 12, 605, 82, 551, 52053, 508, 82, 284, 13764, 82, 10143, 1034, 320, 69, 2710, 11, 282, 4952, 1058, 50480, 609, 10662, 220, 31736, 968, 8939, 6054, 286, 4508, 11656, 6922, 11, 29989, 997, 310, 369, 282, 304, 2909, 13216, 11229, 512, 394, 1194, 4530, 12, 605, 82, 551, 52053, 508, 82, 284, 52053, 868, 82, 13764, 82, 10143, 1034, 320, 69, 2710, 11, 282, 4952, 1058, 50480, 609, 10662, 31736, 5550, 3064, 6922, 17514, 2710, 5850, 31736, 968, 8939, 6054, 310, 422, 539, 11656, 6922, 17950, 11, 2360, 30783, 997, 394, 1194, 22274, 1158, 394, 20170, 6922, 17950, 340, 72348, 286, 775, 512, 310, 1194, 446, 2688, 264, 10361, 538, 13, 4078, 364, 4835, 80355, 311, 1160, 10361, 6989, 13352, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 220, 2561, 13931, 11, 477, 45244, 389, 264, 2728, 6324, 271, 14711, 6075, 512, 755, 20170, 6922, 5980, 997, 262, 4304, 861, 220, 2561, 13931, 11, 477, 45244, 389, 264, 2728, 6324, 7275, 262, 422, 2909, 374, 2290, 512, 1827, 286, 1179, 5918, 1354, 198, 286, 682, 284, 5918, 1354, 4952, 8644, 19247, 8728, 746, 286, 682, 5430, 3348, 17027, 2455, 286, 2909, 37787, 284, 10839, 30979, 21680, 11, 1401, 28604, 865, 36354, 4952, 609, 24010, 286, 369, 297, 304, 2909, 37787, 512, 310, 1194, 4530, 12, 605, 82, 551, 1034, 82, 1, 21921, 78, 4952, 609, 10662, 78, 2710, 1192, 262, 775, 512, 286, 422, 11656, 6922, 11, 955, 8, 323, 374, 100217, 6922, 11, 29989, 997, 310, 369, 282, 304, 2909, 13216, 11229, 512, 394, 1194, 4530, 12, 605, 82, 551, 52053, 508, 82, 284, 13764, 82, 10143, 1034, 320, 69, 2710, 11, 282, 4952, 1058, 50480, 609, 10662, 220, 31736, 968, 8939, 6054, 286, 4508, 11656, 6922, 11, 29989, 997, 310, 369, 282, 304, 2909, 13216, 11229, 512, 394, 1194, 4530, 12, 605, 82, 551, 52053, 508, 82, 284, 52053, 868, 82, 13764, 82, 10143, 1034, 320, 69, 2710, 11, 282, 4952, 1058, 50480, 609, 10662, 31736, 5550, 3064, 6922, 17514, 2710, 5850, 31736, 968, 8939, 6054, 310, 422, 539, 11656, 6922, 17950, 11, 2360, 30783, 997, 394, 1194, 22274, 1158, 394, 20170, 6922, 17950, 340, 72348, 286, 775, 512, 310, 1194, 446, 2688, 264, 10361, 538, 13, 4078, 364, 4835, 80355, 311, 1160, 10361, 6989, 13352, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
pgmpy/pgmpy
pgmpy/readwrite/XMLBIF.py
XMLBIFWriter.get_definition
def get_definition(self): """ Add Definition to XMLBIF Return ------ dict: dict of type {variable: definition tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_definition() {'hear-bark': <Element DEFINITION at 0x7f1d48977408>, 'family-out': <Element DEFINITION at 0x7f1d489773c8>, 'dog-out': <Element DEFINITION at 0x7f1d48977388>, 'bowel-problem': <Element DEFINITION at 0x7f1d48977348>, 'light-on': <Element DEFINITION at 0x7f1d48977448>} """ cpds = self.model.get_cpds() cpds.sort(key=lambda x: x.variable) definition_tag = {} for cpd in cpds: definition_tag[cpd.variable] = etree.SubElement(self.network, "DEFINITION") etree.SubElement(definition_tag[cpd.variable], "FOR").text = cpd.variable for child in sorted(cpd.variables[:0:-1]): etree.SubElement(definition_tag[cpd.variable], "GIVEN").text = child return definition_tag
python
def get_definition(self): """ Add Definition to XMLBIF Return ------ dict: dict of type {variable: definition tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_definition() {'hear-bark': <Element DEFINITION at 0x7f1d48977408>, 'family-out': <Element DEFINITION at 0x7f1d489773c8>, 'dog-out': <Element DEFINITION at 0x7f1d48977388>, 'bowel-problem': <Element DEFINITION at 0x7f1d48977348>, 'light-on': <Element DEFINITION at 0x7f1d48977448>} """ cpds = self.model.get_cpds() cpds.sort(key=lambda x: x.variable) definition_tag = {} for cpd in cpds: definition_tag[cpd.variable] = etree.SubElement(self.network, "DEFINITION") etree.SubElement(definition_tag[cpd.variable], "FOR").text = cpd.variable for child in sorted(cpd.variables[:0:-1]): etree.SubElement(definition_tag[cpd.variable], "GIVEN").text = child return definition_tag
[ "def", "get_definition", "(", "self", ")", ":", "cpds", "=", "self", ".", "model", ".", "get_cpds", "(", ")", "cpds", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", ".", "variable", ")", "definition_tag", "=", "{", "}", "for", "cpd", "in", "cpds", ":", "definition_tag", "[", "cpd", ".", "variable", "]", "=", "etree", ".", "SubElement", "(", "self", ".", "network", ",", "\"DEFINITION\"", ")", "etree", ".", "SubElement", "(", "definition_tag", "[", "cpd", ".", "variable", "]", ",", "\"FOR\"", ")", ".", "text", "=", "cpd", ".", "variable", "for", "child", "in", "sorted", "(", "cpd", ".", "variables", "[", ":", "0", ":", "-", "1", "]", ")", ":", "etree", ".", "SubElement", "(", "definition_tag", "[", "cpd", ".", "variable", "]", ",", "\"GIVEN\"", ")", ".", "text", "=", "child", "return", "definition_tag" ]
Add Definition to XMLBIF Return ------ dict: dict of type {variable: definition tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_definition() {'hear-bark': <Element DEFINITION at 0x7f1d48977408>, 'family-out': <Element DEFINITION at 0x7f1d489773c8>, 'dog-out': <Element DEFINITION at 0x7f1d48977388>, 'bowel-problem': <Element DEFINITION at 0x7f1d48977348>, 'light-on': <Element DEFINITION at 0x7f1d48977448>}
[ "Add", "Definition", "to", "XMLBIF" ]
train
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/readwrite/XMLBIF.py#L372-L399
<|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 Definition to XMLBIF Return ------ dict: dict of type {variable: definition tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_definition() {'hear-bark': <Element DEFINITION at 0x7f1d48977408>, 'family-out': <Element DEFINITION at 0x7f1d489773c8>, 'dog-out': <Element DEFINITION at 0x7f1d48977388>, 'bowel-problem': <Element DEFINITION at 0x7f1d48977348>, 'light-on': <Element DEFINITION at 0x7f1d48977448>} ### Response: def get_definition(self): """ Add Definition to XMLBIF Return ------ dict: dict of type {variable: definition tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_definition() {'hear-bark': <Element DEFINITION at 0x7f1d48977408>, 'family-out': <Element DEFINITION at 0x7f1d489773c8>, 'dog-out': <Element DEFINITION at 0x7f1d48977388>, 'bowel-problem': <Element DEFINITION at 0x7f1d48977348>, 'light-on': <Element DEFINITION at 0x7f1d48977448>} """ cpds = self.model.get_cpds() cpds.sort(key=lambda x: x.variable) definition_tag = {} for cpd in cpds: definition_tag[cpd.variable] = etree.SubElement(self.network, "DEFINITION") etree.SubElement(definition_tag[cpd.variable], "FOR").text = cpd.variable for child in sorted(cpd.variables[:0:-1]): etree.SubElement(definition_tag[cpd.variable], "GIVEN").text = child return definition_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, 2261, 20288, 311, 12138, 33, 2843, 271, 286, 3494, 198, 286, 11556, 7233, 286, 6587, 25, 6587, 315, 955, 314, 10014, 25, 7419, 4877, 633, 286, 26379, 198, 286, 90238, 286, 12382, 7061, 284, 12138, 33, 2843, 6628, 7790, 340, 286, 12382, 7061, 673, 32798, 746, 286, 5473, 87160, 1481, 847, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2318, 12803, 260, 364, 19521, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 66, 23, 12803, 260, 364, 18964, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2421, 12803, 260, 364, 15802, 301, 10039, 10329, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2166, 12803, 260, 364, 4238, 10539, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2166, 29, 633, 14711, 6075, 512, 755, 636, 32798, 1214, 997, 286, 3270, 286, 2758, 20288, 311, 12138, 33, 2843, 271, 286, 3494, 198, 286, 11556, 7233, 286, 6587, 25, 6587, 315, 955, 314, 10014, 25, 7419, 4877, 633, 286, 26379, 198, 286, 90238, 286, 12382, 7061, 284, 12138, 33, 2843, 6628, 7790, 340, 286, 12382, 7061, 673, 32798, 746, 286, 5473, 87160, 1481, 847, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2318, 12803, 260, 364, 19521, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 66, 23, 12803, 260, 364, 18964, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2421, 12803, 260, 364, 15802, 301, 10039, 10329, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2166, 12803, 260, 364, 4238, 10539, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2166, 32396, 286, 3270, 286, 12773, 5469, 284, 659, 3272, 673, 40911, 5469, 746, 286, 12773, 5469, 10838, 4962, 28604, 865, 25, 865, 46321, 340, 286, 7419, 9556, 284, 5731, 286, 369, 12773, 67, 304, 12773, 5469, 512, 310, 7419, 9556, 58, 4777, 67, 46321, 60, 284, 67755, 93442, 1214, 21216, 11, 330, 13963, 691, 7237, 1158, 310, 67755, 93442, 7, 18881, 9556, 58, 4777, 67, 46321, 1145, 330, 32002, 1865, 1342, 284, 12773, 67, 46321, 198, 310, 369, 1716, 304, 10839, 1361, 15720, 52393, 3530, 15, 11184, 16, 22953, 394, 67755, 93442, 7, 18881, 9556, 58, 4777, 67, 46321, 1145, 330, 38, 68057, 1865, 1342, 284, 1716, 271, 286, 471, 7419, 9556, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 20288, 311, 12138, 33, 2843, 271, 286, 3494, 198, 286, 11556, 7233, 286, 6587, 25, 6587, 315, 955, 314, 10014, 25, 7419, 4877, 633, 286, 26379, 198, 286, 90238, 286, 12382, 7061, 284, 12138, 33, 2843, 6628, 7790, 340, 286, 12382, 7061, 673, 32798, 746, 286, 5473, 87160, 1481, 847, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2318, 12803, 260, 364, 19521, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 66, 23, 12803, 260, 364, 18964, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2421, 12803, 260, 364, 15802, 301, 10039, 10329, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2166, 12803, 260, 364, 4238, 10539, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2166, 29, 633, 14711, 6075, 512, 755, 636, 32798, 1214, 997, 286, 3270, 286, 2758, 20288, 311, 12138, 33, 2843, 271, 286, 3494, 198, 286, 11556, 7233, 286, 6587, 25, 6587, 315, 955, 314, 10014, 25, 7419, 4877, 633, 286, 26379, 198, 286, 90238, 286, 12382, 7061, 284, 12138, 33, 2843, 6628, 7790, 340, 286, 12382, 7061, 673, 32798, 746, 286, 5473, 87160, 1481, 847, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2318, 12803, 260, 364, 19521, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 66, 23, 12803, 260, 364, 18964, 9994, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2421, 12803, 260, 364, 15802, 301, 10039, 10329, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 23267, 2166, 12803, 260, 364, 4238, 10539, 1232, 366, 1726, 62026, 7237, 520, 220, 15, 87, 22, 69, 16, 67, 22418, 24472, 2166, 32396, 286, 3270, 286, 12773, 5469, 284, 659, 3272, 673, 40911, 5469, 746, 286, 12773, 5469, 10838, 4962, 28604, 865, 25, 865, 46321, 340, 286, 7419, 9556, 284, 5731, 286, 369, 12773, 67, 304, 12773, 5469, 512, 310, 7419, 9556, 58, 4777, 67, 46321, 60, 284, 67755, 93442, 1214, 21216, 11, 330, 13963, 691, 7237, 1158, 310, 67755, 93442, 7, 18881, 9556, 58, 4777, 67, 46321, 1145, 330, 32002, 1865, 1342, 284, 12773, 67, 46321, 198, 310, 369, 1716, 304, 10839, 1361, 15720, 52393, 3530, 15, 11184, 16, 22953, 394, 67755, 93442, 7, 18881, 9556, 58, 4777, 67, 46321, 1145, 330, 38, 68057, 1865, 1342, 284, 1716, 271, 286, 471, 7419, 9556, 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 ]
dhermes/bezier
scripts/post_process_journal.py
post_process_travis_macos
def post_process_travis_macos(journal_filename): """Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file. """ travis_build_dir = os.environ.get("TRAVIS_BUILD_DIR", "") with open(journal_filename, "r") as file_obj: content = file_obj.read() processed = content.replace(travis_build_dir, "${TRAVIS_BUILD_DIR}") with open(journal_filename, "w") as file_obj: file_obj.write(processed)
python
def post_process_travis_macos(journal_filename): """Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file. """ travis_build_dir = os.environ.get("TRAVIS_BUILD_DIR", "") with open(journal_filename, "r") as file_obj: content = file_obj.read() processed = content.replace(travis_build_dir, "${TRAVIS_BUILD_DIR}") with open(journal_filename, "w") as file_obj: file_obj.write(processed)
[ "def", "post_process_travis_macos", "(", "journal_filename", ")", ":", "travis_build_dir", "=", "os", ".", "environ", ".", "get", "(", "\"TRAVIS_BUILD_DIR\"", ",", "\"\"", ")", "with", "open", "(", "journal_filename", ",", "\"r\"", ")", "as", "file_obj", ":", "content", "=", "file_obj", ".", "read", "(", ")", "processed", "=", "content", ".", "replace", "(", "travis_build_dir", ",", "\"${TRAVIS_BUILD_DIR}\"", ")", "with", "open", "(", "journal_filename", ",", "\"w\"", ")", "as", "file_obj", ":", "file_obj", ".", "write", "(", "processed", ")" ]
Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file.
[ "Post", "-", "process", "a", "generated", "journal", "file", "on", "Travis", "macOS", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/post_process_journal.py#L23-L34
<|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: Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file. ### Response: def post_process_travis_macos(journal_filename): """Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file. """ travis_build_dir = os.environ.get("TRAVIS_BUILD_DIR", "") with open(journal_filename, "r") as file_obj: content = file_obj.read() processed = content.replace(travis_build_dir, "${TRAVIS_BUILD_DIR}") with open(journal_filename, "w") as file_obj: file_obj.write(processed) <|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, 4226, 51194, 264, 8066, 8486, 1052, 389, 41810, 68278, 382, 262, 18161, 512, 286, 8486, 13626, 320, 496, 1680, 578, 836, 315, 279, 8486, 1052, 382, 14711, 6075, 512, 755, 1772, 11557, 3631, 23156, 23647, 437, 3406, 5036, 13626, 997, 262, 4304, 4226, 51194, 264, 8066, 8486, 1052, 389, 41810, 68278, 382, 262, 18161, 512, 286, 8486, 13626, 320, 496, 1680, 578, 836, 315, 279, 8486, 1052, 627, 262, 3270, 262, 10346, 285, 21465, 4432, 284, 2709, 24656, 673, 446, 2434, 99816, 38591, 8455, 498, 15018, 262, 449, 1825, 3406, 5036, 13626, 11, 330, 81, 909, 439, 1052, 7478, 512, 286, 2262, 284, 1052, 7478, 4217, 746, 262, 15590, 284, 2262, 7125, 7779, 23156, 21465, 4432, 11, 11094, 2434, 99816, 38591, 8455, 14790, 262, 449, 1825, 3406, 5036, 13626, 11, 330, 86, 909, 439, 1052, 7478, 512, 286, 1052, 7478, 3921, 22693, 291, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 4226, 51194, 264, 8066, 8486, 1052, 389, 41810, 68278, 382, 262, 18161, 512, 286, 8486, 13626, 320, 496, 1680, 578, 836, 315, 279, 8486, 1052, 382, 14711, 6075, 512, 755, 1772, 11557, 3631, 23156, 23647, 437, 3406, 5036, 13626, 997, 262, 4304, 4226, 51194, 264, 8066, 8486, 1052, 389, 41810, 68278, 382, 262, 18161, 512, 286, 8486, 13626, 320, 496, 1680, 578, 836, 315, 279, 8486, 1052, 627, 262, 3270, 262, 10346, 285, 21465, 4432, 284, 2709, 24656, 673, 446, 2434, 99816, 38591, 8455, 498, 15018, 262, 449, 1825, 3406, 5036, 13626, 11, 330, 81, 909, 439, 1052, 7478, 512, 286, 2262, 284, 1052, 7478, 4217, 746, 262, 15590, 284, 2262, 7125, 7779, 23156, 21465, 4432, 11, 11094, 2434, 99816, 38591, 8455, 14790, 262, 449, 1825, 3406, 5036, 13626, 11, 330, 86, 909, 439, 1052, 7478, 512, 286, 1052, 7478, 3921, 22693, 291, 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 ]
src-d/lookout-sdk
python/lookout/sdk/grpc/log_fields.py
LogFieldsContext.pack_metadata
def pack_metadata(self) -> List[Tuple[str, Any]]: """Packs the log fields and the invocation metadata into a new metadata The log fields are added in the new metadata with the key `LOG_FIELDS_KEY_META`. """ metadata = [(k, v) for k, v in self._invocation_metadata.items() if k != LOG_FIELDS_KEY_META] metadata.append((LOG_FIELDS_KEY_META, self._log_fields.dumps())) return metadata
python
def pack_metadata(self) -> List[Tuple[str, Any]]: """Packs the log fields and the invocation metadata into a new metadata The log fields are added in the new metadata with the key `LOG_FIELDS_KEY_META`. """ metadata = [(k, v) for k, v in self._invocation_metadata.items() if k != LOG_FIELDS_KEY_META] metadata.append((LOG_FIELDS_KEY_META, self._log_fields.dumps())) return metadata
[ "def", "pack_metadata", "(", "self", ")", "->", "List", "[", "Tuple", "[", "str", ",", "Any", "]", "]", ":", "metadata", "=", "[", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "self", ".", "_invocation_metadata", ".", "items", "(", ")", "if", "k", "!=", "LOG_FIELDS_KEY_META", "]", "metadata", ".", "append", "(", "(", "LOG_FIELDS_KEY_META", ",", "self", ".", "_log_fields", ".", "dumps", "(", ")", ")", ")", "return", "metadata" ]
Packs the log fields and the invocation metadata into a new metadata The log fields are added in the new metadata with the key `LOG_FIELDS_KEY_META`.
[ "Packs", "the", "log", "fields", "and", "the", "invocation", "metadata", "into", "a", "new", "metadata" ]
train
https://github.com/src-d/lookout-sdk/blob/2ca64a77b022864fed3bb31d12997712c7e98e6e/python/lookout/sdk/grpc/log_fields.py#L53-L63
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Packs the log fields and the invocation metadata into a new metadata The log fields are added in the new metadata with the key `LOG_FIELDS_KEY_META`. ### Response: def pack_metadata(self) -> List[Tuple[str, Any]]: """Packs the log fields and the invocation metadata into a new metadata The log fields are added in the new metadata with the key `LOG_FIELDS_KEY_META`. """ metadata = [(k, v) for k, v in self._invocation_metadata.items() if k != LOG_FIELDS_KEY_META] metadata.append((LOG_FIELDS_KEY_META, self._log_fields.dumps())) return metadata <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 47, 7977, 279, 1515, 5151, 323, 279, 29796, 11408, 1139, 264, 502, 11408, 271, 286, 578, 1515, 5151, 527, 3779, 304, 279, 502, 11408, 449, 279, 1401, 198, 286, 1595, 7391, 54099, 6738, 60936, 63438, 14711, 6075, 512, 755, 3854, 23012, 1214, 8, 1492, 1796, 20961, 6189, 17752, 11, 5884, 84420, 286, 4304, 47, 7977, 279, 1515, 5151, 323, 279, 29796, 11408, 1139, 264, 502, 11408, 271, 286, 578, 1515, 5151, 527, 3779, 304, 279, 502, 11408, 449, 279, 1401, 198, 286, 1595, 7391, 54099, 6738, 60936, 63438, 286, 3270, 286, 11408, 284, 18305, 74, 11, 348, 8, 369, 597, 11, 348, 304, 659, 1462, 14386, 2328, 23012, 9812, 746, 504, 422, 597, 976, 8241, 54099, 6738, 60936, 933, 286, 11408, 2102, 1209, 7391, 54099, 6738, 60936, 11, 659, 1462, 848, 12406, 22252, 12419, 286, 471, 11408, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 47, 7977, 279, 1515, 5151, 323, 279, 29796, 11408, 1139, 264, 502, 11408, 271, 286, 578, 1515, 5151, 527, 3779, 304, 279, 502, 11408, 449, 279, 1401, 198, 286, 1595, 7391, 54099, 6738, 60936, 63438, 14711, 6075, 512, 755, 3854, 23012, 1214, 8, 1492, 1796, 20961, 6189, 17752, 11, 5884, 84420, 286, 4304, 47, 7977, 279, 1515, 5151, 323, 279, 29796, 11408, 1139, 264, 502, 11408, 271, 286, 578, 1515, 5151, 527, 3779, 304, 279, 502, 11408, 449, 279, 1401, 198, 286, 1595, 7391, 54099, 6738, 60936, 63438, 286, 3270, 286, 11408, 284, 18305, 74, 11, 348, 8, 369, 597, 11, 348, 304, 659, 1462, 14386, 2328, 23012, 9812, 746, 504, 422, 597, 976, 8241, 54099, 6738, 60936, 933, 286, 11408, 2102, 1209, 7391, 54099, 6738, 60936, 11, 659, 1462, 848, 12406, 22252, 12419, 286, 471, 11408, 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 ]
gwastro/pycbc
pycbc/types/array.py
Array._return
def _return(self, ary): """Wrap the ary to return an Array type """ if isinstance(ary, Array): return ary return Array(ary, copy=False)
python
def _return(self, ary): """Wrap the ary to return an Array type """ if isinstance(ary, Array): return ary return Array(ary, copy=False)
[ "def", "_return", "(", "self", ",", "ary", ")", ":", "if", "isinstance", "(", "ary", ",", "Array", ")", ":", "return", "ary", "return", "Array", "(", "ary", ",", "copy", "=", "False", ")" ]
Wrap the ary to return an Array type
[ "Wrap", "the", "ary", "to", "return", "an", "Array", "type" ]
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/types/array.py#L238-L242
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Wrap the ary to return an Array type ### Response: def _return(self, ary): """Wrap the ary to return an Array type """ if isinstance(ary, Array): return ary return Array(ary, copy=False) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 27885, 279, 74021, 311, 471, 459, 2982, 955, 271, 14711, 6075, 512, 755, 721, 693, 1214, 11, 74021, 997, 286, 4304, 27885, 279, 74021, 311, 471, 459, 2982, 955, 3270, 286, 422, 11656, 7, 661, 11, 2982, 997, 310, 471, 74021, 198, 286, 471, 2982, 7, 661, 11, 3048, 5725, 340, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 27885, 279, 74021, 311, 471, 459, 2982, 955, 271, 14711, 6075, 512, 755, 721, 693, 1214, 11, 74021, 997, 286, 4304, 27885, 279, 74021, 311, 471, 459, 2982, 955, 3270, 286, 422, 11656, 7, 661, 11, 2982, 997, 310, 471, 74021, 198, 286, 471, 2982, 7, 661, 11, 3048, 5725, 340, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
Kronuz/pyScss
scss/compiler.py
Compilation._at_variables
def _at_variables(self, calculator, rule, scope, block): """ Implements @variables and @vars """ warn_deprecated( rule, "@variables and @vars are deprecated. " "Just assign variables at top-level.") _rule = rule.copy() _rule.unparsed_contents = block.unparsed_contents _rule.namespace = rule.namespace _rule.properties = [] self.manage_children(_rule, scope)
python
def _at_variables(self, calculator, rule, scope, block): """ Implements @variables and @vars """ warn_deprecated( rule, "@variables and @vars are deprecated. " "Just assign variables at top-level.") _rule = rule.copy() _rule.unparsed_contents = block.unparsed_contents _rule.namespace = rule.namespace _rule.properties = [] self.manage_children(_rule, scope)
[ "def", "_at_variables", "(", "self", ",", "calculator", ",", "rule", ",", "scope", ",", "block", ")", ":", "warn_deprecated", "(", "rule", ",", "\"@variables and @vars are deprecated. \"", "\"Just assign variables at top-level.\"", ")", "_rule", "=", "rule", ".", "copy", "(", ")", "_rule", ".", "unparsed_contents", "=", "block", ".", "unparsed_contents", "_rule", ".", "namespace", "=", "rule", ".", "namespace", "_rule", ".", "properties", "=", "[", "]", "self", ".", "manage_children", "(", "_rule", ",", "scope", ")" ]
Implements @variables and @vars
[ "Implements" ]
train
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/compiler.py#L1011-L1023
<|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: Implements @variables and @vars ### Response: def _at_variables(self, calculator, rule, scope, block): """ Implements @variables and @vars """ warn_deprecated( rule, "@variables and @vars are deprecated. " "Just assign variables at top-level.") _rule = rule.copy() _rule.unparsed_contents = block.unparsed_contents _rule.namespace = rule.namespace _rule.properties = [] self.manage_children(_rule, scope) <|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, 1453, 4779, 571, 19129, 323, 571, 15742, 271, 14711, 6075, 512, 755, 721, 266, 29282, 1214, 11, 31052, 11, 6037, 11, 7036, 11, 2565, 997, 286, 3270, 286, 51060, 571, 19129, 323, 571, 15742, 198, 286, 3270, 286, 8985, 2310, 20483, 1021, 310, 6037, 345, 310, 8594, 19129, 323, 571, 15742, 527, 32690, 13, 220, 6360, 310, 330, 10156, 9993, 7482, 520, 1948, 11852, 13352, 286, 721, 13233, 284, 6037, 12511, 746, 286, 721, 13233, 6441, 42130, 17096, 284, 2565, 6441, 42130, 17096, 198, 286, 721, 13233, 51509, 284, 6037, 51509, 198, 286, 721, 13233, 21661, 284, 4260, 286, 659, 51921, 32306, 2551, 13233, 11, 7036, 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 ]
[ 1, 1, 1, 1,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1453, 4779, 571, 19129, 323, 571, 15742, 271, 14711, 6075, 512, 755, 721, 266, 29282, 1214, 11, 31052, 11, 6037, 11, 7036, 11, 2565, 997, 286, 3270, 286, 51060, 571, 19129, 323, 571, 15742, 198, 286, 3270, 286, 8985, 2310, 20483, 1021, 310, 6037, 345, 310, 8594, 19129, 323, 571, 15742, 527, 32690, 13, 220, 6360, 310, 330, 10156, 9993, 7482, 520, 1948, 11852, 13352, 286, 721, 13233, 284, 6037, 12511, 746, 286, 721, 13233, 6441, 42130, 17096, 284, 2565, 6441, 42130, 17096, 198, 286, 721, 13233, 51509, 284, 6037, 51509, 198, 286, 721, 13233, 21661, 284, 4260, 286, 659, 51921, 32306, 2551, 13233, 11, 7036, 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 ]
yamins81/tabular
tabular/io.py
parsetypes
def parsetypes(dtype): """ Parse the types from a structured numpy dtype object. Return list of string representations of types from a structured numpy dtype object, e.g. ['int', 'float', 'str']. Used by :func:`tabular.io.saveSV` to write out type information in the header. **Parameters** **dtype** : numpy dtype object Structured numpy dtype object to parse. **Returns** **out** : list of strings List of strings corresponding to numpy types:: [dtype[i].name.strip('1234567890').rstrip('ing') \ for i in range(len(dtype))] """ return [dtype[i].name.strip('1234567890').rstrip('ing') for i in range(len(dtype))]
python
def parsetypes(dtype): """ Parse the types from a structured numpy dtype object. Return list of string representations of types from a structured numpy dtype object, e.g. ['int', 'float', 'str']. Used by :func:`tabular.io.saveSV` to write out type information in the header. **Parameters** **dtype** : numpy dtype object Structured numpy dtype object to parse. **Returns** **out** : list of strings List of strings corresponding to numpy types:: [dtype[i].name.strip('1234567890').rstrip('ing') \ for i in range(len(dtype))] """ return [dtype[i].name.strip('1234567890').rstrip('ing') for i in range(len(dtype))]
[ "def", "parsetypes", "(", "dtype", ")", ":", "return", "[", "dtype", "[", "i", "]", ".", "name", ".", "strip", "(", "'1234567890'", ")", ".", "rstrip", "(", "'ing'", ")", "for", "i", "in", "range", "(", "len", "(", "dtype", ")", ")", "]" ]
Parse the types from a structured numpy dtype object. Return list of string representations of types from a structured numpy dtype object, e.g. ['int', 'float', 'str']. Used by :func:`tabular.io.saveSV` to write out type information in the header. **Parameters** **dtype** : numpy dtype object Structured numpy dtype object to parse. **Returns** **out** : list of strings List of strings corresponding to numpy types:: [dtype[i].name.strip('1234567890').rstrip('ing') \ for i in range(len(dtype))]
[ "Parse", "the", "types", "from", "a", "structured", "numpy", "dtype", "object", "." ]
train
https://github.com/yamins81/tabular/blob/1caf091c8c395960a9ad7078f95158b533cc52dd/tabular/io.py#L1808-L1835
<|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 types from a structured numpy dtype object. Return list of string representations of types from a structured numpy dtype object, e.g. ['int', 'float', 'str']. Used by :func:`tabular.io.saveSV` to write out type information in the header. **Parameters** **dtype** : numpy dtype object Structured numpy dtype object to parse. **Returns** **out** : list of strings List of strings corresponding to numpy types:: [dtype[i].name.strip('1234567890').rstrip('ing') \ for i in range(len(dtype))] ### Response: def parsetypes(dtype): """ Parse the types from a structured numpy dtype object. Return list of string representations of types from a structured numpy dtype object, e.g. ['int', 'float', 'str']. Used by :func:`tabular.io.saveSV` to write out type information in the header. **Parameters** **dtype** : numpy dtype object Structured numpy dtype object to parse. **Returns** **out** : list of strings List of strings corresponding to numpy types:: [dtype[i].name.strip('1234567890').rstrip('ing') \ for i in range(len(dtype))] """ return [dtype[i].name.strip('1234567890').rstrip('ing') for i in range(len(dtype))] <|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, 4595, 505, 264, 34030, 8760, 13534, 1665, 382, 262, 3494, 1160, 315, 925, 44713, 315, 4595, 505, 264, 34030, 8760, 720, 262, 13534, 1665, 11, 384, 1326, 13, 2570, 396, 518, 364, 3733, 518, 364, 496, 663, 382, 262, 12477, 555, 551, 2900, 19258, 6323, 1299, 4340, 5799, 18282, 63, 311, 3350, 704, 955, 2038, 304, 279, 720, 262, 4342, 382, 262, 3146, 9905, 57277, 286, 3146, 48827, 334, 551, 220, 8760, 13534, 1665, 271, 310, 16531, 3149, 8760, 13534, 1665, 311, 4820, 382, 262, 3146, 16851, 57277, 286, 3146, 412, 334, 551, 220, 1160, 315, 9246, 271, 310, 1796, 315, 9246, 12435, 311, 8760, 4595, 66152, 394, 510, 48827, 1004, 948, 609, 17624, 493, 4513, 10961, 16474, 15, 1861, 71498, 493, 287, 873, 1144, 720, 338, 369, 602, 304, 2134, 7046, 56850, 595, 2595, 14711, 6075, 512, 755, 1370, 751, 1842, 56850, 997, 262, 3270, 262, 15118, 279, 4595, 505, 264, 34030, 8760, 13534, 1665, 382, 262, 3494, 1160, 315, 925, 44713, 315, 4595, 505, 264, 34030, 8760, 720, 262, 13534, 1665, 11, 384, 1326, 13, 2570, 396, 518, 364, 3733, 518, 364, 496, 663, 382, 262, 12477, 555, 551, 2900, 19258, 6323, 1299, 4340, 5799, 18282, 63, 311, 3350, 704, 955, 2038, 304, 279, 720, 262, 4342, 382, 262, 3146, 9905, 57277, 286, 3146, 48827, 334, 551, 220, 8760, 13534, 1665, 271, 310, 16531, 3149, 8760, 13534, 1665, 311, 4820, 382, 262, 3146, 16851, 57277, 286, 3146, 412, 334, 551, 220, 1160, 315, 9246, 271, 310, 1796, 315, 9246, 12435, 311, 8760, 4595, 66152, 394, 510, 48827, 1004, 948, 609, 17624, 493, 4513, 10961, 16474, 15, 1861, 71498, 493, 287, 873, 1144, 720, 338, 369, 602, 304, 2134, 7046, 56850, 595, 2595, 262, 3270, 262, 471, 510, 48827, 1004, 948, 609, 17624, 493, 4513, 10961, 16474, 15, 1861, 71498, 493, 287, 873, 720, 310, 369, 602, 304, 2134, 7046, 56850, 23094, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 14802, 279, 4595, 505, 264, 34030, 8760, 13534, 1665, 382, 262, 3494, 1160, 315, 925, 44713, 315, 4595, 505, 264, 34030, 8760, 720, 262, 13534, 1665, 11, 384, 1326, 13, 2570, 396, 518, 364, 3733, 518, 364, 496, 663, 382, 262, 12477, 555, 551, 2900, 19258, 6323, 1299, 4340, 5799, 18282, 63, 311, 3350, 704, 955, 2038, 304, 279, 720, 262, 4342, 382, 262, 3146, 9905, 57277, 286, 3146, 48827, 334, 551, 220, 8760, 13534, 1665, 271, 310, 16531, 3149, 8760, 13534, 1665, 311, 4820, 382, 262, 3146, 16851, 57277, 286, 3146, 412, 334, 551, 220, 1160, 315, 9246, 271, 310, 1796, 315, 9246, 12435, 311, 8760, 4595, 66152, 394, 510, 48827, 1004, 948, 609, 17624, 493, 4513, 10961, 16474, 15, 1861, 71498, 493, 287, 873, 1144, 720, 338, 369, 602, 304, 2134, 7046, 56850, 595, 2595, 14711, 6075, 512, 755, 1370, 751, 1842, 56850, 997, 262, 3270, 262, 15118, 279, 4595, 505, 264, 34030, 8760, 13534, 1665, 382, 262, 3494, 1160, 315, 925, 44713, 315, 4595, 505, 264, 34030, 8760, 720, 262, 13534, 1665, 11, 384, 1326, 13, 2570, 396, 518, 364, 3733, 518, 364, 496, 663, 382, 262, 12477, 555, 551, 2900, 19258, 6323, 1299, 4340, 5799, 18282, 63, 311, 3350, 704, 955, 2038, 304, 279, 720, 262, 4342, 382, 262, 3146, 9905, 57277, 286, 3146, 48827, 334, 551, 220, 8760, 13534, 1665, 271, 310, 16531, 3149, 8760, 13534, 1665, 311, 4820, 382, 262, 3146, 16851, 57277, 286, 3146, 412, 334, 551, 220, 1160, 315, 9246, 271, 310, 1796, 315, 9246, 12435, 311, 8760, 4595, 66152, 394, 510, 48827, 1004, 948, 609, 17624, 493, 4513, 10961, 16474, 15, 1861, 71498, 493, 287, 873, 1144, 720, 338, 369, 602, 304, 2134, 7046, 56850, 595, 2595, 262, 3270, 262, 471, 510, 48827, 1004, 948, 609, 17624, 493, 4513, 10961, 16474, 15, 1861, 71498, 493, 287, 873, 720, 310, 369, 602, 304, 2134, 7046, 56850, 23094, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
janpipek/physt
physt/plotting/vega.py
_create_axes
def _create_axes(hist: HistogramBase, vega: dict, kwargs: dict): """Create axes in the figure.""" xlabel = kwargs.pop("xlabel", hist.axis_names[0]) ylabel = kwargs.pop("ylabel", hist.axis_names[1] if len(hist.axis_names) >= 2 else None) vega["axes"] = [ {"orient": "bottom", "scale": "xscale", "title": xlabel}, {"orient": "left", "scale": "yscale", "title": ylabel} ]
python
def _create_axes(hist: HistogramBase, vega: dict, kwargs: dict): """Create axes in the figure.""" xlabel = kwargs.pop("xlabel", hist.axis_names[0]) ylabel = kwargs.pop("ylabel", hist.axis_names[1] if len(hist.axis_names) >= 2 else None) vega["axes"] = [ {"orient": "bottom", "scale": "xscale", "title": xlabel}, {"orient": "left", "scale": "yscale", "title": ylabel} ]
[ "def", "_create_axes", "(", "hist", ":", "HistogramBase", ",", "vega", ":", "dict", ",", "kwargs", ":", "dict", ")", ":", "xlabel", "=", "kwargs", ".", "pop", "(", "\"xlabel\"", ",", "hist", ".", "axis_names", "[", "0", "]", ")", "ylabel", "=", "kwargs", ".", "pop", "(", "\"ylabel\"", ",", "hist", ".", "axis_names", "[", "1", "]", "if", "len", "(", "hist", ".", "axis_names", ")", ">=", "2", "else", "None", ")", "vega", "[", "\"axes\"", "]", "=", "[", "{", "\"orient\"", ":", "\"bottom\"", ",", "\"scale\"", ":", "\"xscale\"", ",", "\"title\"", ":", "xlabel", "}", ",", "{", "\"orient\"", ":", "\"left\"", ",", "\"scale\"", ":", "\"yscale\"", ",", "\"title\"", ":", "ylabel", "}", "]" ]
Create axes in the figure.
[ "Create", "axes", "in", "the", "figure", "." ]
train
https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/plotting/vega.py#L673-L680
<|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 axes in the figure. ### Response: def _create_axes(hist: HistogramBase, vega: dict, kwargs: dict): """Create axes in the figure.""" xlabel = kwargs.pop("xlabel", hist.axis_names[0]) ylabel = kwargs.pop("ylabel", hist.axis_names[1] if len(hist.axis_names) >= 2 else None) vega["axes"] = [ {"orient": "bottom", "scale": "xscale", "title": xlabel}, {"orient": "left", "scale": "yscale", "title": ylabel} ] <|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, 25776, 304, 279, 7216, 382, 14711, 6075, 512, 755, 721, 3261, 59494, 84061, 25, 83238, 4066, 11, 348, 11437, 25, 6587, 11, 16901, 25, 6587, 997, 262, 4304, 4110, 25776, 304, 279, 7216, 14781, 262, 55878, 284, 16901, 8452, 446, 50815, 498, 13034, 36251, 9366, 58, 15, 2608, 262, 50912, 284, 16901, 8452, 446, 50861, 498, 13034, 36251, 9366, 58, 16, 60, 422, 2479, 84061, 36251, 9366, 8, 2669, 220, 17, 775, 2290, 340, 262, 348, 11437, 1204, 20589, 1365, 284, 2330, 286, 5324, 15226, 794, 330, 15205, 498, 330, 12727, 794, 330, 87, 12727, 498, 330, 2150, 794, 55878, 1613, 286, 5324, 15226, 794, 330, 2414, 498, 330, 12727, 794, 330, 84009, 498, 330, 2150, 794, 50912, 534, 262, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 25776, 304, 279, 7216, 382, 14711, 6075, 512, 755, 721, 3261, 59494, 84061, 25, 83238, 4066, 11, 348, 11437, 25, 6587, 11, 16901, 25, 6587, 997, 262, 4304, 4110, 25776, 304, 279, 7216, 14781, 262, 55878, 284, 16901, 8452, 446, 50815, 498, 13034, 36251, 9366, 58, 15, 2608, 262, 50912, 284, 16901, 8452, 446, 50861, 498, 13034, 36251, 9366, 58, 16, 60, 422, 2479, 84061, 36251, 9366, 8, 2669, 220, 17, 775, 2290, 340, 262, 348, 11437, 1204, 20589, 1365, 284, 2330, 286, 5324, 15226, 794, 330, 15205, 498, 330, 12727, 794, 330, 87, 12727, 498, 330, 2150, 794, 55878, 1613, 286, 5324, 15226, 794, 330, 2414, 498, 330, 12727, 794, 330, 84009, 498, 330, 2150, 794, 50912, 534, 262, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
sethmlarson/virtualbox-python
virtualbox/library.py
IInternalSessionControl.on_network_adapter_change
def on_network_adapter_change(self, network_adapter, change_adapter): """Triggered when settings of a network adapter of the associated virtual machine have changed. in network_adapter of type :class:`INetworkAdapter` in change_adapter of type bool raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ if not isinstance(network_adapter, INetworkAdapter): raise TypeError("network_adapter can only be an instance of type INetworkAdapter") if not isinstance(change_adapter, bool): raise TypeError("change_adapter can only be an instance of type bool") self._call("onNetworkAdapterChange", in_p=[network_adapter, change_adapter])
python
def on_network_adapter_change(self, network_adapter, change_adapter): """Triggered when settings of a network adapter of the associated virtual machine have changed. in network_adapter of type :class:`INetworkAdapter` in change_adapter of type bool raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ if not isinstance(network_adapter, INetworkAdapter): raise TypeError("network_adapter can only be an instance of type INetworkAdapter") if not isinstance(change_adapter, bool): raise TypeError("change_adapter can only be an instance of type bool") self._call("onNetworkAdapterChange", in_p=[network_adapter, change_adapter])
[ "def", "on_network_adapter_change", "(", "self", ",", "network_adapter", ",", "change_adapter", ")", ":", "if", "not", "isinstance", "(", "network_adapter", ",", "INetworkAdapter", ")", ":", "raise", "TypeError", "(", "\"network_adapter can only be an instance of type INetworkAdapter\"", ")", "if", "not", "isinstance", "(", "change_adapter", ",", "bool", ")", ":", "raise", "TypeError", "(", "\"change_adapter can only be an instance of type bool\"", ")", "self", ".", "_call", "(", "\"onNetworkAdapterChange\"", ",", "in_p", "=", "[", "network_adapter", ",", "change_adapter", "]", ")" ]
Triggered when settings of a network adapter of the associated virtual machine have changed. in network_adapter of type :class:`INetworkAdapter` in change_adapter of type bool raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation.
[ "Triggered", "when", "settings", "of", "a", "network", "adapter", "of", "the", "associated", "virtual", "machine", "have", "changed", "." ]
train
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L28324-L28344
<|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: Triggered when settings of a network adapter of the associated virtual machine have changed. in network_adapter of type :class:`INetworkAdapter` in change_adapter of type bool raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. ### Response: def on_network_adapter_change(self, network_adapter, change_adapter): """Triggered when settings of a network adapter of the associated virtual machine have changed. in network_adapter of type :class:`INetworkAdapter` in change_adapter of type bool raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ if not isinstance(network_adapter, INetworkAdapter): raise TypeError("network_adapter can only be an instance of type INetworkAdapter") if not isinstance(change_adapter, bool): raise TypeError("change_adapter can only be an instance of type bool") self._call("onNetworkAdapterChange", in_p=[network_adapter, change_adapter]) <|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, 18423, 291, 994, 5110, 315, 264, 4009, 13253, 315, 279, 198, 286, 5938, 4200, 5780, 617, 5614, 382, 286, 304, 4009, 44782, 315, 955, 551, 1058, 19258, 691, 2404, 6065, 19884, 286, 304, 2349, 44782, 315, 955, 1845, 271, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 89224, 1423, 4077, 310, 9343, 1614, 29034, 5784, 627, 1827, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 1211, 1423, 4077, 310, 9343, 955, 29034, 5784, 382, 14711, 6075, 512, 755, 389, 21640, 44782, 16326, 1214, 11, 4009, 44782, 11, 2349, 44782, 997, 286, 4304, 18423, 291, 994, 5110, 315, 264, 4009, 13253, 315, 279, 198, 286, 5938, 4200, 5780, 617, 5614, 382, 286, 304, 4009, 44782, 315, 955, 551, 1058, 19258, 691, 2404, 6065, 19884, 286, 304, 2349, 44782, 315, 955, 1845, 271, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 89224, 1423, 4077, 310, 9343, 1614, 29034, 5784, 627, 1827, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 1211, 1423, 4077, 310, 9343, 955, 29034, 5784, 627, 1827, 286, 3270, 286, 422, 539, 11656, 47642, 44782, 11, 2006, 2404, 6065, 997, 310, 4933, 26082, 446, 17969, 44782, 649, 1193, 387, 459, 2937, 315, 955, 2006, 2404, 6065, 1158, 286, 422, 539, 11656, 58169, 44782, 11, 1845, 997, 310, 4933, 26082, 446, 3455, 44782, 649, 1193, 387, 459, 2937, 315, 955, 1845, 1158, 286, 659, 1462, 6797, 446, 263, 12600, 6065, 4164, 761, 3909, 304, 623, 5941, 17969, 44782, 11, 2349, 44782, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 18423, 291, 994, 5110, 315, 264, 4009, 13253, 315, 279, 198, 286, 5938, 4200, 5780, 617, 5614, 382, 286, 304, 4009, 44782, 315, 955, 551, 1058, 19258, 691, 2404, 6065, 19884, 286, 304, 2349, 44782, 315, 955, 1845, 271, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 89224, 1423, 4077, 310, 9343, 1614, 29034, 5784, 627, 1827, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 1211, 1423, 4077, 310, 9343, 955, 29034, 5784, 382, 14711, 6075, 512, 755, 389, 21640, 44782, 16326, 1214, 11, 4009, 44782, 11, 2349, 44782, 997, 286, 4304, 18423, 291, 994, 5110, 315, 264, 4009, 13253, 315, 279, 198, 286, 5938, 4200, 5780, 617, 5614, 382, 286, 304, 4009, 44782, 315, 955, 551, 1058, 19258, 691, 2404, 6065, 19884, 286, 304, 2349, 44782, 315, 955, 1845, 271, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 89224, 1423, 4077, 310, 9343, 1614, 29034, 5784, 627, 1827, 286, 25930, 551, 1058, 19258, 53, 1642, 1480, 8087, 1211, 1423, 4077, 310, 9343, 955, 29034, 5784, 627, 1827, 286, 3270, 286, 422, 539, 11656, 47642, 44782, 11, 2006, 2404, 6065, 997, 310, 4933, 26082, 446, 17969, 44782, 649, 1193, 387, 459, 2937, 315, 955, 2006, 2404, 6065, 1158, 286, 422, 539, 11656, 58169, 44782, 11, 1845, 997, 310, 4933, 26082, 446, 3455, 44782, 649, 1193, 387, 459, 2937, 315, 955, 1845, 1158, 286, 659, 1462, 6797, 446, 263, 12600, 6065, 4164, 761, 3909, 304, 623, 5941, 17969, 44782, 11, 2349, 44782, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
datadotworld/data.world-py
datadotworld/client/_swagger/apis/insights_api.py
InsightsApi.get_insight
def get_insight(self, project_owner, project_id, id, **kwargs): """ Retrieve an insight Retrieve an insight. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_insight(project_owner, project_id, id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str project_owner: User name and unique identifier of the creator of a project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `government` is the unique identifier of the owner. (required) :param str project_id: User name and unique identifier of the project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `how-to-add-depth-to-your-data-with-the-us-census-acs` is the unique identifier of the owner. (required) :param str id: Insight unique identifier. (required) :return: InsightSummaryResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.get_insight_with_http_info(project_owner, project_id, id, **kwargs) else: (data) = self.get_insight_with_http_info(project_owner, project_id, id, **kwargs) return data
python
def get_insight(self, project_owner, project_id, id, **kwargs): """ Retrieve an insight Retrieve an insight. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_insight(project_owner, project_id, id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str project_owner: User name and unique identifier of the creator of a project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `government` is the unique identifier of the owner. (required) :param str project_id: User name and unique identifier of the project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `how-to-add-depth-to-your-data-with-the-us-census-acs` is the unique identifier of the owner. (required) :param str id: Insight unique identifier. (required) :return: InsightSummaryResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.get_insight_with_http_info(project_owner, project_id, id, **kwargs) else: (data) = self.get_insight_with_http_info(project_owner, project_id, id, **kwargs) return data
[ "def", "get_insight", "(", "self", ",", "project_owner", ",", "project_id", ",", "id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'callback'", ")", ":", "return", "self", ".", "get_insight_with_http_info", "(", "project_owner", ",", "project_id", ",", "id", ",", "*", "*", "kwargs", ")", "else", ":", "(", "data", ")", "=", "self", ".", "get_insight_with_http_info", "(", "project_owner", ",", "project_id", ",", "id", ",", "*", "*", "kwargs", ")", "return", "data" ]
Retrieve an insight Retrieve an insight. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_insight(project_owner, project_id, id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str project_owner: User name and unique identifier of the creator of a project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `government` is the unique identifier of the owner. (required) :param str project_id: User name and unique identifier of the project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `how-to-add-depth-to-your-data-with-the-us-census-acs` is the unique identifier of the owner. (required) :param str id: Insight unique identifier. (required) :return: InsightSummaryResponse If the method is called asynchronously, returns the request thread.
[ "Retrieve", "an", "insight", "Retrieve", "an", "insight", ".", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "define", "a", "callback", "function", "to", "be", "invoked", "when", "receiving", "the", "response", ".", ">>>", "def", "callback_function", "(", "response", ")", ":", ">>>", "pprint", "(", "response", ")", ">>>", ">>>", "thread", "=", "api", ".", "get_insight", "(", "project_owner", "project_id", "id", "callback", "=", "callback_function", ")" ]
train
https://github.com/datadotworld/data.world-py/blob/ffaeb115f358731ab0b805b0c43b7ff2e3cf0a77/datadotworld/client/_swagger/apis/insights_api.py#L284-L310
<|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 an insight Retrieve an insight. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_insight(project_owner, project_id, id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str project_owner: User name and unique identifier of the creator of a project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `government` is the unique identifier of the owner. (required) :param str project_id: User name and unique identifier of the project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `how-to-add-depth-to-your-data-with-the-us-census-acs` is the unique identifier of the owner. (required) :param str id: Insight unique identifier. (required) :return: InsightSummaryResponse If the method is called asynchronously, returns the request thread. ### Response: def get_insight(self, project_owner, project_id, id, **kwargs): """ Retrieve an insight Retrieve an insight. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_insight(project_owner, project_id, id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str project_owner: User name and unique identifier of the creator of a project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `government` is the unique identifier of the owner. (required) :param str project_id: User name and unique identifier of the project. For example, in the URL: [https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs](https://data.world/government/how-to-add-depth-to-your-data-with-the-us-census-acs), `how-to-add-depth-to-your-data-with-the-us-census-acs` is the unique identifier of the owner. (required) :param str id: Insight unique identifier. (required) :return: InsightSummaryResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.get_insight_with_http_info(project_owner, project_id, id, **kwargs) else: (data) = self.get_insight_with_http_info(project_owner, project_id, id, **kwargs) 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, 88765, 459, 20616, 198, 286, 32662, 459, 20616, 627, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 7124, 264, 1595, 13802, 63, 734, 198, 286, 311, 387, 27979, 994, 12588, 279, 2077, 627, 286, 12382, 711, 4927, 9353, 5802, 997, 286, 12382, 257, 47546, 5802, 340, 286, 3662, 397, 286, 12382, 4617, 284, 6464, 673, 35486, 492, 21855, 30127, 11, 2447, 851, 11, 887, 11, 4927, 28, 13802, 9353, 696, 286, 551, 913, 4927, 734, 25, 578, 4927, 734, 198, 310, 369, 40107, 1715, 13, 320, 13099, 340, 286, 551, 913, 610, 2447, 30127, 25, 2724, 836, 323, 5016, 13110, 315, 279, 20514, 315, 264, 2447, 13, 1789, 3187, 11, 304, 279, 5665, 25, 510, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 9725, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 705, 1595, 87863, 63, 374, 279, 5016, 13110, 315, 279, 6506, 13, 320, 6413, 340, 286, 551, 913, 610, 2447, 851, 25, 2724, 836, 323, 5016, 13110, 315, 279, 2447, 13, 1789, 3187, 11, 304, 279, 5665, 25, 510, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 9725, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 705, 1595, 5269, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 63, 374, 279, 5016, 13110, 315, 279, 6506, 13, 320, 6413, 340, 286, 551, 913, 610, 887, 25, 72071, 5016, 13110, 13, 320, 6413, 340, 286, 551, 693, 25, 72071, 19791, 2647, 198, 338, 1442, 279, 1749, 374, 2663, 68881, 345, 338, 4780, 279, 1715, 4617, 382, 14711, 6075, 512, 755, 636, 35486, 492, 1214, 11, 2447, 30127, 11, 2447, 851, 11, 887, 11, 3146, 9872, 997, 286, 3270, 286, 32662, 459, 20616, 198, 286, 32662, 459, 20616, 627, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 7124, 264, 1595, 13802, 63, 734, 198, 286, 311, 387, 27979, 994, 12588, 279, 2077, 627, 286, 12382, 711, 4927, 9353, 5802, 997, 286, 12382, 257, 47546, 5802, 340, 286, 3662, 397, 286, 12382, 4617, 284, 6464, 673, 35486, 492, 21855, 30127, 11, 2447, 851, 11, 887, 11, 4927, 28, 13802, 9353, 696, 286, 551, 913, 4927, 734, 25, 578, 4927, 734, 198, 310, 369, 40107, 1715, 13, 320, 13099, 340, 286, 551, 913, 610, 2447, 30127, 25, 2724, 836, 323, 5016, 13110, 315, 279, 20514, 315, 264, 2447, 13, 1789, 3187, 11, 304, 279, 5665, 25, 510, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 88765, 459, 20616, 198, 286, 32662, 459, 20616, 627, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 7124, 264, 1595, 13802, 63, 734, 198, 286, 311, 387, 27979, 994, 12588, 279, 2077, 627, 286, 12382, 711, 4927, 9353, 5802, 997, 286, 12382, 257, 47546, 5802, 340, 286, 3662, 397, 286, 12382, 4617, 284, 6464, 673, 35486, 492, 21855, 30127, 11, 2447, 851, 11, 887, 11, 4927, 28, 13802, 9353, 696, 286, 551, 913, 4927, 734, 25, 578, 4927, 734, 198, 310, 369, 40107, 1715, 13, 320, 13099, 340, 286, 551, 913, 610, 2447, 30127, 25, 2724, 836, 323, 5016, 13110, 315, 279, 20514, 315, 264, 2447, 13, 1789, 3187, 11, 304, 279, 5665, 25, 510, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 9725, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 705, 1595, 87863, 63, 374, 279, 5016, 13110, 315, 279, 6506, 13, 320, 6413, 340, 286, 551, 913, 610, 2447, 851, 25, 2724, 836, 323, 5016, 13110, 315, 279, 2447, 13, 1789, 3187, 11, 304, 279, 5665, 25, 510, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 9725, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 705, 1595, 5269, 4791, 19082, 31410, 4791, 53246, 14271, 27281, 10826, 26766, 1824, 13940, 12, 19807, 63, 374, 279, 5016, 13110, 315, 279, 6506, 13, 320, 6413, 340, 286, 551, 913, 610, 887, 25, 72071, 5016, 13110, 13, 320, 6413, 340, 286, 551, 693, 25, 72071, 19791, 2647, 198, 338, 1442, 279, 1749, 374, 2663, 68881, 345, 338, 4780, 279, 1715, 4617, 382, 14711, 6075, 512, 755, 636, 35486, 492, 1214, 11, 2447, 30127, 11, 2447, 851, 11, 887, 11, 3146, 9872, 997, 286, 3270, 286, 32662, 459, 20616, 198, 286, 32662, 459, 20616, 627, 286, 1115, 1749, 3727, 264, 67049, 10339, 1715, 555, 1670, 13, 2057, 1304, 459, 198, 286, 40107, 10339, 1715, 11, 4587, 7124, 264, 1595, 13802, 63, 734, 198, 286, 311, 387, 27979, 994, 12588, 279, 2077, 627, 286, 12382, 711, 4927, 9353, 5802, 997, 286, 12382, 257, 47546, 5802, 340, 286, 3662, 397, 286, 12382, 4617, 284, 6464, 673, 35486, 492, 21855, 30127, 11, 2447, 851, 11, 887, 11, 4927, 28, 13802, 9353, 696, 286, 551, 913, 4927, 734, 25, 578, 4927, 734, 198, 310, 369, 40107, 1715, 13, 320, 13099, 340, 286, 551, 913, 610, 2447, 30127, 25, 2724, 836, 323, 5016, 13110, 315, 279, 20514, 315, 264, 2447, 13, 1789, 3187, 11, 304, 279, 5665, 25, 510, 2485, 1129, 695, 23731, 4951, 26112, 51426, 4791, 19082, 31410 ]
tensorflow/tensor2tensor
tensor2tensor/models/video/next_frame_glow.py
get_cond_latents
def get_cond_latents(all_latents=None, hparams=None): """Get z^{cond}_{t} given z^{1..t-1}. Args: all_latents: list of list of tensors, outer-size equals no.of time_steps-1 inner-size equals hparams.n_levels. hparams: See next_frame_glow_hparams. Returns: cond_latents: conditional latents at time-step t. """ cond_latents = None if hparams.gen_mode == "conditional": if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]: num_cond_latents = (hparams.num_cond_latents + int(hparams.cond_first_frame)) if len(all_latents) >= num_cond_latents: cond_latents = all_latents[-hparams.num_cond_latents:] if hparams.cond_first_frame: cond_latents = [all_latents[0]] + cond_latents elif hparams.latent_dist_encoder in ["pointwise", "conv_lstm"]: if all_latents: cond_latents = all_latents[-1] if hparams.gen_mode == "conditional": global_step = tf.train.get_or_create_global_step() condition = tf.greater(global_step, hparams.pretrain_steps) else: condition = tf.constant(False, dtype=tf.bool) return condition, cond_latents
python
def get_cond_latents(all_latents=None, hparams=None): """Get z^{cond}_{t} given z^{1..t-1}. Args: all_latents: list of list of tensors, outer-size equals no.of time_steps-1 inner-size equals hparams.n_levels. hparams: See next_frame_glow_hparams. Returns: cond_latents: conditional latents at time-step t. """ cond_latents = None if hparams.gen_mode == "conditional": if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]: num_cond_latents = (hparams.num_cond_latents + int(hparams.cond_first_frame)) if len(all_latents) >= num_cond_latents: cond_latents = all_latents[-hparams.num_cond_latents:] if hparams.cond_first_frame: cond_latents = [all_latents[0]] + cond_latents elif hparams.latent_dist_encoder in ["pointwise", "conv_lstm"]: if all_latents: cond_latents = all_latents[-1] if hparams.gen_mode == "conditional": global_step = tf.train.get_or_create_global_step() condition = tf.greater(global_step, hparams.pretrain_steps) else: condition = tf.constant(False, dtype=tf.bool) return condition, cond_latents
[ "def", "get_cond_latents", "(", "all_latents", "=", "None", ",", "hparams", "=", "None", ")", ":", "cond_latents", "=", "None", "if", "hparams", ".", "gen_mode", "==", "\"conditional\"", ":", "if", "hparams", ".", "latent_dist_encoder", "in", "[", "\"conv_net\"", ",", "\"conv3d_net\"", "]", ":", "num_cond_latents", "=", "(", "hparams", ".", "num_cond_latents", "+", "int", "(", "hparams", ".", "cond_first_frame", ")", ")", "if", "len", "(", "all_latents", ")", ">=", "num_cond_latents", ":", "cond_latents", "=", "all_latents", "[", "-", "hparams", ".", "num_cond_latents", ":", "]", "if", "hparams", ".", "cond_first_frame", ":", "cond_latents", "=", "[", "all_latents", "[", "0", "]", "]", "+", "cond_latents", "elif", "hparams", ".", "latent_dist_encoder", "in", "[", "\"pointwise\"", ",", "\"conv_lstm\"", "]", ":", "if", "all_latents", ":", "cond_latents", "=", "all_latents", "[", "-", "1", "]", "if", "hparams", ".", "gen_mode", "==", "\"conditional\"", ":", "global_step", "=", "tf", ".", "train", ".", "get_or_create_global_step", "(", ")", "condition", "=", "tf", ".", "greater", "(", "global_step", ",", "hparams", ".", "pretrain_steps", ")", "else", ":", "condition", "=", "tf", ".", "constant", "(", "False", ",", "dtype", "=", "tf", ".", "bool", ")", "return", "condition", ",", "cond_latents" ]
Get z^{cond}_{t} given z^{1..t-1}. Args: all_latents: list of list of tensors, outer-size equals no.of time_steps-1 inner-size equals hparams.n_levels. hparams: See next_frame_glow_hparams. Returns: cond_latents: conditional latents at time-step t.
[ "Get", "z^", "{", "cond", "}", "_", "{", "t", "}", "given", "z^", "{", "1", "..", "t", "-", "1", "}", "." ]
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/next_frame_glow.py#L150-L179
<|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 z^{cond}_{t} given z^{1..t-1}. Args: all_latents: list of list of tensors, outer-size equals no.of time_steps-1 inner-size equals hparams.n_levels. hparams: See next_frame_glow_hparams. Returns: cond_latents: conditional latents at time-step t. ### Response: def get_cond_latents(all_latents=None, hparams=None): """Get z^{cond}_{t} given z^{1..t-1}. Args: all_latents: list of list of tensors, outer-size equals no.of time_steps-1 inner-size equals hparams.n_levels. hparams: See next_frame_glow_hparams. Returns: cond_latents: conditional latents at time-step t. """ cond_latents = None if hparams.gen_mode == "conditional": if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]: num_cond_latents = (hparams.num_cond_latents + int(hparams.cond_first_frame)) if len(all_latents) >= num_cond_latents: cond_latents = all_latents[-hparams.num_cond_latents:] if hparams.cond_first_frame: cond_latents = [all_latents[0]] + cond_latents elif hparams.latent_dist_encoder in ["pointwise", "conv_lstm"]: if all_latents: cond_latents = all_latents[-1] if hparams.gen_mode == "conditional": global_step = tf.train.get_or_create_global_step() condition = tf.greater(global_step, hparams.pretrain_steps) else: condition = tf.constant(False, dtype=tf.bool) return condition, cond_latents <|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, 1167, 48922, 1321, 52635, 83, 92, 2728, 1167, 48922, 16, 497, 83, 12, 16, 92, 382, 220, 18161, 512, 262, 682, 27266, 812, 25, 1160, 315, 1160, 315, 78187, 345, 338, 16335, 7321, 17239, 912, 10440, 892, 23566, 12, 16, 198, 338, 9358, 7321, 17239, 305, 3603, 1276, 38919, 627, 262, 305, 3603, 25, 3580, 1828, 9106, 1928, 10516, 1552, 3603, 627, 220, 5295, 512, 262, 9955, 27266, 812, 25, 35787, 6987, 812, 520, 892, 30308, 259, 382, 14711, 6075, 512, 755, 636, 25437, 27266, 812, 21013, 27266, 812, 5980, 11, 305, 3603, 5980, 997, 220, 4304, 1991, 1167, 48922, 1321, 52635, 83, 92, 2728, 1167, 48922, 16, 497, 83, 12, 16, 92, 382, 220, 18161, 512, 262, 682, 27266, 812, 25, 1160, 315, 1160, 315, 78187, 345, 338, 16335, 7321, 17239, 912, 10440, 892, 23566, 12, 16, 198, 338, 9358, 7321, 17239, 305, 3603, 1276, 38919, 627, 262, 305, 3603, 25, 3580, 1828, 9106, 1928, 10516, 1552, 3603, 627, 220, 5295, 512, 262, 9955, 27266, 812, 25, 35787, 6987, 812, 520, 892, 30308, 259, 627, 220, 3270, 220, 9955, 27266, 812, 284, 2290, 198, 220, 422, 305, 3603, 23668, 7450, 624, 330, 46468, 4764, 262, 422, 305, 3603, 29731, 306, 16416, 40168, 304, 4482, 12296, 20301, 498, 330, 12296, 18, 67, 20301, 34834, 415, 1661, 25437, 27266, 812, 284, 320, 71, 3603, 10744, 25437, 27266, 812, 3694, 3586, 528, 3283, 3603, 93739, 13275, 9106, 1192, 415, 422, 2479, 21013, 27266, 812, 8, 2669, 1661, 25437, 27266, 812, 512, 286, 9955, 27266, 812, 284, 682, 27266, 812, 7764, 71, 3603, 10744, 25437, 27266, 812, 25106, 286, 422, 305, 3603, 93739, 13275, 9106, 512, 692, 9955, 27266, 812, 284, 510, 543, 27266, 812, 58, 15, 5163, 489, 9955, 27266, 812, 198, 262, 4508, 305, 3603, 29731, 306, 16416, 40168, 304, 4482, 2837, 4583, 498, 330, 12296, 97497, 34834, 415, 422, 682, 27266, 812, 512, 286, 9955, 27266, 812, 284, 682, 27266, 812, 7764, 16, 2595, 220, 422, 305, 3603, 23668, 7450, 624, 330, 46468, 4764, 262, 3728, 12212, 284, 6543, 20226, 673, 8908, 8827, 19854, 12212, 746, 262, 3044, 284, 6543, 1326, 29462, 33051, 12212, 11, 305, 3603, 6357, 10613, 23566, 340, 220, 775, 512, 262, 3044, 284, 6543, 31130, 23852, 11, 13534, 34019, 29891, 340, 220, 471, 3044, 11, 9955, 27266, 812, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1167, 48922, 1321, 52635, 83, 92, 2728, 1167, 48922, 16, 497, 83, 12, 16, 92, 382, 220, 18161, 512, 262, 682, 27266, 812, 25, 1160, 315, 1160, 315, 78187, 345, 338, 16335, 7321, 17239, 912, 10440, 892, 23566, 12, 16, 198, 338, 9358, 7321, 17239, 305, 3603, 1276, 38919, 627, 262, 305, 3603, 25, 3580, 1828, 9106, 1928, 10516, 1552, 3603, 627, 220, 5295, 512, 262, 9955, 27266, 812, 25, 35787, 6987, 812, 520, 892, 30308, 259, 382, 14711, 6075, 512, 755, 636, 25437, 27266, 812, 21013, 27266, 812, 5980, 11, 305, 3603, 5980, 997, 220, 4304, 1991, 1167, 48922, 1321, 52635, 83, 92, 2728, 1167, 48922, 16, 497, 83, 12, 16, 92, 382, 220, 18161, 512, 262, 682, 27266, 812, 25, 1160, 315, 1160, 315, 78187, 345, 338, 16335, 7321, 17239, 912, 10440, 892, 23566, 12, 16, 198, 338, 9358, 7321, 17239, 305, 3603, 1276, 38919, 627, 262, 305, 3603, 25, 3580, 1828, 9106, 1928, 10516, 1552, 3603, 627, 220, 5295, 512, 262, 9955, 27266, 812, 25, 35787, 6987, 812, 520, 892, 30308, 259, 627, 220, 3270, 220, 9955, 27266, 812, 284, 2290, 198, 220, 422, 305, 3603, 23668, 7450, 624, 330, 46468, 4764, 262, 422, 305, 3603, 29731, 306, 16416, 40168, 304, 4482, 12296, 20301, 498, 330, 12296, 18, 67, 20301, 34834, 415, 1661, 25437, 27266, 812, 284, 320, 71, 3603, 10744, 25437, 27266, 812, 3694, 3586, 528, 3283, 3603, 93739, 13275, 9106, 1192, 415, 422, 2479, 21013, 27266, 812, 8, 2669, 1661, 25437, 27266, 812, 512, 286, 9955, 27266, 812, 284, 682, 27266, 812, 7764, 71, 3603, 10744, 25437, 27266, 812, 25106, 286, 422, 305, 3603, 93739, 13275, 9106, 512, 692, 9955, 27266, 812, 284, 510, 543, 27266, 812, 58, 15, 5163, 489, 9955, 27266, 812, 198, 262, 4508, 305, 3603, 29731, 306, 16416, 40168, 304, 4482, 2837, 4583, 498, 330, 12296, 97497, 34834, 415, 422, 682, 27266, 812, 512, 286, 9955, 27266, 812, 284, 682, 27266, 812, 7764, 16, 2595, 220, 422, 305, 3603, 23668, 7450, 624, 330, 46468, 4764, 262, 3728, 12212, 284, 6543, 20226, 673, 8908, 8827, 19854, 12212, 746, 262, 3044, 284, 6543, 1326, 29462, 33051, 12212, 11, 305, 3603, 6357, 10613, 23566, 340, 220, 775, 512, 262, 3044, 284, 6543, 31130, 23852, 11, 13534, 34019, 29891, 340, 220, 471, 3044, 11, 9955, 27266, 812, 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 ]
openid/python-openid
openid/message.py
Message._fixNS
def _fixNS(self, namespace): """Convert an input value into the internally used values of this object @param namespace: The string or constant to convert @type namespace: str or unicode or BARE_NS or OPENID_NS """ if namespace == OPENID_NS: if self._openid_ns_uri is None: raise UndefinedOpenIDNamespace('OpenID namespace not set') else: namespace = self._openid_ns_uri if namespace != BARE_NS and type(namespace) not in [str, unicode]: raise TypeError( "Namespace must be BARE_NS, OPENID_NS or a string. got %r" % (namespace,)) if namespace != BARE_NS and ':' not in namespace: fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r' warnings.warn(fmt % (namespace,), DeprecationWarning) if namespace == 'sreg': fmt = 'Using %r instead of "sreg" as namespace' warnings.warn(fmt % (SREG_URI,), DeprecationWarning,) return SREG_URI return namespace
python
def _fixNS(self, namespace): """Convert an input value into the internally used values of this object @param namespace: The string or constant to convert @type namespace: str or unicode or BARE_NS or OPENID_NS """ if namespace == OPENID_NS: if self._openid_ns_uri is None: raise UndefinedOpenIDNamespace('OpenID namespace not set') else: namespace = self._openid_ns_uri if namespace != BARE_NS and type(namespace) not in [str, unicode]: raise TypeError( "Namespace must be BARE_NS, OPENID_NS or a string. got %r" % (namespace,)) if namespace != BARE_NS and ':' not in namespace: fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r' warnings.warn(fmt % (namespace,), DeprecationWarning) if namespace == 'sreg': fmt = 'Using %r instead of "sreg" as namespace' warnings.warn(fmt % (SREG_URI,), DeprecationWarning,) return SREG_URI return namespace
[ "def", "_fixNS", "(", "self", ",", "namespace", ")", ":", "if", "namespace", "==", "OPENID_NS", ":", "if", "self", ".", "_openid_ns_uri", "is", "None", ":", "raise", "UndefinedOpenIDNamespace", "(", "'OpenID namespace not set'", ")", "else", ":", "namespace", "=", "self", ".", "_openid_ns_uri", "if", "namespace", "!=", "BARE_NS", "and", "type", "(", "namespace", ")", "not", "in", "[", "str", ",", "unicode", "]", ":", "raise", "TypeError", "(", "\"Namespace must be BARE_NS, OPENID_NS or a string. got %r\"", "%", "(", "namespace", ",", ")", ")", "if", "namespace", "!=", "BARE_NS", "and", "':'", "not", "in", "namespace", ":", "fmt", "=", "'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r'", "warnings", ".", "warn", "(", "fmt", "%", "(", "namespace", ",", ")", ",", "DeprecationWarning", ")", "if", "namespace", "==", "'sreg'", ":", "fmt", "=", "'Using %r instead of \"sreg\" as namespace'", "warnings", ".", "warn", "(", "fmt", "%", "(", "SREG_URI", ",", ")", ",", "DeprecationWarning", ",", ")", "return", "SREG_URI", "return", "namespace" ]
Convert an input value into the internally used values of this object @param namespace: The string or constant to convert @type namespace: str or unicode or BARE_NS or OPENID_NS
[ "Convert", "an", "input", "value", "into", "the", "internally", "used", "values", "of", "this", "object" ]
train
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/message.py#L369-L396
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Convert an input value into the internally used values of this object @param namespace: The string or constant to convert @type namespace: str or unicode or BARE_NS or OPENID_NS ### Response: def _fixNS(self, namespace): """Convert an input value into the internally used values of this object @param namespace: The string or constant to convert @type namespace: str or unicode or BARE_NS or OPENID_NS """ if namespace == OPENID_NS: if self._openid_ns_uri is None: raise UndefinedOpenIDNamespace('OpenID namespace not set') else: namespace = self._openid_ns_uri if namespace != BARE_NS and type(namespace) not in [str, unicode]: raise TypeError( "Namespace must be BARE_NS, OPENID_NS or a string. got %r" % (namespace,)) if namespace != BARE_NS and ':' not in namespace: fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r' warnings.warn(fmt % (namespace,), DeprecationWarning) if namespace == 'sreg': fmt = 'Using %r instead of "sreg" as namespace' warnings.warn(fmt % (SREG_URI,), DeprecationWarning,) return SREG_URI return namespace <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 12281, 459, 1988, 907, 1139, 279, 34167, 1511, 2819, 315, 198, 286, 420, 1665, 271, 286, 571, 913, 4573, 25, 578, 925, 477, 6926, 311, 5625, 198, 286, 571, 1337, 4573, 25, 610, 477, 27169, 477, 426, 4577, 34877, 477, 30941, 926, 34877, 271, 14711, 6075, 512, 755, 721, 5862, 2507, 1214, 11, 4573, 997, 286, 4304, 12281, 459, 1988, 907, 1139, 279, 34167, 1511, 2819, 315, 198, 286, 420, 1665, 271, 286, 571, 913, 4573, 25, 578, 925, 477, 6926, 311, 5625, 198, 286, 571, 1337, 4573, 25, 610, 477, 27169, 477, 426, 4577, 34877, 477, 30941, 926, 34877, 198, 286, 3270, 286, 422, 4573, 624, 30941, 926, 34877, 512, 310, 422, 659, 1462, 49651, 35828, 15943, 374, 2290, 512, 394, 4933, 63470, 5109, 926, 23533, 493, 5109, 926, 4573, 539, 743, 1329, 310, 775, 512, 394, 4573, 284, 659, 1462, 49651, 35828, 15943, 271, 286, 422, 4573, 976, 426, 4577, 34877, 323, 955, 53497, 8, 539, 304, 510, 496, 11, 27169, 10556, 310, 4933, 26082, 1021, 394, 330, 23533, 2011, 387, 426, 4577, 34877, 11, 30941, 926, 34877, 477, 264, 925, 13, 2751, 1034, 81, 702, 394, 1034, 320, 2280, 11, 4489, 286, 422, 4573, 976, 426, 4577, 34877, 323, 37404, 539, 304, 4573, 512, 310, 9055, 284, 364, 5109, 926, 220, 17, 13, 15, 4573, 48316, 61975, 387, 35514, 3957, 13, 25545, 1034, 81, 1270, 310, 19530, 22123, 29297, 1034, 320, 2280, 60664, 4241, 2827, 367, 12358, 696, 310, 422, 4573, 624, 364, 82, 1610, 3730, 394, 9055, 284, 364, 16834, 1034, 81, 4619, 315, 330, 82, 1610, 1, 439, 4573, 1270, 394, 19530, 22123, 29297, 1034, 320, 50, 12450, 23990, 60664, 4241, 2827, 367, 12358, 55245, 394, 471, 328, 12450, 23990, 271, 286, 471, 4573, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 12281, 459, 1988, 907, 1139, 279, 34167, 1511, 2819, 315, 198, 286, 420, 1665, 271, 286, 571, 913, 4573, 25, 578, 925, 477, 6926, 311, 5625, 198, 286, 571, 1337, 4573, 25, 610, 477, 27169, 477, 426, 4577, 34877, 477, 30941, 926, 34877, 271, 14711, 6075, 512, 755, 721, 5862, 2507, 1214, 11, 4573, 997, 286, 4304, 12281, 459, 1988, 907, 1139, 279, 34167, 1511, 2819, 315, 198, 286, 420, 1665, 271, 286, 571, 913, 4573, 25, 578, 925, 477, 6926, 311, 5625, 198, 286, 571, 1337, 4573, 25, 610, 477, 27169, 477, 426, 4577, 34877, 477, 30941, 926, 34877, 198, 286, 3270, 286, 422, 4573, 624, 30941, 926, 34877, 512, 310, 422, 659, 1462, 49651, 35828, 15943, 374, 2290, 512, 394, 4933, 63470, 5109, 926, 23533, 493, 5109, 926, 4573, 539, 743, 1329, 310, 775, 512, 394, 4573, 284, 659, 1462, 49651, 35828, 15943, 271, 286, 422, 4573, 976, 426, 4577, 34877, 323, 955, 53497, 8, 539, 304, 510, 496, 11, 27169, 10556, 310, 4933, 26082, 1021, 394, 330, 23533, 2011, 387, 426, 4577, 34877, 11, 30941, 926, 34877, 477, 264, 925, 13, 2751, 1034, 81, 702, 394, 1034, 320, 2280, 11, 4489, 286, 422, 4573, 976, 426, 4577, 34877, 323, 37404, 539, 304, 4573, 512, 310, 9055, 284, 364, 5109, 926, 220, 17, 13, 15, 4573, 48316, 61975, 387, 35514, 3957, 13, 25545, 1034, 81, 1270, 310, 19530, 22123, 29297, 1034, 320, 2280, 60664, 4241, 2827, 367, 12358, 696, 310, 422, 4573, 624, 364, 82, 1610, 3730, 394, 9055, 284, 364, 16834, 1034, 81, 4619, 315, 330, 82, 1610, 1, 439, 4573, 1270, 394, 19530, 22123, 29297, 1034, 320, 50, 12450, 23990, 60664, 4241, 2827, 367, 12358, 55245, 394, 471, 328, 12450, 23990, 271, 286, 471, 4573, 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 ]
senaite/senaite.core
bika/lims/setuphandlers.py
setup_handler
def setup_handler(context): """SENAITE setup handler """ if context.readDataFile("bika.lims_various.txt") is None: return logger.info("SENAITE setup handler [BEGIN]") portal = context.getSite() # Run Installers remove_default_content(portal) hide_navbar_items(portal) reindex_content_structure(portal) setup_groups(portal) setup_catalog_mappings(portal) setup_core_catalogs(portal) # Setting up all LIMS catalogs defined in catalog folder setup_catalogs(portal, getCatalogDefinitions()) # Run after all catalogs have been setup setup_auditlog_catalog(portal) logger.info("SENAITE setup handler [DONE]")
python
def setup_handler(context): """SENAITE setup handler """ if context.readDataFile("bika.lims_various.txt") is None: return logger.info("SENAITE setup handler [BEGIN]") portal = context.getSite() # Run Installers remove_default_content(portal) hide_navbar_items(portal) reindex_content_structure(portal) setup_groups(portal) setup_catalog_mappings(portal) setup_core_catalogs(portal) # Setting up all LIMS catalogs defined in catalog folder setup_catalogs(portal, getCatalogDefinitions()) # Run after all catalogs have been setup setup_auditlog_catalog(portal) logger.info("SENAITE setup handler [DONE]")
[ "def", "setup_handler", "(", "context", ")", ":", "if", "context", ".", "readDataFile", "(", "\"bika.lims_various.txt\"", ")", "is", "None", ":", "return", "logger", ".", "info", "(", "\"SENAITE setup handler [BEGIN]\"", ")", "portal", "=", "context", ".", "getSite", "(", ")", "# Run Installers", "remove_default_content", "(", "portal", ")", "hide_navbar_items", "(", "portal", ")", "reindex_content_structure", "(", "portal", ")", "setup_groups", "(", "portal", ")", "setup_catalog_mappings", "(", "portal", ")", "setup_core_catalogs", "(", "portal", ")", "# Setting up all LIMS catalogs defined in catalog folder", "setup_catalogs", "(", "portal", ",", "getCatalogDefinitions", "(", ")", ")", "# Run after all catalogs have been setup", "setup_auditlog_catalog", "(", "portal", ")", "logger", ".", "info", "(", "\"SENAITE setup handler [DONE]\"", ")" ]
SENAITE setup handler
[ "SENAITE", "setup", "handler" ]
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/setuphandlers.py#L336-L361
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: SENAITE setup handler ### Response: def setup_handler(context): """SENAITE setup handler """ if context.readDataFile("bika.lims_various.txt") is None: return logger.info("SENAITE setup handler [BEGIN]") portal = context.getSite() # Run Installers remove_default_content(portal) hide_navbar_items(portal) reindex_content_structure(portal) setup_groups(portal) setup_catalog_mappings(portal) setup_core_catalogs(portal) # Setting up all LIMS catalogs defined in catalog folder setup_catalogs(portal, getCatalogDefinitions()) # Run after all catalogs have been setup setup_auditlog_catalog(portal) logger.info("SENAITE setup handler [DONE]") <|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, 937, 7476, 6119, 6642, 7158, 271, 14711, 6075, 512, 755, 6642, 10393, 5491, 997, 262, 4304, 937, 7476, 6119, 6642, 7158, 198, 262, 12713, 262, 422, 2317, 4217, 1061, 1738, 446, 65, 11755, 929, 5861, 4715, 1245, 3996, 909, 374, 2290, 512, 286, 471, 271, 262, 6050, 5506, 446, 937, 7476, 6119, 6642, 7158, 510, 38688, 60, 5240, 262, 24007, 284, 2317, 673, 18060, 2892, 262, 674, 6588, 19796, 388, 198, 262, 4148, 10198, 7647, 21924, 278, 340, 262, 10477, 29333, 2308, 12408, 21924, 278, 340, 262, 312, 1275, 7647, 39383, 21924, 278, 340, 262, 6642, 21833, 21924, 278, 340, 262, 6642, 48410, 85253, 21924, 278, 340, 262, 6642, 15834, 48410, 82, 21924, 278, 696, 262, 674, 20638, 709, 682, 445, 63564, 91385, 4613, 304, 16808, 8695, 198, 262, 6642, 48410, 82, 21924, 278, 11, 636, 42706, 51642, 12647, 262, 674, 6588, 1306, 682, 91385, 617, 1027, 6642, 198, 262, 6642, 85537, 848, 48410, 21924, 278, 696, 262, 6050, 5506, 446, 937, 7476, 6119, 6642, 7158, 510, 71496, 49015, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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,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30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 937, 7476, 6119, 6642, 7158, 271, 14711, 6075, 512, 755, 6642, 10393, 5491, 997, 262, 4304, 937, 7476, 6119, 6642, 7158, 198, 262, 12713, 262, 422, 2317, 4217, 1061, 1738, 446, 65, 11755, 929, 5861, 4715, 1245, 3996, 909, 374, 2290, 512, 286, 471, 271, 262, 6050, 5506, 446, 937, 7476, 6119, 6642, 7158, 510, 38688, 60, 5240, 262, 24007, 284, 2317, 673, 18060, 2892, 262, 674, 6588, 19796, 388, 198, 262, 4148, 10198, 7647, 21924, 278, 340, 262, 10477, 29333, 2308, 12408, 21924, 278, 340, 262, 312, 1275, 7647, 39383, 21924, 278, 340, 262, 6642, 21833, 21924, 278, 340, 262, 6642, 48410, 85253, 21924, 278, 340, 262, 6642, 15834, 48410, 82, 21924, 278, 696, 262, 674, 20638, 709, 682, 445, 63564, 91385, 4613, 304, 16808, 8695, 198, 262, 6642, 48410, 82, 21924, 278, 11, 636, 42706, 51642, 12647, 262, 674, 6588, 1306, 682, 91385, 617, 1027, 6642, 198, 262, 6642, 85537, 848, 48410, 21924, 278, 696, 262, 6050, 5506, 446, 937, 7476, 6119, 6642, 7158, 510, 71496, 49015, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
Microsoft/LightGBM
python-package/lightgbm/basic.py
Dataset.__init_from_list_np2d
def __init_from_list_np2d(self, mats, params_str, ref_dataset): """Initialize data from a list of 2-D numpy matrices.""" ncol = mats[0].shape[1] nrow = np.zeros((len(mats),), np.int32) if mats[0].dtype == np.float64: ptr_data = (ctypes.POINTER(ctypes.c_double) * len(mats))() else: ptr_data = (ctypes.POINTER(ctypes.c_float) * len(mats))() holders = [] type_ptr_data = None for i, mat in enumerate(mats): if len(mat.shape) != 2: raise ValueError('Input numpy.ndarray must be 2 dimensional') if mat.shape[1] != ncol: raise ValueError('Input arrays must have same number of columns') nrow[i] = mat.shape[0] if mat.dtype == np.float32 or mat.dtype == np.float64: mats[i] = np.array(mat.reshape(mat.size), dtype=mat.dtype, copy=False) else: # change non-float data to float data, need to copy mats[i] = np.array(mat.reshape(mat.size), dtype=np.float32) chunk_ptr_data, chunk_type_ptr_data, holder = c_float_array(mats[i]) if type_ptr_data is not None and chunk_type_ptr_data != type_ptr_data: raise ValueError('Input chunks must have same type') ptr_data[i] = chunk_ptr_data type_ptr_data = chunk_type_ptr_data holders.append(holder) self.handle = ctypes.c_void_p() _safe_call(_LIB.LGBM_DatasetCreateFromMats( ctypes.c_int(len(mats)), ctypes.cast(ptr_data, ctypes.POINTER(ctypes.POINTER(ctypes.c_double))), ctypes.c_int(type_ptr_data), nrow.ctypes.data_as(ctypes.POINTER(ctypes.c_int32)), ctypes.c_int(ncol), ctypes.c_int(C_API_IS_ROW_MAJOR), c_str(params_str), ref_dataset, ctypes.byref(self.handle))) return self
python
def __init_from_list_np2d(self, mats, params_str, ref_dataset): """Initialize data from a list of 2-D numpy matrices.""" ncol = mats[0].shape[1] nrow = np.zeros((len(mats),), np.int32) if mats[0].dtype == np.float64: ptr_data = (ctypes.POINTER(ctypes.c_double) * len(mats))() else: ptr_data = (ctypes.POINTER(ctypes.c_float) * len(mats))() holders = [] type_ptr_data = None for i, mat in enumerate(mats): if len(mat.shape) != 2: raise ValueError('Input numpy.ndarray must be 2 dimensional') if mat.shape[1] != ncol: raise ValueError('Input arrays must have same number of columns') nrow[i] = mat.shape[0] if mat.dtype == np.float32 or mat.dtype == np.float64: mats[i] = np.array(mat.reshape(mat.size), dtype=mat.dtype, copy=False) else: # change non-float data to float data, need to copy mats[i] = np.array(mat.reshape(mat.size), dtype=np.float32) chunk_ptr_data, chunk_type_ptr_data, holder = c_float_array(mats[i]) if type_ptr_data is not None and chunk_type_ptr_data != type_ptr_data: raise ValueError('Input chunks must have same type') ptr_data[i] = chunk_ptr_data type_ptr_data = chunk_type_ptr_data holders.append(holder) self.handle = ctypes.c_void_p() _safe_call(_LIB.LGBM_DatasetCreateFromMats( ctypes.c_int(len(mats)), ctypes.cast(ptr_data, ctypes.POINTER(ctypes.POINTER(ctypes.c_double))), ctypes.c_int(type_ptr_data), nrow.ctypes.data_as(ctypes.POINTER(ctypes.c_int32)), ctypes.c_int(ncol), ctypes.c_int(C_API_IS_ROW_MAJOR), c_str(params_str), ref_dataset, ctypes.byref(self.handle))) return self
[ "def", "__init_from_list_np2d", "(", "self", ",", "mats", ",", "params_str", ",", "ref_dataset", ")", ":", "ncol", "=", "mats", "[", "0", "]", ".", "shape", "[", "1", "]", "nrow", "=", "np", ".", "zeros", "(", "(", "len", "(", "mats", ")", ",", ")", ",", "np", ".", "int32", ")", "if", "mats", "[", "0", "]", ".", "dtype", "==", "np", ".", "float64", ":", "ptr_data", "=", "(", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_double", ")", "*", "len", "(", "mats", ")", ")", "(", ")", "else", ":", "ptr_data", "=", "(", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_float", ")", "*", "len", "(", "mats", ")", ")", "(", ")", "holders", "=", "[", "]", "type_ptr_data", "=", "None", "for", "i", ",", "mat", "in", "enumerate", "(", "mats", ")", ":", "if", "len", "(", "mat", ".", "shape", ")", "!=", "2", ":", "raise", "ValueError", "(", "'Input numpy.ndarray must be 2 dimensional'", ")", "if", "mat", ".", "shape", "[", "1", "]", "!=", "ncol", ":", "raise", "ValueError", "(", "'Input arrays must have same number of columns'", ")", "nrow", "[", "i", "]", "=", "mat", ".", "shape", "[", "0", "]", "if", "mat", ".", "dtype", "==", "np", ".", "float32", "or", "mat", ".", "dtype", "==", "np", ".", "float64", ":", "mats", "[", "i", "]", "=", "np", ".", "array", "(", "mat", ".", "reshape", "(", "mat", ".", "size", ")", ",", "dtype", "=", "mat", ".", "dtype", ",", "copy", "=", "False", ")", "else", ":", "# change non-float data to float data, need to copy", "mats", "[", "i", "]", "=", "np", ".", "array", "(", "mat", ".", "reshape", "(", "mat", ".", "size", ")", ",", "dtype", "=", "np", ".", "float32", ")", "chunk_ptr_data", ",", "chunk_type_ptr_data", ",", "holder", "=", "c_float_array", "(", "mats", "[", "i", "]", ")", "if", "type_ptr_data", "is", "not", "None", "and", "chunk_type_ptr_data", "!=", "type_ptr_data", ":", "raise", "ValueError", "(", "'Input chunks must have same type'", ")", "ptr_data", "[", "i", "]", "=", "chunk_ptr_data", "type_ptr_data", "=", "chunk_type_ptr_data", "holders", ".", "append", "(", "holder", ")", "self", ".", "handle", "=", "ctypes", ".", "c_void_p", "(", ")", "_safe_call", "(", "_LIB", ".", "LGBM_DatasetCreateFromMats", "(", "ctypes", ".", "c_int", "(", "len", "(", "mats", ")", ")", ",", "ctypes", ".", "cast", "(", "ptr_data", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_double", ")", ")", ")", ",", "ctypes", ".", "c_int", "(", "type_ptr_data", ")", ",", "nrow", ".", "ctypes", ".", "data_as", "(", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_int32", ")", ")", ",", "ctypes", ".", "c_int", "(", "ncol", ")", ",", "ctypes", ".", "c_int", "(", "C_API_IS_ROW_MAJOR", ")", ",", "c_str", "(", "params_str", ")", ",", "ref_dataset", ",", "ctypes", ".", "byref", "(", "self", ".", "handle", ")", ")", ")", "return", "self" ]
Initialize data from a list of 2-D numpy matrices.
[ "Initialize", "data", "from", "a", "list", "of", "2", "-", "D", "numpy", "matrices", "." ]
train
https://github.com/Microsoft/LightGBM/blob/8d2ec69f4f685b0ab1c4624d59ee2d3287bb3147/python-package/lightgbm/basic.py#L872-L917
<|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: Initialize data from a list of 2-D numpy matrices. ### Response: def __init_from_list_np2d(self, mats, params_str, ref_dataset): """Initialize data from a list of 2-D numpy matrices.""" ncol = mats[0].shape[1] nrow = np.zeros((len(mats),), np.int32) if mats[0].dtype == np.float64: ptr_data = (ctypes.POINTER(ctypes.c_double) * len(mats))() else: ptr_data = (ctypes.POINTER(ctypes.c_float) * len(mats))() holders = [] type_ptr_data = None for i, mat in enumerate(mats): if len(mat.shape) != 2: raise ValueError('Input numpy.ndarray must be 2 dimensional') if mat.shape[1] != ncol: raise ValueError('Input arrays must have same number of columns') nrow[i] = mat.shape[0] if mat.dtype == np.float32 or mat.dtype == np.float64: mats[i] = np.array(mat.reshape(mat.size), dtype=mat.dtype, copy=False) else: # change non-float data to float data, need to copy mats[i] = np.array(mat.reshape(mat.size), dtype=np.float32) chunk_ptr_data, chunk_type_ptr_data, holder = c_float_array(mats[i]) if type_ptr_data is not None and chunk_type_ptr_data != type_ptr_data: raise ValueError('Input chunks must have same type') ptr_data[i] = chunk_ptr_data type_ptr_data = chunk_type_ptr_data holders.append(holder) self.handle = ctypes.c_void_p() _safe_call(_LIB.LGBM_DatasetCreateFromMats( ctypes.c_int(len(mats)), ctypes.cast(ptr_data, ctypes.POINTER(ctypes.POINTER(ctypes.c_double))), ctypes.c_int(type_ptr_data), nrow.ctypes.data_as(ctypes.POINTER(ctypes.c_int32)), ctypes.c_int(ncol), ctypes.c_int(C_API_IS_ROW_MAJOR), c_str(params_str), ref_dataset, ctypes.byref(self.handle))) return self <|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, 10130, 828, 505, 264, 1160, 315, 220, 17, 9607, 8760, 36295, 382, 14711, 6075, 512, 755, 1328, 2381, 5791, 2062, 42860, 17, 67, 1214, 11, 62156, 11, 3712, 2966, 11, 2098, 19536, 997, 286, 4304, 10130, 828, 505, 264, 1160, 315, 220, 17, 9607, 8760, 36295, 14781, 286, 308, 2119, 284, 62156, 58, 15, 948, 12510, 58, 16, 933, 286, 308, 654, 284, 2660, 13064, 1209, 2963, 1278, 1900, 705, 705, 2660, 6537, 843, 340, 286, 422, 62156, 58, 15, 948, 48827, 624, 2660, 16304, 1227, 512, 310, 10295, 1807, 284, 320, 302, 1842, 86073, 16321, 41683, 1842, 522, 25618, 8, 353, 2479, 1278, 1900, 595, 746, 286, 775, 512, 310, 10295, 1807, 284, 320, 302, 1842, 86073, 16321, 41683, 1842, 522, 18047, 8, 353, 2479, 1278, 1900, 595, 2892, 286, 29809, 284, 4260, 286, 955, 4446, 1807, 284, 2290, 271, 286, 369, 602, 11, 5634, 304, 13555, 1278, 1900, 997, 310, 422, 2479, 34497, 7201, 8, 976, 220, 17, 512, 394, 4933, 15764, 493, 2566, 8760, 36649, 2011, 387, 220, 17, 56987, 4713, 310, 422, 5634, 7201, 58, 16, 60, 976, 308, 2119, 512, 394, 4933, 15764, 493, 2566, 18893, 2011, 617, 1890, 1396, 315, 8310, 4713, 310, 308, 654, 1004, 60, 284, 5634, 7201, 58, 15, 2595, 310, 422, 5634, 46855, 624, 2660, 16304, 843, 477, 5634, 46855, 624, 2660, 16304, 1227, 512, 394, 62156, 1004, 60, 284, 2660, 7382, 34497, 23967, 34497, 2546, 705, 13534, 28, 8637, 46855, 11, 3048, 5725, 340, 310, 775, 512, 394, 674, 2349, 2536, 2269, 1261, 828, 311, 2273, 828, 11, 1205, 311, 3048, 198, 394, 62156, 1004, 60, 284, 2660, 7382, 34497, 23967, 34497, 2546, 705, 13534, 17874, 16304, 843, 696, 310, 12143, 4446, 1807, 11, 12143, 1857, 4446, 1807, 11, 12102, 284, 272, 18047, 3943, 1278, 1900, 1004, 2608, 310, 422, 955, 4446, 1807, 374, 539, 2290, 323, 12143, 1857, 4446, 1807, 976, 955, 4446, 1807, 512, 394, 4933, 15764, 493, 2566, 27855, 2011, 617, 1890, 955, 1329, 310, 10295, 1807, 1004, 60, 284, 12143, 4446, 1807, 198, 310, 955, 4446, 1807, 284, 12143, 1857, 4446, 1807, 198, 310, 29809, 2102, 47926, 696, 286, 659, 10341, 284, 49319, 522, 38875, 623, 746, 286, 721, 19193, 13735, 2551, 24778, 1236, 5494, 44, 1586, 8534, 4110, 3915, 44, 1900, 1021, 310, 49319, 522, 4132, 7046, 1278, 1900, 7110, 310, 49319, 36191, 24807, 1807, 11, 49319, 86073, 16321, 41683, 1842, 86073, 16321, 41683, 1842, 522, 25618, 42849, 310, 49319, 522, 4132, 5930, 4446, 1807, 1350, 310, 308, 654, 50564, 1842, 2245, 12162, 41683, 1842, 86073, 16321, 41683, 1842, 522, 4132, 843, 7110, 310, 49319, 522, 4132, 58168, 337, 1350, 310, 49319, 522, 4132, 3100, 11669, 13056, 39989, 53145, 1350, 310, 272, 2966, 9094, 2966, 1350, 310, 2098, 19536, 345, 310, 49319, 19544, 1116, 1214, 10341, 6054, 286, 471, 659, 198, 27, 91, 8862, 728, 428, 91 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10130, 828, 505, 264, 1160, 315, 220, 17, 9607, 8760, 36295, 382, 14711, 6075, 512, 755, 1328, 2381, 5791, 2062, 42860, 17, 67, 1214, 11, 62156, 11, 3712, 2966, 11, 2098, 19536, 997, 286, 4304, 10130, 828, 505, 264, 1160, 315, 220, 17, 9607, 8760, 36295, 14781, 286, 308, 2119, 284, 62156, 58, 15, 948, 12510, 58, 16, 933, 286, 308, 654, 284, 2660, 13064, 1209, 2963, 1278, 1900, 705, 705, 2660, 6537, 843, 340, 286, 422, 62156, 58, 15, 948, 48827, 624, 2660, 16304, 1227, 512, 310, 10295, 1807, 284, 320, 302, 1842, 86073, 16321, 41683, 1842, 522, 25618, 8, 353, 2479, 1278, 1900, 595, 746, 286, 775, 512, 310, 10295, 1807, 284, 320, 302, 1842, 86073, 16321, 41683, 1842, 522, 18047, 8, 353, 2479, 1278, 1900, 595, 2892, 286, 29809, 284, 4260, 286, 955, 4446, 1807, 284, 2290, 271, 286, 369, 602, 11, 5634, 304, 13555, 1278, 1900, 997, 310, 422, 2479, 34497, 7201, 8, 976, 220, 17, 512, 394, 4933, 15764, 493, 2566, 8760, 36649, 2011, 387, 220, 17, 56987, 4713, 310, 422, 5634, 7201, 58, 16, 60, 976, 308, 2119, 512, 394, 4933, 15764, 493, 2566, 18893, 2011, 617, 1890, 1396, 315, 8310, 4713, 310, 308, 654, 1004, 60, 284, 5634, 7201, 58, 15, 2595, 310, 422, 5634, 46855, 624, 2660, 16304, 843, 477, 5634, 46855, 624, 2660, 16304, 1227, 512, 394, 62156, 1004, 60, 284, 2660, 7382, 34497, 23967, 34497, 2546, 705, 13534, 28, 8637, 46855, 11, 3048, 5725, 340, 310, 775, 512, 394, 674, 2349, 2536, 2269, 1261, 828, 311, 2273, 828, 11, 1205, 311, 3048, 198, 394, 62156, 1004, 60, 284, 2660, 7382, 34497, 23967, 34497, 2546, 705, 13534, 17874, 16304, 843, 696, 310, 12143, 4446, 1807, 11, 12143, 1857, 4446, 1807, 11, 12102, 284, 272, 18047, 3943, 1278, 1900, 1004, 2608, 310, 422, 955, 4446, 1807, 374, 539, 2290, 323, 12143, 1857, 4446, 1807, 976, 955, 4446, 1807, 512, 394, 4933, 15764, 493, 2566, 27855, 2011, 617, 1890, 955, 1329, 310, 10295, 1807, 1004, 60, 284, 12143, 4446, 1807, 198, 310, 955, 4446, 1807, 284, 12143, 1857, 4446, 1807, 198, 310, 29809, 2102, 47926, 696, 286, 659, 10341, 284, 49319, 522, 38875, 623, 746, 286, 721, 19193, 13735, 2551, 24778, 1236, 5494, 44, 1586, 8534, 4110, 3915, 44, 1900, 1021, 310, 49319, 522, 4132, 7046, 1278, 1900, 7110, 310, 49319, 36191, 24807, 1807, 11, 49319, 86073, 16321, 41683, 1842, 86073, 16321, 41683, 1842, 522, 25618, 42849, 310, 49319, 522, 4132, 5930, 4446, 1807, 1350, 310, 308, 654, 50564, 1842, 2245, 12162, 41683, 1842, 86073, 16321, 41683, 1842, 522, 4132, 843, 7110, 310, 49319, 522, 4132, 58168, 337, 1350, 310, 49319, 522, 4132, 3100, 11669, 13056, 39989, 53145, 1350, 310, 272, 2966, 9094, 2966, 1350, 310, 2098, 19536, 345, 310, 49319, 19544, 1116, 1214, 10341, 6054, 286, 471, 659, 198, 27, 91, 8862, 728, 428, 91 ]
paylogic/halogen
halogen/types.py
ISOUTCDateTime.format_as_utc
def format_as_utc(self, value): """Format UTC times.""" if isinstance(value, datetime.datetime): if value.tzinfo is not None: value = value.astimezone(pytz.UTC) value = value.replace(microsecond=0) return value.isoformat().replace('+00:00', 'Z')
python
def format_as_utc(self, value): """Format UTC times.""" if isinstance(value, datetime.datetime): if value.tzinfo is not None: value = value.astimezone(pytz.UTC) value = value.replace(microsecond=0) return value.isoformat().replace('+00:00', 'Z')
[ "def", "format_as_utc", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", ":", "if", "value", ".", "tzinfo", "is", "not", "None", ":", "value", "=", "value", ".", "astimezone", "(", "pytz", ".", "UTC", ")", "value", "=", "value", ".", "replace", "(", "microsecond", "=", "0", ")", "return", "value", ".", "isoformat", "(", ")", ".", "replace", "(", "'+00:00'", ",", "'Z'", ")" ]
Format UTC times.
[ "Format", "UTC", "times", "." ]
train
https://github.com/paylogic/halogen/blob/2dec0a67c506d02d1f51915fa7163f59764a0bde/halogen/types.py#L110-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: Format UTC times. ### Response: def format_as_utc(self, value): """Format UTC times.""" if isinstance(value, datetime.datetime): if value.tzinfo is not None: value = value.astimezone(pytz.UTC) value = value.replace(microsecond=0) return value.isoformat().replace('+00:00', 'Z') <|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, 4152, 28503, 3115, 382, 14711, 6075, 512, 755, 3645, 12162, 85359, 1214, 11, 907, 997, 286, 4304, 4152, 28503, 3115, 14781, 286, 422, 11656, 3764, 11, 9050, 20296, 997, 310, 422, 907, 739, 89, 2801, 374, 539, 2290, 512, 394, 907, 284, 907, 46157, 547, 8855, 1319, 16820, 89, 88169, 340, 310, 907, 284, 907, 7125, 1278, 2823, 5686, 28, 15, 340, 286, 471, 907, 65860, 2293, 1020, 8319, 47265, 410, 25, 410, 518, 364, 57, 1329, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 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, 0, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 4152, 28503, 3115, 382, 14711, 6075, 512, 755, 3645, 12162, 85359, 1214, 11, 907, 997, 286, 4304, 4152, 28503, 3115, 14781, 286, 422, 11656, 3764, 11, 9050, 20296, 997, 310, 422, 907, 739, 89, 2801, 374, 539, 2290, 512, 394, 907, 284, 907, 46157, 547, 8855, 1319, 16820, 89, 88169, 340, 310, 907, 284, 907, 7125, 1278, 2823, 5686, 28, 15, 340, 286, 471, 907, 65860, 2293, 1020, 8319, 47265, 410, 25, 410, 518, 364, 57, 1329, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
WZBSocialScienceCenter/tmtoolkit
tmtoolkit/topicmod/visualize.py
plot_topic_word_heatmap
def plot_topic_word_heatmap(fig, ax, topic_word_distrib, vocab, which_topics=None, which_topic_indices=None, which_words=None, which_word_indices=None, xaxislabel=None, yaxislabel=None, **kwargs): """ Plot a heatmap for a topic-word distribution `topic_word_distrib` to a matplotlib Figure `fig` and Axes `ax` using `vocab` as vocabulary on the x-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the y-axis. A subset of words from `vocab` can be specified either directly with a sequence `which_words` or `which_document_indices` containing a sequence of word indices in `vocab`. A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1] Additional arguments can be passed via `kwargs` to `plot_heatmap`. Please note that it is almost always necessary to select a subset of your topic-word distribution with the `which_words` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high to give a reasonable picture. """ if which_topics is not None and which_topic_indices is not None: raise ValueError('only `which_topics` or `which_topic_indices` can be set, not both') if which_words is not None and which_word_indices is not None: raise ValueError('only `which_words` or `which_word_indices` can be set, not both') if which_topics is not None: which_topic_indices = np.array(which_topics) - 1 if which_words is not None: which_word_indices = np.where(np.isin(vocab, which_words))[0] select_distrib_subset = False topic_labels = np.array(range(1, topic_word_distrib.shape[0]+1)) if which_topic_indices is not None: select_distrib_subset = True topic_labels = topic_labels[which_topic_indices] if which_word_indices is not None: select_distrib_subset = True vocab = np.array(vocab)[which_word_indices] if select_distrib_subset: topic_word_distrib = mat2d_window_from_indices(topic_word_distrib, which_topic_indices, which_word_indices) return plot_heatmap(fig, ax, topic_word_distrib, xaxislabel=xaxislabel or 'vocab', yaxislabel=yaxislabel or 'topic', xticklabels=vocab, yticklabels=topic_labels, **kwargs)
python
def plot_topic_word_heatmap(fig, ax, topic_word_distrib, vocab, which_topics=None, which_topic_indices=None, which_words=None, which_word_indices=None, xaxislabel=None, yaxislabel=None, **kwargs): """ Plot a heatmap for a topic-word distribution `topic_word_distrib` to a matplotlib Figure `fig` and Axes `ax` using `vocab` as vocabulary on the x-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the y-axis. A subset of words from `vocab` can be specified either directly with a sequence `which_words` or `which_document_indices` containing a sequence of word indices in `vocab`. A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1] Additional arguments can be passed via `kwargs` to `plot_heatmap`. Please note that it is almost always necessary to select a subset of your topic-word distribution with the `which_words` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high to give a reasonable picture. """ if which_topics is not None and which_topic_indices is not None: raise ValueError('only `which_topics` or `which_topic_indices` can be set, not both') if which_words is not None and which_word_indices is not None: raise ValueError('only `which_words` or `which_word_indices` can be set, not both') if which_topics is not None: which_topic_indices = np.array(which_topics) - 1 if which_words is not None: which_word_indices = np.where(np.isin(vocab, which_words))[0] select_distrib_subset = False topic_labels = np.array(range(1, topic_word_distrib.shape[0]+1)) if which_topic_indices is not None: select_distrib_subset = True topic_labels = topic_labels[which_topic_indices] if which_word_indices is not None: select_distrib_subset = True vocab = np.array(vocab)[which_word_indices] if select_distrib_subset: topic_word_distrib = mat2d_window_from_indices(topic_word_distrib, which_topic_indices, which_word_indices) return plot_heatmap(fig, ax, topic_word_distrib, xaxislabel=xaxislabel or 'vocab', yaxislabel=yaxislabel or 'topic', xticklabels=vocab, yticklabels=topic_labels, **kwargs)
[ "def", "plot_topic_word_heatmap", "(", "fig", ",", "ax", ",", "topic_word_distrib", ",", "vocab", ",", "which_topics", "=", "None", ",", "which_topic_indices", "=", "None", ",", "which_words", "=", "None", ",", "which_word_indices", "=", "None", ",", "xaxislabel", "=", "None", ",", "yaxislabel", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "which_topics", "is", "not", "None", "and", "which_topic_indices", "is", "not", "None", ":", "raise", "ValueError", "(", "'only `which_topics` or `which_topic_indices` can be set, not both'", ")", "if", "which_words", "is", "not", "None", "and", "which_word_indices", "is", "not", "None", ":", "raise", "ValueError", "(", "'only `which_words` or `which_word_indices` can be set, not both'", ")", "if", "which_topics", "is", "not", "None", ":", "which_topic_indices", "=", "np", ".", "array", "(", "which_topics", ")", "-", "1", "if", "which_words", "is", "not", "None", ":", "which_word_indices", "=", "np", ".", "where", "(", "np", ".", "isin", "(", "vocab", ",", "which_words", ")", ")", "[", "0", "]", "select_distrib_subset", "=", "False", "topic_labels", "=", "np", ".", "array", "(", "range", "(", "1", ",", "topic_word_distrib", ".", "shape", "[", "0", "]", "+", "1", ")", ")", "if", "which_topic_indices", "is", "not", "None", ":", "select_distrib_subset", "=", "True", "topic_labels", "=", "topic_labels", "[", "which_topic_indices", "]", "if", "which_word_indices", "is", "not", "None", ":", "select_distrib_subset", "=", "True", "vocab", "=", "np", ".", "array", "(", "vocab", ")", "[", "which_word_indices", "]", "if", "select_distrib_subset", ":", "topic_word_distrib", "=", "mat2d_window_from_indices", "(", "topic_word_distrib", ",", "which_topic_indices", ",", "which_word_indices", ")", "return", "plot_heatmap", "(", "fig", ",", "ax", ",", "topic_word_distrib", ",", "xaxislabel", "=", "xaxislabel", "or", "'vocab'", ",", "yaxislabel", "=", "yaxislabel", "or", "'topic'", ",", "xticklabels", "=", "vocab", ",", "yticklabels", "=", "topic_labels", ",", "*", "*", "kwargs", ")" ]
Plot a heatmap for a topic-word distribution `topic_word_distrib` to a matplotlib Figure `fig` and Axes `ax` using `vocab` as vocabulary on the x-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the y-axis. A subset of words from `vocab` can be specified either directly with a sequence `which_words` or `which_document_indices` containing a sequence of word indices in `vocab`. A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1] Additional arguments can be passed via `kwargs` to `plot_heatmap`. Please note that it is almost always necessary to select a subset of your topic-word distribution with the `which_words` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high to give a reasonable picture.
[ "Plot", "a", "heatmap", "for", "a", "topic", "-", "word", "distribution", "topic_word_distrib", "to", "a", "matplotlib", "Figure", "fig", "and", "Axes", "ax", "using", "vocab", "as", "vocabulary", "on", "the", "x", "-", "axis", "and", "topics", "from", "1", "to", "n_topics", "=", "doc_topic_distrib", ".", "shape", "[", "1", "]", "on", "the", "y", "-", "axis", ".", "A", "subset", "of", "words", "from", "vocab", "can", "be", "specified", "either", "directly", "with", "a", "sequence", "which_words", "or", "which_document_indices", "containing", "a", "sequence", "of", "word", "indices", "in", "vocab", ".", "A", "subset", "of", "topics", "can", "be", "specified", "either", "with", "a", "sequence", "which_topics", "containing", "sequence", "of", "numbers", "between", "[", "1", "n_topics", "]", "or", "which_topic_indices", "which", "is", "a", "number", "between", "[", "0", "n_topics", "-", "1", "]", "Additional", "arguments", "can", "be", "passed", "via", "kwargs", "to", "plot_heatmap", "." ]
train
https://github.com/WZBSocialScienceCenter/tmtoolkit/blob/ca8b9d072e37ccc82b533f47d48bd9755722305b/tmtoolkit/topicmod/visualize.py#L182-L232
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Plot a heatmap for a topic-word distribution `topic_word_distrib` to a matplotlib Figure `fig` and Axes `ax` using `vocab` as vocabulary on the x-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the y-axis. A subset of words from `vocab` can be specified either directly with a sequence `which_words` or `which_document_indices` containing a sequence of word indices in `vocab`. A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1] Additional arguments can be passed via `kwargs` to `plot_heatmap`. Please note that it is almost always necessary to select a subset of your topic-word distribution with the `which_words` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high to give a reasonable picture. ### Response: def plot_topic_word_heatmap(fig, ax, topic_word_distrib, vocab, which_topics=None, which_topic_indices=None, which_words=None, which_word_indices=None, xaxislabel=None, yaxislabel=None, **kwargs): """ Plot a heatmap for a topic-word distribution `topic_word_distrib` to a matplotlib Figure `fig` and Axes `ax` using `vocab` as vocabulary on the x-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the y-axis. A subset of words from `vocab` can be specified either directly with a sequence `which_words` or `which_document_indices` containing a sequence of word indices in `vocab`. A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1] Additional arguments can be passed via `kwargs` to `plot_heatmap`. Please note that it is almost always necessary to select a subset of your topic-word distribution with the `which_words` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high to give a reasonable picture. """ if which_topics is not None and which_topic_indices is not None: raise ValueError('only `which_topics` or `which_topic_indices` can be set, not both') if which_words is not None and which_word_indices is not None: raise ValueError('only `which_words` or `which_word_indices` can be set, not both') if which_topics is not None: which_topic_indices = np.array(which_topics) - 1 if which_words is not None: which_word_indices = np.where(np.isin(vocab, which_words))[0] select_distrib_subset = False topic_labels = np.array(range(1, topic_word_distrib.shape[0]+1)) if which_topic_indices is not None: select_distrib_subset = True topic_labels = topic_labels[which_topic_indices] if which_word_indices is not None: select_distrib_subset = True vocab = np.array(vocab)[which_word_indices] if select_distrib_subset: topic_word_distrib = mat2d_window_from_indices(topic_word_distrib, which_topic_indices, which_word_indices) return plot_heatmap(fig, ax, topic_word_distrib, xaxislabel=xaxislabel or 'vocab', yaxislabel=yaxislabel or 'topic', xticklabels=vocab, yticklabels=topic_labels, **kwargs) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 26687, 264, 97723, 369, 264, 8712, 38428, 8141, 1595, 16816, 13843, 821, 4894, 63, 311, 264, 17220, 19575, 1595, 915, 63, 323, 90804, 1595, 710, 4077, 262, 1701, 1595, 87947, 63, 439, 36018, 389, 279, 865, 36421, 323, 13650, 505, 220, 16, 311, 1595, 77, 65458, 28, 5349, 32514, 821, 4894, 7201, 58, 16, 60, 63, 389, 198, 262, 279, 379, 36421, 627, 262, 362, 27084, 315, 4339, 505, 1595, 87947, 63, 649, 387, 5300, 3060, 6089, 449, 264, 8668, 1595, 8370, 19518, 63, 477, 198, 262, 1595, 8370, 27326, 18839, 63, 8649, 264, 8668, 315, 3492, 15285, 304, 1595, 87947, 19154, 262, 362, 27084, 315, 13650, 649, 387, 5300, 3060, 449, 264, 8668, 1595, 8370, 65458, 63, 8649, 8668, 315, 5219, 1990, 198, 262, 510, 16, 11, 308, 65458, 60, 477, 1595, 8370, 32514, 18839, 63, 902, 374, 264, 1396, 1990, 510, 15, 11, 308, 65458, 12, 16, 933, 262, 24086, 6105, 649, 387, 5946, 4669, 1595, 9872, 63, 311, 1595, 4569, 71081, 2235, 63438, 262, 5321, 5296, 430, 433, 374, 4661, 2744, 5995, 311, 3373, 264, 27084, 315, 701, 8712, 38428, 8141, 449, 279, 198, 262, 1595, 8370, 19518, 63, 477, 1595, 8370, 65458, 63, 5137, 11, 439, 6062, 279, 3392, 315, 828, 311, 387, 68683, 690, 387, 2288, 1579, 198, 262, 311, 3041, 264, 13579, 6945, 382, 14711, 6075, 512, 755, 7234, 32514, 13843, 71081, 2235, 34110, 11, 3944, 11, 8712, 13843, 821, 4894, 11, 24757, 345, 1014, 902, 65458, 5980, 11, 902, 32514, 18839, 5980, 345, 1014, 902, 19518, 5980, 11, 902, 13843, 18839, 5980, 345, 1014, 865, 7332, 1530, 5980, 11, 379, 7332, 1530, 5980, 345, 1014, 3146, 9872, 997, 262, 3270, 262, 27124, 264, 97723, 369, 264, 8712, 38428, 8141, 1595, 16816, 13843, 821, 4894, 63, 311, 264, 17220, 19575, 1595, 915, 63, 323, 90804, 1595, 710, 4077, 262, 1701, 1595, 87947, 63, 439, 36018, 389, 279, 865, 36421, 323, 13650, 505, 220, 16, 311, 1595, 77, 65458, 28, 5349, 32514, 821, 4894, 7201, 58, 16, 60, 63, 389, 198, 262, 279, 379, 36421, 627, 262, 362, 27084, 315, 4339, 505, 1595, 87947, 63, 649, 387, 5300, 3060, 6089, 449, 264, 8668, 1595, 8370, 19518, 63, 477, 198, 262, 1595, 8370, 27326, 18839, 63, 8649, 264, 8668, 315, 3492, 15285, 304, 1595, 87947, 19154, 262, 362, 27084, 315, 13650, 649, 387, 5300, 3060, 449, 264, 8668, 1595, 8370, 65458, 63, 8649, 8668, 315, 5219, 1990, 198, 262, 510, 16, 11, 308, 65458, 60, 477, 1595, 8370, 32514, 18839, 63, 902, 374, 264, 1396, 1990, 510, 15, 11, 308, 65458, 12, 16, 933, 262, 24086, 6105, 649, 387, 5946, 4669, 1595, 9872, 63, 311, 1595, 4569, 71081, 2235, 63438, 262, 5321, 5296, 430, 433, 374, 4661, 2744, 5995, 311, 3373, 264, 27084, 315, 701, 8712, 38428, 8141, 449, 279, 198, 262, 1595, 8370, 19518, 63, 477, 1595, 8370 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 26687, 264, 97723, 369, 264, 8712, 38428, 8141, 1595, 16816, 13843, 821, 4894, 63, 311, 264, 17220, 19575, 1595, 915, 63, 323, 90804, 1595, 710, 4077, 262, 1701, 1595, 87947, 63, 439, 36018, 389, 279, 865, 36421, 323, 13650, 505, 220, 16, 311, 1595, 77, 65458, 28, 5349, 32514, 821, 4894, 7201, 58, 16, 60, 63, 389, 198, 262, 279, 379, 36421, 627, 262, 362, 27084, 315, 4339, 505, 1595, 87947, 63, 649, 387, 5300, 3060, 6089, 449, 264, 8668, 1595, 8370, 19518, 63, 477, 198, 262, 1595, 8370, 27326, 18839, 63, 8649, 264, 8668, 315, 3492, 15285, 304, 1595, 87947, 19154, 262, 362, 27084, 315, 13650, 649, 387, 5300, 3060, 449, 264, 8668, 1595, 8370, 65458, 63, 8649, 8668, 315, 5219, 1990, 198, 262, 510, 16, 11, 308, 65458, 60, 477, 1595, 8370, 32514, 18839, 63, 902, 374, 264, 1396, 1990, 510, 15, 11, 308, 65458, 12, 16, 933, 262, 24086, 6105, 649, 387, 5946, 4669, 1595, 9872, 63, 311, 1595, 4569, 71081, 2235, 63438, 262, 5321, 5296, 430, 433, 374, 4661, 2744, 5995, 311, 3373, 264, 27084, 315, 701, 8712, 38428, 8141, 449, 279, 198, 262, 1595, 8370, 19518, 63, 477, 1595, 8370, 65458, 63, 5137, 11, 439, 6062, 279, 3392, 315, 828, 311, 387, 68683, 690, 387, 2288, 1579, 198, 262, 311, 3041, 264, 13579, 6945, 382, 14711, 6075, 512, 755, 7234, 32514, 13843, 71081, 2235, 34110, 11, 3944, 11, 8712, 13843, 821, 4894, 11, 24757, 345, 1014, 902, 65458, 5980, 11, 902, 32514, 18839, 5980, 345, 1014, 902, 19518, 5980, 11, 902, 13843, 18839, 5980, 345, 1014, 865, 7332, 1530, 5980, 11, 379, 7332, 1530, 5980, 345, 1014, 3146, 9872, 997, 262, 3270, 262, 27124, 264, 97723, 369, 264, 8712, 38428, 8141, 1595, 16816, 13843, 821, 4894, 63, 311, 264, 17220, 19575, 1595, 915, 63, 323, 90804, 1595, 710, 4077, 262, 1701, 1595, 87947, 63, 439, 36018, 389, 279, 865, 36421, 323, 13650, 505, 220, 16, 311, 1595, 77, 65458, 28, 5349, 32514, 821, 4894, 7201, 58, 16, 60, 63, 389, 198, 262, 279, 379, 36421, 627, 262, 362, 27084, 315, 4339, 505, 1595, 87947, 63, 649, 387, 5300, 3060, 6089, 449, 264, 8668, 1595, 8370, 19518, 63, 477, 198, 262, 1595, 8370, 27326, 18839, 63, 8649, 264, 8668, 315, 3492, 15285, 304, 1595, 87947, 19154, 262, 362, 27084, 315, 13650, 649, 387, 5300, 3060, 449, 264, 8668, 1595, 8370, 65458, 63, 8649, 8668, 315, 5219, 1990, 198, 262, 510, 16, 11, 308, 65458, 60, 477, 1595, 8370, 32514, 18839, 63, 902, 374, 264, 1396, 1990, 510, 15, 11, 308, 65458, 12, 16, 933, 262, 24086, 6105, 649, 387, 5946, 4669, 1595, 9872, 63, 311, 1595, 4569, 71081, 2235, 63438, 262, 5321, 5296, 430, 433, 374, 4661, 2744, 5995, 311, 3373, 264, 27084, 315, 701, 8712, 38428, 8141, 449, 279, 198, 262, 1595, 8370, 19518, 63, 477, 1595, 8370 ]
ajk8/microcache
microcache/__init__.py
Microcache.temporarily_disabled
def temporarily_disabled(self): """ Temporarily disable the cache (useful for testing) """ old_setting = self.options.enabled self.disable(clear_cache=False) try: yield finally: self.options.enabled = old_setting
python
def temporarily_disabled(self): """ Temporarily disable the cache (useful for testing) """ old_setting = self.options.enabled self.disable(clear_cache=False) try: yield finally: self.options.enabled = old_setting
[ "def", "temporarily_disabled", "(", "self", ")", ":", "old_setting", "=", "self", ".", "options", ".", "enabled", "self", ".", "disable", "(", "clear_cache", "=", "False", ")", "try", ":", "yield", "finally", ":", "self", ".", "options", ".", "enabled", "=", "old_setting" ]
Temporarily disable the cache (useful for testing)
[ "Temporarily", "disable", "the", "cache", "(", "useful", "for", "testing", ")" ]
train
https://github.com/ajk8/microcache/blob/24876c2c5f8959a806e2701adb7efbf70a87a1ae/microcache/__init__.py#L241-L250
<|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: Temporarily disable the cache (useful for testing) ### Response: def temporarily_disabled(self): """ Temporarily disable the cache (useful for testing) """ old_setting = self.options.enabled self.disable(clear_cache=False) try: yield finally: self.options.enabled = old_setting <|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, 12427, 97254, 11404, 279, 6636, 320, 817, 1285, 369, 7649, 696, 14711, 6075, 512, 755, 28191, 52501, 1214, 997, 286, 3270, 286, 20539, 97254, 11404, 279, 6636, 320, 817, 1285, 369, 7649, 340, 286, 3270, 286, 2362, 20931, 284, 659, 11152, 22929, 198, 286, 659, 43728, 1361, 1576, 11790, 5725, 340, 286, 1456, 512, 310, 7692, 198, 286, 5616, 512, 310, 659, 11152, 22929, 284, 2362, 20931, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 12427, 97254, 11404, 279, 6636, 320, 817, 1285, 369, 7649, 696, 14711, 6075, 512, 755, 28191, 52501, 1214, 997, 286, 3270, 286, 20539, 97254, 11404, 279, 6636, 320, 817, 1285, 369, 7649, 340, 286, 3270, 286, 2362, 20931, 284, 659, 11152, 22929, 198, 286, 659, 43728, 1361, 1576, 11790, 5725, 340, 286, 1456, 512, 310, 7692, 198, 286, 5616, 512, 310, 659, 11152, 22929, 284, 2362, 20931, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
tensorflow/tensor2tensor
tensor2tensor/models/evolved_transformer.py
add_evolved_transformer_hparams
def add_evolved_transformer_hparams(hparams): """Add Evolved Transformer hparams. Note: These are for the Adam optimizer, not the Adafactor optimizer used in the paper. Args: hparams: Current hparams. Returns: hparams updated with Evolved Transformer values. """ # Evolved Transformer "layers" are twice as deep as Transformer, so roughly # halve the number that we use. These numbers are taken from # arxiv.org/abs/1901.11117 . hparams.num_encoder_layers = 3 hparams.num_decoder_layers = 4 # Learning rate and decay scheme that mimics the transformer Adam config, # but with cosine decay instead of rsqrt. hparams.learning_rate_constant /= hparams.learning_rate_warmup_steps ** 0.5 hparams.learning_rate_schedule = ( "constant*linear_warmup*single_cycle_cos_decay*rsqrt_hidden_size") # The current infrastructure does not support exposing # `train_steps` to the decay functions, and so we are hard coding the decay # steps here to match the default number of train steps used in `t2t_trainer`. # TODO(davidso): Thread `train_steps` through to decay functions so we do not # have to worry about a `learning_rate_decay_steps` mismatch. hparams.learning_rate_decay_steps = 250000 return hparams
python
def add_evolved_transformer_hparams(hparams): """Add Evolved Transformer hparams. Note: These are for the Adam optimizer, not the Adafactor optimizer used in the paper. Args: hparams: Current hparams. Returns: hparams updated with Evolved Transformer values. """ # Evolved Transformer "layers" are twice as deep as Transformer, so roughly # halve the number that we use. These numbers are taken from # arxiv.org/abs/1901.11117 . hparams.num_encoder_layers = 3 hparams.num_decoder_layers = 4 # Learning rate and decay scheme that mimics the transformer Adam config, # but with cosine decay instead of rsqrt. hparams.learning_rate_constant /= hparams.learning_rate_warmup_steps ** 0.5 hparams.learning_rate_schedule = ( "constant*linear_warmup*single_cycle_cos_decay*rsqrt_hidden_size") # The current infrastructure does not support exposing # `train_steps` to the decay functions, and so we are hard coding the decay # steps here to match the default number of train steps used in `t2t_trainer`. # TODO(davidso): Thread `train_steps` through to decay functions so we do not # have to worry about a `learning_rate_decay_steps` mismatch. hparams.learning_rate_decay_steps = 250000 return hparams
[ "def", "add_evolved_transformer_hparams", "(", "hparams", ")", ":", "# Evolved Transformer \"layers\" are twice as deep as Transformer, so roughly", "# halve the number that we use. These numbers are taken from", "# arxiv.org/abs/1901.11117 .", "hparams", ".", "num_encoder_layers", "=", "3", "hparams", ".", "num_decoder_layers", "=", "4", "# Learning rate and decay scheme that mimics the transformer Adam config,", "# but with cosine decay instead of rsqrt.", "hparams", ".", "learning_rate_constant", "/=", "hparams", ".", "learning_rate_warmup_steps", "**", "0.5", "hparams", ".", "learning_rate_schedule", "=", "(", "\"constant*linear_warmup*single_cycle_cos_decay*rsqrt_hidden_size\"", ")", "# The current infrastructure does not support exposing", "# `train_steps` to the decay functions, and so we are hard coding the decay", "# steps here to match the default number of train steps used in `t2t_trainer`.", "# TODO(davidso): Thread `train_steps` through to decay functions so we do not", "# have to worry about a `learning_rate_decay_steps` mismatch.", "hparams", ".", "learning_rate_decay_steps", "=", "250000", "return", "hparams" ]
Add Evolved Transformer hparams. Note: These are for the Adam optimizer, not the Adafactor optimizer used in the paper. Args: hparams: Current hparams. Returns: hparams updated with Evolved Transformer values.
[ "Add", "Evolved", "Transformer", "hparams", "." ]
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/evolved_transformer.py#L704-L733
<|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 Evolved Transformer hparams. Note: These are for the Adam optimizer, not the Adafactor optimizer used in the paper. Args: hparams: Current hparams. Returns: hparams updated with Evolved Transformer values. ### Response: def add_evolved_transformer_hparams(hparams): """Add Evolved Transformer hparams. Note: These are for the Adam optimizer, not the Adafactor optimizer used in the paper. Args: hparams: Current hparams. Returns: hparams updated with Evolved Transformer values. """ # Evolved Transformer "layers" are twice as deep as Transformer, so roughly # halve the number that we use. These numbers are taken from # arxiv.org/abs/1901.11117 . hparams.num_encoder_layers = 3 hparams.num_decoder_layers = 4 # Learning rate and decay scheme that mimics the transformer Adam config, # but with cosine decay instead of rsqrt. hparams.learning_rate_constant /= hparams.learning_rate_warmup_steps ** 0.5 hparams.learning_rate_schedule = ( "constant*linear_warmup*single_cycle_cos_decay*rsqrt_hidden_size") # The current infrastructure does not support exposing # `train_steps` to the decay functions, and so we are hard coding the decay # steps here to match the default number of train steps used in `t2t_trainer`. # TODO(davidso): Thread `train_steps` through to decay functions so we do not # have to worry about a `learning_rate_decay_steps` mismatch. hparams.learning_rate_decay_steps = 250000 return hparams <|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, 10641, 8905, 63479, 305, 3603, 382, 220, 7181, 25, 4314, 527, 369, 279, 15387, 26714, 11, 539, 279, 2467, 2642, 5739, 26714, 1511, 304, 198, 220, 279, 5684, 382, 220, 18161, 512, 262, 305, 3603, 25, 9303, 305, 3603, 382, 220, 5295, 512, 262, 305, 3603, 6177, 449, 10641, 8905, 63479, 2819, 382, 14711, 6075, 512, 755, 923, 44813, 8905, 18956, 261, 1552, 3603, 3283, 3603, 997, 220, 4304, 2261, 10641, 8905, 63479, 305, 3603, 382, 220, 7181, 25, 4314, 527, 369, 279, 15387, 26714, 11, 539, 279, 2467, 2642, 5739, 26714, 1511, 304, 198, 220, 279, 5684, 382, 220, 18161, 512, 262, 305, 3603, 25, 9303, 305, 3603, 382, 220, 5295, 512, 262, 305, 3603, 6177, 449, 10641, 8905, 63479, 2819, 627, 220, 3270, 220, 674, 10641, 8905, 63479, 330, 45298, 1, 527, 11157, 439, 5655, 439, 63479, 11, 779, 17715, 198, 220, 674, 15104, 588, 279, 1396, 430, 584, 1005, 13, 4314, 5219, 527, 4529, 505, 198, 220, 674, 802, 89833, 2726, 14, 3518, 14, 7028, 16, 13, 5037, 1114, 16853, 220, 305, 3603, 10744, 40168, 27183, 284, 220, 18, 198, 220, 305, 3603, 10744, 50943, 27183, 284, 220, 19, 271, 220, 674, 21579, 4478, 323, 31815, 13155, 430, 28003, 1233, 279, 43678, 15387, 2242, 345, 220, 674, 719, 449, 76359, 31815, 4619, 315, 10242, 8303, 627, 220, 305, 3603, 66702, 9430, 36067, 16860, 305, 3603, 66702, 9430, 1704, 2227, 455, 23566, 3146, 220, 15, 13, 20, 198, 220, 305, 3603, 66702, 9430, 35630, 284, 2456, 415, 330, 18568, 9, 23603, 1704, 2227, 455, 9, 15698, 40179, 62292, 44360, 9, 5544, 8303, 27837, 2424, 1158, 220, 674, 578, 1510, 14054, 1587, 539, 1862, 47066, 198, 220, 674, 1595, 10613, 23566, 63, 311, 279, 31815, 5865, 11, 323, 779, 584, 527, 2653, 11058, 279, 31815, 198, 220, 674, 7504, 1618, 311, 2489, 279, 1670, 1396, 315, 5542, 7504, 1511, 304, 1595, 83, 17, 83, 3631, 1780, 19154, 220, 674, 5456, 1528, 15567, 708, 1680, 8926, 1595, 10613, 23566, 63, 1555, 311, 31815, 5865, 779, 584, 656, 539, 198, 220, 674, 617, 311, 11196, 922, 264, 1595, 21656, 9430, 44360, 23566, 63, 36401, 627, 220, 305, 3603, 66702, 9430, 44360, 23566, 284, 220, 5154, 931, 198, 220, 471, 305, 3603, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2261, 10641, 8905, 63479, 305, 3603, 382, 220, 7181, 25, 4314, 527, 369, 279, 15387, 26714, 11, 539, 279, 2467, 2642, 5739, 26714, 1511, 304, 198, 220, 279, 5684, 382, 220, 18161, 512, 262, 305, 3603, 25, 9303, 305, 3603, 382, 220, 5295, 512, 262, 305, 3603, 6177, 449, 10641, 8905, 63479, 2819, 382, 14711, 6075, 512, 755, 923, 44813, 8905, 18956, 261, 1552, 3603, 3283, 3603, 997, 220, 4304, 2261, 10641, 8905, 63479, 305, 3603, 382, 220, 7181, 25, 4314, 527, 369, 279, 15387, 26714, 11, 539, 279, 2467, 2642, 5739, 26714, 1511, 304, 198, 220, 279, 5684, 382, 220, 18161, 512, 262, 305, 3603, 25, 9303, 305, 3603, 382, 220, 5295, 512, 262, 305, 3603, 6177, 449, 10641, 8905, 63479, 2819, 627, 220, 3270, 220, 674, 10641, 8905, 63479, 330, 45298, 1, 527, 11157, 439, 5655, 439, 63479, 11, 779, 17715, 198, 220, 674, 15104, 588, 279, 1396, 430, 584, 1005, 13, 4314, 5219, 527, 4529, 505, 198, 220, 674, 802, 89833, 2726, 14, 3518, 14, 7028, 16, 13, 5037, 1114, 16853, 220, 305, 3603, 10744, 40168, 27183, 284, 220, 18, 198, 220, 305, 3603, 10744, 50943, 27183, 284, 220, 19, 271, 220, 674, 21579, 4478, 323, 31815, 13155, 430, 28003, 1233, 279, 43678, 15387, 2242, 345, 220, 674, 719, 449, 76359, 31815, 4619, 315, 10242, 8303, 627, 220, 305, 3603, 66702, 9430, 36067, 16860, 305, 3603, 66702, 9430, 1704, 2227, 455, 23566, 3146, 220, 15, 13, 20, 198, 220, 305, 3603, 66702, 9430, 35630, 284, 2456, 415, 330, 18568, 9, 23603, 1704, 2227, 455, 9, 15698, 40179, 62292, 44360, 9, 5544, 8303, 27837, 2424, 1158, 220, 674, 578, 1510, 14054, 1587, 539, 1862, 47066, 198, 220, 674, 1595, 10613, 23566, 63, 311, 279, 31815, 5865, 11, 323, 779, 584, 527, 2653, 11058, 279, 31815, 198, 220, 674, 7504, 1618, 311, 2489, 279, 1670, 1396, 315, 5542, 7504, 1511, 304, 1595, 83, 17, 83, 3631, 1780, 19154, 220, 674, 5456, 1528, 15567, 708, 1680, 8926, 1595, 10613, 23566, 63, 1555, 311, 31815, 5865, 779, 584, 656, 539, 198, 220, 674, 617, 311, 11196, 922, 264, 1595, 21656, 9430, 44360, 23566, 63, 36401, 627, 220, 305, 3603, 66702, 9430, 44360, 23566, 284, 220, 5154, 931, 198, 220, 471, 305, 3603, 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 ]
orbeckst/RecSQL
recsql/sqlarray.py
KRingbuffer._prune
def _prune(self): """Primitive way to keep dict in sync with RB.""" delkeys = [k for k in self.keys() if k not in self.__ringbuffer] for k in delkeys: # necessary because dict is changed during iterations super(KRingbuffer,self).__delitem__(k)
python
def _prune(self): """Primitive way to keep dict in sync with RB.""" delkeys = [k for k in self.keys() if k not in self.__ringbuffer] for k in delkeys: # necessary because dict is changed during iterations super(KRingbuffer,self).__delitem__(k)
[ "def", "_prune", "(", "self", ")", ":", "delkeys", "=", "[", "k", "for", "k", "in", "self", ".", "keys", "(", ")", "if", "k", "not", "in", "self", ".", "__ringbuffer", "]", "for", "k", "in", "delkeys", ":", "# necessary because dict is changed during iterations", "super", "(", "KRingbuffer", ",", "self", ")", ".", "__delitem__", "(", "k", ")" ]
Primitive way to keep dict in sync with RB.
[ "Primitive", "way", "to", "keep", "dict", "in", "sync", "with", "RB", "." ]
train
https://github.com/orbeckst/RecSQL/blob/6acbf821022361719391697c9c2f0822f9f8022a/recsql/sqlarray.py#L692-L696
<|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: Primitive way to keep dict in sync with RB. ### Response: def _prune(self): """Primitive way to keep dict in sync with RB.""" delkeys = [k for k in self.keys() if k not in self.__ringbuffer] for k in delkeys: # necessary because dict is changed during iterations super(KRingbuffer,self).__delitem__(k) <|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, 34413, 1648, 311, 2567, 6587, 304, 13105, 449, 29074, 382, 14711, 6075, 512, 755, 721, 652, 2957, 1214, 997, 286, 4304, 34413, 1648, 311, 2567, 6587, 304, 13105, 449, 29074, 14781, 286, 1624, 10786, 284, 510, 74, 369, 597, 304, 659, 9301, 368, 422, 597, 539, 304, 659, 4952, 12928, 7726, 933, 286, 369, 597, 304, 1624, 10786, 25, 220, 674, 5995, 1606, 6587, 374, 5614, 2391, 26771, 198, 310, 2307, 17155, 44566, 7726, 22280, 21015, 9783, 1224, 3889, 74, 340, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 34413, 1648, 311, 2567, 6587, 304, 13105, 449, 29074, 382, 14711, 6075, 512, 755, 721, 652, 2957, 1214, 997, 286, 4304, 34413, 1648, 311, 2567, 6587, 304, 13105, 449, 29074, 14781, 286, 1624, 10786, 284, 510, 74, 369, 597, 304, 659, 9301, 368, 422, 597, 539, 304, 659, 4952, 12928, 7726, 933, 286, 369, 597, 304, 1624, 10786, 25, 220, 674, 5995, 1606, 6587, 374, 5614, 2391, 26771, 198, 310, 2307, 17155, 44566, 7726, 22280, 21015, 9783, 1224, 3889, 74, 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 ]
miguelgrinberg/python-engineio
engineio/asyncio_server.py
AsyncServer.start_background_task
def start_background_task(self, target, *args, **kwargs): """Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. The return value is a ``asyncio.Task`` object. """ return asyncio.ensure_future(target(*args, **kwargs))
python
def start_background_task(self, target, *args, **kwargs): """Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. The return value is a ``asyncio.Task`` object. """ return asyncio.ensure_future(target(*args, **kwargs))
[ "def", "start_background_task", "(", "self", ",", "target", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "asyncio", ".", "ensure_future", "(", "target", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. The return value is a ``asyncio.Task`` object.
[ "Start", "a", "background", "task", "using", "the", "appropriate", "async", "model", "." ]
train
https://github.com/miguelgrinberg/python-engineio/blob/261fd67103cb5d9a44369415748e66fdf62de6fb/engineio/asyncio_server.py#L266-L279
<|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: Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. The return value is a ``asyncio.Task`` object. ### Response: def start_background_task(self, target, *args, **kwargs): """Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. The return value is a ``asyncio.Task`` object. """ return asyncio.ensure_future(target(*args, **kwargs)) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 3563, 264, 4092, 3465, 1701, 279, 8475, 3393, 1646, 382, 286, 1115, 374, 264, 15919, 734, 430, 8522, 649, 1005, 311, 1212, 264, 198, 286, 4092, 3465, 1701, 279, 1749, 430, 374, 18641, 449, 279, 198, 286, 4183, 3393, 3941, 382, 286, 551, 913, 2218, 25, 279, 2218, 734, 311, 9203, 627, 286, 551, 913, 2897, 25, 6105, 311, 1522, 311, 279, 734, 627, 286, 551, 913, 16901, 25, 16570, 6105, 311, 1522, 311, 279, 734, 382, 286, 578, 471, 907, 374, 264, 10103, 7847, 822, 29358, 14196, 1665, 382, 14711, 6075, 512, 755, 1212, 25070, 12461, 1214, 11, 2218, 11, 353, 2164, 11, 3146, 9872, 997, 286, 4304, 3563, 264, 4092, 3465, 1701, 279, 8475, 3393, 1646, 382, 286, 1115, 374, 264, 15919, 734, 430, 8522, 649, 1005, 311, 1212, 264, 198, 286, 4092, 3465, 1701, 279, 1749, 430, 374, 18641, 449, 279, 198, 286, 4183, 3393, 3941, 382, 286, 551, 913, 2218, 25, 279, 2218, 734, 311, 9203, 627, 286, 551, 913, 2897, 25, 6105, 311, 1522, 311, 279, 734, 627, 286, 551, 913, 16901, 25, 16570, 6105, 311, 1522, 311, 279, 734, 382, 286, 578, 471, 907, 374, 264, 10103, 7847, 822, 29358, 14196, 1665, 627, 286, 3270, 286, 471, 46018, 64165, 60840, 8807, 4163, 2164, 11, 3146, 9872, 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, 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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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 3563, 264, 4092, 3465, 1701, 279, 8475, 3393, 1646, 382, 286, 1115, 374, 264, 15919, 734, 430, 8522, 649, 1005, 311, 1212, 264, 198, 286, 4092, 3465, 1701, 279, 1749, 430, 374, 18641, 449, 279, 198, 286, 4183, 3393, 3941, 382, 286, 551, 913, 2218, 25, 279, 2218, 734, 311, 9203, 627, 286, 551, 913, 2897, 25, 6105, 311, 1522, 311, 279, 734, 627, 286, 551, 913, 16901, 25, 16570, 6105, 311, 1522, 311, 279, 734, 382, 286, 578, 471, 907, 374, 264, 10103, 7847, 822, 29358, 14196, 1665, 382, 14711, 6075, 512, 755, 1212, 25070, 12461, 1214, 11, 2218, 11, 353, 2164, 11, 3146, 9872, 997, 286, 4304, 3563, 264, 4092, 3465, 1701, 279, 8475, 3393, 1646, 382, 286, 1115, 374, 264, 15919, 734, 430, 8522, 649, 1005, 311, 1212, 264, 198, 286, 4092, 3465, 1701, 279, 1749, 430, 374, 18641, 449, 279, 198, 286, 4183, 3393, 3941, 382, 286, 551, 913, 2218, 25, 279, 2218, 734, 311, 9203, 627, 286, 551, 913, 2897, 25, 6105, 311, 1522, 311, 279, 734, 627, 286, 551, 913, 16901, 25, 16570, 6105, 311, 1522, 311, 279, 734, 382, 286, 578, 471, 907, 374, 264, 10103, 7847, 822, 29358, 14196, 1665, 627, 286, 3270, 286, 471, 46018, 64165, 60840, 8807, 4163, 2164, 11, 3146, 9872, 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 ]
lago-project/lago
lago/build.py
Build.normalize_build_spec
def normalize_build_spec(self, build_spec): """ Convert a build spec into a list of Command tuples. After running this command, self.build_cmds should hold all the commands that should be run on the disk in self.disk_path. Args: build_spec (dict): The buildspec part from the init file """ for cmd in build_spec: if not cmd: continue cmd_name = cmd.keys()[0] cmd_options = cmd.values()[0] cmd_handler = self.get_cmd_handler(cmd_name) self.build_cmds.append(cmd_handler(cmd_options))
python
def normalize_build_spec(self, build_spec): """ Convert a build spec into a list of Command tuples. After running this command, self.build_cmds should hold all the commands that should be run on the disk in self.disk_path. Args: build_spec (dict): The buildspec part from the init file """ for cmd in build_spec: if not cmd: continue cmd_name = cmd.keys()[0] cmd_options = cmd.values()[0] cmd_handler = self.get_cmd_handler(cmd_name) self.build_cmds.append(cmd_handler(cmd_options))
[ "def", "normalize_build_spec", "(", "self", ",", "build_spec", ")", ":", "for", "cmd", "in", "build_spec", ":", "if", "not", "cmd", ":", "continue", "cmd_name", "=", "cmd", ".", "keys", "(", ")", "[", "0", "]", "cmd_options", "=", "cmd", ".", "values", "(", ")", "[", "0", "]", "cmd_handler", "=", "self", ".", "get_cmd_handler", "(", "cmd_name", ")", "self", ".", "build_cmds", ".", "append", "(", "cmd_handler", "(", "cmd_options", ")", ")" ]
Convert a build spec into a list of Command tuples. After running this command, self.build_cmds should hold all the commands that should be run on the disk in self.disk_path. Args: build_spec (dict): The buildspec part from the init file
[ "Convert", "a", "build", "spec", "into", "a", "list", "of", "Command", "tuples", ".", "After", "running", "this", "command", "self", ".", "build_cmds", "should", "hold", "all", "the", "commands", "that", "should", "be", "run", "on", "the", "disk", "in", "self", ".", "disk_path", "." ]
train
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/build.py#L120-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: Convert a build spec into a list of Command tuples. After running this command, self.build_cmds should hold all the commands that should be run on the disk in self.disk_path. Args: build_spec (dict): The buildspec part from the init file ### Response: def normalize_build_spec(self, build_spec): """ Convert a build spec into a list of Command tuples. After running this command, self.build_cmds should hold all the commands that should be run on the disk in self.disk_path. Args: build_spec (dict): The buildspec part from the init file """ for cmd in build_spec: if not cmd: continue cmd_name = cmd.keys()[0] cmd_options = cmd.values()[0] cmd_handler = self.get_cmd_handler(cmd_name) self.build_cmds.append(cmd_handler(cmd_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, 12281, 264, 1977, 1424, 1139, 264, 1160, 315, 7498, 46325, 627, 286, 4740, 4401, 420, 3290, 11, 659, 13542, 90572, 1288, 3412, 682, 198, 286, 279, 11545, 430, 1288, 387, 1629, 389, 279, 13668, 304, 659, 87311, 2703, 382, 286, 18161, 512, 310, 1977, 13908, 320, 8644, 1680, 578, 1977, 9727, 961, 505, 279, 3003, 1052, 271, 14711, 6075, 512, 755, 22436, 21465, 13908, 1214, 11, 1977, 13908, 997, 286, 3270, 286, 7316, 264, 1977, 1424, 1139, 264, 1160, 315, 7498, 46325, 627, 286, 4740, 4401, 420, 3290, 11, 659, 13542, 90572, 1288, 3412, 682, 198, 286, 279, 11545, 430, 1288, 387, 1629, 389, 279, 13668, 304, 659, 87311, 2703, 382, 286, 18161, 512, 310, 1977, 13908, 320, 8644, 1680, 578, 1977, 9727, 961, 505, 279, 3003, 1052, 198, 286, 3270, 286, 369, 5556, 304, 1977, 13908, 512, 310, 422, 539, 5556, 512, 394, 3136, 198, 310, 5556, 1292, 284, 5556, 9301, 10324, 15, 933, 310, 5556, 8917, 284, 5556, 10883, 10324, 15, 933, 310, 5556, 10393, 284, 659, 673, 11946, 10393, 14493, 1292, 340, 310, 659, 13542, 90572, 2102, 14493, 10393, 14493, 8917, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 12281, 264, 1977, 1424, 1139, 264, 1160, 315, 7498, 46325, 627, 286, 4740, 4401, 420, 3290, 11, 659, 13542, 90572, 1288, 3412, 682, 198, 286, 279, 11545, 430, 1288, 387, 1629, 389, 279, 13668, 304, 659, 87311, 2703, 382, 286, 18161, 512, 310, 1977, 13908, 320, 8644, 1680, 578, 1977, 9727, 961, 505, 279, 3003, 1052, 271, 14711, 6075, 512, 755, 22436, 21465, 13908, 1214, 11, 1977, 13908, 997, 286, 3270, 286, 7316, 264, 1977, 1424, 1139, 264, 1160, 315, 7498, 46325, 627, 286, 4740, 4401, 420, 3290, 11, 659, 13542, 90572, 1288, 3412, 682, 198, 286, 279, 11545, 430, 1288, 387, 1629, 389, 279, 13668, 304, 659, 87311, 2703, 382, 286, 18161, 512, 310, 1977, 13908, 320, 8644, 1680, 578, 1977, 9727, 961, 505, 279, 3003, 1052, 198, 286, 3270, 286, 369, 5556, 304, 1977, 13908, 512, 310, 422, 539, 5556, 512, 394, 3136, 198, 310, 5556, 1292, 284, 5556, 9301, 10324, 15, 933, 310, 5556, 8917, 284, 5556, 10883, 10324, 15, 933, 310, 5556, 10393, 284, 659, 673, 11946, 10393, 14493, 1292, 340, 310, 659, 13542, 90572, 2102, 14493, 10393, 14493, 8917, 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 ]
exekias/droplet
droplet/commands.py
run
def run(cmd, background=False): """ Executes the given command If background flag is True the command will run in background and this method will return a :class:`Popen` object If background is False (default) the command will run in this thread and this method will return stdout. A CommandException will be raised if command fails """ logger.debug('Running command: %s' % cmd) if background: return subprocess.Popen(cmd, shell=True, close_fds=True) else: (status, output) = commands.getstatusoutput(cmd) if status != 0: logger.error("Command failed: %s" % cmd) if output: logger.debug('OUTPUT:\n' + output) if status != 0: raise CommandException(status, output) return output
python
def run(cmd, background=False): """ Executes the given command If background flag is True the command will run in background and this method will return a :class:`Popen` object If background is False (default) the command will run in this thread and this method will return stdout. A CommandException will be raised if command fails """ logger.debug('Running command: %s' % cmd) if background: return subprocess.Popen(cmd, shell=True, close_fds=True) else: (status, output) = commands.getstatusoutput(cmd) if status != 0: logger.error("Command failed: %s" % cmd) if output: logger.debug('OUTPUT:\n' + output) if status != 0: raise CommandException(status, output) return output
[ "def", "run", "(", "cmd", ",", "background", "=", "False", ")", ":", "logger", ".", "debug", "(", "'Running command: %s'", "%", "cmd", ")", "if", "background", ":", "return", "subprocess", ".", "Popen", "(", "cmd", ",", "shell", "=", "True", ",", "close_fds", "=", "True", ")", "else", ":", "(", "status", ",", "output", ")", "=", "commands", ".", "getstatusoutput", "(", "cmd", ")", "if", "status", "!=", "0", ":", "logger", ".", "error", "(", "\"Command failed: %s\"", "%", "cmd", ")", "if", "output", ":", "logger", ".", "debug", "(", "'OUTPUT:\\n'", "+", "output", ")", "if", "status", "!=", "0", ":", "raise", "CommandException", "(", "status", ",", "output", ")", "return", "output" ]
Executes the given command If background flag is True the command will run in background and this method will return a :class:`Popen` object If background is False (default) the command will run in this thread and this method will return stdout. A CommandException will be raised if command fails
[ "Executes", "the", "given", "command" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/commands.py#L37-L65
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Executes the given command If background flag is True the command will run in background and this method will return a :class:`Popen` object If background is False (default) the command will run in this thread and this method will return stdout. A CommandException will be raised if command fails ### Response: def run(cmd, background=False): """ Executes the given command If background flag is True the command will run in background and this method will return a :class:`Popen` object If background is False (default) the command will run in this thread and this method will return stdout. A CommandException will be raised if command fails """ logger.debug('Running command: %s' % cmd) if background: return subprocess.Popen(cmd, shell=True, close_fds=True) else: (status, output) = commands.getstatusoutput(cmd) if status != 0: logger.error("Command failed: %s" % cmd) if output: logger.debug('OUTPUT:\n' + output) if status != 0: raise CommandException(status, output) 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, 10427, 2142, 279, 2728, 3290, 271, 262, 1442, 4092, 5292, 374, 3082, 279, 3290, 690, 1629, 304, 4092, 198, 262, 323, 420, 1749, 690, 471, 264, 551, 1058, 19258, 47, 2569, 63, 1665, 271, 262, 1442, 4092, 374, 3641, 320, 2309, 8, 279, 3290, 690, 1629, 304, 420, 4617, 198, 262, 323, 420, 1749, 690, 471, 20676, 382, 262, 362, 7498, 1378, 690, 387, 9408, 422, 3290, 14865, 271, 14711, 6075, 512, 755, 1629, 14493, 11, 4092, 5725, 997, 262, 3270, 262, 56642, 279, 2728, 3290, 271, 262, 1442, 4092, 5292, 374, 3082, 279, 3290, 690, 1629, 304, 4092, 198, 262, 323, 420, 1749, 690, 471, 264, 551, 1058, 19258, 47, 2569, 63, 1665, 271, 262, 1442, 4092, 374, 3641, 320, 2309, 8, 279, 3290, 690, 1629, 304, 420, 4617, 198, 262, 323, 420, 1749, 690, 471, 20676, 382, 262, 362, 7498, 1378, 690, 387, 9408, 422, 3290, 14865, 198, 262, 3270, 262, 6050, 8042, 493, 19527, 3290, 25, 1034, 82, 6, 1034, 5556, 696, 262, 422, 4092, 512, 286, 471, 24418, 66640, 14493, 11, 12811, 3702, 11, 3345, 91538, 3702, 696, 262, 775, 512, 286, 320, 2899, 11, 2612, 8, 284, 11545, 673, 2899, 3081, 14493, 340, 286, 422, 2704, 976, 220, 15, 512, 310, 6050, 4517, 446, 4153, 4745, 25, 1034, 82, 1, 1034, 5556, 696, 286, 422, 2612, 512, 310, 6050, 8042, 493, 31401, 7338, 77, 6, 489, 2612, 696, 286, 422, 2704, 976, 220, 15, 512, 310, 4933, 7498, 1378, 14159, 11, 2612, 696, 286, 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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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 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, 279, 2728, 3290, 271, 262, 1442, 4092, 5292, 374, 3082, 279, 3290, 690, 1629, 304, 4092, 198, 262, 323, 420, 1749, 690, 471, 264, 551, 1058, 19258, 47, 2569, 63, 1665, 271, 262, 1442, 4092, 374, 3641, 320, 2309, 8, 279, 3290, 690, 1629, 304, 420, 4617, 198, 262, 323, 420, 1749, 690, 471, 20676, 382, 262, 362, 7498, 1378, 690, 387, 9408, 422, 3290, 14865, 271, 14711, 6075, 512, 755, 1629, 14493, 11, 4092, 5725, 997, 262, 3270, 262, 56642, 279, 2728, 3290, 271, 262, 1442, 4092, 5292, 374, 3082, 279, 3290, 690, 1629, 304, 4092, 198, 262, 323, 420, 1749, 690, 471, 264, 551, 1058, 19258, 47, 2569, 63, 1665, 271, 262, 1442, 4092, 374, 3641, 320, 2309, 8, 279, 3290, 690, 1629, 304, 420, 4617, 198, 262, 323, 420, 1749, 690, 471, 20676, 382, 262, 362, 7498, 1378, 690, 387, 9408, 422, 3290, 14865, 198, 262, 3270, 262, 6050, 8042, 493, 19527, 3290, 25, 1034, 82, 6, 1034, 5556, 696, 262, 422, 4092, 512, 286, 471, 24418, 66640, 14493, 11, 12811, 3702, 11, 3345, 91538, 3702, 696, 262, 775, 512, 286, 320, 2899, 11, 2612, 8, 284, 11545, 673, 2899, 3081, 14493, 340, 286, 422, 2704, 976, 220, 15, 512, 310, 6050, 4517, 446, 4153, 4745, 25, 1034, 82, 1, 1034, 5556, 696, 286, 422, 2612, 512, 310, 6050, 8042, 493, 31401, 7338, 77, 6, 489, 2612, 696, 286, 422, 2704, 976, 220, 15, 512, 310, 4933, 7498, 1378, 14159, 11, 2612, 696, 286, 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 ]
hanguokai/youku
youku/youku_schemas.py
YoukuSchemas.playlist_category
def playlist_category(self): """doc: http://open.youku.com/docs/doc?id=94 """ url = 'https://openapi.youku.com/v2/schemas/playlist/category.json' r = requests.get(url) check_error(r) return r.json()
python
def playlist_category(self): """doc: http://open.youku.com/docs/doc?id=94 """ url = 'https://openapi.youku.com/v2/schemas/playlist/category.json' r = requests.get(url) check_error(r) return r.json()
[ "def", "playlist_category", "(", "self", ")", ":", "url", "=", "'https://openapi.youku.com/v2/schemas/playlist/category.json'", "r", "=", "requests", ".", "get", "(", "url", ")", "check_error", "(", "r", ")", "return", "r", ".", "json", "(", ")" ]
doc: http://open.youku.com/docs/doc?id=94
[ "doc", ":", "http", ":", "//", "open", ".", "youku", ".", "com", "/", "docs", "/", "doc?id", "=", "94" ]
train
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_schemas.py#L51-L57
<|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: doc: http://open.youku.com/docs/doc?id=94 ### Response: def playlist_category(self): """doc: http://open.youku.com/docs/doc?id=94 """ url = 'https://openapi.youku.com/v2/schemas/playlist/category.json' r = requests.get(url) check_error(r) return r.json() <|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, 5349, 25, 1795, 1129, 2569, 2441, 283, 12407, 916, 27057, 40610, 20970, 28, 6281, 271, 14711, 6075, 512, 755, 27889, 12110, 1214, 997, 286, 4304, 5349, 25, 1795, 1129, 2569, 2441, 283, 12407, 916, 27057, 40610, 20970, 28, 6281, 198, 286, 3270, 286, 2576, 284, 364, 2485, 1129, 2569, 2113, 2441, 283, 12407, 916, 5574, 17, 2754, 32226, 14, 35333, 47433, 4421, 1270, 286, 436, 284, 7540, 673, 6659, 340, 286, 1817, 4188, 2666, 340, 286, 471, 436, 4421, 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,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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, 5349, 25, 1795, 1129, 2569, 2441, 283, 12407, 916, 27057, 40610, 20970, 28, 6281, 271, 14711, 6075, 512, 755, 27889, 12110, 1214, 997, 286, 4304, 5349, 25, 1795, 1129, 2569, 2441, 283, 12407, 916, 27057, 40610, 20970, 28, 6281, 198, 286, 3270, 286, 2576, 284, 364, 2485, 1129, 2569, 2113, 2441, 283, 12407, 916, 5574, 17, 2754, 32226, 14, 35333, 47433, 4421, 1270, 286, 436, 284, 7540, 673, 6659, 340, 286, 1817, 4188, 2666, 340, 286, 471, 436, 4421, 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 ]
apache/incubator-mxnet
example/gluon/embedding_learning/train.py
train
def train(epochs, ctx): """Training function.""" if isinstance(ctx, mx.Context): ctx = [ctx] net.initialize(mx.init.Xavier(magnitude=2), ctx=ctx) opt_options = {'learning_rate': opt.lr, 'wd': opt.wd} if opt.optimizer == 'sgd': opt_options['momentum'] = 0.9 if opt.optimizer == 'adam': opt_options['epsilon'] = 1e-7 trainer = gluon.Trainer(net.collect_params(), opt.optimizer, opt_options, kvstore=opt.kvstore) if opt.lr_beta > 0.0: # Jointly train class-specific beta. # See "sampling matters in deep embedding learning" paper for details. beta.initialize(mx.init.Constant(opt.beta), ctx=ctx) trainer_beta = gluon.Trainer([beta], 'sgd', {'learning_rate': opt.lr_beta, 'momentum': 0.9}, kvstore=opt.kvstore) loss = MarginLoss(margin=opt.margin, nu=opt.nu) best_val = 0.0 for epoch in range(epochs): tic = time.time() prev_loss, cumulative_loss = 0.0, 0.0 # Learning rate schedule. trainer.set_learning_rate(get_lr(opt.lr, epoch, steps, opt.factor)) logging.info('Epoch %d learning rate=%f', epoch, trainer.learning_rate) if opt.lr_beta > 0.0: trainer_beta.set_learning_rate(get_lr(opt.lr_beta, epoch, steps, opt.factor)) logging.info('Epoch %d beta learning rate=%f', epoch, trainer_beta.learning_rate) # Inner training loop. for i in range(200): batch = train_data.next() data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0) label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0) Ls = [] with ag.record(): for x, y in zip(data, label): a_indices, anchors, positives, negatives, _ = net(x) if opt.lr_beta > 0.0: L = loss(anchors, positives, negatives, beta, y[a_indices]) else: L = loss(anchors, positives, negatives, opt.beta, None) # Store the loss and do backward after we have done forward # on all GPUs for better speed on multiple GPUs. Ls.append(L) cumulative_loss += nd.mean(L).asscalar() for L in Ls: L.backward() # Update. trainer.step(batch.data[0].shape[0]) if opt.lr_beta > 0.0: trainer_beta.step(batch.data[0].shape[0]) if (i+1) % opt.log_interval == 0: logging.info('[Epoch %d, Iter %d] training loss=%f' % ( epoch, i+1, cumulative_loss - prev_loss)) prev_loss = cumulative_loss logging.info('[Epoch %d] training loss=%f'%(epoch, cumulative_loss)) logging.info('[Epoch %d] time cost: %f'%(epoch, time.time()-tic)) names, val_accs = test(ctx) for name, val_acc in zip(names, val_accs): logging.info('[Epoch %d] validation: %s=%f'%(epoch, name, val_acc)) if val_accs[0] > best_val: best_val = val_accs[0] logging.info('Saving %s.' % opt.save_model_prefix) net.save_parameters('%s.params' % opt.save_model_prefix) return best_val
python
def train(epochs, ctx): """Training function.""" if isinstance(ctx, mx.Context): ctx = [ctx] net.initialize(mx.init.Xavier(magnitude=2), ctx=ctx) opt_options = {'learning_rate': opt.lr, 'wd': opt.wd} if opt.optimizer == 'sgd': opt_options['momentum'] = 0.9 if opt.optimizer == 'adam': opt_options['epsilon'] = 1e-7 trainer = gluon.Trainer(net.collect_params(), opt.optimizer, opt_options, kvstore=opt.kvstore) if opt.lr_beta > 0.0: # Jointly train class-specific beta. # See "sampling matters in deep embedding learning" paper for details. beta.initialize(mx.init.Constant(opt.beta), ctx=ctx) trainer_beta = gluon.Trainer([beta], 'sgd', {'learning_rate': opt.lr_beta, 'momentum': 0.9}, kvstore=opt.kvstore) loss = MarginLoss(margin=opt.margin, nu=opt.nu) best_val = 0.0 for epoch in range(epochs): tic = time.time() prev_loss, cumulative_loss = 0.0, 0.0 # Learning rate schedule. trainer.set_learning_rate(get_lr(opt.lr, epoch, steps, opt.factor)) logging.info('Epoch %d learning rate=%f', epoch, trainer.learning_rate) if opt.lr_beta > 0.0: trainer_beta.set_learning_rate(get_lr(opt.lr_beta, epoch, steps, opt.factor)) logging.info('Epoch %d beta learning rate=%f', epoch, trainer_beta.learning_rate) # Inner training loop. for i in range(200): batch = train_data.next() data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0) label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0) Ls = [] with ag.record(): for x, y in zip(data, label): a_indices, anchors, positives, negatives, _ = net(x) if opt.lr_beta > 0.0: L = loss(anchors, positives, negatives, beta, y[a_indices]) else: L = loss(anchors, positives, negatives, opt.beta, None) # Store the loss and do backward after we have done forward # on all GPUs for better speed on multiple GPUs. Ls.append(L) cumulative_loss += nd.mean(L).asscalar() for L in Ls: L.backward() # Update. trainer.step(batch.data[0].shape[0]) if opt.lr_beta > 0.0: trainer_beta.step(batch.data[0].shape[0]) if (i+1) % opt.log_interval == 0: logging.info('[Epoch %d, Iter %d] training loss=%f' % ( epoch, i+1, cumulative_loss - prev_loss)) prev_loss = cumulative_loss logging.info('[Epoch %d] training loss=%f'%(epoch, cumulative_loss)) logging.info('[Epoch %d] time cost: %f'%(epoch, time.time()-tic)) names, val_accs = test(ctx) for name, val_acc in zip(names, val_accs): logging.info('[Epoch %d] validation: %s=%f'%(epoch, name, val_acc)) if val_accs[0] > best_val: best_val = val_accs[0] logging.info('Saving %s.' % opt.save_model_prefix) net.save_parameters('%s.params' % opt.save_model_prefix) return best_val
[ "def", "train", "(", "epochs", ",", "ctx", ")", ":", "if", "isinstance", "(", "ctx", ",", "mx", ".", "Context", ")", ":", "ctx", "=", "[", "ctx", "]", "net", ".", "initialize", "(", "mx", ".", "init", ".", "Xavier", "(", "magnitude", "=", "2", ")", ",", "ctx", "=", "ctx", ")", "opt_options", "=", "{", "'learning_rate'", ":", "opt", ".", "lr", ",", "'wd'", ":", "opt", ".", "wd", "}", "if", "opt", ".", "optimizer", "==", "'sgd'", ":", "opt_options", "[", "'momentum'", "]", "=", "0.9", "if", "opt", ".", "optimizer", "==", "'adam'", ":", "opt_options", "[", "'epsilon'", "]", "=", "1e-7", "trainer", "=", "gluon", ".", "Trainer", "(", "net", ".", "collect_params", "(", ")", ",", "opt", ".", "optimizer", ",", "opt_options", ",", "kvstore", "=", "opt", ".", "kvstore", ")", "if", "opt", ".", "lr_beta", ">", "0.0", ":", "# Jointly train class-specific beta.", "# See \"sampling matters in deep embedding learning\" paper for details.", "beta", ".", "initialize", "(", "mx", ".", "init", ".", "Constant", "(", "opt", ".", "beta", ")", ",", "ctx", "=", "ctx", ")", "trainer_beta", "=", "gluon", ".", "Trainer", "(", "[", "beta", "]", ",", "'sgd'", ",", "{", "'learning_rate'", ":", "opt", ".", "lr_beta", ",", "'momentum'", ":", "0.9", "}", ",", "kvstore", "=", "opt", ".", "kvstore", ")", "loss", "=", "MarginLoss", "(", "margin", "=", "opt", ".", "margin", ",", "nu", "=", "opt", ".", "nu", ")", "best_val", "=", "0.0", "for", "epoch", "in", "range", "(", "epochs", ")", ":", "tic", "=", "time", ".", "time", "(", ")", "prev_loss", ",", "cumulative_loss", "=", "0.0", ",", "0.0", "# Learning rate schedule.", "trainer", ".", "set_learning_rate", "(", "get_lr", "(", "opt", ".", "lr", ",", "epoch", ",", "steps", ",", "opt", ".", "factor", ")", ")", "logging", ".", "info", "(", "'Epoch %d learning rate=%f'", ",", "epoch", ",", "trainer", ".", "learning_rate", ")", "if", "opt", ".", "lr_beta", ">", "0.0", ":", "trainer_beta", ".", "set_learning_rate", "(", "get_lr", "(", "opt", ".", "lr_beta", ",", "epoch", ",", "steps", ",", "opt", ".", "factor", ")", ")", "logging", ".", "info", "(", "'Epoch %d beta learning rate=%f'", ",", "epoch", ",", "trainer_beta", ".", "learning_rate", ")", "# Inner training loop.", "for", "i", "in", "range", "(", "200", ")", ":", "batch", "=", "train_data", ".", "next", "(", ")", "data", "=", "gluon", ".", "utils", ".", "split_and_load", "(", "batch", ".", "data", "[", "0", "]", ",", "ctx_list", "=", "ctx", ",", "batch_axis", "=", "0", ")", "label", "=", "gluon", ".", "utils", ".", "split_and_load", "(", "batch", ".", "label", "[", "0", "]", ",", "ctx_list", "=", "ctx", ",", "batch_axis", "=", "0", ")", "Ls", "=", "[", "]", "with", "ag", ".", "record", "(", ")", ":", "for", "x", ",", "y", "in", "zip", "(", "data", ",", "label", ")", ":", "a_indices", ",", "anchors", ",", "positives", ",", "negatives", ",", "_", "=", "net", "(", "x", ")", "if", "opt", ".", "lr_beta", ">", "0.0", ":", "L", "=", "loss", "(", "anchors", ",", "positives", ",", "negatives", ",", "beta", ",", "y", "[", "a_indices", "]", ")", "else", ":", "L", "=", "loss", "(", "anchors", ",", "positives", ",", "negatives", ",", "opt", ".", "beta", ",", "None", ")", "# Store the loss and do backward after we have done forward", "# on all GPUs for better speed on multiple GPUs.", "Ls", ".", "append", "(", "L", ")", "cumulative_loss", "+=", "nd", ".", "mean", "(", "L", ")", ".", "asscalar", "(", ")", "for", "L", "in", "Ls", ":", "L", ".", "backward", "(", ")", "# Update.", "trainer", ".", "step", "(", "batch", ".", "data", "[", "0", "]", ".", "shape", "[", "0", "]", ")", "if", "opt", ".", "lr_beta", ">", "0.0", ":", "trainer_beta", ".", "step", "(", "batch", ".", "data", "[", "0", "]", ".", "shape", "[", "0", "]", ")", "if", "(", "i", "+", "1", ")", "%", "opt", ".", "log_interval", "==", "0", ":", "logging", ".", "info", "(", "'[Epoch %d, Iter %d] training loss=%f'", "%", "(", "epoch", ",", "i", "+", "1", ",", "cumulative_loss", "-", "prev_loss", ")", ")", "prev_loss", "=", "cumulative_loss", "logging", ".", "info", "(", "'[Epoch %d] training loss=%f'", "%", "(", "epoch", ",", "cumulative_loss", ")", ")", "logging", ".", "info", "(", "'[Epoch %d] time cost: %f'", "%", "(", "epoch", ",", "time", ".", "time", "(", ")", "-", "tic", ")", ")", "names", ",", "val_accs", "=", "test", "(", "ctx", ")", "for", "name", ",", "val_acc", "in", "zip", "(", "names", ",", "val_accs", ")", ":", "logging", ".", "info", "(", "'[Epoch %d] validation: %s=%f'", "%", "(", "epoch", ",", "name", ",", "val_acc", ")", ")", "if", "val_accs", "[", "0", "]", ">", "best_val", ":", "best_val", "=", "val_accs", "[", "0", "]", "logging", ".", "info", "(", "'Saving %s.'", "%", "opt", ".", "save_model_prefix", ")", "net", ".", "save_parameters", "(", "'%s.params'", "%", "opt", ".", "save_model_prefix", ")", "return", "best_val" ]
Training function.
[ "Training", "function", "." ]
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/gluon/embedding_learning/train.py#L169-L250
<|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: Training function. ### Response: def train(epochs, ctx): """Training function.""" if isinstance(ctx, mx.Context): ctx = [ctx] net.initialize(mx.init.Xavier(magnitude=2), ctx=ctx) opt_options = {'learning_rate': opt.lr, 'wd': opt.wd} if opt.optimizer == 'sgd': opt_options['momentum'] = 0.9 if opt.optimizer == 'adam': opt_options['epsilon'] = 1e-7 trainer = gluon.Trainer(net.collect_params(), opt.optimizer, opt_options, kvstore=opt.kvstore) if opt.lr_beta > 0.0: # Jointly train class-specific beta. # See "sampling matters in deep embedding learning" paper for details. beta.initialize(mx.init.Constant(opt.beta), ctx=ctx) trainer_beta = gluon.Trainer([beta], 'sgd', {'learning_rate': opt.lr_beta, 'momentum': 0.9}, kvstore=opt.kvstore) loss = MarginLoss(margin=opt.margin, nu=opt.nu) best_val = 0.0 for epoch in range(epochs): tic = time.time() prev_loss, cumulative_loss = 0.0, 0.0 # Learning rate schedule. trainer.set_learning_rate(get_lr(opt.lr, epoch, steps, opt.factor)) logging.info('Epoch %d learning rate=%f', epoch, trainer.learning_rate) if opt.lr_beta > 0.0: trainer_beta.set_learning_rate(get_lr(opt.lr_beta, epoch, steps, opt.factor)) logging.info('Epoch %d beta learning rate=%f', epoch, trainer_beta.learning_rate) # Inner training loop. for i in range(200): batch = train_data.next() data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0) label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0) Ls = [] with ag.record(): for x, y in zip(data, label): a_indices, anchors, positives, negatives, _ = net(x) if opt.lr_beta > 0.0: L = loss(anchors, positives, negatives, beta, y[a_indices]) else: L = loss(anchors, positives, negatives, opt.beta, None) # Store the loss and do backward after we have done forward # on all GPUs for better speed on multiple GPUs. Ls.append(L) cumulative_loss += nd.mean(L).asscalar() for L in Ls: L.backward() # Update. trainer.step(batch.data[0].shape[0]) if opt.lr_beta > 0.0: trainer_beta.step(batch.data[0].shape[0]) if (i+1) % opt.log_interval == 0: logging.info('[Epoch %d, Iter %d] training loss=%f' % ( epoch, i+1, cumulative_loss - prev_loss)) prev_loss = cumulative_loss logging.info('[Epoch %d] training loss=%f'%(epoch, cumulative_loss)) logging.info('[Epoch %d] time cost: %f'%(epoch, time.time()-tic)) names, val_accs = test(ctx) for name, val_acc in zip(names, val_accs): logging.info('[Epoch %d] validation: %s=%f'%(epoch, name, val_acc)) if val_accs[0] > best_val: best_val = val_accs[0] logging.info('Saving %s.' % opt.save_model_prefix) net.save_parameters('%s.params' % opt.save_model_prefix) return best_val <|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, 38030, 734, 382, 14711, 6075, 512, 755, 5542, 7, 47629, 11, 5753, 997, 262, 4304, 38030, 734, 14781, 262, 422, 11656, 7654, 11, 14961, 9512, 997, 286, 5753, 284, 510, 3858, 933, 262, 4272, 27060, 69181, 8435, 4436, 31748, 1278, 35815, 28, 17, 705, 5753, 28, 3858, 696, 262, 3469, 8917, 284, 5473, 21656, 9430, 1232, 3469, 64449, 11, 364, 6511, 1232, 3469, 1444, 67, 534, 262, 422, 3469, 71395, 624, 364, 2034, 67, 3730, 286, 3469, 8917, 681, 29699, 372, 663, 284, 220, 15, 13, 24, 198, 262, 422, 3469, 71395, 624, 364, 52054, 3730, 286, 3469, 8917, 681, 32867, 663, 284, 220, 16, 68, 12, 22, 198, 262, 29994, 284, 78376, 263, 8404, 1780, 31823, 30224, 6887, 1535, 3469, 71395, 345, 1014, 3469, 8917, 345, 1014, 16574, 4412, 28, 2985, 5314, 85, 4412, 340, 262, 422, 3469, 64449, 50392, 871, 220, 15, 13, 15, 512, 286, 674, 30833, 398, 5542, 538, 19440, 13746, 627, 286, 674, 3580, 330, 98059, 13146, 304, 5655, 40188, 6975, 1, 5684, 369, 3649, 627, 286, 13746, 27060, 69181, 8435, 60040, 25556, 63029, 705, 5753, 28, 3858, 340, 286, 29994, 50392, 284, 78376, 263, 8404, 1780, 2625, 19674, 1145, 364, 2034, 67, 756, 10812, 5473, 21656, 9430, 1232, 3469, 64449, 50392, 11, 364, 29699, 372, 1232, 220, 15, 13, 24, 1613, 10812, 16574, 4412, 28, 2985, 5314, 85, 4412, 696, 262, 4814, 284, 72224, 40938, 1278, 2976, 28, 2985, 44577, 11, 11148, 28, 2985, 1276, 84, 696, 262, 1888, 6320, 284, 220, 15, 13, 15, 198, 262, 369, 16746, 304, 2134, 7, 47629, 997, 286, 62547, 284, 892, 6512, 746, 286, 8031, 11442, 11, 40944, 11442, 284, 220, 15, 13, 15, 11, 220, 15, 13, 15, 271, 286, 674, 21579, 4478, 9899, 627, 286, 29994, 995, 68391, 9430, 5550, 47186, 25556, 64449, 11, 16746, 11, 7504, 11, 3469, 84934, 1192, 286, 8558, 5506, 493, 45438, 1034, 67, 6975, 4478, 8003, 69, 518, 16746, 11, 29994, 66702, 9430, 340, 286, 422, 3469, 64449, 50392, 871, 220, 15, 13, 15, 512, 310, 29994, 50392, 995, 68391, 9430, 5550, 47186, 25556, 64449, 50392, 11, 16746, 11, 7504, 11, 3469, 84934, 1192, 310, 8558, 5506, 493, 45438, 1034, 67, 13746, 6975, 4478, 8003, 69, 518, 16746, 11, 29994, 50392, 66702, 9430, 696, 286, 674, 37456, 4967, 6471, 627, 286, 369, 602, 304, 2134, 7, 1049, 997, 310, 7309, 284, 5542, 1807, 4630, 746, 310, 828, 284, 78376, 263, 8576, 5402, 8543, 12693, 31239, 2245, 58, 15, 1145, 5753, 2062, 28, 3858, 11, 7309, 24480, 28, 15, 340, 310, 2440, 284, 78376, 263, 8576, 5402, 8543, 12693, 31239, 2981, 58, 15, 1145, 5753, 2062, 28, 3858, 11, 7309, 24480, 28, 15, 696, 310, 445, 82, 284, 4260, 310, 449, 945, 33124, 4019, 394, 369, 865, 11, 379, 304, 10521, 2657, 11, 2440, 997, 504, 264, 18839, 11, 56539, 11, 64756, 11, 75185 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 38030, 734, 382, 14711, 6075, 512, 755, 5542, 7, 47629, 11, 5753, 997, 262, 4304, 38030, 734, 14781, 262, 422, 11656, 7654, 11, 14961, 9512, 997, 286, 5753, 284, 510, 3858, 933, 262, 4272, 27060, 69181, 8435, 4436, 31748, 1278, 35815, 28, 17, 705, 5753, 28, 3858, 696, 262, 3469, 8917, 284, 5473, 21656, 9430, 1232, 3469, 64449, 11, 364, 6511, 1232, 3469, 1444, 67, 534, 262, 422, 3469, 71395, 624, 364, 2034, 67, 3730, 286, 3469, 8917, 681, 29699, 372, 663, 284, 220, 15, 13, 24, 198, 262, 422, 3469, 71395, 624, 364, 52054, 3730, 286, 3469, 8917, 681, 32867, 663, 284, 220, 16, 68, 12, 22, 198, 262, 29994, 284, 78376, 263, 8404, 1780, 31823, 30224, 6887, 1535, 3469, 71395, 345, 1014, 3469, 8917, 345, 1014, 16574, 4412, 28, 2985, 5314, 85, 4412, 340, 262, 422, 3469, 64449, 50392, 871, 220, 15, 13, 15, 512, 286, 674, 30833, 398, 5542, 538, 19440, 13746, 627, 286, 674, 3580, 330, 98059, 13146, 304, 5655, 40188, 6975, 1, 5684, 369, 3649, 627, 286, 13746, 27060, 69181, 8435, 60040, 25556, 63029, 705, 5753, 28, 3858, 340, 286, 29994, 50392, 284, 78376, 263, 8404, 1780, 2625, 19674, 1145, 364, 2034, 67, 756, 10812, 5473, 21656, 9430, 1232, 3469, 64449, 50392, 11, 364, 29699, 372, 1232, 220, 15, 13, 24, 1613, 10812, 16574, 4412, 28, 2985, 5314, 85, 4412, 696, 262, 4814, 284, 72224, 40938, 1278, 2976, 28, 2985, 44577, 11, 11148, 28, 2985, 1276, 84, 696, 262, 1888, 6320, 284, 220, 15, 13, 15, 198, 262, 369, 16746, 304, 2134, 7, 47629, 997, 286, 62547, 284, 892, 6512, 746, 286, 8031, 11442, 11, 40944, 11442, 284, 220, 15, 13, 15, 11, 220, 15, 13, 15, 271, 286, 674, 21579, 4478, 9899, 627, 286, 29994, 995, 68391, 9430, 5550, 47186, 25556, 64449, 11, 16746, 11, 7504, 11, 3469, 84934, 1192, 286, 8558, 5506, 493, 45438, 1034, 67, 6975, 4478, 8003, 69, 518, 16746, 11, 29994, 66702, 9430, 340, 286, 422, 3469, 64449, 50392, 871, 220, 15, 13, 15, 512, 310, 29994, 50392, 995, 68391, 9430, 5550, 47186, 25556, 64449, 50392, 11, 16746, 11, 7504, 11, 3469, 84934, 1192, 310, 8558, 5506, 493, 45438, 1034, 67, 13746, 6975, 4478, 8003, 69, 518, 16746, 11, 29994, 50392, 66702, 9430, 696, 286, 674, 37456, 4967, 6471, 627, 286, 369, 602, 304, 2134, 7, 1049, 997, 310, 7309, 284, 5542, 1807, 4630, 746, 310, 828, 284, 78376, 263, 8576, 5402, 8543, 12693, 31239, 2245, 58, 15, 1145, 5753, 2062, 28, 3858, 11, 7309, 24480, 28, 15, 340, 310, 2440, 284, 78376, 263, 8576, 5402, 8543, 12693, 31239, 2981, 58, 15, 1145, 5753, 2062, 28, 3858, 11, 7309, 24480, 28, 15, 696, 310, 445, 82, 284, 4260, 310, 449, 945, 33124, 4019, 394, 369, 865, 11, 379, 304, 10521, 2657, 11, 2440, 997, 504, 264, 18839, 11, 56539, 11, 64756, 11, 75185 ]
gsi-upm/soil
soil/web/__init__.py
ModularServer.launch
def launch(self, port=None): """ Run the app. """ if port is not None: self.port = port url = 'http://127.0.0.1:{PORT}'.format(PORT=self.port) print('Interface starting at {url}'.format(url=url)) self.listen(self.port) # webbrowser.open(url) tornado.ioloop.IOLoop.instance().start()
python
def launch(self, port=None): """ Run the app. """ if port is not None: self.port = port url = 'http://127.0.0.1:{PORT}'.format(PORT=self.port) print('Interface starting at {url}'.format(url=url)) self.listen(self.port) # webbrowser.open(url) tornado.ioloop.IOLoop.instance().start()
[ "def", "launch", "(", "self", ",", "port", "=", "None", ")", ":", "if", "port", "is", "not", "None", ":", "self", ".", "port", "=", "port", "url", "=", "'http://127.0.0.1:{PORT}'", ".", "format", "(", "PORT", "=", "self", ".", "port", ")", "print", "(", "'Interface starting at {url}'", ".", "format", "(", "url", "=", "url", ")", ")", "self", ".", "listen", "(", "self", ".", "port", ")", "# webbrowser.open(url)", "tornado", ".", "ioloop", ".", "IOLoop", ".", "instance", "(", ")", ".", "start", "(", ")" ]
Run the app.
[ "Run", "the", "app", "." ]
train
https://github.com/gsi-upm/soil/blob/a3ea434f237f039c3cadbc2e0a83ae626d77b818/soil/web/__init__.py#L245-L254
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Run the app. ### Response: def launch(self, port=None): """ Run the app. """ if port is not None: self.port = port url = 'http://127.0.0.1:{PORT}'.format(PORT=self.port) print('Interface starting at {url}'.format(url=url)) self.listen(self.port) # webbrowser.open(url) tornado.ioloop.IOLoop.instance().start() <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6869, 279, 917, 382, 14711, 6075, 512, 755, 7195, 1214, 11, 2700, 5980, 997, 286, 4304, 6588, 279, 917, 13, 3270, 1827, 286, 422, 2700, 374, 539, 2290, 512, 310, 659, 14940, 284, 2700, 198, 286, 2576, 284, 364, 1277, 1129, 6804, 13, 15, 13, 15, 13, 16, 12832, 5205, 24398, 2293, 63402, 7822, 14940, 340, 286, 1194, 493, 5160, 6041, 520, 314, 1103, 24398, 2293, 6659, 65663, 1192, 286, 659, 23453, 1214, 14940, 340, 286, 674, 3566, 23279, 5949, 6659, 340, 286, 45272, 8777, 10216, 454, 2506, 1971, 48406, 13366, 1020, 2527, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6869, 279, 917, 382, 14711, 6075, 512, 755, 7195, 1214, 11, 2700, 5980, 997, 286, 4304, 6588, 279, 917, 13, 3270, 1827, 286, 422, 2700, 374, 539, 2290, 512, 310, 659, 14940, 284, 2700, 198, 286, 2576, 284, 364, 1277, 1129, 6804, 13, 15, 13, 15, 13, 16, 12832, 5205, 24398, 2293, 63402, 7822, 14940, 340, 286, 1194, 493, 5160, 6041, 520, 314, 1103, 24398, 2293, 6659, 65663, 1192, 286, 659, 23453, 1214, 14940, 340, 286, 674, 3566, 23279, 5949, 6659, 340, 286, 45272, 8777, 10216, 454, 2506, 1971, 48406, 13366, 1020, 2527, 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 ]
user-cont/conu
conu/backend/k8s/backend.py
K8sBackend.delete_namespace
def delete_namespace(self, name): """ Delete namespace with specific name :param name: str, namespace to delete :return: None """ self.core_api.delete_namespace(name, client.V1DeleteOptions()) logger.info("Deleting namespace: %s", name)
python
def delete_namespace(self, name): """ Delete namespace with specific name :param name: str, namespace to delete :return: None """ self.core_api.delete_namespace(name, client.V1DeleteOptions()) logger.info("Deleting namespace: %s", name)
[ "def", "delete_namespace", "(", "self", ",", "name", ")", ":", "self", ".", "core_api", ".", "delete_namespace", "(", "name", ",", "client", ".", "V1DeleteOptions", "(", ")", ")", "logger", ".", "info", "(", "\"Deleting namespace: %s\"", ",", "name", ")" ]
Delete namespace with specific name :param name: str, namespace to delete :return: None
[ "Delete", "namespace", "with", "specific", "name", ":", "param", "name", ":", "str", "namespace", "to", "delete", ":", "return", ":", "None" ]
train
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/k8s/backend.py#L169-L177
<|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: Delete namespace with specific name :param name: str, namespace to delete :return: None ### Response: def delete_namespace(self, name): """ Delete namespace with specific name :param name: str, namespace to delete :return: None """ self.core_api.delete_namespace(name, client.V1DeleteOptions()) logger.info("Deleting namespace: %s", 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, 6571, 4573, 449, 3230, 836, 198, 286, 551, 913, 836, 25, 610, 11, 4573, 311, 3783, 198, 286, 551, 693, 25, 2290, 271, 14711, 6075, 512, 755, 3783, 42671, 1214, 11, 836, 997, 286, 3270, 286, 10645, 4573, 449, 3230, 836, 198, 286, 551, 913, 836, 25, 610, 11, 4573, 311, 3783, 198, 286, 551, 693, 25, 2290, 198, 286, 3270, 286, 659, 4976, 11959, 7592, 42671, 3232, 11, 3016, 5168, 16, 6571, 3883, 12647, 286, 6050, 5506, 446, 61575, 4573, 25, 1034, 82, 498, 836, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 6571, 4573, 449, 3230, 836, 198, 286, 551, 913, 836, 25, 610, 11, 4573, 311, 3783, 198, 286, 551, 693, 25, 2290, 271, 14711, 6075, 512, 755, 3783, 42671, 1214, 11, 836, 997, 286, 3270, 286, 10645, 4573, 449, 3230, 836, 198, 286, 551, 913, 836, 25, 610, 11, 4573, 311, 3783, 198, 286, 551, 693, 25, 2290, 198, 286, 3270, 286, 659, 4976, 11959, 7592, 42671, 3232, 11, 3016, 5168, 16, 6571, 3883, 12647, 286, 6050, 5506, 446, 61575, 4573, 25, 1034, 82, 498, 836, 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 ]
quantmind/dynts
dynts/api/timeseries.py
TimeSeries.series
def series(self): '''Generator of single series data (no dates are included).''' data = self.values() if len(data): for c in range(self.count()): yield data[:, c] else: raise StopIteration
python
def series(self): '''Generator of single series data (no dates are included).''' data = self.values() if len(data): for c in range(self.count()): yield data[:, c] else: raise StopIteration
[ "def", "series", "(", "self", ")", ":", "data", "=", "self", ".", "values", "(", ")", "if", "len", "(", "data", ")", ":", "for", "c", "in", "range", "(", "self", ".", "count", "(", ")", ")", ":", "yield", "data", "[", ":", ",", "c", "]", "else", ":", "raise", "StopIteration" ]
Generator of single series data (no dates are included).
[ "Generator", "of", "single", "series", "data", "(", "no", "dates", "are", "included", ")", "." ]
train
https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/api/timeseries.py#L211-L218
<|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: Generator of single series data (no dates are included). ### Response: def series(self): '''Generator of single series data (no dates are included).''' data = self.values() if len(data): for c in range(self.count()): yield data[:, c] else: raise StopIteration <|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, 12846, 315, 3254, 4101, 828, 320, 2201, 13003, 527, 5343, 3677, 14711, 6075, 512, 755, 4101, 1214, 5903, 286, 11712, 12846, 315, 3254, 4101, 828, 320, 2201, 13003, 527, 5343, 570, 56822, 286, 828, 284, 659, 10883, 3652, 286, 422, 2479, 2657, 5903, 310, 369, 272, 304, 2134, 1214, 6637, 368, 5903, 394, 7692, 828, 9821, 272, 6242, 286, 775, 2904, 310, 4933, 14549, 54201, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 12846, 315, 3254, 4101, 828, 320, 2201, 13003, 527, 5343, 3677, 14711, 6075, 512, 755, 4101, 1214, 5903, 286, 11712, 12846, 315, 3254, 4101, 828, 320, 2201, 13003, 527, 5343, 570, 56822, 286, 828, 284, 659, 10883, 3652, 286, 422, 2479, 2657, 5903, 310, 369, 272, 304, 2134, 1214, 6637, 368, 5903, 394, 7692, 828, 9821, 272, 6242, 286, 775, 2904, 310, 4933, 14549, 54201, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/visualise.py
opensignals_style
def opensignals_style(figure_list, grid_plot=None, toolbar="right"): """ ----- Brief ----- Function used to automatically apply the OpenSignals graphical style to Bokeh plots. ----------- Description ----------- OpenSignals has its own graphical style and Bokeh plots function in an object oriented way. This function allows to apply the Opensignals graphical style to a set of Bokeh figures objects given as inputs. ---------- Parameters ---------- figure_list : bokeh figure/s The base object/s where the graphical functions will be applied. grid_plot : bokeh gridplot Contains the layout structure, where multiple bokeh figures are represented. toolbar : str String defining the toolbar position. """ for fig in figure_list: fig.background_fill_color = (242, 242, 242) fig.toolbar.active_scroll = fig.select_one(WheelZoomTool) # Removal of unnecessary tools. figure_tools = fig.tools for tool in range(len(figure_tools) - 1, -1, -1): if not isinstance(figure_tools[tool], (type(PanTool()), type(BoxZoomTool()), type(WheelZoomTool()), type(ResetTool()))): del figure_tools[tool] fig.sizing_mode = 'scale_width' fig.height = 200 fig.toolbar.logo = None fig.toolbar_location = toolbar fig.xgrid.grid_line_color = (150, 150, 150) fig.ygrid.grid_line_color = (150, 150, 150) fig.xgrid.grid_line_dash = [2, 2] fig.xaxis.major_tick_line_color = "white" fig.xaxis.minor_tick_line_color = "white" fig.xaxis.axis_line_color = "white" fig.yaxis.major_tick_in = 0 fig.yaxis.major_tick_out = 0 fig.yaxis.major_tick_line_color = "white" fig.yaxis.minor_tick_line_color = "white" fig.yaxis.minor_tick_in = 0 fig.yaxis.minor_tick_out = 0 fig.yaxis.axis_line_color = (150, 150, 150) fig.yaxis.axis_line_dash = [2, 2] fig.yaxis.major_label_text_color = (88, 88, 88) fig.xaxis.major_label_text_color = (88, 88, 88) fig.ygrid.grid_line_dash = [2, 2] if isinstance(grid_plot, list): if grid_plot: for g_plot in grid_plot: g_plot.sizing_mode = 'scale_width' g_plot.height = 600
python
def opensignals_style(figure_list, grid_plot=None, toolbar="right"): """ ----- Brief ----- Function used to automatically apply the OpenSignals graphical style to Bokeh plots. ----------- Description ----------- OpenSignals has its own graphical style and Bokeh plots function in an object oriented way. This function allows to apply the Opensignals graphical style to a set of Bokeh figures objects given as inputs. ---------- Parameters ---------- figure_list : bokeh figure/s The base object/s where the graphical functions will be applied. grid_plot : bokeh gridplot Contains the layout structure, where multiple bokeh figures are represented. toolbar : str String defining the toolbar position. """ for fig in figure_list: fig.background_fill_color = (242, 242, 242) fig.toolbar.active_scroll = fig.select_one(WheelZoomTool) # Removal of unnecessary tools. figure_tools = fig.tools for tool in range(len(figure_tools) - 1, -1, -1): if not isinstance(figure_tools[tool], (type(PanTool()), type(BoxZoomTool()), type(WheelZoomTool()), type(ResetTool()))): del figure_tools[tool] fig.sizing_mode = 'scale_width' fig.height = 200 fig.toolbar.logo = None fig.toolbar_location = toolbar fig.xgrid.grid_line_color = (150, 150, 150) fig.ygrid.grid_line_color = (150, 150, 150) fig.xgrid.grid_line_dash = [2, 2] fig.xaxis.major_tick_line_color = "white" fig.xaxis.minor_tick_line_color = "white" fig.xaxis.axis_line_color = "white" fig.yaxis.major_tick_in = 0 fig.yaxis.major_tick_out = 0 fig.yaxis.major_tick_line_color = "white" fig.yaxis.minor_tick_line_color = "white" fig.yaxis.minor_tick_in = 0 fig.yaxis.minor_tick_out = 0 fig.yaxis.axis_line_color = (150, 150, 150) fig.yaxis.axis_line_dash = [2, 2] fig.yaxis.major_label_text_color = (88, 88, 88) fig.xaxis.major_label_text_color = (88, 88, 88) fig.ygrid.grid_line_dash = [2, 2] if isinstance(grid_plot, list): if grid_plot: for g_plot in grid_plot: g_plot.sizing_mode = 'scale_width' g_plot.height = 600
[ "def", "opensignals_style", "(", "figure_list", ",", "grid_plot", "=", "None", ",", "toolbar", "=", "\"right\"", ")", ":", "for", "fig", "in", "figure_list", ":", "fig", ".", "background_fill_color", "=", "(", "242", ",", "242", ",", "242", ")", "fig", ".", "toolbar", ".", "active_scroll", "=", "fig", ".", "select_one", "(", "WheelZoomTool", ")", "# Removal of unnecessary tools.", "figure_tools", "=", "fig", ".", "tools", "for", "tool", "in", "range", "(", "len", "(", "figure_tools", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "not", "isinstance", "(", "figure_tools", "[", "tool", "]", ",", "(", "type", "(", "PanTool", "(", ")", ")", ",", "type", "(", "BoxZoomTool", "(", ")", ")", ",", "type", "(", "WheelZoomTool", "(", ")", ")", ",", "type", "(", "ResetTool", "(", ")", ")", ")", ")", ":", "del", "figure_tools", "[", "tool", "]", "fig", ".", "sizing_mode", "=", "'scale_width'", "fig", ".", "height", "=", "200", "fig", ".", "toolbar", ".", "logo", "=", "None", "fig", ".", "toolbar_location", "=", "toolbar", "fig", ".", "xgrid", ".", "grid_line_color", "=", "(", "150", ",", "150", ",", "150", ")", "fig", ".", "ygrid", ".", "grid_line_color", "=", "(", "150", ",", "150", ",", "150", ")", "fig", ".", "xgrid", ".", "grid_line_dash", "=", "[", "2", ",", "2", "]", "fig", ".", "xaxis", ".", "major_tick_line_color", "=", "\"white\"", "fig", ".", "xaxis", ".", "minor_tick_line_color", "=", "\"white\"", "fig", ".", "xaxis", ".", "axis_line_color", "=", "\"white\"", "fig", ".", "yaxis", ".", "major_tick_in", "=", "0", "fig", ".", "yaxis", ".", "major_tick_out", "=", "0", "fig", ".", "yaxis", ".", "major_tick_line_color", "=", "\"white\"", "fig", ".", "yaxis", ".", "minor_tick_line_color", "=", "\"white\"", "fig", ".", "yaxis", ".", "minor_tick_in", "=", "0", "fig", ".", "yaxis", ".", "minor_tick_out", "=", "0", "fig", ".", "yaxis", ".", "axis_line_color", "=", "(", "150", ",", "150", ",", "150", ")", "fig", ".", "yaxis", ".", "axis_line_dash", "=", "[", "2", ",", "2", "]", "fig", ".", "yaxis", ".", "major_label_text_color", "=", "(", "88", ",", "88", ",", "88", ")", "fig", ".", "xaxis", ".", "major_label_text_color", "=", "(", "88", ",", "88", ",", "88", ")", "fig", ".", "ygrid", ".", "grid_line_dash", "=", "[", "2", ",", "2", "]", "if", "isinstance", "(", "grid_plot", ",", "list", ")", ":", "if", "grid_plot", ":", "for", "g_plot", "in", "grid_plot", ":", "g_plot", ".", "sizing_mode", "=", "'scale_width'", "g_plot", ".", "height", "=", "600" ]
----- Brief ----- Function used to automatically apply the OpenSignals graphical style to Bokeh plots. ----------- Description ----------- OpenSignals has its own graphical style and Bokeh plots function in an object oriented way. This function allows to apply the Opensignals graphical style to a set of Bokeh figures objects given as inputs. ---------- Parameters ---------- figure_list : bokeh figure/s The base object/s where the graphical functions will be applied. grid_plot : bokeh gridplot Contains the layout structure, where multiple bokeh figures are represented. toolbar : str String defining the toolbar position.
[ "-----", "Brief", "-----", "Function", "used", "to", "automatically", "apply", "the", "OpenSignals", "graphical", "style", "to", "Bokeh", "plots", "." ]
train
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/visualise.py#L663-L735
<|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: ----- Brief ----- Function used to automatically apply the OpenSignals graphical style to Bokeh plots. ----------- Description ----------- OpenSignals has its own graphical style and Bokeh plots function in an object oriented way. This function allows to apply the Opensignals graphical style to a set of Bokeh figures objects given as inputs. ---------- Parameters ---------- figure_list : bokeh figure/s The base object/s where the graphical functions will be applied. grid_plot : bokeh gridplot Contains the layout structure, where multiple bokeh figures are represented. toolbar : str String defining the toolbar position. ### Response: def opensignals_style(figure_list, grid_plot=None, toolbar="right"): """ ----- Brief ----- Function used to automatically apply the OpenSignals graphical style to Bokeh plots. ----------- Description ----------- OpenSignals has its own graphical style and Bokeh plots function in an object oriented way. This function allows to apply the Opensignals graphical style to a set of Bokeh figures objects given as inputs. ---------- Parameters ---------- figure_list : bokeh figure/s The base object/s where the graphical functions will be applied. grid_plot : bokeh gridplot Contains the layout structure, where multiple bokeh figures are represented. toolbar : str String defining the toolbar position. """ for fig in figure_list: fig.background_fill_color = (242, 242, 242) fig.toolbar.active_scroll = fig.select_one(WheelZoomTool) # Removal of unnecessary tools. figure_tools = fig.tools for tool in range(len(figure_tools) - 1, -1, -1): if not isinstance(figure_tools[tool], (type(PanTool()), type(BoxZoomTool()), type(WheelZoomTool()), type(ResetTool()))): del figure_tools[tool] fig.sizing_mode = 'scale_width' fig.height = 200 fig.toolbar.logo = None fig.toolbar_location = toolbar fig.xgrid.grid_line_color = (150, 150, 150) fig.ygrid.grid_line_color = (150, 150, 150) fig.xgrid.grid_line_dash = [2, 2] fig.xaxis.major_tick_line_color = "white" fig.xaxis.minor_tick_line_color = "white" fig.xaxis.axis_line_color = "white" fig.yaxis.major_tick_in = 0 fig.yaxis.major_tick_out = 0 fig.yaxis.major_tick_line_color = "white" fig.yaxis.minor_tick_line_color = "white" fig.yaxis.minor_tick_in = 0 fig.yaxis.minor_tick_out = 0 fig.yaxis.axis_line_color = (150, 150, 150) fig.yaxis.axis_line_dash = [2, 2] fig.yaxis.major_label_text_color = (88, 88, 88) fig.xaxis.major_label_text_color = (88, 88, 88) fig.ygrid.grid_line_dash = [2, 2] if isinstance(grid_plot, list): if grid_plot: for g_plot in grid_plot: g_plot.sizing_mode = 'scale_width' g_plot.height = 600 <|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, 35864, 262, 37618, 198, 262, 81049, 262, 5830, 1511, 311, 9651, 3881, 279, 5377, 97759, 54243, 1742, 311, 2577, 71717, 31794, 382, 262, 220, 26999, 262, 7817, 198, 262, 220, 26999, 262, 5377, 97759, 706, 1202, 1866, 54243, 1742, 323, 2577, 71717, 31794, 734, 304, 459, 1665, 42208, 1648, 382, 262, 1115, 734, 6276, 311, 3881, 279, 67279, 625, 1147, 54243, 1742, 311, 264, 743, 315, 2577, 71717, 12678, 6302, 2728, 439, 11374, 382, 262, 31423, 262, 13831, 198, 262, 31423, 262, 7216, 2062, 551, 712, 71717, 7216, 2754, 198, 286, 578, 2385, 1665, 2754, 1405, 279, 54243, 5865, 690, 387, 9435, 382, 262, 5950, 25347, 551, 712, 71717, 5950, 4569, 198, 286, 31911, 279, 6932, 6070, 11, 1405, 5361, 712, 71717, 12678, 527, 15609, 382, 262, 27031, 551, 610, 198, 286, 935, 27409, 279, 27031, 2361, 382, 14711, 6075, 512, 755, 16264, 625, 1147, 15468, 7, 18257, 2062, 11, 5950, 25347, 5980, 11, 27031, 429, 1315, 15497, 262, 3270, 262, 81049, 262, 37618, 198, 262, 81049, 262, 5830, 1511, 311, 9651, 3881, 279, 5377, 97759, 54243, 1742, 311, 2577, 71717, 31794, 382, 262, 220, 26999, 262, 7817, 198, 262, 220, 26999, 262, 5377, 97759, 706, 1202, 1866, 54243, 1742, 323, 2577, 71717, 31794, 734, 304, 459, 1665, 42208, 1648, 382, 262, 1115, 734, 6276, 311, 3881, 279, 67279, 625, 1147, 54243, 1742, 311, 264, 743, 315, 2577, 71717, 12678, 6302, 2728, 439, 11374, 382, 262, 31423, 262, 13831, 198, 262, 31423, 262, 7216, 2062, 551, 712, 71717, 7216, 2754, 198, 286, 578, 2385, 1665, 2754, 1405, 279, 54243, 5865, 690, 387, 9435, 382, 262, 5950, 25347, 551, 712, 71717, 5950, 4569, 198, 286, 31911, 279, 6932, 6070, 11, 1405, 5361, 712, 71717, 12678, 527, 15609, 382, 262, 27031, 551, 610, 198, 286, 935, 27409, 279, 27031, 2361, 382, 262, 12713, 262, 369, 4237, 304, 7216, 2062, 512, 286, 4237, 11979, 31828, 6855, 284, 320, 12754, 11, 220, 12754, 11, 220, 12754, 696, 286, 4237, 48516, 13930, 42507, 284, 4237, 9911, 11929, 14358, 8597, 26728, 7896, 696, 286, 674, 57817, 315, 26225, 7526, 627, 286, 7216, 40823, 284, 4237, 24029, 198, 286, 369, 5507, 304, 2134, 7046, 7, 18257, 40823, 8, 482, 220, 16, 11, 482, 16, 11, 482, 16, 997, 310, 422, 539, 11656, 7, 18257, 40823, 58, 14506, 1145, 320, 1337, 5417, 276, 7896, 12122, 955, 68858, 26728, 7896, 15044, 22232, 955, 14358, 8597, 26728, 7896, 12122, 955, 7, 15172, 7896, 10340, 997, 394, 1624, 7216, 40823, 58, 14506, 2595, 286, 4237, 516, 4954, 7450, 284, 364, 12727, 8086, 1270, 286, 4237, 5846, 284, 220, 1049, 198, 286, 4237, 48516, 58621, 284, 2290, 198, 286, 4237, 48516, 13427, 284, 27031, 271, 286, 4237, 2036, 4297, 10000, 6665, 6855, 284, 320, 3965, 11, 220, 3965, 11, 220, 3965, 340, 286, 4237, 2441, 4297, 10000, 6665, 6855, 284, 320, 3965, 11, 220, 3965 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 35864, 262, 37618, 198, 262, 81049, 262, 5830, 1511, 311, 9651, 3881, 279, 5377, 97759, 54243, 1742, 311, 2577, 71717, 31794, 382, 262, 220, 26999, 262, 7817, 198, 262, 220, 26999, 262, 5377, 97759, 706, 1202, 1866, 54243, 1742, 323, 2577, 71717, 31794, 734, 304, 459, 1665, 42208, 1648, 382, 262, 1115, 734, 6276, 311, 3881, 279, 67279, 625, 1147, 54243, 1742, 311, 264, 743, 315, 2577, 71717, 12678, 6302, 2728, 439, 11374, 382, 262, 31423, 262, 13831, 198, 262, 31423, 262, 7216, 2062, 551, 712, 71717, 7216, 2754, 198, 286, 578, 2385, 1665, 2754, 1405, 279, 54243, 5865, 690, 387, 9435, 382, 262, 5950, 25347, 551, 712, 71717, 5950, 4569, 198, 286, 31911, 279, 6932, 6070, 11, 1405, 5361, 712, 71717, 12678, 527, 15609, 382, 262, 27031, 551, 610, 198, 286, 935, 27409, 279, 27031, 2361, 382, 14711, 6075, 512, 755, 16264, 625, 1147, 15468, 7, 18257, 2062, 11, 5950, 25347, 5980, 11, 27031, 429, 1315, 15497, 262, 3270, 262, 81049, 262, 37618, 198, 262, 81049, 262, 5830, 1511, 311, 9651, 3881, 279, 5377, 97759, 54243, 1742, 311, 2577, 71717, 31794, 382, 262, 220, 26999, 262, 7817, 198, 262, 220, 26999, 262, 5377, 97759, 706, 1202, 1866, 54243, 1742, 323, 2577, 71717, 31794, 734, 304, 459, 1665, 42208, 1648, 382, 262, 1115, 734, 6276, 311, 3881, 279, 67279, 625, 1147, 54243, 1742, 311, 264, 743, 315, 2577, 71717, 12678, 6302, 2728, 439, 11374, 382, 262, 31423, 262, 13831, 198, 262, 31423, 262, 7216, 2062, 551, 712, 71717, 7216, 2754, 198, 286, 578, 2385, 1665, 2754, 1405, 279, 54243, 5865, 690, 387, 9435, 382, 262, 5950, 25347, 551, 712, 71717, 5950, 4569, 198, 286, 31911, 279, 6932, 6070, 11, 1405, 5361, 712, 71717, 12678, 527, 15609, 382, 262, 27031, 551, 610, 198, 286, 935, 27409, 279, 27031, 2361, 382, 262, 12713, 262, 369, 4237, 304, 7216, 2062, 512, 286, 4237, 11979, 31828, 6855, 284, 320, 12754, 11, 220, 12754, 11, 220, 12754, 696, 286, 4237, 48516, 13930, 42507, 284, 4237, 9911, 11929, 14358, 8597, 26728, 7896, 696, 286, 674, 57817, 315, 26225, 7526, 627, 286, 7216, 40823, 284, 4237, 24029, 198, 286, 369, 5507, 304, 2134, 7046, 7, 18257, 40823, 8, 482, 220, 16, 11, 482, 16, 11, 482, 16, 997, 310, 422, 539, 11656, 7, 18257, 40823, 58, 14506, 1145, 320, 1337, 5417, 276, 7896, 12122, 955, 68858, 26728, 7896, 15044, 22232, 955, 14358, 8597, 26728, 7896, 12122, 955, 7, 15172, 7896, 10340, 997, 394, 1624, 7216, 40823, 58, 14506, 2595, 286, 4237, 516, 4954, 7450, 284, 364, 12727, 8086, 1270, 286, 4237, 5846, 284, 220, 1049, 198, 286, 4237, 48516, 58621, 284, 2290, 198, 286, 4237, 48516, 13427, 284, 27031, 271, 286, 4237, 2036, 4297, 10000, 6665, 6855, 284, 320, 3965, 11, 220, 3965, 11, 220, 3965, 340, 286, 4237, 2441, 4297, 10000, 6665, 6855, 284, 320, 3965, 11, 220, 3965 ]
twilio/twilio-python
twilio/rest/monitor/v1/alert.py
AlertList.page
def page(self, log_level=values.unset, start_date=values.unset, end_date=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of AlertInstance records from the API. Request is executed immediately :param unicode log_level: Only show alerts for this log-level. :param date start_date: Only show Alerts on or after this date. :param date end_date: Only show Alerts on or before this date. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of AlertInstance :rtype: twilio.rest.monitor.v1.alert.AlertPage """ params = values.of({ 'LogLevel': log_level, 'StartDate': serialize.iso8601_date(start_date), 'EndDate': serialize.iso8601_date(end_date), 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return AlertPage(self._version, response, self._solution)
python
def page(self, log_level=values.unset, start_date=values.unset, end_date=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of AlertInstance records from the API. Request is executed immediately :param unicode log_level: Only show alerts for this log-level. :param date start_date: Only show Alerts on or after this date. :param date end_date: Only show Alerts on or before this date. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of AlertInstance :rtype: twilio.rest.monitor.v1.alert.AlertPage """ params = values.of({ 'LogLevel': log_level, 'StartDate': serialize.iso8601_date(start_date), 'EndDate': serialize.iso8601_date(end_date), 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return AlertPage(self._version, response, self._solution)
[ "def", "page", "(", "self", ",", "log_level", "=", "values", ".", "unset", ",", "start_date", "=", "values", ".", "unset", ",", "end_date", "=", "values", ".", "unset", ",", "page_token", "=", "values", ".", "unset", ",", "page_number", "=", "values", ".", "unset", ",", "page_size", "=", "values", ".", "unset", ")", ":", "params", "=", "values", ".", "of", "(", "{", "'LogLevel'", ":", "log_level", ",", "'StartDate'", ":", "serialize", ".", "iso8601_date", "(", "start_date", ")", ",", "'EndDate'", ":", "serialize", ".", "iso8601_date", "(", "end_date", ")", ",", "'PageToken'", ":", "page_token", ",", "'Page'", ":", "page_number", ",", "'PageSize'", ":", "page_size", ",", "}", ")", "response", "=", "self", ".", "_version", ".", "page", "(", "'GET'", ",", "self", ".", "_uri", ",", "params", "=", "params", ",", ")", "return", "AlertPage", "(", "self", ".", "_version", ",", "response", ",", "self", ".", "_solution", ")" ]
Retrieve a single page of AlertInstance records from the API. Request is executed immediately :param unicode log_level: Only show alerts for this log-level. :param date start_date: Only show Alerts on or after this date. :param date end_date: Only show Alerts on or before this date. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of AlertInstance :rtype: twilio.rest.monitor.v1.alert.AlertPage
[ "Retrieve", "a", "single", "page", "of", "AlertInstance", "records", "from", "the", "API", ".", "Request", "is", "executed", "immediately" ]
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/monitor/v1/alert.py#L96-L128
<|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 a single page of AlertInstance records from the API. Request is executed immediately :param unicode log_level: Only show alerts for this log-level. :param date start_date: Only show Alerts on or after this date. :param date end_date: Only show Alerts on or before this date. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of AlertInstance :rtype: twilio.rest.monitor.v1.alert.AlertPage ### Response: def page(self, log_level=values.unset, start_date=values.unset, end_date=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of AlertInstance records from the API. Request is executed immediately :param unicode log_level: Only show alerts for this log-level. :param date start_date: Only show Alerts on or after this date. :param date end_date: Only show Alerts on or before this date. :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of AlertInstance :rtype: twilio.rest.monitor.v1.alert.AlertPage """ params = values.of({ 'LogLevel': log_level, 'StartDate': serialize.iso8601_date(start_date), 'EndDate': serialize.iso8601_date(end_date), 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return AlertPage(self._version, response, self._solution) <|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, 264, 3254, 2199, 315, 14302, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 27169, 1515, 8438, 25, 8442, 1501, 30350, 369, 420, 1515, 11852, 627, 286, 551, 913, 2457, 1212, 4257, 25, 8442, 1501, 69408, 389, 477, 1306, 420, 2457, 627, 286, 551, 913, 2457, 842, 4257, 25, 8442, 1501, 69408, 389, 477, 1603, 420, 2457, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 14302, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 64598, 3211, 16, 21150, 41243, 2732, 271, 14711, 6075, 512, 755, 2199, 1214, 11, 1515, 8438, 28, 3745, 6441, 751, 11, 1212, 4257, 28, 3745, 6441, 751, 345, 1835, 842, 4257, 28, 3745, 6441, 751, 11, 2199, 6594, 28, 3745, 6441, 751, 345, 1835, 2199, 5617, 28, 3745, 6441, 751, 11, 2199, 2424, 28, 3745, 6441, 751, 997, 286, 3270, 286, 32662, 264, 3254, 2199, 315, 14302, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 27169, 1515, 8438, 25, 8442, 1501, 30350, 369, 420, 1515, 11852, 627, 286, 551, 913, 2457, 1212, 4257, 25, 8442, 1501, 69408, 389, 477, 1306, 420, 2457, 627, 286, 551, 913, 2457, 842, 4257, 25, 8442, 1501, 69408, 389, 477, 1603, 420, 2457, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 14302, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 64598, 3211, 16, 21150, 41243, 2732, 198, 286, 3270, 286, 3712, 284, 2819, 10440, 2313, 310, 364, 73776, 1232, 1515, 8438, 345, 310, 364, 45630, 1232, 25217, 65860, 18670, 16, 4257, 10865, 4257, 1350, 310, 364, 49561, 1232, 25217, 65860, 18670, 16, 4257, 15426, 4257, 1350, 310, 364, 2732, 3404, 1232, 2199, 6594, 345, 310, 364, 2732, 1232, 2199, 5617, 345, 310, 364, 47017, 1232, 2199, 2424, 345, 286, 9763, 286, 2077, 284, 659, 1462, 4464, 10678, 1021, 310, 364, 3891, 756, 310, 659, 1462, 6198, 345, 310, 3712, 58743, 345, 286, 5235, 286, 471, 14302, 2732, 1214, 1462, 4464, 11, 2077, 11, 659, 1462, 50560, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 264, 3254, 2199, 315, 14302, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 27169, 1515, 8438, 25, 8442, 1501, 30350, 369, 420, 1515, 11852, 627, 286, 551, 913, 2457, 1212, 4257, 25, 8442, 1501, 69408, 389, 477, 1306, 420, 2457, 627, 286, 551, 913, 2457, 842, 4257, 25, 8442, 1501, 69408, 389, 477, 1603, 420, 2457, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 14302, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 64598, 3211, 16, 21150, 41243, 2732, 271, 14711, 6075, 512, 755, 2199, 1214, 11, 1515, 8438, 28, 3745, 6441, 751, 11, 1212, 4257, 28, 3745, 6441, 751, 345, 1835, 842, 4257, 28, 3745, 6441, 751, 11, 2199, 6594, 28, 3745, 6441, 751, 345, 1835, 2199, 5617, 28, 3745, 6441, 751, 11, 2199, 2424, 28, 3745, 6441, 751, 997, 286, 3270, 286, 32662, 264, 3254, 2199, 315, 14302, 2584, 7576, 505, 279, 5446, 627, 286, 6274, 374, 16070, 7214, 271, 286, 551, 913, 27169, 1515, 8438, 25, 8442, 1501, 30350, 369, 420, 1515, 11852, 627, 286, 551, 913, 2457, 1212, 4257, 25, 8442, 1501, 69408, 389, 477, 1306, 420, 2457, 627, 286, 551, 913, 2457, 842, 4257, 25, 8442, 1501, 69408, 389, 477, 1603, 420, 2457, 627, 286, 551, 913, 610, 2199, 6594, 25, 5874, 3404, 3984, 555, 279, 5446, 198, 286, 551, 913, 528, 2199, 5617, 25, 5874, 5742, 11, 420, 907, 374, 5042, 369, 3016, 1614, 198, 286, 551, 913, 528, 2199, 2424, 25, 5742, 315, 7576, 311, 471, 11, 17088, 311, 220, 1135, 271, 286, 551, 4310, 25, 5874, 315, 14302, 2584, 198, 286, 551, 33613, 25, 4483, 34429, 22113, 64598, 3211, 16, 21150, 41243, 2732, 198, 286, 3270, 286, 3712, 284, 2819, 10440, 2313, 310, 364, 73776, 1232, 1515, 8438, 345, 310, 364, 45630, 1232, 25217, 65860, 18670, 16, 4257, 10865, 4257, 1350, 310, 364, 49561, 1232, 25217, 65860, 18670, 16, 4257, 15426, 4257, 1350, 310, 364, 2732, 3404, 1232, 2199, 6594, 345, 310, 364, 2732, 1232, 2199, 5617, 345, 310, 364, 47017, 1232, 2199, 2424, 345, 286, 9763, 286, 2077, 284, 659, 1462, 4464, 10678, 1021, 310, 364, 3891, 756, 310, 659, 1462, 6198, 345, 310, 3712, 58743, 345, 286, 5235, 286, 471, 14302, 2732, 1214, 1462, 4464, 11, 2077, 11, 659, 1462, 50560, 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 ]
coderholic/pyradio
pyradio/player.py
VlcPlayer._format_volume_string
def _format_volume_string(self, volume_string): """ format vlc's volume """ self.actual_volume = int(volume_string.split(self.volume_string)[1].split(',')[0].split()[0]) return '[Vol: {}%] '.format(int(100 * self.actual_volume / self.max_volume))
python
def _format_volume_string(self, volume_string): """ format vlc's volume """ self.actual_volume = int(volume_string.split(self.volume_string)[1].split(',')[0].split()[0]) return '[Vol: {}%] '.format(int(100 * self.actual_volume / self.max_volume))
[ "def", "_format_volume_string", "(", "self", ",", "volume_string", ")", ":", "self", ".", "actual_volume", "=", "int", "(", "volume_string", ".", "split", "(", "self", ".", "volume_string", ")", "[", "1", "]", ".", "split", "(", "','", ")", "[", "0", "]", ".", "split", "(", ")", "[", "0", "]", ")", "return", "'[Vol: {}%] '", ".", "format", "(", "int", "(", "100", "*", "self", ".", "actual_volume", "/", "self", ".", "max_volume", ")", ")" ]
format vlc's volume
[ "format", "vlc", "s", "volume" ]
train
https://github.com/coderholic/pyradio/blob/c5219d350bccbccd49dbd627c1f886a952ea1963/pyradio/player.py#L706-L709
<|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: format vlc's volume ### Response: def _format_volume_string(self, volume_string): """ format vlc's volume """ self.actual_volume = int(volume_string.split(self.volume_string)[1].split(',')[0].split()[0]) return '[Vol: {}%] '.format(int(100 * self.actual_volume / self.max_volume)) <|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, 2293, 348, 17704, 596, 8286, 271, 14711, 6075, 512, 755, 721, 2293, 28039, 3991, 1214, 11, 8286, 3991, 997, 286, 4304, 3645, 348, 17704, 596, 8286, 3270, 286, 659, 69220, 28039, 284, 528, 75806, 3991, 5402, 1214, 41584, 3991, 6758, 16, 948, 7105, 98614, 15, 948, 7105, 10324, 15, 2608, 286, 471, 18814, 37461, 25, 4792, 4, 60, 6389, 2293, 1577, 7, 1041, 353, 659, 69220, 28039, 611, 659, 6817, 28039, 1192, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 2293, 348, 17704, 596, 8286, 271, 14711, 6075, 512, 755, 721, 2293, 28039, 3991, 1214, 11, 8286, 3991, 997, 286, 4304, 3645, 348, 17704, 596, 8286, 3270, 286, 659, 69220, 28039, 284, 528, 75806, 3991, 5402, 1214, 41584, 3991, 6758, 16, 948, 7105, 98614, 15, 948, 7105, 10324, 15, 2608, 286, 471, 18814, 37461, 25, 4792, 4, 60, 6389, 2293, 1577, 7, 1041, 353, 659, 69220, 28039, 611, 659, 6817, 28039, 1192, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
pkgw/pwkit
pwkit/io.py
Path.read_lines
def read_lines (self, mode='rt', noexistok=False, **kwargs): """Generate a sequence of lines from the file pointed to by this path, by opening as a regular file and iterating over it. The lines therefore contain their newline characters. If *noexistok*, a nonexistent file will result in an empty sequence rather than an exception. *kwargs* are passed to :meth:`Path.open`. """ try: with self.open (mode=mode, **kwargs) as f: for line in f: yield line except IOError as e: if e.errno != 2 or not noexistok: raise
python
def read_lines (self, mode='rt', noexistok=False, **kwargs): """Generate a sequence of lines from the file pointed to by this path, by opening as a regular file and iterating over it. The lines therefore contain their newline characters. If *noexistok*, a nonexistent file will result in an empty sequence rather than an exception. *kwargs* are passed to :meth:`Path.open`. """ try: with self.open (mode=mode, **kwargs) as f: for line in f: yield line except IOError as e: if e.errno != 2 or not noexistok: raise
[ "def", "read_lines", "(", "self", ",", "mode", "=", "'rt'", ",", "noexistok", "=", "False", ",", "*", "*", "kwargs", ")", ":", "try", ":", "with", "self", ".", "open", "(", "mode", "=", "mode", ",", "*", "*", "kwargs", ")", "as", "f", ":", "for", "line", "in", "f", ":", "yield", "line", "except", "IOError", "as", "e", ":", "if", "e", ".", "errno", "!=", "2", "or", "not", "noexistok", ":", "raise" ]
Generate a sequence of lines from the file pointed to by this path, by opening as a regular file and iterating over it. The lines therefore contain their newline characters. If *noexistok*, a nonexistent file will result in an empty sequence rather than an exception. *kwargs* are passed to :meth:`Path.open`.
[ "Generate", "a", "sequence", "of", "lines", "from", "the", "file", "pointed", "to", "by", "this", "path", "by", "opening", "as", "a", "regular", "file", "and", "iterating", "over", "it", ".", "The", "lines", "therefore", "contain", "their", "newline", "characters", ".", "If", "*", "noexistok", "*", "a", "nonexistent", "file", "will", "result", "in", "an", "empty", "sequence", "rather", "than", "an", "exception", ".", "*", "kwargs", "*", "are", "passed", "to", ":", "meth", ":", "Path", ".", "open", "." ]
train
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L803-L817
<|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 sequence of lines from the file pointed to by this path, by opening as a regular file and iterating over it. The lines therefore contain their newline characters. If *noexistok*, a nonexistent file will result in an empty sequence rather than an exception. *kwargs* are passed to :meth:`Path.open`. ### Response: def read_lines (self, mode='rt', noexistok=False, **kwargs): """Generate a sequence of lines from the file pointed to by this path, by opening as a regular file and iterating over it. The lines therefore contain their newline characters. If *noexistok*, a nonexistent file will result in an empty sequence rather than an exception. *kwargs* are passed to :meth:`Path.open`. """ try: with self.open (mode=mode, **kwargs) as f: for line in f: yield line except IOError as e: if e.errno != 2 or not noexistok: raise <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 32215, 264, 8668, 315, 5238, 505, 279, 1052, 14618, 311, 555, 420, 1853, 11, 555, 198, 286, 8736, 439, 264, 5912, 1052, 323, 88335, 927, 433, 13, 578, 5238, 9093, 198, 286, 6782, 872, 40127, 5885, 13, 1442, 353, 2201, 29675, 564, 12594, 264, 88034, 1052, 198, 286, 690, 1121, 304, 459, 4384, 8668, 4856, 1109, 459, 4788, 13, 353, 9872, 5736, 286, 527, 5946, 311, 551, 69991, 19258, 1858, 5949, 63438, 14711, 6075, 512, 755, 1373, 18828, 320, 726, 11, 3941, 1151, 3423, 518, 912, 29675, 564, 5725, 11, 3146, 9872, 997, 286, 4304, 32215, 264, 8668, 315, 5238, 505, 279, 1052, 14618, 311, 555, 420, 1853, 11, 555, 198, 286, 8736, 439, 264, 5912, 1052, 323, 88335, 927, 433, 13, 578, 5238, 9093, 198, 286, 6782, 872, 40127, 5885, 13, 1442, 353, 2201, 29675, 564, 12594, 264, 88034, 1052, 198, 286, 690, 1121, 304, 459, 4384, 8668, 4856, 1109, 459, 4788, 13, 353, 9872, 5736, 286, 527, 5946, 311, 551, 69991, 19258, 1858, 5949, 63438, 286, 3270, 286, 1456, 512, 310, 449, 659, 5949, 320, 8684, 28, 8684, 11, 3146, 9872, 8, 439, 282, 512, 394, 369, 1584, 304, 282, 512, 504, 7692, 1584, 198, 286, 3734, 62061, 439, 384, 512, 310, 422, 384, 18948, 2201, 976, 220, 17, 477, 539, 912, 29675, 564, 512, 394, 4933, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 32215, 264, 8668, 315, 5238, 505, 279, 1052, 14618, 311, 555, 420, 1853, 11, 555, 198, 286, 8736, 439, 264, 5912, 1052, 323, 88335, 927, 433, 13, 578, 5238, 9093, 198, 286, 6782, 872, 40127, 5885, 13, 1442, 353, 2201, 29675, 564, 12594, 264, 88034, 1052, 198, 286, 690, 1121, 304, 459, 4384, 8668, 4856, 1109, 459, 4788, 13, 353, 9872, 5736, 286, 527, 5946, 311, 551, 69991, 19258, 1858, 5949, 63438, 14711, 6075, 512, 755, 1373, 18828, 320, 726, 11, 3941, 1151, 3423, 518, 912, 29675, 564, 5725, 11, 3146, 9872, 997, 286, 4304, 32215, 264, 8668, 315, 5238, 505, 279, 1052, 14618, 311, 555, 420, 1853, 11, 555, 198, 286, 8736, 439, 264, 5912, 1052, 323, 88335, 927, 433, 13, 578, 5238, 9093, 198, 286, 6782, 872, 40127, 5885, 13, 1442, 353, 2201, 29675, 564, 12594, 264, 88034, 1052, 198, 286, 690, 1121, 304, 459, 4384, 8668, 4856, 1109, 459, 4788, 13, 353, 9872, 5736, 286, 527, 5946, 311, 551, 69991, 19258, 1858, 5949, 63438, 286, 3270, 286, 1456, 512, 310, 449, 659, 5949, 320, 8684, 28, 8684, 11, 3146, 9872, 8, 439, 282, 512, 394, 369, 1584, 304, 282, 512, 504, 7692, 1584, 198, 286, 3734, 62061, 439, 384, 512, 310, 422, 384, 18948, 2201, 976, 220, 17, 477, 539, 912, 29675, 564, 512, 394, 4933, 198, 27, 91, 8862, 728, 428, 91, 29, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]
python-constraint/python-constraint
constraint/__init__.py
Problem.getSolution
def getSolution(self): """ Find and return a solution to the problem Example: >>> problem = Problem() >>> problem.getSolution() is None True >>> problem.addVariables(["a"], [42]) >>> problem.getSolution() {'a': 42} @return: Solution for the problem @rtype: dictionary mapping variables to values """ domains, constraints, vconstraints = self._getArgs() if not domains: return None return self._solver.getSolution(domains, constraints, vconstraints)
python
def getSolution(self): """ Find and return a solution to the problem Example: >>> problem = Problem() >>> problem.getSolution() is None True >>> problem.addVariables(["a"], [42]) >>> problem.getSolution() {'a': 42} @return: Solution for the problem @rtype: dictionary mapping variables to values """ domains, constraints, vconstraints = self._getArgs() if not domains: return None return self._solver.getSolution(domains, constraints, vconstraints)
[ "def", "getSolution", "(", "self", ")", ":", "domains", ",", "constraints", ",", "vconstraints", "=", "self", ".", "_getArgs", "(", ")", "if", "not", "domains", ":", "return", "None", "return", "self", ".", "_solver", ".", "getSolution", "(", "domains", ",", "constraints", ",", "vconstraints", ")" ]
Find and return a solution to the problem Example: >>> problem = Problem() >>> problem.getSolution() is None True >>> problem.addVariables(["a"], [42]) >>> problem.getSolution() {'a': 42} @return: Solution for the problem @rtype: dictionary mapping variables to values
[ "Find", "and", "return", "a", "solution", "to", "the", "problem" ]
train
https://github.com/python-constraint/python-constraint/blob/e23fe9852cddddf1c3e258e03f2175df24b4c702/constraint/__init__.py#L212-L231
<|startoftext|> ### Instruction: You are a Senior Software Developer and a helpful AI programming assistant. Generate only Python code without explanations. Respond only in English. ### Task: Find and return a solution to the problem Example: >>> problem = Problem() >>> problem.getSolution() is None True >>> problem.addVariables(["a"], [42]) >>> problem.getSolution() {'a': 42} @return: Solution for the problem @rtype: dictionary mapping variables to values ### Response: def getSolution(self): """ Find and return a solution to the problem Example: >>> problem = Problem() >>> problem.getSolution() is None True >>> problem.addVariables(["a"], [42]) >>> problem.getSolution() {'a': 42} @return: Solution for the problem @rtype: dictionary mapping variables to values """ domains, constraints, vconstraints = self._getArgs() if not domains: return None return self._solver.getSolution(domains, constraints, vconstraints) <|endoftext|>
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10086, 323, 471, 264, 6425, 311, 279, 3575, 271, 286, 13688, 1473, 286, 12382, 3575, 284, 22854, 746, 286, 12382, 3575, 673, 37942, 368, 374, 2290, 198, 286, 3082, 198, 286, 12382, 3575, 1388, 23510, 19605, 64, 8073, 510, 2983, 2608, 286, 12382, 3575, 673, 37942, 746, 286, 5473, 64, 1232, 220, 2983, 633, 286, 571, 693, 25, 12761, 369, 279, 3575, 198, 286, 571, 33613, 25, 11240, 13021, 7482, 311, 2819, 271, 14711, 6075, 512, 755, 636, 37942, 1214, 997, 286, 3270, 286, 7531, 323, 471, 264, 6425, 311, 279, 3575, 271, 286, 13688, 1473, 286, 12382, 3575, 284, 22854, 746, 286, 12382, 3575, 673, 37942, 368, 374, 2290, 198, 286, 3082, 198, 286, 12382, 3575, 1388, 23510, 19605, 64, 8073, 510, 2983, 2608, 286, 12382, 3575, 673, 37942, 746, 286, 5473, 64, 1232, 220, 2983, 633, 286, 571, 693, 25, 12761, 369, 279, 3575, 198, 286, 571, 33613, 25, 11240, 13021, 7482, 311, 2819, 198, 286, 3270, 286, 31576, 11, 17413, 11, 348, 66412, 284, 659, 1462, 456, 4209, 746, 286, 422, 539, 31576, 512, 310, 471, 2290, 198, 286, 471, 659, 1462, 76601, 673, 37942, 61956, 1771, 11, 17413, 11, 348, 66412, 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 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 128000, 27, 91, 2527, 14450, 428, 91, 397, 14711, 30151, 512, 2675, 527, 264, 19903, 4476, 25922, 323, 264, 11190, 15592, 15840, 18328, 13, 20400, 1193, 13325, 2082, 2085, 41941, 13, 40633, 1193, 304, 6498, 382, 14711, 5546, 512, 10086, 323, 471, 264, 6425, 311, 279, 3575, 271, 286, 13688, 1473, 286, 12382, 3575, 284, 22854, 746, 286, 12382, 3575, 673, 37942, 368, 374, 2290, 198, 286, 3082, 198, 286, 12382, 3575, 1388, 23510, 19605, 64, 8073, 510, 2983, 2608, 286, 12382, 3575, 673, 37942, 746, 286, 5473, 64, 1232, 220, 2983, 633, 286, 571, 693, 25, 12761, 369, 279, 3575, 198, 286, 571, 33613, 25, 11240, 13021, 7482, 311, 2819, 271, 14711, 6075, 512, 755, 636, 37942, 1214, 997, 286, 3270, 286, 7531, 323, 471, 264, 6425, 311, 279, 3575, 271, 286, 13688, 1473, 286, 12382, 3575, 284, 22854, 746, 286, 12382, 3575, 673, 37942, 368, 374, 2290, 198, 286, 3082, 198, 286, 12382, 3575, 1388, 23510, 19605, 64, 8073, 510, 2983, 2608, 286, 12382, 3575, 673, 37942, 746, 286, 5473, 64, 1232, 220, 2983, 633, 286, 571, 693, 25, 12761, 369, 279, 3575, 198, 286, 571, 33613, 25, 11240, 13021, 7482, 311, 2819, 198, 286, 3270, 286, 31576, 11, 17413, 11, 348, 66412, 284, 659, 1462, 456, 4209, 746, 286, 422, 539, 31576, 512, 310, 471, 2290, 198, 286, 471, 659, 1462, 76601, 673, 37942, 61956, 1771, 11, 17413, 11, 348, 66412, 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 ]
gagneurlab/concise
concise/utils/position.py
extract_landmarks
def extract_landmarks(gtf, landmarks=ALL_LANDMARKS): """Given an gene annotation GFF/GTF file, # Arguments gtf: File path or a loaded `pd.DataFrame` with columns: seqname, feature, start, end, strand landmarks: list or a dictionary of landmark extractors (function or name) # Note When landmark extractor names are used, they have to be implemented in the module `concise.preprocessing.position` # Returns Dictionary of pd.DataFrames with landmark positions (columns: seqname, position, strand) """ if isinstance(gtf, str): _logger.info("Reading gtf file..") gtf = read_gtf(gtf) _logger.info("Done") _logger.info("Running landmark extractors..") # landmarks to a dictionary with a function assert isinstance(landmarks, (list, tuple, set, dict)) if isinstance(landmarks, dict): landmarks = {k: _get_fun(v) for k, v in landmarks.items()} else: landmarks = {_to_string(fn_str): _get_fun(fn_str) for fn_str in landmarks} r = {k: _validate_pos(v(gtf)) for k, v in landmarks.items()} _logger.info("Done!") return r
python
def extract_landmarks(gtf, landmarks=ALL_LANDMARKS): """Given an gene annotation GFF/GTF file, # Arguments gtf: File path or a loaded `pd.DataFrame` with columns: seqname, feature, start, end, strand landmarks: list or a dictionary of landmark extractors (function or name) # Note When landmark extractor names are used, they have to be implemented in the module `concise.preprocessing.position` # Returns Dictionary of pd.DataFrames with landmark positions (columns: seqname, position, strand) """ if isinstance(gtf, str): _logger.info("Reading gtf file..") gtf = read_gtf(gtf) _logger.info("Done") _logger.info("Running landmark extractors..") # landmarks to a dictionary with a function assert isinstance(landmarks, (list, tuple, set, dict)) if isinstance(landmarks, dict): landmarks = {k: _get_fun(v) for k, v in landmarks.items()} else: landmarks = {_to_string(fn_str): _get_fun(fn_str) for fn_str in landmarks} r = {k: _validate_pos(v(gtf)) for k, v in landmarks.items()} _logger.info("Done!") return r
[ "def", "extract_landmarks", "(", "gtf", ",", "landmarks", "=", "ALL_LANDMARKS", ")", ":", "if", "isinstance", "(", "gtf", ",", "str", ")", ":", "_logger", ".", "info", "(", "\"Reading gtf file..\"", ")", "gtf", "=", "read_gtf", "(", "gtf", ")", "_logger", ".", "info", "(", "\"Done\"", ")", "_logger", ".", "info", "(", "\"Running landmark extractors..\"", ")", "# landmarks to a dictionary with a function", "assert", "isinstance", "(", "landmarks", ",", "(", "list", ",", "tuple", ",", "set", ",", "dict", ")", ")", "if", "isinstance", "(", "landmarks", ",", "dict", ")", ":", "landmarks", "=", "{", "k", ":", "_get_fun", "(", "v", ")", "for", "k", ",", "v", "in", "landmarks", ".", "items", "(", ")", "}", "else", ":", "landmarks", "=", "{", "_to_string", "(", "fn_str", ")", ":", "_get_fun", "(", "fn_str", ")", "for", "fn_str", "in", "landmarks", "}", "r", "=", "{", "k", ":", "_validate_pos", "(", "v", "(", "gtf", ")", ")", "for", "k", ",", "v", "in", "landmarks", ".", "items", "(", ")", "}", "_logger", ".", "info", "(", "\"Done!\"", ")", "return", "r" ]
Given an gene annotation GFF/GTF file, # Arguments gtf: File path or a loaded `pd.DataFrame` with columns: seqname, feature, start, end, strand landmarks: list or a dictionary of landmark extractors (function or name) # Note When landmark extractor names are used, they have to be implemented in the module `concise.preprocessing.position` # Returns Dictionary of pd.DataFrames with landmark positions (columns: seqname, position, strand)
[ "Given", "an", "gene", "annotation", "GFF", "/", "GTF", "file" ]
train
https://github.com/gagneurlab/concise/blob/d15262eb1e590008bc96ba31e93bfbdbfa1a9fd4/concise/utils/position.py#L16-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: Given an gene annotation GFF/GTF file, # Arguments gtf: File path or a loaded `pd.DataFrame` with columns: seqname, feature, start, end, strand landmarks: list or a dictionary of landmark extractors (function or name) # Note When landmark extractor names are used, they have to be implemented in the module `concise.preprocessing.position` # Returns Dictionary of pd.DataFrames with landmark positions (columns: seqname, position, strand) ### Response: def extract_landmarks(gtf, landmarks=ALL_LANDMARKS): """Given an gene annotation GFF/GTF file, # Arguments gtf: File path or a loaded `pd.DataFrame` with columns: seqname, feature, start, end, strand landmarks: list or a dictionary of landmark extractors (function or name) # Note When landmark extractor names are used, they have to be implemented in the module `concise.preprocessing.position` # Returns Dictionary of pd.DataFrames with landmark positions (columns: seqname, position, strand) """ if isinstance(gtf, str): _logger.info("Reading gtf file..") gtf = read_gtf(gtf) _logger.info("Done") _logger.info("Running landmark extractors..") # landmarks to a dictionary with a function assert isinstance(landmarks, (list, tuple, set, dict)) if isinstance(landmarks, dict): landmarks = {k: _get_fun(v) for k, v in landmarks.items()} else: landmarks = {_to_string(fn_str): _get_fun(fn_str) for fn_str in landmarks} r = {k: _validate_pos(v(gtf)) for k, v in landmarks.items()} _logger.info("Done!") 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, 22818, 459, 15207, 21917, 480, 1785, 16169, 11042, 1052, 3638, 262, 674, 28802, 198, 286, 342, 9112, 25, 2958, 1853, 477, 264, 6799, 1595, 15720, 21756, 63, 449, 8310, 512, 262, 13278, 609, 11, 4668, 11, 1212, 11, 842, 11, 42589, 198, 286, 61024, 25, 1160, 477, 264, 11240, 315, 38350, 8819, 1105, 320, 1723, 477, 836, 696, 262, 674, 7181, 198, 286, 3277, 38350, 68572, 5144, 527, 1511, 11, 814, 617, 311, 387, 11798, 304, 198, 262, 279, 4793, 1595, 41546, 1082, 60064, 6318, 19884, 262, 674, 5295, 198, 286, 10685, 315, 7900, 3417, 35145, 449, 38350, 10093, 198, 262, 320, 16773, 25, 13278, 609, 11, 2361, 11, 42589, 696, 14711, 6075, 512, 755, 8819, 61606, 15914, 3348, 9112, 11, 61024, 28, 4006, 2406, 4064, 24995, 50, 997, 262, 4304, 22818, 459, 15207, 21917, 480, 1785, 16169, 11042, 1052, 3638, 262, 674, 28802, 198, 286, 342, 9112, 25, 2958, 1853, 477, 264, 6799, 1595, 15720, 21756, 63, 449, 8310, 512, 262, 13278, 609, 11, 4668, 11, 1212, 11, 842, 11, 42589, 198, 286, 61024, 25, 1160, 477, 264, 11240, 315, 38350, 8819, 1105, 320, 1723, 477, 836, 696, 262, 674, 7181, 198, 286, 3277, 38350, 68572, 5144, 527, 1511, 11, 814, 617, 311, 387, 11798, 304, 198, 262, 279, 4793, 1595, 41546, 1082, 60064, 6318, 19884, 262, 674, 5295, 198, 286, 10685, 315, 7900, 3417, 35145, 449, 38350, 10093, 198, 262, 320, 16773, 25, 13278, 609, 11, 2361, 11, 42589, 340, 262, 3270, 262, 422, 11656, 3348, 9112, 11, 610, 997, 286, 721, 9985, 5506, 446, 32999, 342, 9112, 1052, 497, 1158, 286, 342, 9112, 284, 1373, 1928, 9112, 3348, 9112, 340, 286, 721, 9985, 5506, 446, 17911, 5240, 262, 721, 9985, 5506, 446, 19527, 38350, 8819, 1105, 497, 1158, 262, 674, 61024, 311, 264, 11240, 449, 264, 734, 198, 262, 2105, 11656, 7, 1974, 15914, 11, 320, 1638, 11, 14743, 11, 743, 11, 6587, 1192, 262, 422, 11656, 7, 1974, 15914, 11, 6587, 997, 286, 61024, 284, 314, 74, 25, 721, 456, 29415, 3832, 8, 369, 597, 11, 348, 304, 61024, 9812, 24413, 262, 775, 512, 286, 61024, 284, 49717, 998, 3991, 24968, 2966, 1680, 721, 456, 29415, 24968, 2966, 340, 3909, 369, 5279, 2966, 304, 61024, 633, 262, 436, 284, 314, 74, 25, 721, 7212, 6615, 3832, 3348, 9112, 595, 369, 597, 11, 348, 304, 61024, 9812, 24413, 262, 721, 9985, 5506, 446, 17911, 23849, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 15207, 21917, 480, 1785, 16169, 11042, 1052, 3638, 262, 674, 28802, 198, 286, 342, 9112, 25, 2958, 1853, 477, 264, 6799, 1595, 15720, 21756, 63, 449, 8310, 512, 262, 13278, 609, 11, 4668, 11, 1212, 11, 842, 11, 42589, 198, 286, 61024, 25, 1160, 477, 264, 11240, 315, 38350, 8819, 1105, 320, 1723, 477, 836, 696, 262, 674, 7181, 198, 286, 3277, 38350, 68572, 5144, 527, 1511, 11, 814, 617, 311, 387, 11798, 304, 198, 262, 279, 4793, 1595, 41546, 1082, 60064, 6318, 19884, 262, 674, 5295, 198, 286, 10685, 315, 7900, 3417, 35145, 449, 38350, 10093, 198, 262, 320, 16773, 25, 13278, 609, 11, 2361, 11, 42589, 696, 14711, 6075, 512, 755, 8819, 61606, 15914, 3348, 9112, 11, 61024, 28, 4006, 2406, 4064, 24995, 50, 997, 262, 4304, 22818, 459, 15207, 21917, 480, 1785, 16169, 11042, 1052, 3638, 262, 674, 28802, 198, 286, 342, 9112, 25, 2958, 1853, 477, 264, 6799, 1595, 15720, 21756, 63, 449, 8310, 512, 262, 13278, 609, 11, 4668, 11, 1212, 11, 842, 11, 42589, 198, 286, 61024, 25, 1160, 477, 264, 11240, 315, 38350, 8819, 1105, 320, 1723, 477, 836, 696, 262, 674, 7181, 198, 286, 3277, 38350, 68572, 5144, 527, 1511, 11, 814, 617, 311, 387, 11798, 304, 198, 262, 279, 4793, 1595, 41546, 1082, 60064, 6318, 19884, 262, 674, 5295, 198, 286, 10685, 315, 7900, 3417, 35145, 449, 38350, 10093, 198, 262, 320, 16773, 25, 13278, 609, 11, 2361, 11, 42589, 340, 262, 3270, 262, 422, 11656, 3348, 9112, 11, 610, 997, 286, 721, 9985, 5506, 446, 32999, 342, 9112, 1052, 497, 1158, 286, 342, 9112, 284, 1373, 1928, 9112, 3348, 9112, 340, 286, 721, 9985, 5506, 446, 17911, 5240, 262, 721, 9985, 5506, 446, 19527, 38350, 8819, 1105, 497, 1158, 262, 674, 61024, 311, 264, 11240, 449, 264, 734, 198, 262, 2105, 11656, 7, 1974, 15914, 11, 320, 1638, 11, 14743, 11, 743, 11, 6587, 1192, 262, 422, 11656, 7, 1974, 15914, 11, 6587, 997, 286, 61024, 284, 314, 74, 25, 721, 456, 29415, 3832, 8, 369, 597, 11, 348, 304, 61024, 9812, 24413, 262, 775, 512, 286, 61024, 284, 49717, 998, 3991, 24968, 2966, 1680, 721, 456, 29415, 24968, 2966, 340, 3909, 369, 5279, 2966, 304, 61024, 633, 262, 436, 284, 314, 74, 25, 721, 7212, 6615, 3832, 3348, 9112, 595, 369, 597, 11, 348, 304, 61024, 9812, 24413, 262, 721, 9985, 5506, 446, 17911, 23849, 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, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009, 128009 ]