Skip to content

Commit

Permalink
refactor: use value_or_default instead of conditional expression (#2927)
Browse files Browse the repository at this point in the history
Use value_or_default instead of conditional expr

Co-authored-by: Peter Schutt <[email protected]>
  • Loading branch information
cbscsm and peterschutt authored Dec 23, 2023
1 parent e8a65e4 commit 91762e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion litestar/stores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from litestar.exceptions import ImproperlyConfiguredException
from litestar.types import Empty, EmptyType
from litestar.utils.empty import value_or_default

from .base import NamespacedStore

Expand All @@ -29,7 +30,7 @@ def __init__(self, redis: Redis, namespace: str | None | EmptyType = Empty) -> N
``None``. This will make :meth:`.delete_all` unavailable.
"""
self._redis = redis
self.namespace: str | None = "LITESTAR" if namespace is Empty else namespace
self.namespace: str | None = value_or_default(namespace, "LITESTAR")

# script to get and renew a key in one atomic step
self._get_and_renew_script = self._redis.register_script(
Expand Down

0 comments on commit 91762e5

Please sign in to comment.