nodes: 0, module; 1, function_definition; 2, function_name:calc_geo_lines_in_buffer; 3, parameters; 4, block; 5, identifier:network; 6, identifier:node; 7, identifier:grid; 8, identifier:radius; 9, identifier:radius_inc; 10, expression_statement; 11, expression_statement; 12, while_statement; 13, return_statement; 14, comment:"""Determines lines in nodes' associated graph that are at least partly
      within buffer of radius from node. If there are no lines, the buffer is
      successively extended by radius_inc until lines are found.
  
      Parameters
      ----------
      network : :class:`~.grid.network.Network`
          The eDisGo container object
      node : :class:`~.grid.components.Component`
          Origin node the buffer is created around (e.g. :class:`~.grid.components.Generator`).
          Node must be a member of grid's graph (grid.graph)
      grid : :class:`~.grid.grids.Grid`
          Grid whose lines are searched
      radius : :obj:`float`
          Buffer radius in m
      radius_inc : :obj:`float`
          Buffer radius increment in m
  
      Returns
      -------
      :obj:`list` of :class:`~.grid.components.Line`
          Sorted (by repr()) list of lines
  
      Notes
      -----
      Adapted from `Ding0 <https://github.com/openego/ding0/blob/\
          21a52048f84ec341fe54e0204ac62228a9e8a32a/\
          ding0/tools/geo.py#L53>`_.
      """; 15, assignment; 16, not_operator; 17, block; 18, call; 19, identifier:lines; 20, list; 21, identifier:lines; 22, expression_statement; 23, expression_statement; 24, for_statement; 25, expression_statement; 26, identifier:sorted; 27, argument_list; 28, assignment; 29, assignment; 30, identifier:line; 31, call; 32, block; 33, augmented_assignment; 34, identifier:lines; 35, keyword_argument; 36, identifier:node_shp; 37, call; 38, identifier:buffer_zone_shp; 39, call; 40, attribute; 41, argument_list; 42, expression_statement; 43, expression_statement; 44, if_statement; 45, identifier:radius; 46, identifier:radius_inc; 47, identifier:key; 48, lambda; 49, identifier:transform; 50, argument_list; 51, attribute; 52, argument_list; 53, attribute; 54, identifier:lines; 55, assignment; 56, assignment; 57, call; 58, block; 59, lambda_parameters; 60, call; 61, call; 62, attribute; 63, identifier:node_shp; 64, identifier:buffer; 65, identifier:radius; 66, identifier:grid; 67, identifier:graph; 68, identifier:nodes; 69, subscript; 70, identifier:branch_shp; 71, call; 72, attribute; 73, argument_list; 74, expression_statement; 75, identifier:_; 76, identifier:repr; 77, argument_list; 78, identifier:proj2equidistant; 79, argument_list; 80, identifier:node; 81, identifier:geom; 82, identifier:line; 83, string; 84, identifier:transform; 85, argument_list; 86, identifier:buffer_zone_shp; 87, identifier:intersects; 88, identifier:branch_shp; 89, call; 90, identifier:_; 91, identifier:network; 92, string_content:adj_nodes; 93, call; 94, call; 95, attribute; 96, argument_list; 97, identifier:proj2equidistant; 98, argument_list; 99, identifier:LineString; 100, argument_list; 101, identifier:lines; 102, identifier:append; 103, identifier:line; 104, identifier:network; 105, list; 106, attribute; 107, attribute; 108, subscript; 109, identifier:geom; 110, subscript; 111, identifier:geom; 112, identifier:nodes; 113, integer:0; 114, identifier:nodes; 115, integer:1
code: def calc_geo_lines_in_buffer(network, node, grid, radius, radius_inc):
      """Determines lines in nodes' associated graph that are at least partly
      within buffer of radius from node. If there are no lines, the buffer is
      successively extended by radius_inc until lines are found.
  
      Parameters
      ----------
      network : :class:`~.grid.network.Network`
          The eDisGo container object
      node : :class:`~.grid.components.Component`
          Origin node the buffer is created around (e.g. :class:`~.grid.components.Generator`).
          Node must be a member of grid's graph (grid.graph)
      grid : :class:`~.grid.grids.Grid`
          Grid whose lines are searched
      radius : :obj:`float`
          Buffer radius in m
      radius_inc : :obj:`float`
          Buffer radius increment in m
  
      Returns
      -------
      :obj:`list` of :class:`~.grid.components.Line`
          Sorted (by repr()) list of lines
  
      Notes
      -----
      Adapted from `Ding0 <https://github.com/openego/ding0/blob/\
          21a52048f84ec341fe54e0204ac62228a9e8a32a/\
          ding0/tools/geo.py#L53>`_.
      """
  
      lines = []
  
      while not lines:
          node_shp = transform(proj2equidistant(network), node.geom)
          buffer_zone_shp = node_shp.buffer(radius)
          for line in grid.graph.lines():
              nodes = line['adj_nodes']
              branch_shp = transform(proj2equidistant(network), LineString([nodes[0].geom, nodes[1].geom]))
              if buffer_zone_shp.intersects(branch_shp):
                  lines.append(line)
          radius += radius_inc
  
      return sorted(lines, key=lambda _: repr(_))