Apply suggestions from code review

Co-authored-by: kvid <kvid@users.noreply.github.com>
This commit is contained in:
Daniel Rojas 2024-05-09 10:53:32 +02:00 committed by GitHub
parent 55c6ab51f1
commit 591ae7f84a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 9 deletions

View File

@ -7,6 +7,7 @@
- Components that are not referenced in any connection set will not be rendered. Instead, a warning will be output in the console. ([#328](https://github.com/wireviz/WireViz/issues/328), [#332](https://github.com/wireviz/WireViz/pull/332)) - Components that are not referenced in any connection set will not be rendered. Instead, a warning will be output in the console. ([#328](https://github.com/wireviz/WireViz/issues/328), [#332](https://github.com/wireviz/WireViz/pull/332))
- New command line interface ([#244](https://github.com/wireviz/WireViz/pull/244)). Run `wireviz --help` for details - New command line interface ([#244](https://github.com/wireviz/WireViz/pull/244)). Run `wireviz --help` for details
- The path specified with the `-o`/`--output-dir` option no longer includes the filename (without extension) of the generated files. Use the `-O`/`--output-name` option to specify a different filename for the generated files. - The path specified with the `-o`/`--output-dir` option no longer includes the filename (without extension) of the generated files. Use the `-O`/`--output-name` option to specify a different filename for the generated files.
- The `.gv` file is no longer included as a default output format (only as an intermediate file during processing) unless specified with the new `-f` option described below.
### New features ### New features
@ -49,9 +50,7 @@
- Remove HTML links from the input attributes ([#164](https://github.com/formatc1702/WireViz/pull/164)) - Remove HTML links from the input attributes ([#164](https://github.com/formatc1702/WireViz/pull/164))
- Add harness metadata section ([#158](https://github.com/formatc1702/WireViz/issues/158), [#214](https://github.com/formatc1702/WireViz/pull/214)) - Add harness metadata section ([#158](https://github.com/formatc1702/WireViz/issues/158), [#214](https://github.com/formatc1702/WireViz/pull/214))
- Add support for supplier and supplier part number information ([#240](https://github.com/formatc1702/WireViz/issues/240), [#241](https://github.com/formatc1702/WireViz/pull/241/)) - Add support for supplier and supplier part number information ([#240](https://github.com/formatc1702/WireViz/issues/240), [#241](https://github.com/formatc1702/WireViz/pull/241/))
- Add graph rendering options (colors, font, color name display style, ...) ([#158](https://github.com/formatc1702/WireViz/issues/158), [#214](https://github.com/formatc1702/WireViz/pull/214)) - Add graph rendering options (background colors, fontname, color name display style, ...) ([#158](https://github.com/formatc1702/WireViz/issues/158), [#214](https://github.com/formatc1702/WireViz/pull/214))
- Add support for supplier and supplier part number information ([#240](https://github.com/formatc1702/WireViz/issues/240), [#241](https://github.com/formatc1702/WireViz/pull/241/))
- Add graph rendering options (colors, font, color name display style, ...) ([#158](https://github.com/formatc1702/WireViz/issues/158), [#214](https://github.com/formatc1702/WireViz/pull/214))
- Add support for background colors for cables and connectors, as well as for some individual cells ([#210](https://github.com/formatc1702/WireViz/issues/210), [#219](https://github.com/formatc1702/WireViz/pull/219)) - Add support for background colors for cables and connectors, as well as for some individual cells ([#210](https://github.com/formatc1702/WireViz/issues/210), [#219](https://github.com/formatc1702/WireViz/pull/219))
- Add optional tweaking of the .gv output ([#215](https://github.com/formatc1702/WireViz/pull/215)) (experimental) - Add optional tweaking of the .gv output ([#215](https://github.com/formatc1702/WireViz/pull/215)) (experimental)

View File

@ -137,7 +137,7 @@ mywire.bom.tsv BOM (bill of materials) as tab-separated text file
mywire.html HTML page with wiring diagram and BOM embedded mywire.html HTML page with wiring diagram and BOM embedded
``` ```
Wildcars in the file path are also supported to process multiple files at once, e.g.: Wildcards in the file path are also supported to process multiple files at once, e.g.:
``` ```
$ wireviz ~/path/to/files/*.yml $ wireviz ~/path/to/files/*.yml
``` ```

View File

@ -216,7 +216,7 @@ class Connector:
f'Unknown loop pin "{pin}" for connector "{self.name}"!' f'Unknown loop pin "{pin}" for connector "{self.name}"!'
) )
# Make sure loop connected pins are not hidden. # Make sure loop connected pins are not hidden.
self.activate_pin(pin) self.activate_pin(pin, None)
for i, item in enumerate(self.additional_components): for i, item in enumerate(self.additional_components):
if isinstance(item, dict): if isinstance(item, dict):
@ -318,7 +318,7 @@ class Cable:
f"Warning: Cable {self.name} length_unit={self.length_unit} is ignored because its length contains {u}" f"Warning: Cable {self.name} length_unit={self.length_unit} is ignored because its length contains {u}"
) )
self.length_unit = u self.length_unit = u
elif not any(isinstance(self.length, t) for t in [int, float]): elif not isinstance(self.length, (int, float)):
raise Exception(f"Cable {self.name} length has a non-numeric value") raise Exception(f"Cable {self.name} length has a non-numeric value")
elif self.length_unit is None: elif self.length_unit is None:
self.length_unit = "m" self.length_unit = "m"

View File

@ -28,7 +28,11 @@ epilog += "following characters to specify which file types to output:\n"
epilog += ", ".join([f"{key} ({value.upper()})" for key, value in format_codes.items()]) epilog += ", ".join([f"{key} ({value.upper()})" for key, value in format_codes.items()])
@click.command(epilog=epilog, no_args_is_help=True) @click.command(
epilog=epilog,
no_args_is_help=True,
context_settings=dict(help_option_names=["-h", "--help"]),
)
@click.argument("file", nargs=-1) @click.argument("file", nargs=-1)
@click.option( @click.option(
"-f", "-f",

View File

@ -28,7 +28,7 @@ COLOR_CODES = {
"BUVT", "VTBU", "OGVT", "VTOG", "GNVT", "VTGN", "BNVT", "VTBN", "SLVT", "VTSL", "BUVT", "VTBU", "OGVT", "VTOG", "GNVT", "VTGN", "BNVT", "VTBN", "SLVT", "VTSL",
], ],
"TELALT": [ # 25x2: Tip and then ring of each pair "TELALT": [ # 25x2: Tip and then ring of each pair
"WHBU", "BU", "WHOG", "OG", "WHGN", "GN", "WHBN", "BN", "WHSL", "SL", "WHBU", "BU", "WHOG", "OG", "WHGN", "GN", "WHBN", "BN", "WHSL", "SL",
"RDBU", "BURD", "RDOG", "OGRD", "RDGN", "GNRD", "RDBN", "BNRD", "RDSL", "SLRD", "RDBU", "BURD", "RDOG", "OGRD", "RDGN", "GNRD", "RDBN", "BNRD", "RDSL", "SLRD",
"BKBU", "BUBK", "BKOG", "OGBK", "BKGN", "GNBK", "BKBN", "BNBK", "BKSL", "SLBK", "BKBU", "BUBK", "BKOG", "OGBK", "BKGN", "GNBK", "BKBN", "BNBK", "BKSL", "SLBK",
"YEBU", "BUYE", "YEOG", "OGYE", "YEGN", "GNYE", "YEBN", "BNYE", "YESL", "SLYE", "YEBU", "BUYE", "YEOG", "OGYE", "YEGN", "GNYE", "YEBN", "BNYE", "YESL", "SLYE",
@ -156,7 +156,7 @@ def get_color_hex(input: Colors, pad: bool = False) -> List[str]:
if len(output) == 2: # Give wires with EXACTLY 2 colors that striped look. if len(output) == 2: # Give wires with EXACTLY 2 colors that striped look.
output += output[:1] output += output[:1]
elif pad and len(output) == 1: # Hacky style fix: Give single color wires elif pad and len(output) == 1: # Hacky style fix: Give single color wires
output *= 3 # a triple-up so that wires are the same size. output *= 3 # a triple-up so that wires are the same size
return output return output