Skip to content
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

Refactor code for node mapped attributes. #589

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

malneni
Copy link
Contributor

@malneni malneni commented Jun 28, 2023

Currently, the node mapped attributes are stored within the database dbc_specifics. This refactoring moves them to the more appropriate location within the message/signal dbc_specifics. It will be better when adding or removing message/signal, corresponding rel attributes will be easier to handle

@coveralls
Copy link

coveralls commented Jun 28, 2023

Pull Request Test Coverage Report for Build 5480055055

  • 20 of 20 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 93.875%

Totals Coverage Status
Change from base Build 5388691638: 0.006%
Covered Lines: 7234
Relevant Lines: 7706

💛 - Coveralls

Copy link
Member

@andlaus andlaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this in principle: the ARXML loader already takes the same approach via signal.autosar and database.autosar, etc. That said, I'm not really in a position to judge the merrits of DBC-specific stuff. Maybe @juleq can help out?

for signal in message.signals:
if signal.dbc is not None and signal.dbc.attributes_rel is not None:
for node_name, node_dict in signal.dbc.attributes_rel.items():
for _, attribute in node_dict.items():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you don't use the keys anyways, you can use this:

Suggested change
for _, attribute in node_dict.items():
for attribute in node_dict.values():

cantools/database/can/formats/dbc.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants