Fix PathPair
& PathPairCollection
validation; add path_pair
type hint fn; use path_pair
in Topmodel
init_config
model
#183
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.
ngen.config
Additions
path_pair
type hint fn. Use this instead ofPathPair
(see Feature Details section in FixPathPair
&PathPairCollection
validation; addpath_pair
type hint fn; usepath_pair
inTopmodel
init_config
model #183)Topmodel
subcat
andparam
fields can now be initialized withTopModelSubcat
andTopModelParams
instances respectively.Changes
PathPair
&PathPairCollection
model validationpath_pair
type hint function inTopmodel
init_config
modelAbstractPathPairMixin.read
return type hint correct tobool
. Already returnedbool
, type hint was missing.Feature Details
path_pair
type hint function:In nearly all cases, this should be used as the pydantic model field type if the field is to be a
PathPair[T]
. This will ensure that thePathPair[T]
instance has the specifiedserializer
,deserializer
,reader
, andwriter
.NOTE: if a
PathPair
instance is passed to a model field defined using this function during initialization of the model, anyserializer
,deserializer
,reader
, orwriter
on thePathPair
instance will not be replaced by the inputs provided to this function.NOTE: if a pydantic model's field type is defined using this function, it's
ModelField.type_
will be aPathPairOptions
.Example: