Skip to content

Commit

Permalink
fix: use Dict from typing for 3.8 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Apr 17, 2024
1 parent a781d77 commit 39337e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions silverback/middlewares.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from typing import Any, Dict

from ape.logging import logger
from ape.types import ContractLog
Expand Down Expand Up @@ -26,7 +26,7 @@ def compute_block_time() -> int:
def pre_send(self, message: TaskiqMessage) -> TaskiqMessage:
# TODO: Necessary because bytes/HexBytes doesn't encode/deocde well for some reason
def fix_dict(data: dict, recurse_count: int = 0) -> dict:
fixed_data: dict[str, Any] = {}
fixed_data: Dict[str, Any] = {}
for name, value in data.items():
if isinstance(value, bytes):
fixed_data[name] = to_hex(value)
Expand Down
6 changes: 3 additions & 3 deletions silverback/recorder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Iterator, Optional
from typing import Any, Dict, Iterator, Optional

from ape.logging import get_logger
from pydantic import BaseModel, Field
Expand Down Expand Up @@ -36,10 +36,10 @@ class TaskResult(BaseModel):
block_number: Optional[int] = None

# Custom user metrics here
metrics: dict[str, Datapoint] = {}
metrics: Dict[str, Datapoint] = {}

@classmethod
def _extract_custom_metrics(cls, result: Any, task_name: str) -> dict[str, Datapoint]:
def _extract_custom_metrics(cls, result: Any, task_name: str) -> Dict[str, Datapoint]:
if isinstance(result, Datapoint): # type: ignore[arg-type,misc]
return {"result": result}

Expand Down

0 comments on commit 39337e4

Please sign in to comment.