Skip to content

Commit cdc6d8f

Browse files
committed
use TypeVar
1 parent 6b9fd7d commit cdc6d8f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

reddit_decider/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from typing import IO
1111
from typing import List
1212
from typing import Optional
13+
from typing import Type
14+
from typing import TypeVar
1315
from typing import Union
1416

1517
from baseplate import RequestContext
@@ -64,6 +66,7 @@ class DeciderContext:
6466
bucketing, targeting, and overrides.
6567
:code:`DeciderContext()` is populated in :code:`make_object_for_context()`.
6668
"""
69+
T = TypeVar("T")
6770

6871
def __init__(
6972
self,
@@ -819,8 +822,8 @@ def _get_dynamic_config_value(
819822
self,
820823
feature_name: str,
821824
default: Any,
822-
dc_type: Any,
823-
) -> Any:
825+
dc_type: Type[T],
826+
) -> T:
824827
if self._internal is None:
825828
logger.error("rs_decider is None--did not initialize.")
826829
return default
@@ -840,7 +843,7 @@ def _get_dynamic_config_value(
840843
return default
841844

842845
try:
843-
return dc_type(value)
846+
return dc_type(value) # type: ignore [call-arg]
844847
except TypeError:
845848
return default
846849

0 commit comments

Comments
 (0)