Login
Back to bricks list
Introduction Version

PythonCodeParam

Param for python code. It shows a simple python IDE in the interface to provide code for python. The value of this param is a string containing the python code with each line separated by a newline character ( ).

:param ParamSpec: _description_
:type ParamSpec: _type_

Attributes

PRIVATE_VISIBILITY: LiteralPROTECTED_VISIBILITY: LiteralPUBLIC_VISIBILITY: Literaladditional_info: Optionalallowed_values: Optionaldefault_value: Optionalhuman_name: Optionaloptional: boolshort_description: Optionalunit: Optionalvisibility: Literal

Functions

__INIT__
            If a value is provided there is no need to set the optional
            Setting optional to True, allows default None value
Parameters:
NameTypeDefault valueDescription
default_valueOptional Default value, if none, and optional is false, the config is mandatory
optionalbool False See default value optional[str]
visibilityLiteral public Visibility of the param, see doc on type paramspecvisibilty for more info paramspecvisibilty
human_nameOptional Human readable name of the param, showed in the interface [str]
short_descriptionOptional Description of the param, showed in the interface [str]
BUILD

Method call before the value is used (in task or view) to apply some transformation if needed by the ParamSpec. This does not affect the value in the database.

Parameters:
NameTypeDefault valueDescription
valueAny
Return type:
Any
GET_DEFAULT_VALUE
Return type:
ParamSpecType
TO_DTO
Return type:
ParamSpecDTO
VALIDATE

Validate the value of the param and return the modified value if needed. This method is called when the param is set in the config before saving it in the database. The returned value must be serializable in json.l

Parameters:
NameTypeDefault valueDescription
valueAny
Return type:
str
EMPTY - @classmethod
Return type:
ParamSpec
GET_STR_TYPE - @classmethod
Return type:
str
LOAD_FROM_DTO - @classmethod
Parameters:
NameTypeDefault valueDescription
spec_dtoParamSpecDTO
Return type:
ParamSpec