diff --git a/aries_cloudagent/messaging/models/base_record.py b/aries_cloudagent/messaging/models/base_record.py index 9ebbf74ff6..ade2b70176 100644 --- a/aries_cloudagent/messaging/models/base_record.py +++ b/aries_cloudagent/messaging/models/base_record.py @@ -506,8 +506,8 @@ class BaseExchangeRecord(BaseRecord): def __init__( self, - id: str = None, - state: str = None, + id: Optional[str] = None, + state: Optional[str] = None, *, trace: bool = False, **kwargs, diff --git a/aries_cloudagent/messaging/util.py b/aries_cloudagent/messaging/util.py index 67334331dc..4cb6669eb7 100644 --- a/aries_cloudagent/messaging/util.py +++ b/aries_cloudagent/messaging/util.py @@ -14,7 +14,7 @@ I32_BOUND = 2**31 -def datetime_to_str(dt: Union[str, datetime]) -> str: +def datetime_to_str(dt: Union[str, datetime, None]) -> Union[str, None]: """Convert a datetime object to an indy-standard datetime string. Args: diff --git a/aries_cloudagent/storage/record.py b/aries_cloudagent/storage/record.py index ae3b6e18f7..36266db7af 100644 --- a/aries_cloudagent/storage/record.py +++ b/aries_cloudagent/storage/record.py @@ -1,6 +1,7 @@ """Record instance stored and searchable by BaseStorage implementation.""" from collections import namedtuple +from typing import Optional from uuid import uuid4 @@ -9,7 +10,9 @@ class StorageRecord(namedtuple("StorageRecord", "type value tags id")): __slots__ = () - def __new__(cls, type, value, tags: dict = None, id: str = None): + def __new__( + cls, type, value, tags: Optional[dict] = None, id: Optional[str] = None + ): """Initialize some defaults on record.""" if not id: id = uuid4().hex