pyTooling.CLIAbstraction
¶
Submodules
pyTooling.CLIAbstraction.Argument
pyTooling.CLIAbstraction.BooleanFlag
pyTooling.CLIAbstraction.Command
pyTooling.CLIAbstraction.Flag
pyTooling.CLIAbstraction.KeyValueFlag
pyTooling.CLIAbstraction.OptionalValuedFlag
pyTooling.CLIAbstraction.ValuedFlag
pyTooling.CLIAbstraction.ValuedFlagList
pyTooling.CLIAbstraction.ValuedTupleFlag
Classes
CLIArgument
: An attribute to annotate nested classes as an CLI argument.Program
: Represent a simple command line interface (CLI) executable (program or script).Executable
: Represent a CLI executable derived fromProgram
, that adds an abstraction ofsubprocess.Popen
.
- class pyTooling.CLIAbstraction.CLIArgument[source]¶
An attribute to annotate nested classes as an CLI argument.
Inheritance
- classmethod GetAttributes(method, includeSubClasses=True)¶
Returns attached attributes for a given method.
- classmethod GetClasses(scope=None, filter=None)¶
Return a generator for all classes, where this attribute was attached to.
- Return type:
- Parameters:
- The resulting item stream can be filtered by:
scope
- when the item is a nested class in scopescope
.filter
- when the item is a subclass offilter
.
- static _AppendAttribute(entity, attribute)¶
Helper method, to attach a given pyAttribute to an entity (function, class, method).
- Return type:
- Parameters:
entity (Entity) –
attribute (Attribute) –
-
__AttributesMemberName__:
str
= '__pyattr__'¶ Field name on entities (function, class, method) to store pyAttributes.
- __call__(entity)¶
Make all classes derived from
Attribute
callable, so they can be used as a decorator.
- classmethod __init_subclass__(**kwargs)¶
Ensure each derived class has its own instance of
_classes
to register the usage of that pyAttribute.
- class pyTooling.CLIAbstraction.Program(executablePath=None, binaryDirectoryPath=None, dryRun=False)[source]¶
Represent a simple command line interface (CLI) executable (program or script).
Inheritance
- classmethod __init_subclass__(*args, **kwargs)[source]¶
Whenever a subclass is derived from :class:
Program
, all nested classes declared withinProgram
and which are marked with pyAttributeCLIOption
are collected and then listed in the__cliOptions__
dictionary.
-
__cliParameters__:
Dict
[Type
[CommandLineArgument
],Optional
[CommandLineArgument
]]¶ List of all CLI parameters (used CLI options).
- class pyTooling.CLIAbstraction.Executable(executablePath=None, binaryDirectoryPath=None, workingDirectory=None, dryRun=False)[source]¶
Represent a CLI executable derived from
Program
, that adds an abstraction ofsubprocess.Popen
.Inheritance
- Parameters:
- __init__(executablePath=None, binaryDirectoryPath=None, workingDirectory=None, dryRun=False)[source]¶
-
__cliOptions__:
ClassVar
[Dict
[Type
[CommandLineArgument
],int
]] = {}¶ List of all possible CLI options.
-
__cliParameters__:
Dict
[Type
[CommandLineArgument
],Optional
[CommandLineArgument
]]¶ List of all CLI parameters (used CLI options).
- __getitem__(key)¶
Access to a CLI parameter by CLI option (key must be of type
CommandLineArgument
), which is already used.
- classmethod __init_subclass__(*args, **kwargs)¶
Whenever a subclass is derived from :class:
Program
, all nested classes declared withinProgram
and which are marked with pyAttributeCLIOption
are collected and then listed in the__cliOptions__
dictionary.
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
Exceptions
CLIAbstractionException
: Base exception derived fromException
for all custom exceptions.DryRunException
: This exception is raised if an executable is launched while in dry-run mode.
- exception pyTooling.CLIAbstraction.CLIAbstractionException(message='')[source]¶
Inheritance
- Parameters:
message (str) –
- __cause__¶
exception cause
- __context__¶
exception context
- __delattr__(name, /)¶
Implement delattr(self, name).
- __getattribute__(name, /)¶
Return getattr(self, name).
- __new__(**kwargs)¶
- __reduce__()¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- exception pyTooling.CLIAbstraction.DryRunException(message='')[source]¶
This exception is raised if an executable is launched while in dry-run mode.
Inheritance
- Parameters:
message (str) –
- __cause__¶
exception cause
- __context__¶
exception context
- __delattr__(name, /)¶
Implement delattr(self, name).
- __getattribute__(name, /)¶
Return getattr(self, name).
- __new__(**kwargs)¶
- __reduce__()¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).