Uh oh!
There was an error while loading. Please reload this page.
Admit that **kwargs mapping subtypes may have no direct type parameters - #18850
Merged
hauntsaninja merged 1 commit intoMar 29, 2025
Merged
Conversation
hauntsaninja
approved these changes
Mar 29, 2025
Contributor
Diff from mypy_primer, showing the effect of this PR on open source code: hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ src/hydra_zen/structured_configs/_implementations.py:2950: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "str" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:2950: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "tuple[type, ...]" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:2950: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "dict[str, Any] | None" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:2950: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "bool" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:2950: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "str | None" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:3310: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "str" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:3310: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "tuple[type, ...]" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:3310: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "dict[str, Any] | None" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:3310: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "bool" [arg-type]+ src/hydra_zen/structured_configs/_implementations.py:3310: error: Argument 2 to "make_dataclass" has incompatible type "**StrictDataclassOptions"; expected "str | None" [arg-type] |
CollaboratorAuthor
Okay, I'm lost in that 1000+ LOC method, looks quite scary, but fortunately it isn't relevant. The actual bug is here, attempt to overwrite a key with itself but (trivial to fix and worth fixing anyway, last wrapper dict should just go away, and version condition can define The error on our end is cryptic as always with Min-ish repro: importsysfromdataclassesimportField, make_dataclassfromtypingimportAny, ClassVar, Protocol, Required, TypedDictclassDataClass_(Protocol):
__dataclass_fields__: ClassVar[dict[str, Field[Any]]]
class_BaseOptions(TypedDict, total=False):
cls_name: strnamespace: dict[str, Any] |Nonebases: tuple[type[DataClass_], ...]
init: boolrepr: booleq: boolorder: boolunsafe_hash: boolfrozen: boolclassPy310Options(_BaseOptions):
match_args: boolkw_only: boolslots: boolifsys.version_info< (3, 10):
BaseOptions=_BaseOptionselse:
BaseOptions=Py310OptionsclassStrictOptions(BaseOptions):
cls_name: Required[str] # type: ignoredefchk(o: StrictOptions) ->None:
make_dataclass(fields=[], **o) |
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 freeto 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.
Fixes#13675. I don't know why this check was ever needed (since #11151), but it doesn't seem correct.