Skip to content

Allow Section.from_string to handle None#76

Merged
teald merged 2 commits intomainfrom
fix/from_string_None
Dec 18, 2024
Merged

Allow Section.from_string to handle None#76
teald merged 2 commits intomainfrom
fix/from_string_None

Conversation

@teald
Copy link
Copy Markdown
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
@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