sphinx_uml.pyreverse.main module#
Based on the pylint.pyreverse.main module.
Under Debian, see the
/usr/lib/python3/dist-packages/pylint/pyreverse/main.py
Background:
We must overlad the pylint.pyreverse.main.Run class as we need
an extra option to set the directory where Sphinx stores its output HTML files.
However, adding this option is not straightforward.
The pylint.pyreverse.main.Run.__init__() constructor is monolotic
and runs the following operations:
parsing the arguments from the CLI;
initializing the configuration needed by the
pyreverse.run()method;calling the
pylint.pyreverse.main.Run.run()method with the remaining arguments;exiting the program using the
sys.exit()function!
This design prevents to call pyreverse multiple times, which is needed to process by a Sphinx extension producing muliple UML diagrams.
To address this problem, this file scatters those steps as follows:
The
ParsePyreverseArgsclass parses the arguments;The
Run.__init__constructor takes in parameter the configuration obtained from theParsePyreverseArgsclass;The
Run.runconstructor takes in parameter the remaining CLI arguments, obtained from theParsePyreverseArgs.remaining_argsattribute;
- class sphinx_uml.pyreverse.main.ParsePyreverseArgs(args: list[str])[source]#
Bases:
Run- name: str = 'pyreverse'#
Name of the provider.
- options: Options = [('all-ancestors', {'action': 'store_true', 'default': None, 'help': 'show all ancestors off all classes in <projects>', 'short': 'A'}), ('all-associated', {'action': 'store_true', 'default': None, 'help': 'show recursively all associated off all associated classes', 'short': 'S'}), ('class', {'action': 'extend', 'default': None, 'dest': 'classes', 'help': 'create a class diagram with all classes related to <class>; this uses by default the options -ASmy', 'metavar': '<class>', 'short': 'c', 'type': 'csv'}), ('color-palette', {'action': 'store', 'default': ('#77AADD', '#99DDFF', '#44BB99', '#BBCC33', '#AAAA00', '#EEDD88', '#EE8866', '#FFAABB', '#DDDDDD'), 'dest': 'color_palette', 'help': 'Comma separated list of colors to use', 'metavar': '<color1,color2,...>', 'type': 'csv'}), ('colorized', {'action': 'store_true', 'default': False, 'dest': 'colorized', 'help': 'Use colored output. Classes/modules of the same package get the same color.'}), ('filter-mode', {'action': 'store', 'default': 'PUB_ONLY', 'dest': 'mode', 'help': "filter attributes and functions according to\n <mode>. Correct modes are :\n 'PUB_ONLY' filter all non public attributes\n [DEFAULT], equivalent to PRIVATE+SPECIAL_A\n 'ALL' no filter\n 'SPECIAL' filter Python special functions\n except constructor\n 'OTHER' filter protected and private\n attributes", 'metavar': '<mode>', 'short': 'f', 'type': 'string'}), ('ignore', {'default': ('CVS',), 'dest': 'ignore_list', 'help': 'Files or directories to be skipped. They should be base names, not paths.', 'metavar': '<file[,file...]>', 'type': 'csv'}), ('max-color-depth', {'action': 'store', 'default': 2, 'dest': 'max_color_depth', 'help': 'Use separate colors up to package depth of <depth>', 'metavar': '<depth>', 'type': 'int'}), ('module-names', {'default': None, 'help': 'include module name in representation of classes', 'metavar': '<y or n>', 'short': 'm', 'type': 'yn'}), ('no-standalone', {'action': 'store_true', 'default': False, 'help': 'only show nodes with connections'}), ('only-classnames', {'action': 'store_true', 'default': False, 'help': "don't show attributes and methods in the class boxes; this disables -f values", 'short': 'k'}), ('output', {'action': 'store', 'default': 'dot', 'dest': 'output_format', 'help': "create a *.<format> output file if format is available. Available formats are: dot, puml, plantuml, mmd, html. Any other format will be tried to create by means of the 'dot' command line tool, which requires a graphviz installation.", 'metavar': '<format>', 'short': 'o', 'type': 'string'}), ('output-directory', {'action': 'store', 'default': '', 'help': 'set the output directory path.', 'metavar': '<output_directory>', 'short': 'd', 'type': 'path'}), ('project', {'default': '', 'help': 'set the project name.', 'metavar': '<project name>', 'short': 'p', 'type': 'string'}), ('show-ancestors', {'action': 'store', 'default': None, 'help': 'show <ancestor> generations of ancestor classes not in <projects>', 'metavar': '<ancestor>', 'short': 'a', 'type': 'int'}), ('show-associated', {'action': 'store', 'default': None, 'help': 'show <association_level> levels of associated classes not in <projects>', 'metavar': '<association_level>', 'short': 's', 'type': 'int'}), ('show-builtin', {'action': 'store_true', 'default': False, 'help': 'include builtin objects in representation of classes', 'short': 'b'}), ('show-stdlib', {'action': 'store_true', 'default': False, 'help': 'include standard library objects in representation of classes', 'short': 'L'}), ('source-roots', {'default': (), 'help': 'Add paths to the list of the source roots. Supports globbing patterns. The source root is an absolute path or a path relative to the current working directory used to determine a package namespace for modules located under the source root.', 'metavar': '<path>[,<path>...]', 'type': 'glob_paths_csv'}), ('sphinx-html-dir', {'action': 'store', 'default': '', 'help': 'set the root directory of the HTML documentation generated by Sphinx.', 'metavar': '<input_directory>', 'short': 'd', 'type': 'path'}), ('verbose', {'action': 'store_true', 'default': False, 'help': 'Makes pyreverse more verbose/talkative. Mostly useful for debugging.'})]#
Options provided by this provider.