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

Refactor _validate_data_input to simplify the codes #3818

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

seisman
Copy link
Member

@seisman seisman commented Feb 22, 2025

Avoid nested if-else statements in the _validate_data_input function. Instead, checking the data based on the data kind using match-case statements.

@seisman seisman force-pushed the refactor/validate_data_input branch from e4cc57d to 9672f05 Compare February 22, 2025 16:04
@seisman seisman changed the title Refactor _validate_data_input Refactor _validate_data_input to simplify the codes Feb 22, 2025
Comment on lines +137 to +112
# Determine the required number of columns based on the required_z flag.
required_cols = 3 if required_z else 1
Copy link
Member Author

Choose a reason for hiding this comment

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

Most modules usually requires 2 columns but there are exceptions like histogram and info will works for 1 column. So the default value is 1 if required_z is False.

Will refactor this part in PR #3369

@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. labels Feb 22, 2025
@seisman seisman added this to the 0.15.0 milestone Feb 22, 2025
@seisman seisman marked this pull request as ready for review February 22, 2025 16:13
@seisman seisman removed the needs review This PR has higher priority and needs review. label Feb 22, 2025
@seisman seisman marked this pull request as draft February 22, 2025 16:37
@seisman seisman force-pushed the refactor/validate_data_input branch from 9672f05 to 839caa1 Compare February 25, 2025 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant