def test_class_diagrams(testfile: FunctionalPyreverseTestfile, tmpdir: LocalPath) -> None: input_file = testfile.source for output_format in testfile.options["output_formats"]: with pytest.raises(SystemExit) as sys_exit: args = ["-o", f"{output_format}", "-d", str(tmpdir)] args.extend(testfile.options["command_line_args"]) args += [str(input_file)] Run(args) assert sys_exit.value.code == 0 assert testfile.source.with_suffix(f".{output_format}").read_text( encoding="utf8") == Path( tmpdir / f"classes.{output_format}").read_text(encoding="utf8")
def generate_pumls(app, config): """ Generates PlantUML files for the given packages and writes the files to the components directory in the documentation source. """ sys.stdout.write("Generating PlantUML...\n") sys.stdout.flush() # TODO: make this a configurable thing via the docs config packages = ["conda"] for package in packages: output_path = os.path.join(here, "..", "umls") output_format = "puml" files = [ f"packages_{package}.{output_format}", f"classes_{package}.{output_format}", ] ignore_list = ",".join(ignore) args = [ package, f"--ignore={ignore_list}", f"--output={output_format}", "--colorized", "--max-color-depth=8", f"--project={package}", f"--output-directory={output_path}", "--all-associated", "--all-ancestors", ] try: # Run pyreverse to create the files first Run(args) except SystemExit: pass finally: # Then post-process the generated files to fix some things. post_process(files, output_path) sys.stdout.write("Done generating PlantUML files.\n")
def run_pyreverse(self): """run pyreverse""" from pylint.pyreverse.main import Run Run(sys.argv[1:])
# Copyright (c) 2020 Espressif Systems (Shanghai) Co. Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies # of the Software, and to permit persons to whom the Software is furnished to do # so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # SPDX-License-Identifier: MIT import sys from pylint.pyreverse.main import Run file = "../debug_adapter/__main__.py" cmd_args = sys.argv # save old args pyrev_args = ['-o', 'pdf', '-p', 'uml', '-SA', file, '../debug_adapter'] sys.argv = [cmd_args[0]] + pyrev_args # load args for pyreverse Run(sys.argv)
def run_pyreverse(): """run pyreverse""" from pylint.pyreverse.main import Run args = sys.argv print(args) Run(args)