parameters: (node: Node, src_port_map, dir: str)
return_statement: return result_list
docstring: Extract port_map attributes from node and node.body attributes.
  
              It iterates over src_port_map and substitute external_port_id, internal_port_id and
              internal_layer_id by real values queried from node ports and node.body attributes.
docstring_summary: Extract port_map attributes from node and node.body attributes.
docstring_tokens: Extract port_map attributes from node and node . body attributes .
function: def generate_port_map(node: Node, src_port_map, dir: str):
          """ Extract port_map attributes from node and node.body attributes.
  
              It iterates over src_port_map and substitute external_port_id, internal_port_id and
              internal_layer_id by real values queried from node ports and node.body attributes.
          """
          result_list = []
          for map_item in src_port_map:
              result = dict(map_item)
              assert result is not map_item
              result['external_port_id'] = __class__.find_port_id(node, result['external_port_id'], 'external_port_id')
              result['internal_layer_id'] = __class__.find_internal_layer_id(node.body, result['internal_layer_id'])
              result_list.append(result)
          return result_list
function_tokens: def generate_port_map ( node : Node , src_port_map , dir : str ) : result_list = [ ] for map_item in src_port_map : result = dict ( map_item ) assert result is not map_item result [ 'external_port_id' ] = __class__ . find_port_id ( node , result [ 'external_port_id' ] , 'external_port_id' ) result [ 'internal_layer_id' ] = __class__ . find_internal_layer_id ( node . body , result [ 'internal_layer_id' ] ) result_list . append ( result ) return result_list