Skip to content
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

Updates for Regions inputs #527

Merged
merged 6 commits into from
Sep 20, 2023
Merged

Updates for Regions inputs #527

merged 6 commits into from
Sep 20, 2023

Conversation

larrybradley
Copy link
Member

This PR updates the Regions class as follows:

  • allows initialization without any input, e.g., Regions()
  • adds validation checking of input regions for the Regions object and its append and extend methods
  • Regions.extend now accepts a Regions object

Closes: #508
Closes: #509
Closes: #510

CC: @pllim

@@ -24,7 +24,13 @@ class Regions:
The list of region objects.
"""

def __init__(self, regions):
def __init__(self, regions=(), /):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the / for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It forces the input to be positional only. So Regions(regions=...) is not allowed. list does exactly the same thing.

Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@pllim pllim merged commit 2bfed8f into astropy:main Sep 20, 2023
17 checks passed
@larrybradley larrybradley deleted the regions-inputs branch September 20, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants