Helper for building basic --trait, --no-trait flags. Parameters ---------- name : str The name of the flag. configurable : str The 'Class.trait' string of the trait to be set/unset with the flag set_help : unicode help string for --name flag unset_hel
(name: str, configurable: str, set_help: str = "", unset_help: str = "")
| 1091 | |
| 1092 | |
| 1093 | def boolean_flag(name: str, configurable: str, set_help: str = "", unset_help: str = "") -> StrDict: |
| 1094 | """Helper for building basic --trait, --no-trait flags. |
| 1095 | |
| 1096 | Parameters |
| 1097 | ---------- |
| 1098 | name : str |
| 1099 | The name of the flag. |
| 1100 | configurable : str |
| 1101 | The 'Class.trait' string of the trait to be set/unset with the flag |
| 1102 | set_help : unicode |
| 1103 | help string for --name flag |
| 1104 | unset_help : unicode |
| 1105 | help string for --no-name flag |
| 1106 | |
| 1107 | Returns |
| 1108 | ------- |
| 1109 | cfg : dict |
| 1110 | A dict with two keys: 'name', and 'no-name', for setting and unsetting |
| 1111 | the trait, respectively. |
| 1112 | """ |
| 1113 | # default helpstrings |
| 1114 | set_help = set_help or "set %s=True" % configurable |
| 1115 | unset_help = unset_help or "set %s=False" % configurable |
| 1116 | |
| 1117 | cls, trait = configurable.split(".") |
| 1118 | |
| 1119 | setter = {cls: {trait: True}} |
| 1120 | unsetter = {cls: {trait: False}} |
| 1121 | return {name: (setter, set_help), "no-" + name: (unsetter, unset_help)} |
| 1122 | |
| 1123 | |
| 1124 | def get_config() -> Config: |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…