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

Add a handful of __repr__ methods to improve debuggability #2078

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

MajikVroom
Copy link

These customize what VSCode (and presumably other debuggers) displays to represent an object. So instead of "<Location.Location object at 0x1234123412341234>", you get "W0 KF Midos Bottom Left Chest with W1 Magic Meter".

Examples of the ones I added:

  • World: "W0"
  • Goal: "W0 Light Medallion: path to #Phantom Ganon#"
  • Item: "W1 Magic Meter"
  • Location: "W0 KF Midos Bottom Left Chest with W1 Magic Meter"
  • Region: "W0 KF Midos House"

The level of thought that went into these was "this makes sense to me", and I only added them for the types that I happened to be debugging. No idea if this is useful enough to others to be worth putting in as-is, but figured I should at least offer it up.

@MajikVroom
Copy link
Author

Note that before Goals hit replace_goal_names, their text may be more like "W0 Fire Medallion: {'replace': 'Fire Medallion'}". Could just suppress the hint_text entirely if it's still in dict form if that's going to bother anyone.

@MajikVroom
Copy link
Author

MajikVroom commented Aug 28, 2023

Might also make sense to do __repr__ = __str__ for some of these, if the existing __str__ implementations can be enhanced with the added info. Just not sure if there's anything user-facing based on __str__; I could see a world where spoiler log generation involves stringizing some of these objects.

@cjohnson57 cjohnson57 added Component: Misc A catch-all label Status: Waiting for Release This PR is ready for merge, but we're holding off on it until after the next release and removed Status: Waiting for Release This PR is ready for merge, but we're holding off on it until after the next release labels Nov 11, 2023
Copy link
Collaborator

@cjohnson57 cjohnson57 left a comment

Choose a reason for hiding this comment

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

Good idea to add these

@cjohnson57 cjohnson57 merged commit 8d15cc3 into OoTRandomizer:Dev Nov 29, 2023
3 checks passed
@fenhl fenhl added this to the 8.1 milestone Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Misc A catch-all label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants