-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/validation removal #473
Conversation
21c405f
to
43031a4
Compare
2ea0000
to
29efed0
Compare
Additionaly required KeyArray and KeyArrayLike types to be moved into a new `custom_types` file. Refs: #459
29efed0
to
c3ad6a9
Compare
c3ad6a9
to
ffe066c
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple public interfaces that take values from the user. They should have some level of checking to ensure that the correct values are being used or we protect code that uses unchecked values.
coreax/custom_types.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mightn't we call this types
, i.e. coreax.types
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed to whatever name is preferred. I chose custom_types
as this indicates that the types aren't reexported types from another package, but indeed custom to this package.
) | ||
coreax.validation.validate_key_array(x=random_key, object_name="random_key") | ||
|
||
# Assign herding-specific attributes | ||
self.block_size = block_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block size needs to be greater than 0. This should be validated in some way, either an if
here to check, or try and excepts around where it is used. Note that negative values won't crash the code but produce bad results. This may be the case in multiple places where validate_in_range
was used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding was that we were no longer validating any rules which were logically inconsistent. I.E. no user should expect a non-positive block size to work/make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If #427 is to be added, along with subsequent changes to type hinting, then most of the "validation" will come from type checking (which could be enforced at runtime if so desired)
@tp832944 What are your thoughts? |
Please can you indicate locations (I've just done a commit to remove some left over unused imports). If it is the uses in |
Removes imports of `coreax.validation` that were still remaining in `coreax.kernel`, `coreax.weights` and `test_coresubset`.
They are all in |
PR Type
Closes #462 closes #461 closes #460 closes #459 closes #458 closes #457 closes #456 closes #455 closes #454 closes #453
Description
Removes explicit validation checks and any consequently redundant tests. Moves
KeyArray
and
KeyArrayLike
into a newcustom_types
module.Does this PR introduce a breaking change?
Moving the types to a new module may be considered breaking. However, these are not really mean't for external use anyway.
Checklist before requesting a review