PythonExporter
PythonExporter
¶
Bases: Exporter
Export an engine and its components to Python.
related
Attributes¶
Functions¶
__init__
¶
activation
¶
activation(activation: Activation | None) -> str
Return the code to construct the activation method in Python.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activation |
Activation | None
|
activation method to export |
required |
Returns:
Type | Description |
---|---|
str
|
code to construct the activation method in Python |
defuzzifier
¶
defuzzifier(defuzzifier: Defuzzifier | None) -> str
Return the code to construct the defuzzifier in Python.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
defuzzifier |
Defuzzifier | None
|
defuzzifier to export |
required |
Returns:
Type | Description |
---|---|
str
|
code to construct the defuzzifier in Python |
encapsulate
¶
Encapsulate the instance in a new class if it is an engine, or in a create method otherwise.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance |
Any
|
object to encapsulate |
required |
Returns:
Type | Description |
---|---|
str
|
if the instance is an engine, then the class constructing the engine during initialization; |
str
|
otherwise a method constructing the object |
engine
¶
format
¶
Format the code using the black
formatter if it is installed, otherwise no effects on the code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code |
str
|
code to format. |
required |
**kwargs |
Any
|
keyword arguments to pass to |
{}
|
Returns:
code formatted if black
is installed, otherwise the code without format
input_variable
¶
input_variable(input_variable: InputVariable) -> str
Return the code to construct the input variable in Python.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_variable |
InputVariable
|
input variable to export |
required |
Returns:
Type | Description |
---|---|
str
|
code to construct the input variable in Python |
norm
¶
output_variable
¶
output_variable(output_variable: OutputVariable) -> str
Return the code to construct the output variable in Python.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_variable |
OutputVariable
|
output variable to export |
required |
Returns:
Type | Description |
---|---|
str
|
code to construct the output variable in Python |