-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add length check (setting it) for sequences #1117
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c5cd8a4
Add length check (seting it) for sequences
p-snft d7887e0
Merge branch 'release/v0.5' into fix/length-of-fake-sequences-unset
p-snft 3e66f74
Add test for valid_sequence(...)
p-snft 03e0c9f
Add test for an invalid sequence
p-snft 164d96a
Update docstrings of _plumbing
p-snft 0c394ed
Add _FakeSequence fix to changelog
p-snft 71af2ba
Delete ignored data from integration tests
p-snft 32f9857
Warn about sequences that are too long
p-snft f7e72ae
Test for long sequence warning
p-snft f6f5339
Forbid valid_sequence to overwrite existing length
p-snft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
v0.5.5 () | ||
-------------------------- | ||
|
||
Bug fixes | ||
######### | ||
|
||
* Fix iterating over _FakeSequence objects | ||
|
||
Contributors | ||
############ | ||
|
||
* Patrik Schönfeldt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I would check it differently:
For me a sequence fits for any size, therefore, it is always TRUE, regardless of the checked length.
This behaviour will change if you set a length. From this moment on the size is set. If you now check the wrong length it is not valid any more.
I do not like the hidden setter. I would not expect the function to set the size of the sequence.
If you really want this hidden magic, I would prefer the following:
This will fail if I ask for a different length later. In your function the size will be updated, even if the check ask for different length.
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.
I understand what you are saying. Still, I tried to avoid this being a "hidden setter": According to the docstring,
valid_sequence
explicitly makes the argument a valid sequence of the given length. I did this to solve #1115: In your results, you might want to iterate over all values, real and fake sequences, in the same way.I see three ways of doing this:
valid_sequence
to something likeassure_valid_sequence
to emphasize possible changes by the function.a. using the explicit setter (
_Fakesequence.size = length
) when needed, or byb. renaming
valid_sequence
tomake_valid_sequence
. This would then raise an Error instead of returning False._FakeSequence
and keep scalars. Then, cast on demand (to an np.array).I'd opt to do something quick for the v0.5 release (so that the old behavior is maintained) and to remove the
_FakeSequence
in v0.6.