This way, both BOM and harness.additional_bom_items uses the same
set of keys in their dict entries. This was originally suggested
in a #115 review, but had too many issues to be implemented then.
Build output string in component_table_entry() as the similar strings
in generate_bom(). Repeating a couple of minor if-expressions is small
cost to obtain a more compact and readable main expression.
Make a list from the group iterator for reusage in sum expressions
and to pick first group entry. The expected group sizes are very small,
so performance loss by creating a temporary list should be neglectable.
Alternativly, itertools.tee(group, 3) could be called to triplicate
the iterator, but it was not chosen for readability reasons.
- Use one common entry loop to consume iterator only once.
- Use same key function for sort() and groupby(),
except replace None with empty string when sorting.
- Use the actual BOM as first parameter instead of the whole harness.
- Use a whole AdditionalComponent as second parameter instead of each
attribute separately.
Bug: Failing to assign the default cable length unit when not present.
It was introduced in #198.
Fix: Test the correct cable attribute. This fix solves issue #205.
Using Any or str in type annotations might increase the need for extra
comments to explain the real valid values. However, such needs can be
drastically reduced with the help of semanticly named type aliases.
Each type alias have their legal values described in comments.
Actual validation might be implemented in the future.
GraphViz does not support the a HTML tag when generating the tables for the
cables/connectors, so this change will remove these tags for the graph generation.
However for the HTML BOM output table these links will be generated.
The https://validator.w3.org/ reported Errors:
The align attribute on the th/td element is obsolete. Use CSS instead.
By replacing align="X" attributes with text-align:X; CSS equivalent,
the validator now completes without any errors or warnings.
This solves the remaining issues from #97.
The application name and URL was defined several places in the code,
and the name was not written exactly the same everywhere.
By using the same constants everywhere, consistency is obtained.
This image, with an optional caption below, is displayed in the lower
section of the connector/cable node in the diagram - just above the
notes if present.
This solves the basic part of issue #27, and is a continuation of
PR #137 that was closed due to changes in the base branch.
Add -V command line option (and --version as an alias) to
both wireviz.py and build_examples.py that show version number.
Move the version number from setup.py into __init__.py to access
the same version number specification from all files needing it.
This solves part 4 of issue #167.
It seems, that the current implementation ignores --generate-bom,
and that parser.add_argument() code line is therefore commented
out until it gets implemented to avoid any confusion.
This solves part 1 of issue #167.