fix: remove extra argument causing TypeError in metadata string lists#14
Open
e-kotov wants to merge 1 commit intoOpen-Earth-Monitor:mainfrom
Open
fix: remove extra argument causing TypeError in metadata string lists#14e-kotov wants to merge 1 commit intoOpen-Earth-Monitor:mainfrom
e-kotov wants to merge 1 commit intoOpen-Earth-Monitor:mainfrom
Conversation
The _MetaBaseListString subclass was passing 3 arguments to its parent _MetaBaseList constructor, which only accepts 2. This caused a TypeError when accessing metadata fields like keywords or references.
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the _MetaBaseListString class that caused a TypeError when accessing metadata fields like keywords or creators. The issue was caused by passing three arguments to the parent class constructor which only accepts two.
Changes:
- Removed the erroneous third argument
list()from thesuper().__init__()call in_MetaBaseListString.__init__()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Hi! I found a small bug that causes a crash when working with metadata fields like
keywordsorcreators.The Bug
The class
_MetaBaseListStringtries to pass 3 arguments to its parent class (super().__init__), but the parent class only accepts 2.This causes a
TypeErrorwhenever you try to access or set these fields.How to Reproduce
You can reproduce this without a Zenodo API key.
The crash happens whenever you access a metadata field that is a "list of strings" (like
keywordsorcreators).Real World Example:
Minimal Reproduction (One-Liner):
This one-liner simulates exactly what
dep.metadata.keywordsdoes internally:python -c "from zen.metadata import Metadata; Metadata({'metadata': {}}).keywords"Result (Before Fix):
Result (After Fix):
The Fix
I simply removed the extra
list()argument that was causing the mismatch.Thanks for the great library!