-
Notifications
You must be signed in to change notification settings - Fork 26
Remove top-level actions config key
#84
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
Remove top-level actions config key
#84
Conversation
actions config key
bsieber-mozilla
left a comment
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.
Minor suggestion; overall LGTM
Includes the config/ directory and example config in tests
Remove the need for the top-level `actions` key in the action config This, among other things, removes the need for the Actions.all() method
| def all(self): | ||
| """Return mapping of all actions""" | ||
| return self.actions | ||
| return self.__root__.get(tag.lower()) if tag else None |
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.
Shouldn't we move this to __getitem__() ?
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.
I think they're different right?
__getitem__ is for actions['devtest'], which will throw a KeyError if the item is missing
vs actions.get("devtest") which will return None if the key doesn't exist.
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.
Yeah, but one could rely on the other to match the actions[item.lower()] and actions[None] behaviour
I noticed that we had a top-level actions key in project config. This seemed somewhat unnecessary since there aren't any other config objects besides actions. That meant that any time we wanted to access actions, we'd need to do
actions_instance.actions.<whatever>.This PR removes the top-level
actionskey in config and modifies theActionsPydantic model to give it a__root__property to contain the actions.