Modificar 'validation/excel_validator.py'

This commit is contained in:
dborges 2023-07-11 08:52:48 +00:00
parent 303a404fa0
commit f188754bc7

View File

@ -532,11 +532,11 @@ def is_valid_history(value, validation_conf=None):
try: try:
items = [i.strip() for i in value.split("<")] items = [i.strip() for i in value.split("<")]
for i in items: for i in items:
regex1 = r'^[a-zA-Z &,;.''-]+, ((19|20)\d{2})' regex1 = r'^[a-zA-Z0-9 &,;.:''-]+,?\s*((19|20)\d{2})'
regex2 = r'^[a-zA-Z &,;.''-]+, [a-zA-Z &,;.''-] (19|20)\d{2}\s\([a-zA-Z &,;.''-]+\)' regex2 = r'^[a-zA-Z0-9 &,;.:''-]+,?\s*[a-zA-Z0-9 &,;.''-] (19|20)\d{2}\s\([a-zA-Z0-9 &,;.''-:]+\)'
regex3 = r'^[a-zA-Z &,;.''-]+\, [a-zA-Z &,;.''-]' regex3 = r'^[a-zA-Z0-9 &,;.:''-]+\,?\s*[a-zA-Z0-9 &,;.''-]'
regex4 = r'^[a-zA-Z &,;.''-]+, (19|20)\d{2}\s\([a-zA-Z .''-,;&]+\)' regex4 = r'^[a-zA-Z0-9 &,;.''-]+,?\s*(19|20)\d{2}\s\([a-zA-Z0-9 .''-,;&:]+\)'
regex5 = r'^[a-zA-Z &,;.''-]+, \([a-zA-Z &,;.''-]+\) (19|20)\d{2}' regex5 = r'^[a-zA-Z0-9 &,;.:''-]+,?\s*\([a-zA-Z0-9 &,;.''-:]+\) (19|20)\d{2}'
if re.match(regex1, i): if re.match(regex1, i):
return True return True
elif re.match(regex2, i): elif re.match(regex2, i):
@ -558,8 +558,8 @@ def is_valid_coords(value, validation_conf=None):
return True return True
try: try:
regex1 = r'^-?(90(\.0+)?|[1-8]?\d(\.\d+)?);-?(180(\.0+)?|((1[0-7]\d)|(\d{1,2}))(\.\d+)?)$' regex1 = r'^-?(90(\.0+)?|[1-8]?\d(\.\d+)?)(\s*;\s*-?(180(\.0+)?|((1[0-7]\d)|(\d{1,2}))(\.\d+)?))*$'
regex2 = r'^-?(90(\.0+)?|[1-8]?\d(\.\d+)?);-?(180(\.0+)?|((1[0-7]\d)|(\d{1,2}))(\.\d+)?);(\d+\.\d+|\?);(\d+\.\d+|\?)$|^(\d+\.\d+|\?)$|^;$' regex2 = r'^-?(90(\.0+)?|[1-8]?\d(\.\d+)?)\s*;\s*-?(180(\.0+)?|((1[0-7]\d)|(\d{1,2}))(\.\d+)?)\s*;\s*(\d+\.\d+|\?)\s*;\s*(\d+\.\d+|\?)$|^(\d+\.\d+|\?)$|^\s*;\s*$'
if not re.match(regex1, value) and not re.match(regex2, value): if not re.match(regex1, value) and not re.match(regex2, value):
return False return False