Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: correct type hints on base record #2604

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aries_cloudagent/messaging/models/base_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/messaging/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion aries_cloudagent/storage/record.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Record instance stored and searchable by BaseStorage implementation."""

from collections import namedtuple
from typing import Optional
from uuid import uuid4


Expand All @@ -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
Expand Down