Use OptionInfo type for option registration args/kwargs. #21766
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The options registration system has for a long time passed around
the naked args and kwargs used at registration time.
However the more recent implementation of class field-based
declarative options introduced an
OptionsInfo
dataclass toencapsulate that data.
This PR spreads the use of
OptionsInfo
into the optionsregistration code. Advantages include:
*
or**
.Note that this change renames
OptionsInfo
toOptionInfo
,since it represents the registration of a single option.
It also renames its fields to
args
andkwargs
, since thatis the usage in most of the related code. Also, the name
flag_options
was doubly confusing: A) A flag is just one aspect of an option, and
B) "options" is overloaded. This refers the knobs you can set when
registering an option, so using the word "options" for it is brain-hurting.
I considered "knobs", but figured "kwargs" was just as good, and already
in use.