-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sdata_attrs
- Loading branch information
Showing
21 changed files
with
986 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
from collections.abc import Iterable | ||
|
||
from spatialdata._core.spatialdata import SpatialData | ||
|
||
|
||
def _find_common_table_keys(sdatas: list[SpatialData]) -> set[str]: | ||
def _find_common_table_keys(sdatas: Iterable[SpatialData]) -> set[str]: | ||
""" | ||
Find table keys present in more than one SpatialData object. | ||
Parameters | ||
---------- | ||
sdatas | ||
A list of SpatialData objects. | ||
An `Iterable` of SpatialData objects. | ||
Returns | ||
------- | ||
A set of common keys that are present in the tables of more than one SpatialData object. | ||
""" | ||
common_keys = set(sdatas[0].tables.keys()) | ||
common_keys: set[str] = set() | ||
|
||
for sdata in sdatas[1:]: | ||
common_keys.intersection_update(sdata.tables.keys()) | ||
for sdata in sdatas: | ||
if len(common_keys) == 0: | ||
common_keys = set(sdata.tables.keys()) | ||
else: | ||
common_keys.intersection_update(sdata.tables.keys()) | ||
|
||
return common_keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.