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

Loop over enums to create constants #4

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

radarhere
Copy link

Suggestions for python-pillow#6486

  1. I presume you came up with encoder_name, extents, offset, tile_args after looking at for decoder_name, extents, offset, args in self.tile:. I'm suggesting keeping args, instead of sometimes having args and sometimes tile_args.
  2. I've used the enums more instead of the existing constants, and looped over the enums to create the constants.

Comment on lines +267 to +275
module = sys.modules[__name__]
for item in DDSD:
setattr(module, "DDSD_" + item.name, item.value)
for item in DDSCAPS:
setattr(module, "DDSCAPS_" + item.name, item.value)
for item in DDSCAPS2:
setattr(module, "DDSCAPS2_" + item.name, item.value)
for item in DDPF:
setattr(module, "DDPF_" + item.name, item.value)
Copy link
Owner

Choose a reason for hiding this comment

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

That's a great idea, but it won't work for code auto-completion, but since these are old/obsolete constants(they are replaced by enums) it's all good

@REDxEYE REDxEYE merged commit f59c9ae into REDxEYE:improved_dds Oct 17, 2023
45 of 47 checks passed
@radarhere radarhere deleted the improved_dds branch October 17, 2023 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants