Validators
psengine.helpers.helpers.Validators
¶
Common validators for pydantic models.
check_uhash_prefix
staticmethod
¶
Validate that all fields start with 'uhash:' and add it if missing.
PARAMETER | DESCRIPTION |
---|---|
value
|
String or list of strings to check for uhash prefix.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[str, list]
|
String or list with 'uhash:' prefix ensured. |
Source code in psengine/helpers/helpers.py
convert_relative_time
staticmethod
¶
Convert relative time to datetime string if possible.
PARAMETER | DESCRIPTION |
---|---|
input_time
|
Relative time string, e.g., '7d', '3h'.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
Datetime string in ISO 8601 format if conversion is possible. |
Source code in psengine/helpers/helpers.py
convert_str_to_list
staticmethod
¶
Convert value from str to list and remove None values.
PARAMETER | DESCRIPTION |
---|---|
value
|
String or list to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list
|
Converted list with None values removed. |