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.
Adds the
subokoption to theensure_*functions. This merely determines whether subclasses of the expected type should be preserved or whether they should be forced into the expected type. By default subclasses are allowed (existing behavior), but users are now able to override this as needed. Tests exercise subclasses with theensure_*functions to verify the correct behavior is seen.This can be useful when working with things like MongoDB where
bson.Binaryis passed around and is a subclass ofbytes. In some cases functions are able to handle this subclass without issues. In other cases functions really need abytesobject. This provides a nice switch for enforcing the intended type with theensure_bytes(or otherensure_*) function.xref: zarr-developers/zarr-python#372
xref: zarr-developers/zarr-python#401
TODO:
tox -e py37passes locallytox -e py27passes locallytox -e docspasses locally