Skip to content

Commit

Permalink
Fix some annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jderuiter committed Sep 13, 2023
1 parent a5ede83 commit a5cf912
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bookwyrm/activitypub/base_activity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" basics for an activitypub serializer """
from __future__ import annotations
from dataclasses import dataclass, fields, MISSING
from json import JSONEncoder
import logging
Expand Down Expand Up @@ -72,7 +73,9 @@ class ActivityObject:

def __init__(
self,
activity_objects: Optional[list[str, base_model.BookWyrmModel]] = None,
activity_objects: Optional[
dict[str, Union[str, list[str], ActivityObject, base_model.BookWyrmModel]]
] = None,
**kwargs: Any,
):
"""this lets you pass in an object with fields that aren't in the
Expand Down
6 changes: 3 additions & 3 deletions bookwyrm/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

def get_or_set(
cache_key: str,
function: Callable[..., Any],
function: Callable[..., str],
*args: Tuple[Any, ...],
timeout: Union[float, None] = None
) -> Any:
) -> str:
"""Django's built-in get_or_set isn't cutting it"""
value = cache.get(cache_key)
value = str(cache.get(cache_key))
if value is None:
value = function(*args)
cache.set(cache_key, value, timeout=timeout)
Expand Down

0 comments on commit a5cf912

Please sign in to comment.