Skip to content

Commit

Permalink
style: ignore mypy typing issues on <3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Apr 11, 2024
1 parent 184a939 commit 77a11aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 10 additions & 4 deletions silverback/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def on_startup(self) -> Callable:
def do_something_on_startup(startup_state):
... # Reprocess missed events or blocks
"""
return self.broker_task_decorator(TaskType.STARTUP)
return self.broker_task_decorator(TaskType.STARTUP) # type: ignore[arg-type]

def on_shutdown(self) -> Callable:
"""
Expand All @@ -151,7 +151,7 @@ def on_shutdown(self) -> Callable:
def do_something_on_shutdown():
... # Record final state of app
"""
return self.broker_task_decorator(TaskType.SHUTDOWN)
return self.broker_task_decorator(TaskType.SHUTDOWN) # type: ignore[arg-type]

def on_worker_startup(self) -> Callable:
"""
Expand Down Expand Up @@ -210,7 +210,10 @@ def on_(
else:
self.poll_settings["_blocks_"] = {"start_block": start_block}

return self.broker_task_decorator(TaskType.NEW_BLOCKS, container=container)
return self.broker_task_decorator(
TaskType.NEW_BLOCKS, # type: ignore[arg-type]
container=container,
)

elif isinstance(container, ContractEvent) and isinstance(
container.contract, ContractInstance
Expand All @@ -229,7 +232,10 @@ def on_(
else:
self.poll_settings[key] = {"start_block": start_block}

return self.broker_task_decorator(TaskType.EVENT_LOG, container=container)
return self.broker_task_decorator(
TaskType.EVENT_LOG, # type: ignore[arg-type]
container=container,
)

# TODO: Support account transaction polling
# TODO: Support mempool polling
Expand Down
5 changes: 3 additions & 2 deletions silverback/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from typing_extensions import Self # Introduced 3.11

try:
from enum import StrEnum # Only Python 3.11+
# NOTE: Only Python 3.11+
from enum import StrEnum # type: ignore[attr-defined]

except ImportError:
from backports.strenum import StrEnum # type: ignore[no-redef]
from backports.strenum import StrEnum # type: ignore[no-redef,import-not-found]


class TaskType(StrEnum):
Expand Down

0 comments on commit 77a11aa

Please sign in to comment.