Compare commits
No commits in common. "871b455d5e6244a2a3cb0af4eab479a46f52403d" and "6cf4c5fe276601dbdaeded2cd3bc9efd5eb319a9" have entirely different histories.
871b455d5e
...
6cf4c5fe27
@ -1,22 +1,6 @@
|
||||
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):
|
||||
@ -67,6 +51,22 @@ 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