bitmaptools.arrayblit fix: make x2,y2 optional and update docstring #10257
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.
This function's docstrings don't match its behavior in two ways.
-1
for x2 or y2 as specified in the docstring it will raise an exceptionValueError: x2 must be 0-80
We could update the validation to accept
-1
but this same validation helper in used in multiple other places and I'm not sure if all of them share the same support for and meaning of-1
value.In any case the current code already provides
None
as a value that does make it get taken as the width and/or height of the image. I think there is no need to have two different argument values that lead to that same behavior. So I've just updated the docstring to indicateNone
instead of-1
.TypeError: 'x2' argument required
. This is resolved by removing the ARG_REQUIRED flag from forif_required2
argument to the validation helper call.Tested on a pyportal with this code: