Spaces:
Runtime error
Runtime error
Greg Thompson commited on
Commit ·
1a2dfce
1
Parent(s): 3260908
Update date parsing
Browse files1234567134 unmodified lines14214314414414514614714810 unmodified lines159160161161162163164165165166167167168169170171from collections.abc import Mappingfrom logging import getLoggerimport datetime as dtfrom dateutil.parser import isoparseimport re
from fuzzywuzzy import fuzz134 unmodified lines
def payload_is_valid(payload_object): """ >>> payload_is_valid({'author_id': '+821031323138', 'author_type': 'OWNER', 'contact_uuid': '49d42557-7a64-42fc-98fb-794061f37cf9', 'message_body': 'thirty one', 'message_direction': 'inbound', 'message_id': 'ABEGghAxMjE4Ags-sGJ_JArMAnJBnA', 'message_inserted_at': '2022-07-05T04:00:34.03352Z', 'message_updated_at': '2023-04-06T10:08:23.745072Z'}) >>> payload_is_valid({'author_id': '+5555555', 'author_type': 'OWNER', 'contact_uuid': '3246-43ad-faf7qw-zsdhg-dgGdg', 'message_body': 'thirty one', 'message_direction': 'inbound', 'message_id': 'SDFGGwafada-DFASHA4aDGA', 'message_inserted_at': '2022-07-05T04:00:34.03352Z', 'message_updated_at': '2023-04-06T10:08:23.745072Z'}) True """ return (10 unmodified lines isinstance(payload_object.get('message_inserted_at'), str) and isinstance(payload_object.get('message_updated_at'), str) and isinstance( dt.datetime.fromisoformat(payload_object.get('message_inserted_at')), isoparse(payload_object.get('message_inserted_at')), dt.datetime ) and isinstance( dt.datetime.fromisoformat(payload_object.get('message_updated_at')), isoparse(payload_object.get('message_updated_at')), dt.datetime ) ) )
mathtext_fastapi/nlu.py+5-4