sequence
stringlengths 1.16k
23.8k
| docstring
stringlengths 5
7.69k
|
|---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_keyring'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'keyring'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '23']}; {'id': '6', 'type': 'global_statement', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': '_keyring_backend'}; {'id': '8', 'type': 'if_statement', 'children': ['9', '17']}; {'id': '9', 'type': 'not_operator', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'keyring'}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'KeyringBackend'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'raise_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'string', 'children': [], 'value': '"The keyring must be a subclass of KeyringBackend"'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_keyring_backend'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'keyring'}
|
Set current keyring backend.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run_program'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'prog_list'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'try_statement', 'children': ['9', '102']}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '13', '82']}; {'id': '11', 'type': 'not_operator', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '13', 'type': 'block', 'children': ['14', '27', '37', '43', '77']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'process'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'Popen'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21', '24']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'prog_list'}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'PIPE'}; {'id': '24', 'type': 'keyword_argument', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'PIPE'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '32']}; {'id': '29', 'type': 'pattern_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'process'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'communicate'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'retcode'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'process'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'returncode'}; {'id': '43', 'type': 'if_statement', 'children': ['44', '47']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': '>='}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '47', 'type': 'block', 'children': ['48', '59', '65', '71']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53']}; {'id': '52', 'type': 'string', 'children': [], 'value': '"Program : "'}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'string', 'children': [], 'value': '" "'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'prog_list'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': '"Return Code: "'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'retcode'}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '68', 'type': 'argument_list', 'children': ['69', '70']}; {'id': '69', 'type': 'string', 'children': [], 'value': '"Stdout: "'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'string', 'children': [], 'value': '"Stderr: "'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '77', 'type': 'return_statement', 'children': ['78']}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'retcode'}; {'id': '82', 'type': 'else_clause', 'children': ['83']}; {'id': '83', 'type': 'block', 'children': ['84', '93', '100']}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'string', 'children': [], 'value': '" "'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'prog_list'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'system'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'True', 'children': []}; {'id': '102', 'type': 'except_clause', 'children': ['103']}; {'id': '103', 'type': 'block', 'children': ['104']}; {'id': '104', 'type': 'return_statement', 'children': ['105']}; {'id': '105', 'type': 'False', 'children': []}
|
Run a program and check program return code Note that some commands don't work
well with Popen. So if this function is specifically called with 'shell=True',
then it will run the old 'os.system'. In which case, there is no program output
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fetch_repo_creation_date'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '20', '28', '44', '70']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'gh'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'github'}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'repo'}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '33']}; {'id': '30', 'type': 'pattern_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'rc'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '33', 'type': 'call', 'children': ['34', '43']}; {'id': '34', 'type': 'attribute', 'children': ['35', '42']}; {'id': '35', 'type': 'subscript', 'children': ['36', '41']}; {'id': '36', 'type': 'subscript', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'gh'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'repos'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'repo'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'if_statement', 'children': ['45', '48', '55']}; {'id': '45', 'type': 'comparison_operator', 'children': ['46', '47'], 'value': '=='}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'rc'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '200'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'expression_list', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'REPO_CREATED_TAG_NAME'}; {'id': '52', 'type': 'subscript', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '54', 'type': 'string', 'children': [], 'value': '"created_at"'}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'raise_GitHubError'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64', '65']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'rc'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '65', 'type': 'call', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'gh'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'getheaders'}; {'id': '69', 'type': 'argument_list', 'children': []}; {'id': '70', 'type': 'return_statement', 'children': ['71']}; {'id': '71', 'type': 'expression_list', 'children': ['72', '73']}; {'id': '72', 'type': 'None', 'children': []}; {'id': '73', 'type': 'None', 'children': []}
|
Get the creation date of the repository from GitHub.
:rtype: str, str
:return: special tag name, creation date as ISO date string
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'inverse_dynamics'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'angles'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '11', 'type': 'float', 'children': [], 'value': '1e100'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'states'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'max_force'}; {'id': '17', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '18', 'type': 'block', 'children': ['19', '33']}; {'id': '19', 'type': 'if_statement', 'children': ['20', '23']}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '22'], 'value': 'is not'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'states'}; {'id': '22', 'type': 'None', 'children': []}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '31']}; {'id': '26', 'type': 'attribute', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'set_body_states'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'states'}; {'id': '33', 'type': 'for_statement', 'children': ['34', '37', '41']}; {'id': '34', 'type': 'pattern_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'frame_no'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'frame'}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'angles'}; {'id': '41', 'type': 'block', 'children': ['42', '48', '54', '66', '76', '85', '94', '105', '116', '124', '132', '141', '150', '153', '164']}; {'id': '42', 'type': 'if_statement', 'children': ['43', '46']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': '<'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'frame_no'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'continue_statement', 'children': []}; {'id': '48', 'type': 'if_statement', 'children': ['49', '52']}; {'id': '49', 'type': 'comparison_operator', 'children': ['50', '51'], 'value': '>='}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'frame_no'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'break_statement', 'children': []}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'ode_space'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'collide'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63']}; {'id': '62', 'type': 'None', 'children': []}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'on_collision'}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'assignment', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'states'}; {'id': '69', 'type': 'call', 'children': ['70', '75']}; {'id': '70', 'type': 'attribute', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'get_body_states'}; {'id': '75', 'type': 'argument_list', 'children': []}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '83']}; {'id': '78', 'type': 'attribute', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'set_body_states'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'states'}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'call', 'children': ['87', '92']}; {'id': '87', 'type': 'attribute', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'enable_motors'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'max_force'}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '101']}; {'id': '96', 'type': 'attribute', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'set_target_angles'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'subscript', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'angles'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'frame_no'}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'call', 'children': ['107', '112']}; {'id': '107', 'type': 'attribute', 'children': ['108', '111']}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'ode_world'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'step'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'assignment', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'torques'}; {'id': '119', 'type': 'attribute', 'children': ['120', '123']}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'joint_torques'}; {'id': '124', 'type': 'expression_statement', 'children': ['125']}; {'id': '125', 'type': 'call', 'children': ['126', '131']}; {'id': '126', 'type': 'attribute', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'disable_motors'}; {'id': '131', 'type': 'argument_list', 'children': []}; {'id': '132', 'type': 'expression_statement', 'children': ['133']}; {'id': '133', 'type': 'call', 'children': ['134', '139']}; {'id': '134', 'type': 'attribute', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'set_body_states'}; {'id': '139', 'type': 'argument_list', 'children': ['140']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'states'}; {'id': '141', 'type': 'expression_statement', 'children': ['142']}; {'id': '142', 'type': 'call', 'children': ['143', '148']}; {'id': '143', 'type': 'attribute', 'children': ['144', '147']}; {'id': '144', 'type': 'attribute', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'skeleton'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'add_torques'}; {'id': '148', 'type': 'argument_list', 'children': ['149']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'torques'}; {'id': '150', 'type': 'expression_statement', 'children': ['151']}; {'id': '151', 'type': 'yield', 'children': ['152']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'torques'}; {'id': '153', 'type': 'expression_statement', 'children': ['154']}; {'id': '154', 'type': 'call', 'children': ['155', '160']}; {'id': '155', 'type': 'attribute', 'children': ['156', '159']}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'ode_world'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'step'}; {'id': '160', 'type': 'argument_list', 'children': ['161']}; {'id': '161', 'type': 'attribute', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '164', 'type': 'expression_statement', 'children': ['165']}; {'id': '165', 'type': 'call', 'children': ['166', '171']}; {'id': '166', 'type': 'attribute', 'children': ['167', '170']}; {'id': '167', 'type': 'attribute', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'ode_contactgroup'}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'empty'}; {'id': '171', 'type': 'argument_list', 'children': []}
|
Follow a set of angle data, yielding dynamic joint torques.
Parameters
----------
angles : ndarray (num-frames x num-dofs)
Follow angle data provided by this array of angle values.
start : int, optional
Start following angle data after this frame. Defaults to the start
of the angle data.
end : int, optional
Stop following angle data after this frame. Defaults to the end of
the angle data.
states : list of body states, optional
If given, set the states of the skeleton bodies to these values
before starting to follow the marker data.
max_force : float, optional
Allow each degree of freedom in the skeleton to exert at most this
force when attempting to follow the given joint angles. Defaults to
100N. Setting this value to be large results in more accurate
following but can cause oscillations in the PID controllers,
resulting in noisy torques.
Returns
-------
torques : sequence of torque frames
Returns a generator of joint torque data for the skeleton. One set
of joint torques will be generated for each frame of angle data
between `start` and `end`.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'recursive_glob'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'base_directory'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'regex'}; {'id': '7', 'type': 'string', 'children': [], 'value': "''"}; {'id': '8', 'type': 'block', 'children': ['9', '22', '55']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'glob'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'base_directory'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'regex'}; {'id': '22', 'type': 'for_statement', 'children': ['23', '27', '33']}; {'id': '23', 'type': 'pattern_list', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'dirlist'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'filelist'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'walk'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'base_directory'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'for_statement', 'children': ['35', '36', '37']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'dir_name'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'dirlist'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'glob'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53', '54']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'dir_name'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'regex'}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'files'}
|
Uses glob to find all files or folders that match the regex
starting from the base_directory.
Parameters
----------
base_directory: str
regex: str
Returns
-------
files: list
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'process_point_value'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'command_type'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'op_type'}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_log'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'Processing received point value for index {}: {}'"}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'command'}
|
A PointValue was received from the Master. Process its payload.
:param command_type: (string) Either 'Select' or 'Operate'.
:param command: A ControlRelayOutputBlock or else a wrapped data value (AnalogOutputInt16, etc.).
:param index: (integer) DNP3 index of the payload's data definition.
:param op_type: An OperateType, or None if command_type == 'Select'.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_color_to_scheme'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'scheme'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'foreground'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'background'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'palette_colors'}; {'id': '9', 'type': 'block', 'children': ['10', '21', '25', '97']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '18']}; {'id': '11', 'type': 'boolean_operator', 'children': ['12', '15'], 'value': 'and'}; {'id': '12', 'type': 'comparison_operator', 'children': ['13', '14'], 'value': 'is'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'foreground'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '17'], 'value': 'is'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'background'}; {'id': '17', 'type': 'None', 'children': []}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'scheme'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'new_scheme'}; {'id': '24', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '25', 'type': 'for_statement', 'children': ['26', '27', '28']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'scheme'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'if_statement', 'children': ['30', '35', '88']}; {'id': '30', 'type': 'comparison_operator', 'children': ['31', '34'], 'value': '=='}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '33', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '35', 'type': 'block', 'children': ['36', '47', '58']}; {'id': '36', 'type': 'if_statement', 'children': ['37', '40']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '39'], 'value': 'is'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'foreground'}; {'id': '39', 'type': 'None', 'children': []}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'foreground'}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '47', 'type': 'if_statement', 'children': ['48', '51']}; {'id': '48', 'type': 'comparison_operator', 'children': ['49', '50'], 'value': 'is'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'background'}; {'id': '50', 'type': 'None', 'children': []}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'background'}; {'id': '55', 'type': 'subscript', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '58', 'type': 'if_statement', 'children': ['59', '62', '76']}; {'id': '59', 'type': 'comparison_operator', 'children': ['60', '61'], 'value': '>'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'palette_colors'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '16'}; {'id': '62', 'type': 'block', 'children': ['63']}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'new_scheme'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'tuple', 'children': ['70', '71', '72', '73', '74', '75']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '71', 'type': 'string', 'children': [], 'value': "''"}; {'id': '72', 'type': 'string', 'children': [], 'value': "''"}; {'id': '73', 'type': 'string', 'children': [], 'value': "''"}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'foreground'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'background'}; {'id': '76', 'type': 'else_clause', 'children': ['77']}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'new_scheme'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'tuple', 'children': ['85', '86', '87']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'foreground'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'background'}; {'id': '88', 'type': 'else_clause', 'children': ['89']}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '95']}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'new_scheme'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '97', 'type': 'return_statement', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'new_scheme'}
|
Add foreground and background colours to a color scheme
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'array_2d_from_array_1d'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'array_1d'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'mapping_util'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'map_masked_1d_array_to_2d_array_from_array_1d_shape_and_one_to_two'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '16', '23']}; {'id': '13', 'type': 'keyword_argument', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'array_1d'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'array_1d'}; {'id': '16', 'type': 'keyword_argument', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'one_to_two'}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'masked_grid_index_to_pixel'}
|
Map a 1D array the same dimension as the grid to its original masked 2D array.
Parameters
-----------
array_1d : ndarray
The 1D array which is mapped to its masked 2D array.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'connect'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '17', '26', '34', '42', '51']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'ftp_class'}; {'id': '8', 'type': 'conditional_expression', 'children': ['9', '12', '14'], 'value': 'if'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'ftplib'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'FTP'}; {'id': '12', 'type': 'not_operator', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'SSL'}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'ftplib'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'FTP_TLS'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'ftp'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ftp_class'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'TIMEOUT'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'ftp'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'connect'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'HOST'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'PORT'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ftp'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'login'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'USER'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'PASSWORD'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'SSL'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'ftp'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'prot_p'}; {'id': '50', 'type': 'argument_list', 'children': []}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'ftp'}
|
Connect to FTP server, login and return an ftplib.FTP instance.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_table'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'components'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'topo_info'}; {'id': '6', 'type': 'block', 'children': ['7', '21', '76', '80', '88', '96', '209', '218']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '12']}; {'id': '9', 'type': 'pattern_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'outputs'}; {'id': '12', 'type': 'expression_list', 'children': ['13', '17']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'defaultdict'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'defaultdict'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '21', 'type': 'for_statement', 'children': ['22', '25', '30']}; {'id': '22', 'type': 'pattern_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ctype'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'components'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'if_statement', 'children': ['32', '35']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '34'], 'value': '=='}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ctype'}; {'id': '34', 'type': 'string', 'children': [], 'value': "'bolts'"}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'for_statement', 'children': ['37', '40', '45']}; {'id': '37', 'type': 'pattern_list', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'component_info'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '44', 'type': 'argument_list', 'children': []}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'for_statement', 'children': ['47', '48', '51']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'input_stream'}; {'id': '48', 'type': 'subscript', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'component_info'}; {'id': '50', 'type': 'string', 'children': [], 'value': "'inputs'"}; {'id': '51', 'type': 'block', 'children': ['52', '58', '67']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'input_name'}; {'id': '55', 'type': 'subscript', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'input_stream'}; {'id': '57', 'type': 'string', 'children': [], 'value': "'component_name'"}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '65']}; {'id': '60', 'type': 'attribute', 'children': ['61', '64']}; {'id': '61', 'type': 'subscript', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'input_name'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '74']}; {'id': '69', 'type': 'attribute', 'children': ['70', '73']}; {'id': '70', 'type': 'subscript', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'outputs'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'input_name'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '79', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'spouts_instance'}; {'id': '83', 'type': 'subscript', 'children': ['84', '87']}; {'id': '84', 'type': 'subscript', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'topo_info'}; {'id': '86', 'type': 'string', 'children': [], 'value': "'physical_plan'"}; {'id': '87', 'type': 'string', 'children': [], 'value': "'spouts'"}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'bolts_instance'}; {'id': '91', 'type': 'subscript', 'children': ['92', '95']}; {'id': '92', 'type': 'subscript', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'topo_info'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'physical_plan'"}; {'id': '95', 'type': 'string', 'children': [], 'value': "'bolts'"}; {'id': '96', 'type': 'for_statement', 'children': ['97', '100', '105']}; {'id': '97', 'type': 'pattern_list', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'ctype'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '100', 'type': 'call', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'components'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '104', 'type': 'argument_list', 'children': []}; {'id': '105', 'type': 'block', 'children': ['106', '112']}; {'id': '106', 'type': 'if_statement', 'children': ['107', '110']}; {'id': '107', 'type': 'comparison_operator', 'children': ['108', '109'], 'value': '=='}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'ctype'}; {'id': '109', 'type': 'string', 'children': [], 'value': '"stages"'}; {'id': '110', 'type': 'block', 'children': ['111']}; {'id': '111', 'type': 'continue_statement', 'children': []}; {'id': '112', 'type': 'for_statement', 'children': ['113', '116', '121']}; {'id': '113', 'type': 'pattern_list', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'component_info'}; {'id': '116', 'type': 'call', 'children': ['117', '120']}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '120', 'type': 'argument_list', 'children': []}; {'id': '121', 'type': 'block', 'children': ['122', '133', '164', '183', '202']}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '125', 'type': 'list', 'children': ['126', '132'], 'value': '[ctype[:-1], component_name]'}; {'id': '126', 'type': 'subscript', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'ctype'}; {'id': '128', 'type': 'slice', 'children': ['129', '130']}; {'id': '129', 'type': 'colon', 'children': []}; {'id': '130', 'type': 'unary_operator', 'children': ['131'], 'value': '-'}; {'id': '131', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '133', 'type': 'if_statement', 'children': ['134', '137', '150']}; {'id': '134', 'type': 'comparison_operator', 'children': ['135', '136'], 'value': '=='}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'ctype'}; {'id': '136', 'type': 'string', 'children': [], 'value': "'spouts'"}; {'id': '137', 'type': 'block', 'children': ['138']}; {'id': '138', 'type': 'expression_statement', 'children': ['139']}; {'id': '139', 'type': 'call', 'children': ['140', '143']}; {'id': '140', 'type': 'attribute', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '143', 'type': 'argument_list', 'children': ['144']}; {'id': '144', 'type': 'call', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '146', 'type': 'argument_list', 'children': ['147']}; {'id': '147', 'type': 'subscript', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'spouts_instance'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '150', 'type': 'else_clause', 'children': ['151']}; {'id': '151', 'type': 'block', 'children': ['152']}; {'id': '152', 'type': 'expression_statement', 'children': ['153']}; {'id': '153', 'type': 'call', 'children': ['154', '157']}; {'id': '154', 'type': 'attribute', 'children': ['155', '156']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '157', 'type': 'argument_list', 'children': ['158']}; {'id': '158', 'type': 'call', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '160', 'type': 'argument_list', 'children': ['161']}; {'id': '161', 'type': 'subscript', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'bolts_instance'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '164', 'type': 'expression_statement', 'children': ['165']}; {'id': '165', 'type': 'call', 'children': ['166', '169']}; {'id': '166', 'type': 'attribute', 'children': ['167', '168']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '169', 'type': 'argument_list', 'children': ['170']}; {'id': '170', 'type': 'call', 'children': ['171', '174']}; {'id': '171', 'type': 'attribute', 'children': ['172', '173']}; {'id': '172', 'type': 'string', 'children': [], 'value': "','"}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '174', 'type': 'argument_list', 'children': ['175']}; {'id': '175', 'type': 'call', 'children': ['176', '179']}; {'id': '176', 'type': 'attribute', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '179', 'type': 'argument_list', 'children': ['180', '181']}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '181', 'type': 'list', 'children': ['182'], 'value': "['-']"}; {'id': '182', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '183', 'type': 'expression_statement', 'children': ['184']}; {'id': '184', 'type': 'call', 'children': ['185', '188']}; {'id': '185', 'type': 'attribute', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '188', 'type': 'argument_list', 'children': ['189']}; {'id': '189', 'type': 'call', 'children': ['190', '193']}; {'id': '190', 'type': 'attribute', 'children': ['191', '192']}; {'id': '191', 'type': 'string', 'children': [], 'value': "','"}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '193', 'type': 'argument_list', 'children': ['194']}; {'id': '194', 'type': 'call', 'children': ['195', '198']}; {'id': '195', 'type': 'attribute', 'children': ['196', '197']}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'outputs'}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '198', 'type': 'argument_list', 'children': ['199', '200']}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '200', 'type': 'list', 'children': ['201'], 'value': "['-']"}; {'id': '201', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '202', 'type': 'expression_statement', 'children': ['203']}; {'id': '203', 'type': 'call', 'children': ['204', '207']}; {'id': '204', 'type': 'attribute', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '207', 'type': 'argument_list', 'children': ['208']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '209', 'type': 'expression_statement', 'children': ['210']}; {'id': '210', 'type': 'assignment', 'children': ['211', '212']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '212', 'type': 'list', 'children': ['213', '214', '215', '216', '217'], 'value': "['type', 'name', 'parallelism', 'input', 'output']"}; {'id': '213', 'type': 'string', 'children': [], 'value': "'type'"}; {'id': '214', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '215', 'type': 'string', 'children': [], 'value': "'parallelism'"}; {'id': '216', 'type': 'string', 'children': [], 'value': "'input'"}; {'id': '217', 'type': 'string', 'children': [], 'value': "'output'"}; {'id': '218', 'type': 'return_statement', 'children': ['219']}; {'id': '219', 'type': 'expression_list', 'children': ['220', '221']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'header'}
|
normalize raw logical plan info to table
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pickle_load'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'compression'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '11', '51']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'compression'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'with_statement', 'children': ['13', '30']}; {'id': '13', 'type': 'with_clause', 'children': ['14']}; {'id': '14', 'type': 'with_item', 'children': ['15']}; {'id': '15', 'type': 'as_pattern', 'children': ['16', '28']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'zipfile'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'ZipFile'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '23']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '22', 'type': 'string', 'children': [], 'value': '"r"'}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'compression'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'zipfile'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ZIP_DEFLATED'}; {'id': '28', 'type': 'as_pattern_target', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'myzip'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'with_statement', 'children': ['32', '43']}; {'id': '32', 'type': 'with_clause', 'children': ['33']}; {'id': '33', 'type': 'with_item', 'children': ['34']}; {'id': '34', 'type': 'as_pattern', 'children': ['35', '41']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'myzip'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'string', 'children': [], 'value': '"data"'}; {'id': '41', 'type': 'as_pattern_target', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'pickle'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '51', 'type': 'else_clause', 'children': ['52']}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'with_statement', 'children': ['54', '64']}; {'id': '54', 'type': 'with_clause', 'children': ['55']}; {'id': '55', 'type': 'with_item', 'children': ['56']}; {'id': '56', 'type': 'as_pattern', 'children': ['57', '62']}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '59', 'type': 'argument_list', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '61', 'type': 'string', 'children': [], 'value': '"rb"'}; {'id': '62', 'type': 'as_pattern_target', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '64', 'type': 'block', 'children': ['65']}; {'id': '65', 'type': 'return_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'pickle'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'f'}
|
Unpickle a possible compressed pickle.
Parameters
----------
path: str
path to the output file
compression: bool
if true assumes that pickle was compressed when created and attempts decompression.
Returns
-------
obj: object
the unpickled object
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_stdout'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'workflow_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'task_id'}; {'id': '7', 'type': 'block', 'children': ['8', '25', '36', '42']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '11', 'type': 'binary_operator', 'children': ['12', '13'], 'value': '%'}; {'id': '12', 'type': 'string', 'children': [], 'value': "'%(wf_url)s/%(wf_id)s/tasks/%(task_id)s/stdout'"}; {'id': '13', 'type': 'dictionary', 'children': ['14', '19', '22']}; {'id': '14', 'type': 'pair', 'children': ['15', '16']}; {'id': '15', 'type': 'string', 'children': [], 'value': "'wf_url'"}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'workflows_url'}; {'id': '19', 'type': 'pair', 'children': ['20', '21']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'wf_id'"}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'workflow_id'}; {'id': '22', 'type': 'pair', 'children': ['23', '24']}; {'id': '23', 'type': 'string', 'children': [], 'value': "'task_id'"}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'task_id'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'gbdx_connection'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'raise_for_status'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'text'}
|
Get stdout for a particular task.
Args:
workflow_id (str): Workflow id.
task_id (str): Task id.
Returns:
Stdout of the task (string).
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_getMatchingRowsNoRetries'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tableInfo'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'fieldsToMatch'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'maxRows'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '19', '39', '45', '61', '69', '121', '148', '169', '173', '189', '199', '209', '264']}; {'id': '13', 'type': 'assert_statement', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'fieldsToMatch'}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'fieldsToMatch'}; {'id': '19', 'type': 'assert_statement', 'children': ['20', '35']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '22', 'type': 'generator_expression', 'children': ['23', '28']}; {'id': '23', 'type': 'comparison_operator', 'children': ['24', '25'], 'value': 'in'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'tableInfo'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'dbFieldNames'}; {'id': '28', 'type': 'for_in_clause', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'fieldsToMatch'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'iterkeys'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'fieldsToMatch'}; {'id': '39', 'type': 'assert_statement', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '45', 'type': 'assert_statement', 'children': ['46', '57']}; {'id': '46', 'type': 'call', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '48', 'type': 'generator_expression', 'children': ['49', '54']}; {'id': '49', 'type': 'comparison_operator', 'children': ['50', '51'], 'value': 'in'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'tableInfo'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'dbFieldNames'}; {'id': '54', 'type': 'for_in_clause', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'matchPairs'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'fieldsToMatch'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '68', 'type': 'argument_list', 'children': []}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'matchExpressionGen'}; {'id': '72', 'type': 'generator_expression', 'children': ['73', '118']}; {'id': '73', 'type': 'binary_operator', 'children': ['74', '77'], 'value': '+'}; {'id': '74', 'type': 'subscript', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '76', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '77', 'type': '()', 'children': ['78']}; {'id': '78', 'type': 'conditional_expression', 'children': ['79', '92', '99'], 'value': 'if'}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '81'], 'value': '+'}; {'id': '80', 'type': 'string', 'children': [], 'value': "' IS '"}; {'id': '81', 'type': 'subscript', 'children': ['82', '89']}; {'id': '82', 'type': 'dictionary', 'children': ['83', '86']}; {'id': '83', 'type': 'pair', 'children': ['84', '85']}; {'id': '84', 'type': 'True', 'children': []}; {'id': '85', 'type': 'string', 'children': [], 'value': "'TRUE'"}; {'id': '86', 'type': 'pair', 'children': ['87', '88']}; {'id': '87', 'type': 'False', 'children': []}; {'id': '88', 'type': 'string', 'children': [], 'value': "'FALSE'"}; {'id': '89', 'type': 'subscript', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '91', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '92', 'type': 'call', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '98']}; {'id': '95', 'type': 'subscript', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '97', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '99', 'type': 'conditional_expression', 'children': ['100', '101', '106'], 'value': 'if'}; {'id': '100', 'type': 'string', 'children': [], 'value': "' IS NULL'"}; {'id': '101', 'type': 'comparison_operator', 'children': ['102', '105'], 'value': 'is'}; {'id': '102', 'type': 'subscript', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '104', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '105', 'type': 'None', 'children': []}; {'id': '106', 'type': 'conditional_expression', 'children': ['107', '108', '117'], 'value': 'if'}; {'id': '107', 'type': 'string', 'children': [], 'value': "' IN %s'"}; {'id': '108', 'type': 'call', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '110', 'type': 'argument_list', 'children': ['111', '114']}; {'id': '111', 'type': 'subscript', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '113', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': '_SEQUENCE_TYPES'}; {'id': '117', 'type': 'string', 'children': [], 'value': "'=%s'"}; {'id': '118', 'type': 'for_in_clause', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'matchPairs'}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'assignment', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'matchFieldValues'}; {'id': '124', 'type': 'list_comprehension', 'children': ['125', '128', '131']}; {'id': '125', 'type': 'subscript', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '127', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '128', 'type': 'for_in_clause', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'matchPairs'}; {'id': '131', 'type': 'if_clause', 'children': ['132']}; {'id': '132', 'type': '()', 'children': ['133']}; {'id': '133', 'type': 'boolean_operator', 'children': ['134', '143'], 'value': 'and'}; {'id': '134', 'type': 'not_operator', 'children': ['135']}; {'id': '135', 'type': 'call', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '137', 'type': 'argument_list', 'children': ['138', '141']}; {'id': '138', 'type': 'subscript', 'children': ['139', '140']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '140', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '141', 'type': '()', 'children': ['142']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '143', 'type': 'comparison_operator', 'children': ['144', '147'], 'value': 'is not'}; {'id': '144', 'type': 'subscript', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '146', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '147', 'type': 'None', 'children': []}; {'id': '148', 'type': 'expression_statement', 'children': ['149']}; {'id': '149', 'type': 'assignment', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '151', 'type': 'binary_operator', 'children': ['152', '153'], 'value': '%'}; {'id': '152', 'type': 'string', 'children': [], 'value': "'SELECT %s FROM %s WHERE (%s)'"}; {'id': '153', 'type': 'tuple', 'children': ['154', '160', '163']}; {'id': '154', 'type': 'call', 'children': ['155', '158']}; {'id': '155', 'type': 'attribute', 'children': ['156', '157']}; {'id': '156', 'type': 'string', 'children': [], 'value': "','"}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '158', 'type': 'argument_list', 'children': ['159']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '160', 'type': 'attribute', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'tableInfo'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'tableName'}; {'id': '163', 'type': 'call', 'children': ['164', '167']}; {'id': '164', 'type': 'attribute', 'children': ['165', '166']}; {'id': '165', 'type': 'string', 'children': [], 'value': "' AND '"}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '167', 'type': 'argument_list', 'children': ['168']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'matchExpressionGen'}; {'id': '169', 'type': 'expression_statement', 'children': ['170']}; {'id': '170', 'type': 'assignment', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'sqlParams'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'matchFieldValues'}; {'id': '173', 'type': 'if_statement', 'children': ['174', '177']}; {'id': '174', 'type': 'comparison_operator', 'children': ['175', '176'], 'value': 'is not'}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'maxRows'}; {'id': '176', 'type': 'None', 'children': []}; {'id': '177', 'type': 'block', 'children': ['178', '182']}; {'id': '178', 'type': 'expression_statement', 'children': ['179']}; {'id': '179', 'type': 'augmented_assignment', 'children': ['180', '181'], 'value': '+='}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '181', 'type': 'string', 'children': [], 'value': "' LIMIT %s'"}; {'id': '182', 'type': 'expression_statement', 'children': ['183']}; {'id': '183', 'type': 'call', 'children': ['184', '187']}; {'id': '184', 'type': 'attribute', 'children': ['185', '186']}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'sqlParams'}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '187', 'type': 'argument_list', 'children': ['188']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'maxRows'}; {'id': '189', 'type': 'expression_statement', 'children': ['190']}; {'id': '190', 'type': 'call', 'children': ['191', '196']}; {'id': '191', 'type': 'attribute', 'children': ['192', '195']}; {'id': '192', 'type': 'attribute', 'children': ['193', '194']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'cursor'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '196', 'type': 'argument_list', 'children': ['197', '198']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'sqlParams'}; {'id': '199', 'type': 'expression_statement', 'children': ['200']}; {'id': '200', 'type': 'assignment', 'children': ['201', '202']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '202', 'type': 'call', 'children': ['203', '208']}; {'id': '203', 'type': 'attribute', 'children': ['204', '207']}; {'id': '204', 'type': 'attribute', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'cursor'}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'fetchall'}; {'id': '208', 'type': 'argument_list', 'children': []}; {'id': '209', 'type': 'if_statement', 'children': ['210', '211', '256']}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '211', 'type': 'block', 'children': ['212', '231']}; {'id': '212', 'type': 'assert_statement', 'children': ['213', '223']}; {'id': '213', 'type': 'boolean_operator', 'children': ['214', '217'], 'value': 'or'}; {'id': '214', 'type': 'comparison_operator', 'children': ['215', '216'], 'value': 'is'}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'maxRows'}; {'id': '216', 'type': 'None', 'children': []}; {'id': '217', 'type': 'comparison_operator', 'children': ['218', '222'], 'value': '<='}; {'id': '218', 'type': 'call', 'children': ['219', '220']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '220', 'type': 'argument_list', 'children': ['221']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'maxRows'}; {'id': '223', 'type': 'binary_operator', 'children': ['224', '225'], 'value': '%'}; {'id': '224', 'type': 'string', 'children': [], 'value': '"%d !<= %d"'}; {'id': '225', 'type': 'tuple', 'children': ['226', '230']}; {'id': '226', 'type': 'call', 'children': ['227', '228']}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '228', 'type': 'argument_list', 'children': ['229']}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'maxRows'}; {'id': '231', 'type': 'assert_statement', 'children': ['232', '243']}; {'id': '232', 'type': 'comparison_operator', 'children': ['233', '239'], 'value': '=='}; {'id': '233', 'type': 'call', 'children': ['234', '235']}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '235', 'type': 'argument_list', 'children': ['236']}; {'id': '236', 'type': 'subscript', 'children': ['237', '238']}; {'id': '237', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '238', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '239', 'type': 'call', 'children': ['240', '241']}; {'id': '240', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '241', 'type': 'argument_list', 'children': ['242']}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '243', 'type': 'binary_operator', 'children': ['244', '245'], 'value': '%'}; {'id': '244', 'type': 'string', 'children': [], 'value': '"%d != %d"'}; {'id': '245', 'type': 'tuple', 'children': ['246', '252']}; {'id': '246', 'type': 'call', 'children': ['247', '248']}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '248', 'type': 'argument_list', 'children': ['249']}; {'id': '249', 'type': 'subscript', 'children': ['250', '251']}; {'id': '250', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '251', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '252', 'type': 'call', 'children': ['253', '254']}; {'id': '253', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '254', 'type': 'argument_list', 'children': ['255']}; {'id': '255', 'type': 'identifier', 'children': [], 'value': 'selectFieldNames'}; {'id': '256', 'type': 'else_clause', 'children': ['257']}; {'id': '257', 'type': 'block', 'children': ['258']}; {'id': '258', 'type': 'expression_statement', 'children': ['259']}; {'id': '259', 'type': 'assignment', 'children': ['260', '261']}; {'id': '260', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '261', 'type': 'call', 'children': ['262', '263']}; {'id': '262', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '263', 'type': 'argument_list', 'children': []}; {'id': '264', 'type': 'return_statement', 'children': ['265']}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'rows'}
|
Return a sequence of matching rows with the requested field values from
a table or empty sequence if nothing matched.
tableInfo: Table information: a ClientJobsDAO._TableInfoBase instance
conn: Owned connection acquired from ConnectionFactory.get()
fieldsToMatch: Dictionary of internal fieldName/value mappings that
identify the desired rows. If a value is an instance of
ClientJobsDAO._SEQUENCE_TYPES (list/set/tuple), then the
operator 'IN' will be used in the corresponding SQL
predicate; if the value is bool: "IS TRUE/FALSE"; if the
value is None: "IS NULL"; '=' will be used for all other
cases.
selectFieldNames:
list of fields to return, using internal field names
maxRows: maximum number of rows to return; unlimited if maxRows
is None
retval: A sequence of matching rows, each row consisting of field
values in the order of the requested field names. Empty
sequence is returned when not match exists.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clone'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '28']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_compound_mfrs'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'deepcopy'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_compound_mfrs'}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'result'}
|
Create a complete copy of the stream.
:returns: A new MaterialStream object.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'makedirs'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '5', 'type': 'block', 'children': ['6', '24']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '16']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '14']}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'isdir'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'makedirs'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'path'}
|
Create directories if they do not exist, otherwise do nothing.
Return path for convenience
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_element_mfr'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '48']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '10', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '11', 'type': 'for_statement', 'children': ['12', '13', '18']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'material'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'compounds'}; {'id': '18', 'type': 'block', 'children': ['19', '30']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '22', 'type': 'subscript', 'children': ['23', '29']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': "'['"}; {'id': '29', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'augmented_assignment', 'children': ['32', '33'], 'value': '+='}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '40', '41'], 'value': '*'}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'get_compound_mfr'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '40', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'stoich'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'element_mass_fraction'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'result'}
|
Determine the mass flow rate of the specified elements in the stream.
:returns: Mass flow rates. [kg/h]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'characters'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'quantity'}; {'id': '6', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '7', 'type': 'block', 'children': ['8', '30']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'map'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_to_lower_alpha_only'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'sample'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '29']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'get_dictionary'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': "'lorem_ipsum'"}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'quantity'}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'subscript', 'children': ['32', '38']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'string', 'children': [], 'value': "''"}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '38', 'type': 'slice', 'children': ['39', '40']}; {'id': '39', 'type': 'colon', 'children': []}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'quantity'}
|
Return random characters.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_log_config'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'quiet'}; {'id': '6', 'type': 'block', 'children': ['7', '43', '54']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11', '17', '26', '35']}; {'id': '8', 'type': 'boolean_operator', 'children': ['9', '10'], 'value': 'and'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'quiet'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'raise_statement', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'string', 'children': [], 'value': '"Supplying both --quiet and --verbose makes no sense."'}; {'id': '17', 'type': 'elif_clause', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'DEBUG'}; {'id': '26', 'type': 'elif_clause', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'quiet'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ERROR'}; {'id': '35', 'type': 'else_clause', 'children': ['36']}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'INFO'}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'logger_cfg'}; {'id': '46', 'type': 'dictionary', 'children': ['47', '51']}; {'id': '47', 'type': 'pair', 'children': ['48', '49']}; {'id': '48', 'type': 'string', 'children': [], 'value': '"handlers"'}; {'id': '49', 'type': 'list', 'children': ['50'], 'value': '["click_handler"]'}; {'id': '50', 'type': 'string', 'children': [], 'value': '"click_handler"'}; {'id': '51', 'type': 'pair', 'children': ['52', '53']}; {'id': '52', 'type': 'string', 'children': [], 'value': '"level"'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'dictionary', 'children': ['56', '59', '68', '83']}; {'id': '56', 'type': 'pair', 'children': ['57', '58']}; {'id': '57', 'type': 'string', 'children': [], 'value': '"version"'}; {'id': '58', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '59', 'type': 'pair', 'children': ['60', '61']}; {'id': '60', 'type': 'string', 'children': [], 'value': '"formatters"'}; {'id': '61', 'type': 'dictionary', 'children': ['62']}; {'id': '62', 'type': 'pair', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': '"click_formatter"'}; {'id': '64', 'type': 'dictionary', 'children': ['65']}; {'id': '65', 'type': 'pair', 'children': ['66', '67']}; {'id': '66', 'type': 'string', 'children': [], 'value': '"format"'}; {'id': '67', 'type': 'string', 'children': [], 'value': '"%(message)s"'}; {'id': '68', 'type': 'pair', 'children': ['69', '70']}; {'id': '69', 'type': 'string', 'children': [], 'value': '"handlers"'}; {'id': '70', 'type': 'dictionary', 'children': ['71']}; {'id': '71', 'type': 'pair', 'children': ['72', '73']}; {'id': '72', 'type': 'string', 'children': [], 'value': '"click_handler"'}; {'id': '73', 'type': 'dictionary', 'children': ['74', '77', '80']}; {'id': '74', 'type': 'pair', 'children': ['75', '76']}; {'id': '75', 'type': 'string', 'children': [], 'value': '"level"'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '77', 'type': 'pair', 'children': ['78', '79']}; {'id': '78', 'type': 'string', 'children': [], 'value': '"class"'}; {'id': '79', 'type': 'string', 'children': [], 'value': '"doc2dash.__main__.ClickEchoHandler"'}; {'id': '80', 'type': 'pair', 'children': ['81', '82']}; {'id': '81', 'type': 'string', 'children': [], 'value': '"formatter"'}; {'id': '82', 'type': 'string', 'children': [], 'value': '"click_formatter"'}; {'id': '83', 'type': 'pair', 'children': ['84', '85']}; {'id': '84', 'type': 'string', 'children': [], 'value': '"loggers"'}; {'id': '85', 'type': 'dictionary', 'children': ['86', '89']}; {'id': '86', 'type': 'pair', 'children': ['87', '88']}; {'id': '87', 'type': 'string', 'children': [], 'value': '"doc2dash"'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'logger_cfg'}; {'id': '89', 'type': 'pair', 'children': ['90', '91']}; {'id': '90', 'type': 'string', 'children': [], 'value': '"__main__"'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'logger_cfg'}
|
We use logging's levels as an easy-to-use verbosity controller.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_is_ndb'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '43']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '14']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '9', 'type': 'argument_list', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '_model'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '27', '30']}; {'id': '16', 'type': 'boolean_operator', 'children': ['17', '20'], 'value': 'and'}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '19'], 'value': 'is not'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '_NDB_MODEL'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'issubclass'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_model'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_NDB_MODEL'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'True', 'children': []}; {'id': '30', 'type': 'elif_clause', 'children': ['31', '40']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'issubclass'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': '_model'}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'db'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'Model'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'False', 'children': []}; {'id': '43', 'type': 'raise_statement', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'string', 'children': [], 'value': "'Model class not an NDB or DB model: {0}.'"}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': '_model'}
|
Determine whether the model of the instance is an NDB model.
Returns:
Boolean indicating whether or not the model is an NDB or DB model.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'convert_clip'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'w_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'scope_name'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '11', 'type': 'block', 'children': ['12', '17', '93']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'Converting clip ...'"}; {'id': '17', 'type': 'if_statement', 'children': ['18', '23', '51']}; {'id': '18', 'type': 'comparison_operator', 'children': ['19', '22'], 'value': '=='}; {'id': '19', 'type': 'subscript', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'min'"}; {'id': '22', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '23', 'type': 'block', 'children': ['24', '36']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'string', 'children': [], 'value': '"using ReLU({0})"'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'max'"}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'layer'}; {'id': '39', 'type': 'call', 'children': ['40', '45']}; {'id': '40', 'type': 'attribute', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'keras'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'ReLU'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'keyword_argument', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'max_value'}; {'id': '48', 'type': 'subscript', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '50', 'type': 'string', 'children': [], 'value': "'max'"}; {'id': '51', 'type': 'else_clause', 'children': ['52']}; {'id': '52', 'type': 'block', 'children': ['53', '82']}; {'id': '53', 'type': 'function_definition', 'children': ['54', '55', '67']}; {'id': '54', 'type': 'function_name', 'children': [], 'value': 'target_layer'}; {'id': '55', 'type': 'parameters', 'children': ['56', '57', '62']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '57', 'type': 'default_parameter', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'vmin'}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '61', 'type': 'string', 'children': [], 'value': "'min'"}; {'id': '62', 'type': 'default_parameter', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'vmax'}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '66', 'type': 'string', 'children': [], 'value': "'max'"}; {'id': '67', 'type': 'block', 'children': ['68', '73']}; {'id': '68', 'type': 'import_statement', 'children': ['69']}; {'id': '69', 'type': 'aliased_import', 'children': ['70', '72']}; {'id': '70', 'type': 'dotted_name', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'tensorflow'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '73', 'type': 'return_statement', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'clip_by_value'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '80', '81']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'vmin'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'vmax'}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'layer'}; {'id': '85', 'type': 'call', 'children': ['86', '91']}; {'id': '86', 'type': 'attribute', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'keras'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'Lambda'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'target_layer'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '98']}; {'id': '95', 'type': 'subscript', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'scope_name'}; {'id': '98', 'type': 'call', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'layer'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'subscript', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '103', 'type': 'subscript', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '105', 'type': 'integer', 'children': [], 'value': '0'}
|
Convert clip operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for keras layers
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_newlines'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '7', 'type': 'block', 'children': ['8', '15', '23', '31']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'line_count'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'get_line_count'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'r+'"}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '30', 'type': 'string', 'children': [], 'value': "'r+'"}; {'id': '31', 'type': 'for_statement', 'children': ['32', '33', '37']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'line_count'}; {'id': '37', 'type': 'block', 'children': ['38', '46', '59']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'readline'}; {'id': '45', 'type': 'argument_list', 'children': []}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'sub'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55', '58']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '55', 'type': 'binary_operator', 'children': ['56', '57'], 'value': '+'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '57', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'string'}
|
Adds line breaks after every occurance of a given character in a file.
Args:
f: string, path to input file.
output: string, path to output file.
Returns:
None.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_training'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '21', '33']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '10'], 'value': 'is'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '14']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'yield', 'children': []}; {'id': '14', 'type': 'return_statement', 'children': []}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'old_mode'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'training'}; {'id': '21', 'type': 'if_statement', 'children': ['22', '25']}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': '!='}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'old_mode'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'train'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '33', 'type': 'try_statement', 'children': ['34', '37']}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'yield', 'children': []}; {'id': '37', 'type': 'finally_clause', 'children': ['38']}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'if_statement', 'children': ['40', '43']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': '!='}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'old_mode'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'train'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'old_mode'}
|
A context manager to temporarily set the training mode of 'model'
to 'mode', resetting it when we exit the with-block. A no-op if
mode is None.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fit'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '7', 'type': 'block', 'children': ['8', '17', '26', '33', '39', '45', '54', '63', '69', '77', '95', '101', '107', '113', '145', '156', '162', '168', '176', '192', '312']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'word_vector_transformer'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'WordVectorTransformer'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'keyword_argument', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'padding'}; {'id': '16', 'type': 'string', 'children': [], 'value': "'max'"}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'word_vector_transformer'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'fit_transform'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'LongTensor'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'word_vector_transformer'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'word_vector_transformer'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'y_transformer'}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'LabelEncoder'}; {'id': '44', 'type': 'argument_list', 'children': []}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'y_transformer'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'fit_transform'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'torch'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'from_numpy'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'y_transformer'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'y_transformer'}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'CategorizedDataset'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'dataloader'}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'DataLoader'}; {'id': '82', 'type': 'argument_list', 'children': ['83', '84', '89', '92']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'batch_size'}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'batch_size'}; {'id': '89', 'type': 'keyword_argument', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'shuffle'}; {'id': '91', 'type': 'True', 'children': []}; {'id': '92', 'type': 'keyword_argument', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'num_workers'}; {'id': '94', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '95', 'type': 'expression_statement', 'children': ['96']}; {'id': '96', 'type': 'assignment', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'KERNEL_SIZES'}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'kernel_sizes'}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'NUM_KERNEL'}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'num_kernel'}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'assignment', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'EMBEDDING_DIM'}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'embedding_dim'}; {'id': '113', 'type': 'expression_statement', 'children': ['114']}; {'id': '114', 'type': 'assignment', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '116', 'type': 'call', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'TextCNN'}; {'id': '118', 'type': 'argument_list', 'children': ['119', '126', '129', '139', '142']}; {'id': '119', 'type': 'keyword_argument', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'vocab_size'}; {'id': '121', 'type': 'call', 'children': ['122', '125']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'word_vector_transformer'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'get_vocab_size'}; {'id': '125', 'type': 'argument_list', 'children': []}; {'id': '126', 'type': 'keyword_argument', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'embedding_dim'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'EMBEDDING_DIM'}; {'id': '129', 'type': 'keyword_argument', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'output_size'}; {'id': '131', 'type': 'call', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'attribute', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'y_transformer'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'classes_'}; {'id': '139', 'type': 'keyword_argument', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'kernel_sizes'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'KERNEL_SIZES'}; {'id': '142', 'type': 'keyword_argument', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'num_kernel'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'NUM_KERNEL'}; {'id': '145', 'type': 'if_statement', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'USE_CUDA'}; {'id': '147', 'type': 'block', 'children': ['148']}; {'id': '148', 'type': 'expression_statement', 'children': ['149']}; {'id': '149', 'type': 'assignment', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '151', 'type': 'call', 'children': ['152', '155']}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'cuda'}; {'id': '155', 'type': 'argument_list', 'children': []}; {'id': '156', 'type': 'expression_statement', 'children': ['157']}; {'id': '157', 'type': 'assignment', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'EPOCH'}; {'id': '159', 'type': 'attribute', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'epoch'}; {'id': '162', 'type': 'expression_statement', 'children': ['163']}; {'id': '163', 'type': 'assignment', 'children': ['164', '165']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'LR'}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'lr'}; {'id': '168', 'type': 'expression_statement', 'children': ['169']}; {'id': '169', 'type': 'assignment', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'loss_function'}; {'id': '171', 'type': 'call', 'children': ['172', '175']}; {'id': '172', 'type': 'attribute', 'children': ['173', '174']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'nn'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'CrossEntropyLoss'}; {'id': '175', 'type': 'argument_list', 'children': []}; {'id': '176', 'type': 'expression_statement', 'children': ['177']}; {'id': '177', 'type': 'assignment', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'optimizer'}; {'id': '179', 'type': 'call', 'children': ['180', '183']}; {'id': '180', 'type': 'attribute', 'children': ['181', '182']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'optim'}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'Adam'}; {'id': '183', 'type': 'argument_list', 'children': ['184', '189']}; {'id': '184', 'type': 'call', 'children': ['185', '188']}; {'id': '185', 'type': 'attribute', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '188', 'type': 'argument_list', 'children': []}; {'id': '189', 'type': 'keyword_argument', 'children': ['190', '191']}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'lr'}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'LR'}; {'id': '192', 'type': 'for_statement', 'children': ['193', '194', '198']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'epoch'}; {'id': '194', 'type': 'call', 'children': ['195', '196']}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '196', 'type': 'argument_list', 'children': ['197']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'EPOCH'}; {'id': '198', 'type': 'block', 'children': ['199', '203']}; {'id': '199', 'type': 'expression_statement', 'children': ['200']}; {'id': '200', 'type': 'assignment', 'children': ['201', '202']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'losses'}; {'id': '202', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '203', 'type': 'for_statement', 'children': ['204', '207', '211']}; {'id': '204', 'type': 'pattern_list', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '207', 'type': 'call', 'children': ['208', '209']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '209', 'type': 'argument_list', 'children': ['210']}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'dataloader'}; {'id': '211', 'type': 'block', 'children': ['212', '218', '232', '238', '244', '251', '259', '274', '280', '286']}; {'id': '212', 'type': 'expression_statement', 'children': ['213']}; {'id': '213', 'type': 'assignment', 'children': ['214', '217']}; {'id': '214', 'type': 'pattern_list', 'children': ['215', '216']}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '216', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '218', 'type': 'expression_statement', 'children': ['219']}; {'id': '219', 'type': 'assignment', 'children': ['220', '223']}; {'id': '220', 'type': 'pattern_list', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '223', 'type': 'expression_list', 'children': ['224', '228']}; {'id': '224', 'type': 'call', 'children': ['225', '226']}; {'id': '225', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '226', 'type': 'argument_list', 'children': ['227']}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '228', 'type': 'call', 'children': ['229', '230']}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '230', 'type': 'argument_list', 'children': ['231']}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '232', 'type': 'expression_statement', 'children': ['233']}; {'id': '233', 'type': 'call', 'children': ['234', '237']}; {'id': '234', 'type': 'attribute', 'children': ['235', '236']}; {'id': '235', 'type': 'identifier', 'children': [], 'value': 'optimizer'}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'zero_grad'}; {'id': '237', 'type': 'argument_list', 'children': []}; {'id': '238', 'type': 'expression_statement', 'children': ['239']}; {'id': '239', 'type': 'call', 'children': ['240', '243']}; {'id': '240', 'type': 'attribute', 'children': ['241', '242']}; {'id': '241', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'train'}; {'id': '243', 'type': 'argument_list', 'children': []}; {'id': '244', 'type': 'expression_statement', 'children': ['245']}; {'id': '245', 'type': 'assignment', 'children': ['246', '247']}; {'id': '246', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '247', 'type': 'call', 'children': ['248', '249']}; {'id': '248', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '249', 'type': 'argument_list', 'children': ['250']}; {'id': '250', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '251', 'type': 'expression_statement', 'children': ['252']}; {'id': '252', 'type': 'assignment', 'children': ['253', '254']}; {'id': '253', 'type': 'identifier', 'children': [], 'value': 'loss'}; {'id': '254', 'type': 'call', 'children': ['255', '256']}; {'id': '255', 'type': 'identifier', 'children': [], 'value': 'loss_function'}; {'id': '256', 'type': 'argument_list', 'children': ['257', '258']}; {'id': '257', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '258', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '259', 'type': 'expression_statement', 'children': ['260']}; {'id': '260', 'type': 'call', 'children': ['261', '264']}; {'id': '261', 'type': 'attribute', 'children': ['262', '263']}; {'id': '262', 'type': 'identifier', 'children': [], 'value': 'losses'}; {'id': '263', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '264', 'type': 'argument_list', 'children': ['265']}; {'id': '265', 'type': 'subscript', 'children': ['266', '273']}; {'id': '266', 'type': 'call', 'children': ['267', '272']}; {'id': '267', 'type': 'attribute', 'children': ['268', '271']}; {'id': '268', 'type': 'attribute', 'children': ['269', '270']}; {'id': '269', 'type': 'identifier', 'children': [], 'value': 'loss'}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '271', 'type': 'identifier', 'children': [], 'value': 'tolist'}; {'id': '272', 'type': 'argument_list', 'children': []}; {'id': '273', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '274', 'type': 'expression_statement', 'children': ['275']}; {'id': '275', 'type': 'call', 'children': ['276', '279']}; {'id': '276', 'type': 'attribute', 'children': ['277', '278']}; {'id': '277', 'type': 'identifier', 'children': [], 'value': 'loss'}; {'id': '278', 'type': 'identifier', 'children': [], 'value': 'backward'}; {'id': '279', 'type': 'argument_list', 'children': []}; {'id': '280', 'type': 'expression_statement', 'children': ['281']}; {'id': '281', 'type': 'call', 'children': ['282', '285']}; {'id': '282', 'type': 'attribute', 'children': ['283', '284']}; {'id': '283', 'type': 'identifier', 'children': [], 'value': 'optimizer'}; {'id': '284', 'type': 'identifier', 'children': [], 'value': 'step'}; {'id': '285', 'type': 'argument_list', 'children': []}; {'id': '286', 'type': 'if_statement', 'children': ['287', '292']}; {'id': '287', 'type': 'comparison_operator', 'children': ['288', '291'], 'value': '=='}; {'id': '288', 'type': 'binary_operator', 'children': ['289', '290'], 'value': '%'}; {'id': '289', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '290', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '291', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '292', 'type': 'block', 'children': ['293', '308']}; {'id': '293', 'type': 'expression_statement', 'children': ['294']}; {'id': '294', 'type': 'call', 'children': ['295', '296']}; {'id': '295', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '296', 'type': 'argument_list', 'children': ['297']}; {'id': '297', 'type': 'binary_operator', 'children': ['298', '299'], 'value': '%'}; {'id': '298', 'type': 'string', 'children': [], 'value': '"[%d/%d] mean_loss : %0.2f"'}; {'id': '299', 'type': 'tuple', 'children': ['300', '301', '302']}; {'id': '300', 'type': 'identifier', 'children': [], 'value': 'epoch'}; {'id': '301', 'type': 'identifier', 'children': [], 'value': 'EPOCH'}; {'id': '302', 'type': 'call', 'children': ['303', '306']}; {'id': '303', 'type': 'attribute', 'children': ['304', '305']}; {'id': '304', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '305', 'type': 'identifier', 'children': [], 'value': 'mean'}; {'id': '306', 'type': 'argument_list', 'children': ['307']}; {'id': '307', 'type': 'identifier', 'children': [], 'value': 'losses'}; {'id': '308', 'type': 'expression_statement', 'children': ['309']}; {'id': '309', 'type': 'assignment', 'children': ['310', '311']}; {'id': '310', 'type': 'identifier', 'children': [], 'value': 'losses'}; {'id': '311', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '312', 'type': 'expression_statement', 'children': ['313']}; {'id': '313', 'type': 'assignment', 'children': ['314', '317']}; {'id': '314', 'type': 'attribute', 'children': ['315', '316']}; {'id': '315', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '316', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '317', 'type': 'identifier', 'children': [], 'value': 'model'}
|
Fit KimCNNClassifier according to X, y
Parameters
----------
X : list of string
each item is a raw text
y : list of string
each item is a label
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'copy_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'source_storage'}; {'id': '8', 'type': 'block', 'children': ['9', '25', '37', '46', '100']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '15']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': 'in'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'copied_files'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '24'], 'value': '%'}; {'id': '23', 'type': 'string', 'children': [], 'value': '"Skipping \'%s\' (already copied earlier)"'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '25', 'type': 'if_statement', 'children': ['26', '35']}; {'id': '26', 'type': 'not_operator', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'delete_file'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33', '34']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'source_storage'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': []}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'source_path'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'source_storage'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50', '63']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'dry_run'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '56', 'type': 'argument_list', 'children': ['57', '60']}; {'id': '57', 'type': 'binary_operator', 'children': ['58', '59'], 'value': '%'}; {'id': '58', 'type': 'string', 'children': [], 'value': '"Pretending to copy \'%s\'"'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'source_path'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'else_clause', 'children': ['64']}; {'id': '64', 'type': 'block', 'children': ['65', '77']}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '70', 'type': 'argument_list', 'children': ['71', '74']}; {'id': '71', 'type': 'binary_operator', 'children': ['72', '73'], 'value': '%'}; {'id': '72', 'type': 'string', 'children': [], 'value': '"Copying \'%s\'"'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'source_path'}; {'id': '74', 'type': 'keyword_argument', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '76', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '77', 'type': 'with_statement', 'children': ['78', '89']}; {'id': '78', 'type': 'with_clause', 'children': ['79']}; {'id': '79', 'type': 'with_item', 'children': ['80']}; {'id': '80', 'type': 'as_pattern', 'children': ['81', '87']}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'source_storage'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '87', 'type': 'as_pattern_target', 'children': ['88']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'source_file'}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '97']}; {'id': '92', 'type': 'attribute', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'save'}; {'id': '97', 'type': 'argument_list', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'source_file'}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'call', 'children': ['102', '107']}; {'id': '102', 'type': 'attribute', 'children': ['103', '106']}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'copied_files'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '107', 'type': 'argument_list', 'children': ['108']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}
|
Attempt to copy ``path`` with storage
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '49']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'calculate_average_scores_on_graph'}; {'id': '3', 'type': 'parameters', 'children': ['4', '8', '17', '26', '35', '44']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '6', 'type': 'type', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'BELGraph'}; {'id': '8', 'type': 'typed_default_parameter', 'children': ['9', '10', '16']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '10', 'type': 'type', 'children': ['11']}; {'id': '11', 'type': 'generic_type', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'Optional'}; {'id': '13', 'type': 'type_parameter', 'children': ['14']}; {'id': '14', 'type': 'type', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'typed_default_parameter', 'children': ['18', '19', '25']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '19', 'type': 'type', 'children': ['20']}; {'id': '20', 'type': 'generic_type', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'Optional'}; {'id': '22', 'type': 'type_parameter', 'children': ['23']}; {'id': '23', 'type': 'type', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'typed_default_parameter', 'children': ['27', '28', '34']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'default_score'}; {'id': '28', 'type': 'type', 'children': ['29']}; {'id': '29', 'type': 'generic_type', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'Optional'}; {'id': '31', 'type': 'type_parameter', 'children': ['32']}; {'id': '32', 'type': 'type', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '34', 'type': 'None', 'children': []}; {'id': '35', 'type': 'typed_default_parameter', 'children': ['36', '37', '43']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'runs'}; {'id': '37', 'type': 'type', 'children': ['38']}; {'id': '38', 'type': 'generic_type', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'Optional'}; {'id': '40', 'type': 'type_parameter', 'children': ['41']}; {'id': '41', 'type': 'type', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '43', 'type': 'None', 'children': []}; {'id': '44', 'type': 'typed_default_parameter', 'children': ['45', '46', '48']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'use_tqdm'}; {'id': '46', 'type': 'type', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '48', 'type': 'False', 'children': []}; {'id': '49', 'type': 'block', 'children': ['50', '60', '82']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'subgraphs'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'generate_bioprocess_mechanisms'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'scores'}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'calculate_average_scores_on_subgraphs'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67', '70', '73', '76', '79']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'subgraphs'}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '73', 'type': 'keyword_argument', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'default_score'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'default_score'}; {'id': '76', 'type': 'keyword_argument', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'runs'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'runs'}; {'id': '79', 'type': 'keyword_argument', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'use_tqdm'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'use_tqdm'}; {'id': '82', 'type': 'return_statement', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'scores'}
|
Calculate the scores over all biological processes in the sub-graph.
As an implementation, it simply computes the sub-graphs then calls :func:`calculate_average_scores_on_subgraphs` as
described in that function's documentation.
:param graph: A BEL graph with heats already on the nodes
:param key: The key in the node data dictionary representing the experimental data. Defaults to
:data:`pybel_tools.constants.WEIGHT`.
:param tag: The key for the nodes' data dictionaries where the scores will be put. Defaults to 'score'
:param default_score: The initial score for all nodes. This number can go up or down.
:param runs: The number of times to run the heat diffusion workflow. Defaults to 100.
:param use_tqdm: Should there be a progress bar for runners?
:return: A dictionary of {pybel node tuple: results tuple}
:rtype: dict[tuple, tuple]
Suggested usage with :mod:`pandas`:
>>> import pandas as pd
>>> from pybel_tools.analysis.heat import calculate_average_scores_on_graph
>>> graph = ... # load graph and data
>>> scores = calculate_average_scores_on_graph(graph)
>>> pd.DataFrame.from_items(scores.items(), orient='index', columns=RESULT_LABELS)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_readxml'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '21', '37']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'block'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'sub'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15', '16']}; {'id': '14', 'type': 'string', 'children': [], 'value': "r'<(/?)s>'"}; {'id': '15', 'type': 'string', 'children': [], 'value': "r'<\\1s>'"}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_readblock'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'id': '21', 'type': 'try_statement', 'children': ['22', '30']}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'xml'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'XML'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'block'}; {'id': '30', 'type': 'except_clause', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ParseError'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'xml'}; {'id': '36', 'type': 'None', 'children': []}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'xml'}
|
Read a block and return the result as XML
:return: block as xml
:rtype: xml.etree.ElementTree
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '44']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'for_statement', 'children': ['12', '13', '14']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '27', '35']}; {'id': '16', 'type': 'boolean_operator', 'children': ['17', '22'], 'value': 'or'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'augmented_assignment', 'children': ['30', '31'], 'value': '+='}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '35', 'type': 'else_clause', 'children': ['36']}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Implements the 'merge' operator for merging lists.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_query_params'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '6', 'type': 'block', 'children': ['7', '18', '27', '34', '45', '56']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '10', 'type': 'call', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'urlparse'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'query_params'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'parse_unique_urlencoded'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'query_params'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'new_query'}; {'id': '37', 'type': 'call', 'children': ['38', '43']}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'urlencode'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'query_params'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'new_parts'}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_replace'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'keyword_argument', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'new_query'}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '63']}; {'id': '58', 'type': 'attribute', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'urlunparse'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'new_parts'}
|
Updates a URI with new query parameters.
If a given key from ``params`` is repeated in the ``uri``, then
the URI will be considered invalid and an error will occur.
If the URI is valid, then each value from ``params`` will
replace the corresponding value in the query parameters (if
it exists).
Args:
uri: string, A valid URI, with potential existing query parameters.
params: dict, A dictionary of query parameters.
Returns:
The same URI but with the new query parameters added.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'posteriori_covariance'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '17', '27']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'K'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'GLMM'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'covariance'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'tau'}; {'id': '20', 'type': 'attribute', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_ep'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_posterior'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'tau'}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'pinv'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '36'], 'value': '+'}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'pinv'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'K'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'diag'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'binary_operator', 'children': ['40', '41'], 'value': '/'}; {'id': '40', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'tau'}
|
r""" Covariance of the estimated posteriori.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'image'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'well_row'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'well_column'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'field_row'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'field_column'}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'return_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '53']}; {'id': '14', 'type': 'generator_expression', 'children': ['15', '16', '21']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '16', 'type': 'for_in_clause', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '21', 'type': 'if_clause', 'children': ['22']}; {'id': '22', 'type': 'boolean_operator', 'children': ['23', '46'], 'value': 'and'}; {'id': '23', 'type': 'boolean_operator', 'children': ['24', '39'], 'value': 'and'}; {'id': '24', 'type': 'boolean_operator', 'children': ['25', '32'], 'value': 'and'}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '31'], 'value': '=='}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'attribute'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '30', 'type': 'string', 'children': [], 'value': "'u'"}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'well_column'}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '38'], 'value': '=='}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'attribute'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '37', 'type': 'string', 'children': [], 'value': "'v'"}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'well_row'}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '45'], 'value': '=='}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'attribute'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '44', 'type': 'string', 'children': [], 'value': "'x'"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'field_column'}; {'id': '46', 'type': 'comparison_operator', 'children': ['47', '52'], 'value': '=='}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'attribute'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '51', 'type': 'string', 'children': [], 'value': "'y'"}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'field_row'}; {'id': '53', 'type': 'string', 'children': [], 'value': "''"}
|
Get path of specified image.
Parameters
----------
well_row : int
Starts at 0. Same as --U in files.
well_column : int
Starts at 0. Same as --V in files.
field_row : int
Starts at 0. Same as --Y in files.
field_column : int
Starts at 0. Same as --X in files.
Returns
-------
string
Path to image or empty string if image is not found.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'j2'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '5', 'type': 'block', 'children': ['6', '25', '33']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'to_return'}; {'id': '9', 'type': 'binary_operator', 'children': ['10', '21'], 'value': '-'}; {'id': '10', 'type': 'binary_operator', 'children': ['11', '17'], 'value': '*'}; {'id': '11', 'type': 'binary_operator', 'children': ['12', '13'], 'value': '/'}; {'id': '12', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '13', 'type': '()', 'children': ['14']}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '+'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '16', 'type': 'float', 'children': [], 'value': '1e-15'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'j1'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'j0'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '32']}; {'id': '27', 'type': 'subscript', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'to_return'}; {'id': '29', 'type': 'comparison_operator', 'children': ['30', '31'], 'value': '=='}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'to_return'}
|
A fast j2 defined in terms of other special functions
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getInstanceJstack'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'topology_info'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'instance_id'}; {'id': '7', 'type': 'block', 'children': ['8', '17']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'pid_response'}; {'id': '11', 'type': 'yield', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'getInstancePid'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'topology_info'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'instance_id'}; {'id': '17', 'type': 'try_statement', 'children': ['18', '105']}; {'id': '18', 'type': 'block', 'children': ['19', '29', '38', '48', '58', '68', '76', '86', '94']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'http_client'}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'tornado'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'httpclient'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'AsyncHTTPClient'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'pid_json'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'loads'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'pid_response'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'pid'}; {'id': '41', 'type': 'call', 'children': ['42', '47']}; {'id': '42', 'type': 'attribute', 'children': ['43', '46']}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'pid_json'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'stdout'"}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '47', 'type': 'argument_list', 'children': []}; {'id': '48', 'type': 'if_statement', 'children': ['49', '52']}; {'id': '49', 'type': 'comparison_operator', 'children': ['50', '51'], 'value': '=='}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'pid'}; {'id': '51', 'type': 'string', 'children': [], 'value': "''"}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'raise_statement', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'string', 'children': [], 'value': "'Failed to get pid'"}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'make_shell_endpoint'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'topology_info'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'instance_id'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '71', 'type': 'binary_operator', 'children': ['72', '73'], 'value': '%'}; {'id': '72', 'type': 'string', 'children': [], 'value': '"%s/jstack/%s"'}; {'id': '73', 'type': 'tuple', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'pid'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '79', 'type': 'yield', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'http_client'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'fetch'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'Log'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '91', 'type': 'argument_list', 'children': ['92', '93']}; {'id': '92', 'type': 'string', 'children': [], 'value': '"HTTP call for url: %s"'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '94', 'type': 'raise_statement', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '101']}; {'id': '96', 'type': 'attribute', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'tornado'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'gen'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'Return'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '105', 'type': 'except_clause', 'children': ['106', '114']}; {'id': '106', 'type': 'as_pattern', 'children': ['107', '112']}; {'id': '107', 'type': 'attribute', 'children': ['108', '111']}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'tornado'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'httpclient'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'HTTPError'}; {'id': '112', 'type': 'as_pattern_target', 'children': ['113']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '114', 'type': 'block', 'children': ['115']}; {'id': '115', 'type': 'raise_statement', 'children': ['116']}; {'id': '116', 'type': 'call', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '118', 'type': 'argument_list', 'children': ['119']}; {'id': '119', 'type': 'call', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '121', 'type': 'argument_list', 'children': ['122']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'e'}
|
Fetches Instance jstack from heron-shell.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tsms'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'when'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'tz'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '15', '23']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '12']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'when'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'when'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'totz'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'when'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'tz'}; {'id': '23', 'type': 'return_statement', 'children': ['24']}; {'id': '24', 'type': 'binary_operator', 'children': ['25', '37'], 'value': '+'}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '36'], 'value': '*'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'calendar'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'timegm'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'when'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'timetuple'}; {'id': '35', 'type': 'argument_list', 'children': []}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1000'}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '47'], 'value': '/'}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'when'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'microsecond'}; {'id': '47', 'type': 'float', 'children': [], 'value': '1000.0'}
|
Return a Unix timestamp in milliseconds for the provided datetime. The `totz` function is
called on the datetime to convert it to the provided timezone. It will be converted to UTC if
no timezone is provided.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'bitsToString'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '5', 'type': 'block', 'children': ['6', '19', '42']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '11', 'type': 'argument_list', 'children': ['12', '13']}; {'id': '12', 'type': 'string', 'children': [], 'value': "'c'"}; {'id': '13', 'type': 'binary_operator', 'children': ['14', '15'], 'value': '*'}; {'id': '14', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '19', 'type': 'for_statement', 'children': ['20', '21', '28']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'xrange'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'if_statement', 'children': ['30', '35']}; {'id': '30', 'type': 'comparison_operator', 'children': ['31', '34'], 'value': '=='}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '41']}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '41', 'type': 'string', 'children': [], 'value': "'*'"}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 's'}
|
Returns a string representing a numpy array of 0's and 1's
|
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 4