Skip to content

Commit 5cf288c

Browse files
committed
fix(osmsg/handlers.py): track --length keys independently of --tags
--length keys were only tracked if the same key was also passed to --tags; now the tracked-key set is the union of both.
1 parent 8c928d9 commit 5cf288c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

osmsg/handlers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def __init__(self, config: dict[str, Any], sequence_id: int, valid_changesets: s
120120
self.stubs: dict[int, Changeset] = {}
121121
self.stats: dict[int, ChangesetStats] = {}
122122

123+
self._tracked_keys = set(config.get("additional_tags") or ()) | set(config.get("length") or ())
124+
123125
def _should_collect(self, uname: str, cs_id: int) -> bool:
124126
if self.valid_changesets is not None and cs_id not in self.valid_changesets:
125127
return False
@@ -176,8 +178,8 @@ def _accumulate(self, uid, uname, cs_id, version, tags, kind, way_nodes=None) ->
176178
tv.add(action)
177179
if length_m:
178180
tv.add_length(length_m)
179-
elif cfg["additional_tags"]:
180-
for k in cfg["additional_tags"]:
181+
elif self._tracked_keys:
182+
for k in self._tracked_keys:
181183
if k not in tags:
182184
continue
183185
v = tags[k]

0 commit comments

Comments
 (0)