Add CAN and LIN database creation examples#219
Conversation
epage
left a comment
There was a problem hiding this comment.
Overall, good job! Also, the commit history is very clean!
Some minor comments on conventional commit style
chore(API): Add enum for LinProtocolVersion- I'd classify
choreas work that has no user impact, like changing line endings, comment styles, etc. By default,choredoes not show up in the changelog with the tooling I at least usefix(examples): Fix typo in commentis a good example of a chore.
- I'd put the focus on this more on the major impact.
LinProtocolVersionby itself isn't too helpful. - So maybe something like
fix(API): Expose Ecu.lin_protocol_ver as the new LinProtocolVer enum
- I'd classify
chore(API): Change LinSchedEntry.frames to Frames- This would be a fix like
LinProtocolVersion
- This would be a fix like
- renaming user-visible API calls, changing data types on user-visible API calls, etc should be noted in a
BREAKING CHANGESsection in the commit message.- Now whether we bump
0.x(pre-release's major) for this sake is philosophical (was this API more of an easter egg / early access and doesn't need to be taken into account with semver?)
- Now whether we bump
nixnet/_enums.py
Outdated
| CRC = _cconsts.NX_LIN_LAST_ERR_CODE_CRC | ||
|
|
||
|
|
||
| class LinProtocolVersion(enum.Enum): |
There was a problem hiding this comment.
Weren't we talking about abbreviating Version here like in the constant name?
There was a problem hiding this comment.
I did change the members. I'll change the class name to LinProtocolVer too.
| def get_database_ref_array(ref, prop_id): | ||
| # type: (int, int) -> typing.Iterable[int] | ||
| value_size = _funcs.nx_get_property_size(ref, prop_id) | ||
| value_size = _funcs.nxdb_get_property_size(ref, prop_id) |
There was a problem hiding this comment.
Oops, copy/paste bug on my part. Sorry you had to deal with it
|
|
||
| from nixnet import _props | ||
| from nixnet import constants | ||
| from nixnet.db import _frame |
There was a problem hiding this comment.
Is linsched_entry a descendant of frame?
I recommend all back references do the imports in the functions for consistency to help avoid problems
There was a problem hiding this comment.
I don't think so. The hierarchy looks like this:
Cluster
___Frame
___LinSched
______LinSchedEntry
So Frame is a sibling of LinSchedEntry's parent.
| from nixnet import db | ||
|
|
||
|
|
||
| def main(): |
There was a problem hiding this comment.
Each example
- Should have a unit test
- Should be included in the documentation
| from nixnet import db | ||
|
|
||
|
|
||
| def main(): |
There was a problem hiding this comment.
Each example
- Should have a unit test
- Should be included in the documentation
| @property | ||
| def frames(self): | ||
| return _props.get_lin_sched_entry_frames(self._handle) | ||
| # type: () -> typing.Iterable[_frame.Frame] |
There was a problem hiding this comment.
From travis: nixnet/db/_linsched_entry.py:58: error: Name 'typing' is not defined
You need to import typing. See some of the other files for how to do it without causing flake8 problems
| @frames.setter | ||
| def frames(self, value): | ||
| _props.set_lin_sched_entry_frames(self._handle, value) | ||
| # type: (typing.Iterable[_frame.Frame]) -> None |
There was a problem hiding this comment.
ditto about mypy error from travis
In CONTRIBUTING.rst, the tox integration command that includes LIN should use output interface LIN2 and not CAN2.
Use nxdb_get_property_size instead of nx_get_property_size when getting the size of database properties.
Fixes ni#218 BREAKING CHANGE: Rename `Db.cluster` to `Db.clusters`
BREAKING CHANGE: Modify LinSchedEntry.frames to get/set a list of Frame objects instead of a list of db refs.
BREAKING CHANGE: Add enum LinProtocolVer and modify Ecu.lin_protocol_ver to use it.
Add database creation examples for CAN and LIN. Add documentation and testing for the examples.
56766d1 to
024bacc
Compare
|
Well, I see nothing wrong and I happen to still have write access. I guess I'll merge this :) |
Fixes #218
toxsuccessfully runs, including unit tests and style checks (see CONTRIBUTING.md).