Compare commits
2 Commits
6cf4c5fe27
...
871b455d5e
Author | SHA1 | Date | |
---|---|---|---|
871b455d5e | |||
b15cfdfa99 |
@ -1,6 +1,22 @@
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
def _is_int(value):
|
||||
"""Check if a value is a valid integer."""
|
||||
try:
|
||||
int(value)
|
||||
return True
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
|
||||
def _is_date(value):
|
||||
"""Check if a value is a valid date in YYYY-MM-DD format."""
|
||||
try:
|
||||
datetime.strptime(value, "%Y-%m-%d")
|
||||
return True
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
|
||||
def _validate_number(attrib, attrib_name):
|
||||
"""Validate number-specific attributes."""
|
||||
if attrib.min and not _is_int(attrib.min):
|
||||
@ -51,22 +67,6 @@ def _validate_select(attrib, attrib_name):
|
||||
return False
|
||||
return True
|
||||
|
||||
def _is_int(value):
|
||||
"""Check if a value is a valid integer."""
|
||||
try:
|
||||
int(value)
|
||||
return True
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
|
||||
def _is_date(value):
|
||||
"""Check if a value is a valid date in YYYY-MM-DD format."""
|
||||
try:
|
||||
datetime.strptime(value, "%Y-%m-%d")
|
||||
return True
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
|
||||
# Validate the configuration file to ensure all attributes are properly defined.
|
||||
def validate_config(item_attributes):
|
||||
for attrib_name, attrib in item_attributes.items():
|
||||
|
Loading…
Reference in New Issue
Block a user