21 Commits

Author SHA1 Message Date
KV
19cdff1774 Avoid ResourceWarning: unclosed file (#395)
A number of such warnings showed up when running e.g.
PYTHONWARNINGS=always python build_examples.py
PYTHONWARNINGS=always wireviz ../../examples/demo0?.yml
See https://github.com/wireviz/WireViz/pull/309#issuecomment-2170988381

Fix: All open() calls should be in a "with open() as x" statement
to ensure closing the file when exiting the block in any way.
Otherwise, use the new file_read_text() or file_write_text() functions
to read or write the whole utf-8 text file and closing it.
2024-07-07 16:16:56 +02:00
Daniel Rojas
50d29172ee Remove references for unsupported output formats
Remove the references in the CLI help, but keep the placeholders elsewhere in the code as a TODO
2024-05-09 14:10:19 +02:00
Daniel Rojas
591ae7f84a
Apply suggestions from code review
Co-authored-by: kvid <kvid@users.noreply.github.com>
2024-05-09 10:53:32 +02:00
Daniel Rojas
d19c260940 Simplify file access operations 2021-10-16 22:27:00 +02:00
Daniel Rojas
08b5124adb Add support for multiple prepended files 2021-10-16 22:26:59 +02:00
Daniel Rojas
e3530702f2 Allow specifying output directory and file name separately 2021-10-16 22:26:59 +02:00
Daniel Rojas
d7d7854bce Consolidate wireviz.parse() to handle Path, str and Dict as input 2021-10-16 22:26:59 +02:00
Daniel Rojas
c89cf735ae Apply some manual fixes, reapply black 2021-10-16 22:09:59 +02:00
Daniel Rojas
f92985a61c Apply black 2021-10-16 22:09:59 +02:00
Daniel Rojas
344615483a Apply isort 2021-10-16 22:09:59 +02:00
Daniel Rojas
fb2aae5515 Split file output logic and object return logic
Use `output_formats` parameter to specify which *files* to output to disk,
Use `return_types` parameter to specify which objects to return to a calling Python script
2021-10-16 22:08:01 +02:00
Daniel Rojas
d6d1fbcf16 Output help string if no arguments are received 2021-10-16 22:08:01 +02:00
Daniel Rojas
a4343ae04c Sort --format flags alphabetically 2021-10-16 22:08:01 +02:00
Daniel Rojas
5b3c2b3297 Add encoding info to wv_cli.py 2021-10-16 22:08:01 +02:00
Daniel Rojas
6a08988ca9 Implement image path resolver 2021-10-16 22:08:01 +02:00
Daniel Rojas
a5b0fbe305 Split the YAML loading and parsing functions 2021-10-16 22:08:00 +02:00
Daniel Rojas
b53ce36046 Fix entry point 2021-10-16 22:08:00 +02:00
Daniel Rojas
d3e99abaa8 Only output requested file types (closes #60) 2021-10-16 22:08:00 +02:00
Daniel Rojas
77f668e553 Add CLI help strings 2021-10-16 22:08:00 +02:00
Daniel Rojas
1df45ab833 Implement working proof of concept 2021-10-16 22:08:00 +02:00
Daniel Rojas
a810bd53ae Add wv_cli.py, add Click requirement, change entry point 2021-10-16 22:08:00 +02:00