* Fix AWG<-> mm2 conversions
Add an inverted dictionary and a lookup function from awg -> mm2. Also
do some minor refactoring. Both sides of the conversion table were
converted to strings, since '0000' and '2/0' are perfectly valid AWG
values.
* Update example ex02 with awg -> mm2 conversion
Show conversions for ex02, and make sure it displays conversions in both
directions. Rebuild the example files.
* Fix faulty conversion of non-(mm2,AWG) units
The parsing allows arbitrary units to be used for cable dimensions --
this might be valid units, e.g. square inches, or invalid, e.g. bananas.
We only allow conversion between mm2 and AWG, so check that the
gauge_unit is either of those before conversion. If not, pass through as
is.
* Fix AWG string casing in output
Convert e.g. 'awg, 'AwG' to upper case for consistent rendering. Leave
any other input gauge units as they were.
Co-authored-by: Daniel Rojas <github@danielrojas.net>
* Format all files using autopep8 to add basic PEP8 conformity.
* Add Exception types to bare excepts to prevent catching `ctrl+c`
* Remove some unnecessary assignment to dummy variables before returning
* Add `Optional` to type hints that can be `NoneType`
* Change a number of single-letter variables to more descriptive names
* Replace string.format() use with Python's f-strings, as they tends to be cleaner, and provide a performance boost.
* One multiline string was left as string.format() as I do not believe f-strings support multiline
* Some of the string.format() instances had unused/ignored arguments. I left them out of the f-strings, but I marked those cases with a comments that begins `# FIXME:`
* Rename variables that were shadowding python standard functions (specifically `format->fmt`, `input->inp`, `type->maintype`)
* Some instances of `type` were not changed, as it breaks the yaml parsing. Needs to be looked into.
* Move classes in `wireviz.py` to two new files `DataClasses.py` and `Harness.py`.
Co-authored-by: Daniel Rojas <github@danielrojas.net>