Broaden type annotations from list
to Collection
for input parameters
#233
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates type annotations for input parameters in public API functions throughout the codebase, changing
list[T]
toCollection[T]
fromcollections.abc
. This makes the API more flexible by accepting any collection type (tuples, sets, etc.) rather than requiring lists specifically.Changes
Updated Input Parameter Annotations
src/rastr/create.py
:rasterize_gdf()
-target_cols
parameter_validate_columns_exist()
-target_cols
parameter_validate_columns_numeric()
-target_cols
parameterWhy This Matters
Before this change, users were required to pass lists to these functions:
Now users can pass any collection type:
This is particularly useful when columns are provided dynamically or come from other sources that naturally produce tuples or sets.
What Wasn't Changed
list[...]
remain unchanged since they indicate the concrete type being returned by the function, not the types accepted as inputs._recursive_eval()
were not changed as they are not part of the public API.Testing
Fixes #129
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.