Skip to content

Commit

Permalink
style: run ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
merydian committed Jul 4, 2024
1 parent ae3bcda commit 5bfebdc
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions ORStools/proc/export_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,23 @@ def processAlgorithm(
to_coords = self.get_location_by_id(to_id, response["nodes"])
from_coords = self.get_location_by_id(from_id, response["nodes"])

geometry = QgsGeometry.fromPolylineXY([QgsPointXY(from_coords[0], from_coords[1]),
QgsPointXY(to_coords[0], to_coords[1])])

feat = QgsFeature()
feat.setGeometry(geometry)
feat.setAttributes(
geometry = QgsGeometry.fromPolylineXY(
[
from_id,
to_id,
weight
QgsPointXY(from_coords[0], from_coords[1]),
QgsPointXY(to_coords[0], to_coords[1]),
]
)

feat = QgsFeature()
feat.setGeometry(geometry)
feat.setAttributes([from_id, to_id, weight])
sink.addFeature(feat)

except (exceptions.ApiError, exceptions.InvalidKey, exceptions.GenericServerError) as e:
msg = f"{e.__class__.__name__}: {str(e)}"
feedback.reportError(msg)
logger.log(msg)


return {self.OUT: dest_id}

@staticmethod
Expand All @@ -159,13 +156,10 @@ def get_location_by_id(self, node_id, nodes):
list: The location of the node, or None if the node ID is not found.
"""
for node in nodes:
if node['nodeId'] == node_id:
return node['location']
if node["nodeId"] == node_id:
return node["location"]
return None




def displayName(self) -> str:
"""
Algorithm name shown in QGIS toolbox
Expand Down

0 comments on commit 5bfebdc

Please sign in to comment.