From 3d347827ce47121b43ce8447c2b87dfc0208e093 Mon Sep 17 00:00:00 2001 From: Piotr Gramacki <37406231+piotrgramacki@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:22:27 +0200 Subject: [PATCH] fix: interface change in h3 library (list instead of set) (#436) * fix: adjust to h3 library returning list instead of set * chore: update CHANGELOG --------- Co-authored-by: Kamil Raczycki --- CHANGELOG.md | 4 ++++ srai/neighbourhoods/h3_neighbourhood.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 994d7564..5f783876 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Issue caused by the change in the `h3-py` library 4.0.0b3 [#431](https://github.com/kraina-ai/srai/issues/431) + ## [0.7.0] - 2024-02-02 ### Added diff --git a/srai/neighbourhoods/h3_neighbourhood.py b/srai/neighbourhoods/h3_neighbourhood.py index 402db980..0ebd7f1f 100644 --- a/srai/neighbourhoods/h3_neighbourhood.py +++ b/srai/neighbourhoods/h3_neighbourhood.py @@ -82,7 +82,7 @@ def get_neighbours_up_to_distance( if self._distance_incorrect(distance): return set() - neighbours: set[str] = h3.grid_disk(index, distance) + neighbours: set[str] = set(h3.grid_disk(index, distance)) neighbours = self._handle_center( index, distance, neighbours, at_distance=False, include_center_override=include_center ) @@ -108,7 +108,7 @@ def get_neighbours_at_distance( if self._distance_incorrect(distance): return set() - neighbours: set[str] = h3.grid_ring(index, distance) + neighbours: set[str] = set(h3.grid_ring(index, distance)) neighbours = self._handle_center( index, distance, neighbours, at_distance=True, include_center_override=include_center )