application.scalars package#
Submodules#
application.scalars.color module#
application.scalars.color
- application.scalars.color.parse_color(value)#
Parses a string to ensure it is a valid hexadecimal color code.
- Parameters:
value (str) – The string to be validated as a hexadecimal color code.
- Returns:
The validated hexadecimal color code.
- Return type:
str
- Raises:
exceptions.InvalidColor – If the input string is not a valid hexadecimal color code.
application.scalars.date module#
application.scalars.date
- application.scalars.date.parse_date_value(value)#
Parses a date string in the format ‘YYYY-MM-DD’ and returns it in the same format.
- Parameters:
value (str) – The date string to be parsed.
- Returns:
The parsed date string in the format ‘YYYY-MM-DD’.
- Return type:
str
application.scalars.datetime module#
application.scalars.datetime
- application.scalars.datetime.parse_datetime_value(value)#
Parses a datetime string into a datetime object.
- Parameters:
value (str) – The datetime string to parse. Expected format is ‘%Y-%m-%d %H:%M:%S’.
- Returns:
A datetime object representing the parsed date and time.
- Return type:
datetime
- Raises:
ValueError – If the input string does not match the expected format.
application.scalars.long module#
application.scalars.long
application.scalars.phone module#
application.scalars.phone
- application.scalars.phone.parse_phone(value)#
Parses a phone number string by removing all non-numeric characters and ensuring it is exactly 10 digits long.
- Parameters:
value (str) – The phone number string to be parsed.
- Returns:
The cleaned phone number string containing only digits.
- Return type:
str
- Raises:
exceptions.InvalidPhone – If the cleaned phone number is not exactly 10 digits long.
application.scalars.size module#
application.scalars.size
- application.scalars.size.parse_size(value)#
Parses a size string and validates its format.
- Parameters:
value (str) – The size string to be parsed. It should be a numeric value followed by a unit (%, px, em, rem, or in).
- Returns:
The validated size string.
- Return type:
str
- Raises:
exceptions.InvalidSize – If the size string does not match the expected format.
Module contents#
application.scalars