internals rewrite: clean up checks and hypothesis functionality #1109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR organizes the checks and hypothesis modules across the
core
andbackend
subpackages for overall consistency:pandera.core.{checks, hypotheses}
module specifies the public-facing class API for checks and hypotheses. This provides a way for users to access built-in checks/hypotheses with full auto-completion on an IDE. These methods delegate to thebuiltin_{checks, hypotheses}
modules.pandera.backends.base.builtin_{checks, hypotheses}
modules implement base function implementations that usemultimethod
to dispatch the implementation to a specific data framework (e.g.pandera.backends.pandas.builtin_{checks, hypotheses}
@{Check, Hypothesis}.register_builtin_check_fn
, and framework-specific implementations are marked with@register_builtin_{check, hypothesis}
This PR also cleans up the way
SchemaErrors
failure cases are handled. Instead of having pandas-specific logic in theSchemaErrors
methods:failure_cases_metadata
method was introduced in theBaseSchemaBackend
class to handle consolidating and summarizing failure cases from across multiple checks.FailureCaseMetadata
namedtuple class to clarify the metadata needed bySchemaErrors
.