-
Notifications
You must be signed in to change notification settings - Fork 234
Add a helper function sequence_join to join a sequence by a separator #3961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
49fa01a to
9ee2a21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new helper function, sequence_join, to join 1-D or 2-D sequences with a specified separator and replaces the older _parse_sequence calls in grdclip.
- Replaces _parse_sequence with sequence_join in grdclip.
- Adds the sequence_join implementation in pygmt/helpers/utils.py with extensive docstrings and examples.
- Updates pygmt/helpers/init.py to export the new helper function.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pygmt/src/grdclip.py | Updated to use the new sequence_join helper for joining sequences. |
| pygmt/helpers/utils.py | Added the implementation of sequence_join with parameter validations. |
| pygmt/helpers/init.py | Exported the newly added sequence_join for module-wide usage. |
| ) | ||
|
|
||
|
|
||
| def sequence_join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this as a private function?
| def sequence_join( | |
| def _sequence_join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is used in grdclip.py and will likely be used in many other functions. So, I'd prefer to make it public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, not strong opinions, just worried we might need to refactor it again in the future (which requires more caution for public-facing functions).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR extends the private
_parse_sequencefunction ingrdclipto a more general functionsequence_join, which can join a 1-D or 2-D sequence by a separator.