Produce a mapping of trait names to lists of command line aliases.
(app)
| 79 | return '\n'.join(lines) |
| 80 | |
| 81 | def reverse_aliases(app): |
| 82 | """Produce a mapping of trait names to lists of command line aliases. |
| 83 | """ |
| 84 | res = defaultdict(list) |
| 85 | for alias, trait in app.aliases.items(): |
| 86 | res[trait].append(alias) |
| 87 | |
| 88 | # Flags also often act as aliases for a boolean trait. |
| 89 | # Treat flags which set one trait to True as aliases. |
| 90 | for flag, (cfg, _) in app.flags.items(): |
| 91 | if len(cfg) == 1: |
| 92 | classname = list(cfg)[0] |
| 93 | cls_cfg = cfg[classname] |
| 94 | if len(cls_cfg) == 1: |
| 95 | traitname = list(cls_cfg)[0] |
| 96 | if cls_cfg[traitname] is True: |
| 97 | res[classname+'.'+traitname].append(flag) |
| 98 | |
| 99 | return res |
| 100 | |
| 101 | def write_doc(name, title, app, preamble=None): |
| 102 | trait_aliases = reverse_aliases(app) |
no outgoing calls
no test coverage detected
searching dependent graphs…