Returns whether a the trace need '--' before '--help'. '--' is needed when the component takes keyword arguments, when the value of flag matches one of the argument of the component, or the component takes in keyword-only arguments(e.g. argument with default value). Args: fla
(self, flag='help')
| 215 | return '\n'.join(lines) |
| 216 | |
| 217 | def NeedsSeparatingHyphenHyphen(self, flag='help'): |
| 218 | """Returns whether a the trace need '--' before '--help'. |
| 219 | |
| 220 | '--' is needed when the component takes keyword arguments, when the value of |
| 221 | flag matches one of the argument of the component, or the component takes in |
| 222 | keyword-only arguments(e.g. argument with default value). |
| 223 | |
| 224 | Args: |
| 225 | flag: the flag available for the trace |
| 226 | |
| 227 | Returns: |
| 228 | True for needed '--', False otherwise. |
| 229 | |
| 230 | """ |
| 231 | element = self.GetLastHealthyElement() |
| 232 | component = element.component |
| 233 | spec = inspectutils.GetFullArgSpec(component) |
| 234 | return (spec.varkw is not None |
| 235 | or flag in spec.args |
| 236 | or flag in spec.kwonlyargs) |
| 237 | |
| 238 | |
| 239 | class FireTraceElement: |
no test coverage detected