pyTooling.Attributes.ArgParse.BooleanFlag
Classes
BooleanFlag
: Base-class for all command line arguments with a name.ShortBooleanFlag
: Base-class for all command line arguments with a name.LongBooleanFlag
: Base-class for all command line arguments with a name.WindowsBooleanFlag
: Base-class for all command line arguments with a name.
Classes
- class pyTooling.Attributes.ArgParse.BooleanFlag.BooleanFlag(*args, **kwargs)[source]
Inheritance
- property Args: Tuple
A tuple of additional positional parameters (
*args
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- classmethod GetAttributes(method, includeSubClasses=True)
Returns attached attributes of this kind for a given method.
- classmethod GetClasses(scope=None, subclassOf=None)
Return a generator for all classes, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.subclassOf
- when the item is a subclass ofsubclassOf
.
- Parameters:
- Return type:
- Returns:
A sequence of classes where this attribute is attached to.
- classmethod GetFunctions(scope=None)
Return a generator for all functions, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- classmethod GetMethods(scope=None)
Return a generator for all methods, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- class property HasClassAttributes: bool
Check if class has Attributes.
- Returns:
True
, if the class has Attributes.
- class property HasMethodAttributes: bool
Check if class has any method with Attributes.
- Returns:
True
, if the class has any method with Attributes.
- property KWArgs: Dict
A dictionary of additional named parameters (
**kwargs
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- static _AppendAttribute(entity, attribute)
Append an attribute to a language entity (class, method, function).
Hint
This method can be used in attribute groups to apply multiple attributes within
__call__
method.class GroupAttribute(Attribute): def __call__(self, entity: Entity) -> Entity: self._AppendAttribute(entity, SimpleAttribute(...)) self._AppendAttribute(entity, SimpleAttribute(...)) return entity
- __call__(entity)
Attributes get attached to an entity (function, class, method) and an index is updated at the attribute for reverse lookups.
- __init__(*args, **kwargs)
The constructor expects positional (
*args
) and/or named parameters (**kwargs
) which are passed without modification toadd_argument()
.
- classmethod __init_subclass__(**kwargs)
Ensure each derived class has its own instance of
_functions
,_classes
and_methods
to register the usage of that Attribute.
- _classes: ClassVar[List[Any]] = []
List of classes, this Attribute was attached to.
- _functions: ClassVar[List[Any]] = []
List of functions, this Attribute was attached to.
- _methods: ClassVar[List[Any]] = []
List of methods, this Attribute was attached to.
- _scope: ClassVar[AttributeScope] = 7
Allowed language construct this attribute can be used with.
- _handler: Callable
Reference to a method that is called to handle e.g. a sub-command.
- class pyTooling.Attributes.ArgParse.BooleanFlag.ShortBooleanFlag(*args, **kwargs)[source]
Inheritance
- property Args: Tuple
A tuple of additional positional parameters (
*args
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- classmethod GetAttributes(method, includeSubClasses=True)
Returns attached attributes of this kind for a given method.
- classmethod GetClasses(scope=None, subclassOf=None)
Return a generator for all classes, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.subclassOf
- when the item is a subclass ofsubclassOf
.
- Parameters:
- Return type:
- Returns:
A sequence of classes where this attribute is attached to.
- classmethod GetFunctions(scope=None)
Return a generator for all functions, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- classmethod GetMethods(scope=None)
Return a generator for all methods, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- class property HasClassAttributes: bool
Check if class has Attributes.
- Returns:
True
, if the class has Attributes.
- class property HasMethodAttributes: bool
Check if class has any method with Attributes.
- Returns:
True
, if the class has any method with Attributes.
- property KWArgs: Dict
A dictionary of additional named parameters (
**kwargs
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- static _AppendAttribute(entity, attribute)
Append an attribute to a language entity (class, method, function).
Hint
This method can be used in attribute groups to apply multiple attributes within
__call__
method.class GroupAttribute(Attribute): def __call__(self, entity: Entity) -> Entity: self._AppendAttribute(entity, SimpleAttribute(...)) self._AppendAttribute(entity, SimpleAttribute(...)) return entity
- __call__(entity)
Attributes get attached to an entity (function, class, method) and an index is updated at the attribute for reverse lookups.
- __init__(*args, **kwargs)
The constructor expects positional (
*args
) and/or named parameters (**kwargs
) which are passed without modification toadd_argument()
.
- classmethod __init_subclass__(**kwargs)
Ensure each derived class has its own instance of
_functions
,_classes
and_methods
to register the usage of that Attribute.
- _classes: ClassVar[List[Any]] = []
List of classes, this Attribute was attached to.
- _functions: ClassVar[List[Any]] = []
List of functions, this Attribute was attached to.
- _methods: ClassVar[List[Any]] = []
List of methods, this Attribute was attached to.
- _scope: ClassVar[AttributeScope] = 7
Allowed language construct this attribute can be used with.
- _handler: Callable
Reference to a method that is called to handle e.g. a sub-command.
- class pyTooling.Attributes.ArgParse.BooleanFlag.LongBooleanFlag(*args, **kwargs)[source]
Inheritance
- property Args: Tuple
A tuple of additional positional parameters (
*args
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- classmethod GetAttributes(method, includeSubClasses=True)
Returns attached attributes of this kind for a given method.
- classmethod GetClasses(scope=None, subclassOf=None)
Return a generator for all classes, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.subclassOf
- when the item is a subclass ofsubclassOf
.
- Parameters:
- Return type:
- Returns:
A sequence of classes where this attribute is attached to.
- classmethod GetFunctions(scope=None)
Return a generator for all functions, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- classmethod GetMethods(scope=None)
Return a generator for all methods, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- class property HasClassAttributes: bool
Check if class has Attributes.
- Returns:
True
, if the class has Attributes.
- class property HasMethodAttributes: bool
Check if class has any method with Attributes.
- Returns:
True
, if the class has any method with Attributes.
- property KWArgs: Dict
A dictionary of additional named parameters (
**kwargs
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- static _AppendAttribute(entity, attribute)
Append an attribute to a language entity (class, method, function).
Hint
This method can be used in attribute groups to apply multiple attributes within
__call__
method.class GroupAttribute(Attribute): def __call__(self, entity: Entity) -> Entity: self._AppendAttribute(entity, SimpleAttribute(...)) self._AppendAttribute(entity, SimpleAttribute(...)) return entity
- __call__(entity)
Attributes get attached to an entity (function, class, method) and an index is updated at the attribute for reverse lookups.
- __init__(*args, **kwargs)
The constructor expects positional (
*args
) and/or named parameters (**kwargs
) which are passed without modification toadd_argument()
.
- classmethod __init_subclass__(**kwargs)
Ensure each derived class has its own instance of
_functions
,_classes
and_methods
to register the usage of that Attribute.
- _classes: ClassVar[List[Any]] = []
List of classes, this Attribute was attached to.
- _functions: ClassVar[List[Any]] = []
List of functions, this Attribute was attached to.
- _methods: ClassVar[List[Any]] = []
List of methods, this Attribute was attached to.
- _scope: ClassVar[AttributeScope] = 7
Allowed language construct this attribute can be used with.
- _handler: Callable
Reference to a method that is called to handle e.g. a sub-command.
- class pyTooling.Attributes.ArgParse.BooleanFlag.WindowsBooleanFlag(*args, **kwargs)[source]
Inheritance
- property Args: Tuple
A tuple of additional positional parameters (
*args
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- classmethod GetAttributes(method, includeSubClasses=True)
Returns attached attributes of this kind for a given method.
- classmethod GetClasses(scope=None, subclassOf=None)
Return a generator for all classes, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.subclassOf
- when the item is a subclass ofsubclassOf
.
- Parameters:
- Return type:
- Returns:
A sequence of classes where this attribute is attached to.
- classmethod GetFunctions(scope=None)
Return a generator for all functions, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- classmethod GetMethods(scope=None)
Return a generator for all methods, where this attribute is attached to.
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.
- class property HasClassAttributes: bool
Check if class has Attributes.
- Returns:
True
, if the class has Attributes.
- class property HasMethodAttributes: bool
Check if class has any method with Attributes.
- Returns:
True
, if the class has any method with Attributes.
- property KWArgs: Dict
A dictionary of additional named parameters (
**kwargs
) passed to the attribute. These additional parameters are passed without modification toArgumentParser
.
- static _AppendAttribute(entity, attribute)
Append an attribute to a language entity (class, method, function).
Hint
This method can be used in attribute groups to apply multiple attributes within
__call__
method.class GroupAttribute(Attribute): def __call__(self, entity: Entity) -> Entity: self._AppendAttribute(entity, SimpleAttribute(...)) self._AppendAttribute(entity, SimpleAttribute(...)) return entity
- __call__(entity)
Attributes get attached to an entity (function, class, method) and an index is updated at the attribute for reverse lookups.
- __init__(*args, **kwargs)
The constructor expects positional (
*args
) and/or named parameters (**kwargs
) which are passed without modification toadd_argument()
.
- classmethod __init_subclass__(**kwargs)
Ensure each derived class has its own instance of
_functions
,_classes
and_methods
to register the usage of that Attribute.
- _classes: ClassVar[List[Any]] = []
List of classes, this Attribute was attached to.
- _functions: ClassVar[List[Any]] = []
List of functions, this Attribute was attached to.
- _methods: ClassVar[List[Any]] = []
List of methods, this Attribute was attached to.
- _scope: ClassVar[AttributeScope] = 7
Allowed language construct this attribute can be used with.
- _handler: Callable
Reference to a method that is called to handle e.g. a sub-command.