Skip to content

Commit

Permalink
Merge pull request #1157 from gboeing/features
Browse files Browse the repository at this point in the history
Refactor the features module
  • Loading branch information
gboeing authored Apr 24, 2024
2 parents ba5df5c + 0735f22 commit f8b0c17
Show file tree
Hide file tree
Showing 5 changed files with 356 additions and 714 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
- id: validate-pyproject

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.6"
rev: "v0.4.1"
hooks:
- id: ruff
args: [--fix]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Read the v2 [migration guide](https://github.com/gboeing/osmnx/issues/1123)
- improve docstrings throughout package (#1116)
- improve logging and warnings throughout package (#1125)
- improve error messages throughout package (#1131)
- refactor features module for speed improvement and memory efficiency (#1157)
- refactor save_graph_xml function and \_osm_xml module for a >5x speed improvement and bug fixes (#1135)
- make save_graph_xml function accept only an unsimplified MultiDiGraph as its input data (#1135)
- replace save_graph_xml function's edge_tag_aggs tuple parameter with way_tag_aggs dict parameter (#1135)
Expand Down
4 changes: 3 additions & 1 deletion osmnx/_osm_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def startElement(self, name: str, attrs: AttributesImpl) -> None: # noqa: ANN10
self.object.update({k: v for k, v in attrs.items() if k in ROOT_ATTR_DEFAULTS})

elif name in {"node", "way"}:
self._element = dict(type=name, tags={}, nodes=[], **attrs)
self._element = dict(type=name, tags={}, **attrs)
if name == "way":
self._element["nodes"] = []
self._element.update({k: float(v) for k, v in attrs.items() if k in float_attrs})
self._element.update({k: int(v) for k, v in attrs.items() if k in int_attrs})

Expand Down
Loading

0 comments on commit f8b0c17

Please sign in to comment.