Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _primal_to_gdf(net, points, lines, spatial_weights, nodeID):
"""
Generate gdf(s) from primal network.
Helper for nx_to_gdf.
"""
if points is True:
gdf_nodes = _points_to_gdf(net)
if spatial_weights is True:
W = libpysal.weights.W.from_networkx(net)
W.transform = "b"
if lines is True:
gdf_edges = _lines_to_gdf(net, lines, points, nodeID)
if points is True and lines is True:
if spatial_weights is True:
return gdf_nodes, gdf_edges, W
return gdf_nodes, gdf_edges
if points is True and lines is False:
if spatial_weights is True:
return gdf_nodes, W
return gdf_nodes
return gdf_edges