benchling_sdk.apps.config.scalars module¶
- class BoolScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[bool
]Bool Scalar.
Turn a Boolean-like string value into bool. Any permutation of âtrueâ - case insensitive - is interpreted as True. Any other non-empty string is False.
- class DateScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[datetime.date
]Date Scalar.
Turn an ISO formatted date like YYYY-MM-dd into a date.
- class DateTimeScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[datetime.datetime
]Date Time Scalar.
Turn a date time string into datetime.
- class FloatScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[float
]Float Scalar.
Turn a string into float. Assumes the string, if not empty, is a valid floating point.
- class IntScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[int
]Int Scalar.
Turn a string into int. Assumes the string, if not empty, is a valid integer.
- class IsoDateTimeScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[datetime.datetime
]Iso Date Time Scalar.
Turn a ISO 8601 date time string into datetime. Benchling fields use RFC 3339, unlike app config date times.
- class JsonScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[Union
[Dict
[str
,Any
],List
[Any
],str
,int
,float
,bool
]]Json Scalar.
Turn a string into JSON. Assumes the string is a valid JSON string.
- class ScalarDefinition¶
Bases:
abc.ABC
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Scalar definition.
Map how ScalarConfigTypes values can be converted into corresponding Python types.
- abstract classmethod from_str(value: Optional[str]) Optional[benchling_sdk.apps.config.scalars.ScalarType] ¶
From string.
Given an optional string value of scalar configuration, produce an Optional instance of the specific ScalarType. For instance, converting str to int.
Used when coercing Python types from string values in API responses.
- classmethod init()¶
Init.
- class SecureTextScalar¶
Bases:
benchling_sdk.apps.config.scalars.TextScalar
Secure Text Scalar.
Text is already a string, so no conversion is performed.
- class TextScalar¶
Bases:
benchling_sdk.apps.config.scalars.ScalarDefinition
[str
]Text Scalar.
Text is already a string, so no conversion is performed.
- scalar_definition_from_field_type(field_type: FieldType) ScalarDefinition ¶
Scalar Definition From Field Type.
Returns a ScalarDefinition for parsing a typed value given a field type. Assumes TextScalar (string) for any types not specifically enumerated.