From 4d474b7243b937b0921000753013aa1fc9abf0a2 Mon Sep 17 00:00:00 2001 From: Elena Kolevska Date: Tue, 24 Jun 2025 22:23:10 +0100 Subject: [PATCH] Fixes typing Signed-off-by: Elena Kolevska --- dapr/actor/runtime/_reminder_data.py | 4 ++-- dapr/actor/runtime/actor.py | 2 +- dapr/actor/runtime/mock_actor.py | 2 +- dapr/actor/runtime/state_manager.py | 2 +- dapr/clients/grpc/_request.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dapr/actor/runtime/_reminder_data.py b/dapr/actor/runtime/_reminder_data.py index dec698ac..8821c94b 100644 --- a/dapr/actor/runtime/_reminder_data.py +++ b/dapr/actor/runtime/_reminder_data.py @@ -36,7 +36,7 @@ def __init__( reminder_name: str, state: Optional[bytes], due_time: timedelta, - period: timedelta, + period: Optional[timedelta] = None, ttl: Optional[timedelta] = None, ): """Creates new :class:`ActorReminderData` instance. @@ -77,7 +77,7 @@ def due_time(self) -> timedelta: return self._due_time @property - def period(self) -> timedelta: + def period(self) -> Optional[timedelta]: """Gets period of Actor Reminder.""" return self._period diff --git a/dapr/actor/runtime/actor.py b/dapr/actor/runtime/actor.py index 9f8d6ff8..79b1e6ab 100644 --- a/dapr/actor/runtime/actor.py +++ b/dapr/actor/runtime/actor.py @@ -112,7 +112,7 @@ async def register_reminder( name: str, state: bytes, due_time: timedelta, - period: timedelta, + period: Optional[timedelta] = None, ttl: Optional[timedelta] = None, ) -> None: """Registers actor reminder. diff --git a/dapr/actor/runtime/mock_actor.py b/dapr/actor/runtime/mock_actor.py index e35baac5..82170672 100644 --- a/dapr/actor/runtime/mock_actor.py +++ b/dapr/actor/runtime/mock_actor.py @@ -86,7 +86,7 @@ async def register_reminder( name: str, state: bytes, due_time: timedelta, - period: timedelta, + period: Optional[timedelta] = None, ttl: Optional[timedelta] = None, ) -> None: """Adds actor reminder to self._state_manager._mock_reminders. diff --git a/dapr/actor/runtime/state_manager.py b/dapr/actor/runtime/state_manager.py index dc7ec033..26d39185 100644 --- a/dapr/actor/runtime/state_manager.py +++ b/dapr/actor/runtime/state_manager.py @@ -56,7 +56,7 @@ def ttl_in_seconds(self) -> Optional[int]: return self._ttl_in_seconds @ttl_in_seconds.setter - def ttl_in_seconds(self, new_ttl_in_seconds: int) -> None: + def ttl_in_seconds(self, new_ttl_in_seconds: Optional[int]) -> None: self._ttl_in_seconds = new_ttl_in_seconds diff --git a/dapr/clients/grpc/_request.py b/dapr/clients/grpc/_request.py index 57038121..af761329 100644 --- a/dapr/clients/grpc/_request.py +++ b/dapr/clients/grpc/_request.py @@ -109,7 +109,7 @@ def __init__( super(InvokeMethodRequest, self).__init__(()) self._content_type = content_type - self._http_verb = None + self._http_verb: Optional[str] = None self._http_querystring: Dict[str, str] = {} self.set_data(data) @@ -127,7 +127,7 @@ def http_verb(self) -> Optional[str]: @http_verb.setter def http_verb(self, val: Optional[str]) -> None: """Sets HTTP method to Dapr invocation request.""" - if val not in self.HTTP_METHODS: + if val is not None and val not in self.HTTP_METHODS: raise ValueError(f'{val} is the invalid HTTP verb.') self._http_verb = val