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

Pokemon Emerald: Make use of NamedTuple._replace #3727

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

Zunawe
Copy link
Collaborator

@Zunawe Zunawe commented Aug 2, 2024

What is this fixing or adding?

Uses _replace instead of rebuilding the class by passing in each property. If I was aware of _replace when this was written, I was at least under the impression that it's somewhat improper to use because of the leading underscore. But it's apparently the recommended solution for what's happening here.

How was this tested?

Generated on main and on this branch with the same seed and all relevant randomization turned on and compared the file hashes of the resulting patched ROM. So these changes should all have been hit and resulted in the same values in the output.

@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Aug 2, 2024
@Zunawe Zunawe added is: refactor/cleanup Improvements to code/output readability or organizization. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Aug 2, 2024
Copy link
Member

@Exempt-Medic Exempt-Medic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM. Compared spoiler logs before and after the changes on the same seed with yamls designed to hit these codepaths (verified with print debugging). Spoilers were identical

Copy link
Contributor

@qwint qwint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

under the assumption that NamedTuple._replace() is better than dataclasses and/or creating new ones from existing values,
all changes look good and match existing functionality.

was purely a code review. I did some local testing with NamedTuple._replace to make sure I understood the format correctly, but did not run any tests/gens/etc. on the branch

@Zunawe Zunawe added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Aug 21, 2024
@NewSoupVi NewSoupVi merged commit 05b257a into ArchipelagoMW:main Sep 8, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: refactor/cleanup Improvements to code/output readability or organizization. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants