-
Notifications
You must be signed in to change notification settings - Fork 671
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: Add support for non dictionary iterables for Region.add_exits
#1698
Core: Add support for non dictionary iterables for Region.add_exits
#1698
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two codepaths are basically identical, and this duplication should be eliminated. One way to achieve this could be to keep only the codepath for the dict case and upconvert non-dict input using
if not isinstance(exits, dict):
exits = dict.fromkeys(exits)
(Another way would be to extract the shared code from inside the for loops into a separate method.)
…ArchipelagoMW#1698) * Core: Add support for non dictionary iterables for `Region.add_exits` * some cleanup and duplicate code removal * add unit test for non dict iterable * use more consistent naming * sometimes i just make stuff harder on myself :)
…ArchipelagoMW#1698) * Core: Add support for non dictionary iterables for `Region.add_exits` * some cleanup and duplicate code removal * add unit test for non dict iterable * use more consistent naming * sometimes i just make stuff harder on myself :)
What is this fixing or adding?
Missed this use case when creating these helpers and didn't notice until trying to convert The Messenger :)
How was this tested?
unit tests