This pull request changes the way HarborAsyncClient.construct_model() works by adding a new is_list parameter, which internally iteratively calls a new HarborAsyncClient._construct_model() method, which performs the actual model construction. Furthermore, all methods that previously called construct_model() within a list comprehension have been changed to call it once, but now with the new is_list parameter.
Rationale
The benefit of this is that when the new raw mode is enabled, we completely evade all logic that deals with assumptions about the shape of the data. When construct_model() is called in raw mode, it immediately returns whatever it received.
Currently, raw mode completely circumvents all type checks, and in the future we could potentially make it type safe by adding another overload with a generic type for the data argument of construct_model().
Not updating changelog, since 0.7.1 hasn't been released yet, and it would be nonsensical to have "added raw" AND "made raw safer" in the same version changelog.
This pull request changes the way
HarborAsyncClient.construct_model()
works by adding a newis_list
parameter, which internally iteratively calls a newHarborAsyncClient._construct_model()
method, which performs the actual model construction. Furthermore, all methods that previously calledconstruct_model()
within a list comprehension have been changed to call it once, but now with the newis_list
parameter.Rationale
The benefit of this is that when the new raw mode is enabled, we completely evade all logic that deals with assumptions about the shape of the data. When
construct_model()
is called in raw mode, it immediately returns whatever it received.https://github.com/pederhan/harborapi/blob/3edfd4a9790498cd6c8b47babe15761f1837330d/harborapi/client.py#L290-L313
Currently, raw mode completely circumvents all type checks, and in the future we could potentially make it type safe by adding another overload with a generic type for the
data
argument ofconstruct_model()
.