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

Allow Section.from_string to handle None #76

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Conversation

teald
Copy link
Member

@teald teald commented Dec 18, 2024

Summary

Adds handling for None input to Section.from_string. Minimal example:

from astrodata.utils import Section

from pathlib import Path

file_path = Path("/file/that/does/not/exist.txt")  # In reality, some FITS stuff
string = file_path.read_text() if file_path.exists() else None
section = Section.from_string(string)  # Previously raised exception

This is what DRAGONS expects, and was previously implemented there.

This also adds relevant information to the Section.from_string docstring.

These lines were removed---or somehow missing. This is probably not the
best way to do this, but it's expected by DRAGONS.
@teald teald added the bug Something isn't working label Dec 18, 2024
@teald teald merged commit f609c8f into main Dec 18, 2024
14 checks passed
@teald teald deleted the fix/from_string_None branch December 18, 2024 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant