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

Core: Log warnings at call site, not Utils itself #4229

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

Zannick
Copy link
Contributor

@Zannick Zannick commented Nov 23, 2024

What is this fixing or adding?

When I run tests to generate all supported games, I get a lot of warnings like this:

Utils.py:879: UserWarning: Getting options from multiworld is now deprecated. Please use `self.options.enemy_shuffle` instead.
  warnings.warn(self.log_message)
Utils.py:879: UserWarning: Getting options from multiworld is now deprecated. Please use `self.options.enemy_health` instead.     
  warnings.warn(self.log_message)
Utils.py:879: UserWarning: Getting options from multiworld is now deprecated. Please use `self.options.accessibility` instead.    
  warnings.warn(self.log_message)

Adding in the appropriate keyword argument to the warnings library produces the actual code that needs to be updated:

worlds\alttp\__init__.py:844: UserWarning: Getting options from multiworld is now deprecated. Please use `self.options.glitches_required` instead.
  if self.multiworld.glitches_required[player] == 'no_logic':
worlds\alttp\__init__.py:846: UserWarning: Getting options from multiworld is now deprecated. Please use `self.options.small_key_shuffle` instead.
  if self.multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal:
worlds\alttp\StateHelpers.py:27: UserWarning: Getting options from multiworld is now deprecated. Please use `self.options.retro_bow` instead.
  if state.multiworld.retro_bow[player]:

How was this tested?

python Generate.py --seed=42 --skip_output before and after, and then with deliberate usage of sweep_for_events and setting should_error to True for options access (in order to cover add_stacklevels).

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Nov 23, 2024
@Exempt-Medic Exempt-Medic added the is: enhancement Issues requesting new features or pull requests implementing new features. label Nov 23, 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 changes LGTM, tested various warnings locally and they worked properly. I am confused why the import warnings were there in the first place though.

Copy link
Contributor

@nicholassaylor nicholassaylor left a comment

Choose a reason for hiding this comment

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

Significantly better, LGTM

@Exempt-Medic Exempt-Medic 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 Nov 23, 2024
@Berserker66 Berserker66 merged commit d36c983 into ArchipelagoMW:main Nov 29, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. 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