-
Notifications
You must be signed in to change notification settings - Fork 659
Change can.Message #413
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
Change can.Message #413
Conversation
|
I only published this unfinished PR to test the Codecov threshold that I complained about here. |
Codecov Report
@@ Coverage Diff @@
## develop #413 +/- ##
===========================================
+ Coverage 62.33% 62.49% +0.16%
===========================================
Files 55 55
Lines 4614 4658 +44
===========================================
+ Hits 2876 2911 +35
- Misses 1738 1747 +9 |
|
The Kvaser interface sets some flags on a message object over here. That is not supported when using |
|
I don't mind changing the equality check, but it is not always trivial what can be considered equal messages. Is a gatewayed message between two CAN buses the same or different? Is a message sent multiple times the same or different? Should a message depend on the current state of the interface? If timestamps should be equal, how much are they allowed to differ? It should be high enough to handle log file resolutions but low enough to be able to separate messages sent in burst mode. It won't be possible to avoid surprises. I can't imagine a use case where one would create two separate messages and compare them for equality, so maybe it's best to just skip The custom attributes in the Kvaser interface are not documented so they are probably OK to remove. Hopefully nobody is attaching custom attributes in their applications... |
|
Thanks for your thoughts!
That's a good point. For messages sent in a burst, we'd have to have at least 0.1 ms resolution, probably a bit finer, right? And all current log formats are currently fine with Checking simply for identity sounds interesting ...
Me too. We could print a warning if one tries to, for a version or two. |
|
What do you think about adding a utility function for comparing messages? That should solve the problems with the failing unit tests. |
hardbyte
left a comment
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 you want to add is_extended_id as an optional (extra) arg to the signature of Message we can start the process of deprecating extended_id.
But this PR is complete without that change - let's tidy this up and merge it in. I'll open an issue for the extended_id and if you want to take it on for this release it will be a small stand alone PR.
|
Doing the |
|
Note: A Pull Request is now allowed to drop the coverage by up to 1.0%, to allow small uncovered or only partially covered changes to be applied. |
|
I'm done with this. I would like at least one approving review before this gets merged or someone else merges it after having a look at it. Sorry for the PR being so long, but it was hard to draw a line on where to split this into multiple ones. |
hardbyte
left a comment
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.
It might be worth adding a test for the newly supported deepcopy
Fixes a number of problems with the message object and the file IO:
__eq__()compare by identity onlychannel,bitrate_switchanderror_state_indicatorto__str__()__repr__()__init__()is now properly documentedcheckparam to__init__()that then checks the input, and only thenMessage.id_type(in the docs and prints a warning when used).__bytes__()support__slots__()__hash__()to include all memberslogformat_test.pyaccordingly__copy__()and__deepcopy__()(was required by some tests)equals()methods for comparing two messages by valueTo discuss:
timestampreally be excluded from__eq__()and__hash__()? ⇒ Solved: compare only by identityextended_idin the constructor and the nameis_extended_idas the attribute? Maybe, but this is not discussed in this PR. See Change can.Message #413._check()? Is the current stuff enough?Fixes #350.