-
Notifications
You must be signed in to change notification settings - Fork 5
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
Parallel bug - the behavior of parallel() and Stream.parallel_of() not same. #89
Conversation
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.
PR Type: Bug fix
PR Summary: This pull request addresses an inconsistency between the behavior of parallel streams created via parallel()
and Stream.parallel_of()
. The issue was identified as an AttributeError occurring when terminal actions are called on parallel streams created by parallel()
, which does not happen with streams created by Stream.parallel_of()
. The proposed fix involves setting the _parallelizer
attribute in the StreamConverter.to_parallel_stream()
method to ensure uniform behavior across both methods of creating parallel streams.
Decision: Comment
📝 Type: 'Bug fix' - not supported yet.
- Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
✅ Small diff: the diff is small enough to approve with confidence.
No details provided.
General suggestions:
- While the fix addresses the immediate AttributeError, it's important to consider the broader implications of directly modifying object attributes outside of their class definition. This can lead to issues with encapsulation and maintainability. A more robust solution might involve ensuring that all necessary attributes are set within the constructor or through dedicated methods, providing a clearer and more maintainable approach to object state management.
- The addition of tests is commendable as it helps to ensure that the fix resolves the issue without introducing new ones. However, it would be beneficial to include tests that specifically target the scenario that was failing before the fix was applied, ensuring that the issue is fully resolved.
- The pull request description provides a clear explanation of the problem and the proposed solution, which is helpful for reviewers. Including before and after examples is a good practice that could be enhanced by providing a brief explanation of how the images demonstrate the fix's effectiveness.
Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨
1d9d475
to
bd1f1dd
Compare
bd1f1dd
to
3a96491
Compare
Thank you @NuclearMissile for contributing to pystreamapi! |
The behavior of parallel() and Stream.parallel_of() not same.
Calling some actions on parallel stream created by parallel() like filter causes an AttributeError, but Stream.parallel_of() is OK. May because forget to set _parallelizer in StreamConverter.to_parallel_stream().
Error before fix after running test_parallel_stream.py: