Skip to content

Commit 3ba686d

Browse files
committed
Nodes will now be removed from the Way in strict mode
1 parent cc5c09e commit 3ba686d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

overpy/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__summary__ = "Python Wrapper to access the OpenStreepMap Overpass API"
1414
__uri__ = "https://github.com/DinoTools/python-overpy"
1515

16-
__version__ = "0.4.1"
16+
__version__ = "0.4.2"
1717

1818
__author__ = "PhiBo (DinoTools)"
1919
__email__ = ""

overpy/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,9 @@ def get_nodes(self, resolve_missing=False, strict_mode=True):
927927
result = []
928928
resolved = False
929929

930+
if not strict_mode:
931+
invalid_nodes = []
932+
930933
for node_id in self._node_ids:
931934
try:
932935
node = self._result.get_node(node_id)
@@ -963,12 +966,20 @@ def get_nodes(self, resolve_missing=False, strict_mode=True):
963966
node = None
964967

965968
if node is None:
966-
raise exception.DataIncomplete("Unable to resolve all nodes")
967-
968-
result.append(node)
969+
if strict_mode:
970+
raise exception.DataIncomplete("Unable to resolve all nodes")
971+
else:
972+
# remove the id of the note from the internal list of nodes
973+
invalid_nodes.append(node_id)
974+
else:
975+
result.append(node)
969976

977+
if not strict_mode:
978+
for node_id in invalid_nodes:
979+
self._node_ids.remove(node_id)
970980
return result
971981

982+
972983
@classmethod
973984
def from_json(cls, data, result=None):
974985
"""

0 commit comments

Comments
 (0)