Skip to content

Commit

Permalink
Core: Error on empty options.as_dict (#3773)
Browse files Browse the repository at this point in the history
* Error on empty options.as_dict

* ValueError instead

* Apply suggestions from code review

Co-authored-by: Aaron Wagener <[email protected]>

---------

Co-authored-by: Aaron Wagener <[email protected]>
Co-authored-by: NewSoupVi <[email protected]>
  • Loading branch information
3 people authored Aug 12, 2024
1 parent a3e54a9 commit 67520ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@ def as_dict(self, *option_names: str, casing: str = "snake") -> typing.Dict[str,
:param option_names: names of the options to return
:param casing: case of the keys to return. Supports `snake`, `camel`, `pascal`, `kebab`
"""
assert option_names, "options.as_dict() was used without any option names."
option_results = {}
for option_name in option_names:
if option_name in type(self).type_hints:
Expand Down

0 comments on commit 67520ad

Please sign in to comment.