sgr_commhandler.validators.validator
Provides data type validators.
Attributes
Classes
Implements a default validator for all unsupported data types. |
|
Implements a validator for enumeration values. |
|
Implements a validator for integer values. |
|
Implements a validator for floating-point values. |
|
Implements a validator for text strings. |
|
Implements a validator for boolean values. |
|
Implements a validator for bitmap values. |
|
Implements a validator for date/time values. |
|
Implements a validator for JSON values. |
Module Contents
- sgr_commhandler.validators.validator.INT_SIZES: set[int]
- sgr_commhandler.validators.validator.FLOAT_SIZES: set[int]
- class sgr_commhandler.validators.validator.UnsupportedValidator
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a default validator for all unsupported data types.
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.EnumValidator(type)
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for enumeration values.
- Parameters:
type (sgr_specification.v0.generic.EnumMapProduct)
- _valid_literals: set[str]
- _valid_ordinals: set[int]
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- options()
Gets the validator’s options.
- Returns:
the options
- Return type:
list[Any]
- class sgr_commhandler.validators.validator.IntValidator(size, signed=True)
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for integer values.
- Parameters:
size (int)
signed (bool)
- _size
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.FloatValidator(size)
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for floating-point values.
- Parameters:
size (int)
- _size
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.StringValidator
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for text strings.
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.BooleanValidator
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for boolean values.
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.BitmapValidator
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for bitmap values.
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.DateTimeValidator
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for date/time values.
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool
- class sgr_commhandler.validators.validator.JsonValidator
Bases:
sgr_commhandler.api.data_point_api.DataPointValidatorImplements a validator for JSON values.
- validate(value)
Validates the compatibility of a value.
- Parameters:
value (Any) – the value to validate
- Returns:
true if value is compatible, false otherwise
- Return type:
bool