devana.preprocessing.premade.components.executor
devana.preprocessing.premade.components.executor.editor
- class IEditable[source]
Bases:
ABC
Basic interface for an object to an edition in the context of calling preprocessor.
- abstract property destiny: IDestiny
Should give information of destiny of content. If an editable object has similarity information inside it, this property has higher priority.
- Return type
- abstract property editable: Any
Should return an editable object.
- Return type
Any
- class SourceFileDestiny(parent)[source]
Bases:
IDestiny
Source file destiny to using editable parent information and code printer to generate content.
- property content: str
The contents of the file as test - it will be saved.
- Return type
str
- property name: str
The name of the file, including the extension. This will be used to save as the file name.
- Return type
str
- property path_prefix: Optional[Path]
If set, it will be added to the root write path after which further path modifications are allowed.
- Return type
Optional
[Path
]
- class SourceFileEditor(name, path_prefix=None, source=None)[source]
Bases:
IEditable
Implementation fof C/C++ source file. Please remember that name, path and other information like that from source file instance will be ignored in the context of destiny.
- property destiny: IDestiny
Should give information of destiny of content. If an editable object has similarity information inside it, this property has higher priority.
- Return type
- property editable: Any
Should return an editable object.
- Return type
Any
devana.preprocessing.premade.components.executor.environment
- class Environment(executables, context, calling_data)[source]
Bases:
Generic
[T
]An environment is a set of multiple Executables into one group that share the same context during execution. It is used to group calls to allow working on a common output.
- class CallingData(arguments, target, signature)[source]
Bases:
Generic
[T
]Data for a single Executable call based on which the CallFrame will be created.
- target: T
- class Context(editors, states)[source]
Bases:
IContext
Internal implementation of IContext.
- get_editor(name)[source]
Returns by name the identifier of the mutable object used as the output artifact of the executable. In the case of multiple executables sharing the same context (typical case), the object will be shared. It is allowed to throw an exception in case of non-existent editors or to create an editor. The first approach is recommended, leaving the creation of the contexts’ content to the executable grouping class.
- Return type
- class EnvironmentCreator(creator)[source]
Bases:
Generic
[T
]Helper class to take care an environment creation process.
- create(data)[source]
- Return type
List
[Environment
[TypeVar
(T
)]]
devana.preprocessing.premade.components.executor.executable
- class CallFrame(arguments, target, context)[source]
Bases:
Generic
[T
]Calling data.
- class Arguments(positional=<factory>, named=<factory>)[source]
Bases:
object
Calling arguments.
- class Value(content)[source]
Bases:
object
The current value of the argument with which it will be called.
- content: Any
Python value.
- property type: Type
Python type of content.
- Return type
Type
- class IContext[source]
Bases:
ABC
A description of the current function call context. This is used to share common state between calls to multiple executables, for example, to allow multiple executables to work on the contents of a single file.
- abstract property editors: List[IEditable]
Returns list of all editors.
- Return type
List
[IEditable
]
- abstract get_editor(name)[source]
Returns by name the identifier of the mutable object used as the output artifact of the executable. In the case of multiple executables sharing the same context (typical case), the object will be shared. It is allowed to throw an exception in case of non-existent editors or to create an editor. The first approach is recommended, leaving the creation of the contexts’ content to the executable grouping class.
- Return type
- property target: T
- Return type
TypeVar
(T
)
- class Executable(signature, scope, function)[source]
Bases:
Generic
[T
]Basic, executable fragment. The function should take all arguments listed in the signature, preserve names of non-positional parameters and the order of positional arguments, and take a context instance as the first argument.
- class TargetScope(target=None)[source]
Bases:
Generic
[T
]Configuration of the current scope. The template specialization denotes what type the target’s base type is in the inheritance ladder.
- target: Optional[Type[T]] = None
The specific requested type supported by the scope. If none, the is more generic.
- property scope: TargetScope[T]
- Return type
TargetScope
[TypeVar
(T
)]
- class Signature(name, namespaces=<factory>, arguments=<factory>)[source]
Bases:
object
Invoking target identification data.
- class Arguments(positional=<factory>, named=<factory>)[source]
Bases:
object
Description of the arguments accepted by executable.
- named: Dict[str, Type]
A dictionary of named argument types - those that do not have a clearly defined order and the user can access them by name. In the current version, it is assumed that each positional argument must have a default value (not included in the signature).
- positional: List[Type]
A list of types, in order of appearance of the positional arguments they take - those that cannot be accessed by name.
- classmethod from_function(function, name=None, namespaces=None)[source]
Create a Signature from a function. Type hints for all function parameters are required.
- Return type
- name: str
Name of function.
- namespaces: List[str]
List of supported namespaces, in order from outermost. It is recommended to use at least one ‘devana’ namespace (or the name of your preprocessor) to get better support for data sources such as c++ attributes.
devana.preprocessing.premade.components.executor.executor
- class Executor(creator, executables)[source]
Bases:
Generic
[T
],IGenerator
An object that executes all user function commands within the processing framework in its own context.
Component to create runtime to handle calling hooks and do core preprocessor job.