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

fix: Fix incorrect use of contract.update Update get_hashes_page.py #1264

Closed
wants to merge 1 commit into from

Conversation

0xwitty
Copy link

@0xwitty 0xwitty commented Dec 18, 2024

Description

In the remove_prefix_from_names function, the update() method was incorrectly used on the contract object. The update() method is not applicable to dictionaries in this context, as it expects a dictionary or key-value pairs, but remove_prefix returns a string, not a dictionary.

The corrected line now directly updates the contract['name'] key with the result from remove_prefix, like so:

contract['name'] = remove_prefix(contract['name'], 'openzeppelin_presets_')

This change ensures that the name field is properly updated without causing errors, improving the function's correctness.

Additional Notes

  • The previous approach would lead to an error since contract.update(...) was attempting to assign a string to the dictionary in an incorrect manner.
  • The new approach directly modifies the contract['name'] field, which is the intended behavior.

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md
  • Tried the feature on a public network

@ericnordelo
Copy link
Member

In the remove_prefix_from_names function, the update() method was incorrectly used on the contract object. The update() method is not applicable to dictionaries in this context, as it expects a dictionary or key-value pairs, but remove_prefix returns a string, not a dictionary.

The update function also accepts an iterable object of key, value pairs, and that is what is receiving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants