Skip to content

Commit

Permalink
.sym: quote units with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Jun 27, 2018
1 parent 8715304 commit dd34a77
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion canmatrix/sym.py
Expand Up @@ -71,7 +71,12 @@ def createSignal(db, signal):
if signal.attributes.get('HexadecimalOutput', False):
output += "-h "
if len(signal.unit) > 0:
output += "/u:%s " % (signal.unit[0:16])
t = signal.unit[0:16]
if " " in t:
format_string = '/u:"%s" '
else:
format_string = '/u:%s '
output += format_string % (t)
if float(signal.factor) != 1:
output += "/f:%s " % (format_float(signal.factor))
if float(signal.offset) != 0:
Expand Down

3 comments on commit dd34a77

@danielhrisca
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you use the % formatting?

@altendky
Copy link
Collaborator Author

@altendky altendky commented on dd34a77 Jun 27, 2018

Choose a reason for hiding this comment

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

Because that's what was there before. I don't know of any reason and I wouldn't write it this way now. I just often choose to do such refactors as a group and not mixed in with other changes.

@altendky
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, regarding the broken build... it seems unrelated to this change. See #161.

Please sign in to comment.