command.util¶
Utility functions used in command sub-package.
- lmi.scripts.common.command.util.RE_COMMAND_NAME = <_sre.SRE_Pattern object at 0x7f0463c45300>¶
Command name can also be a single or double dash.
- lmi.scripts.common.command.util.RE_OPT_BRACKET_ARGUMENT = <_sre.SRE_Pattern object at 0x7f0463f2a930>¶
Regular expression matching bracket argument such as <arg_name>.
- lmi.scripts.common.command.util.RE_OPT_LONG_OPTION = <_sre.SRE_Pattern object at 0x7f0463c3ca28>¶
Regular expression matching long options (prefixed with double dash).
- lmi.scripts.common.command.util.RE_OPT_SHORT_OPTION = <_sre.SRE_Pattern object at 0x7f0463f3d500>¶
Regular expression matching showt options. They are one character long, prefixed with single dash.
- lmi.scripts.common.command.util.RE_OPT_UPPER_ARGUMENT = <_sre.SRE_Pattern object at 0x7f0463c48290>¶
Regular expression matching argument written in upper case such as ARG_NAME.
- lmi.scripts.common.command.util.get_module_name(frame_level=2)[source]¶
Get a module name of caller from particular outer frame.
Parameters: frame_level (integer) – Number of nested frames to skip when searching for called function scope by inspecting stack upwards. When the result of this function is applied directly on the definition of function, it’s value should be 1. When used from inside of some other factory, it must be increased by 1.
Level 0 returns name of this module. Level 1 returns module name of caller. Level 2 returns module name of caller’s caller.
Returns: Module name. Return type: string
- lmi.scripts.common.command.util.is_abstract_method(clss, method, missing_is_abstract=False)[source]¶
Check, whether the given method is abstract in given class or list of classes. May be used to check, whether we should override particular abstract method in a meta-class in case that no non-abstract implementation is defined.
Parameters: - clss (type or tuple) – Class or list of classes that is searched for non-abstract implementation of particular method. If the first class having particular method in this list contain non-abstract implementation, False is returned.
- method (string) – Name of method to look for.
- missing_is_abstract (boolean) – This is a value returned, when not such method is defined in a set of given classes.
Returns: Are all occurences of given method abstract?
Return type: boolean