Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds the opt-in
strict_mode_for_literalsrequested in #170. With the option enabled, a loaded value must match both the value and exact type of aLiteralargument:Falseno longer matchesLiteral[0], and an integer does not match an equal-valuedIntEnummember. Mixed alternatives such asLiteral[0, False]retain both choices. The default value-only matching remains unchanged.The option works through
JSONWizard.Meta/LoadMetaandEnvWizard.Meta/EnvMeta. It follows recursive Meta settings, while keeping sibling classes and their cached Literal/optional TypedDict loaders independent. Env loading uses the same value check; it does not add coercion of raw environment strings ('0'still does not matchLiteral[0]). Other field coercion, dumping and the legacydataclass_wizard.v0implementation are unchanged. Includes typed declarations, usage docs, README and changelog entries.Validation:
make teston Python 3.13.1: 926 passed, 2 skipped, 6 xfailed, 4 xpassed. All 896 existing case outcomes remain unchanged; 42 cases are added.make lintremains nonzero on both trees: existing flake8 diagnostics decrease from 1,782 to 1,776. The Pylint command was also run separately because flake8 stops the target; it remains nonzero on both (4,038 to 4,036 diagnostics). Its existing statement-count warning changes from 198 to 200 for the metadata isolation/configuration statements. The new test file has no Ruff, flake8 or Pylint diagnostics.The full tox matrix, PyPy, and Python 3.9/3.11/3.12/3.14 were not run locally.