6
6
7
7
import typing as t
8
8
from collections .abc import Collection
9
- from typing_extensions import Required , TypedDict
9
+ from typing_extensions import Required , TypedDict , Generic
10
10
11
11
if t .TYPE_CHECKING :
12
12
from asyncio import Task
@@ -110,7 +110,10 @@ class PartialTimersDict(TimersDict, total=False):
110
110
"""
111
111
112
112
113
- class SettingsDict (TypedDict , total = False ):
113
+ CtxType = t .TypeVar ("CtxType" , bound = Context )
114
+
115
+
116
+ class SettingsDict (TypedDict , Generic [CtxType ], total = False ):
114
117
"""
115
118
Settings
116
119
"""
@@ -119,10 +122,10 @@ class SettingsDict(TypedDict, total=False):
119
122
functions : Required [Collection [Function | tuple [str , Function ]]]
120
123
concurrency : int
121
124
cron_jobs : Collection [CronJob ]
122
- startup : ReceivesContext
123
- shutdown : ReceivesContext
124
- before_process : ReceivesContext
125
- after_process : ReceivesContext
125
+ startup : ReceivesContext [ CtxType ]
126
+ shutdown : ReceivesContext [ CtxType ]
127
+ before_process : ReceivesContext [ CtxType ]
128
+ after_process : ReceivesContext [ CtxType ]
126
129
timers : PartialTimersDict
127
130
dequeue_timeout : float
128
131
@@ -134,5 +137,5 @@ class SettingsDict(TypedDict, total=False):
134
137
Function = t .Callable [..., t .Any ]
135
138
ListenCallback = t .Callable [[str , "Status" ], t .Any ]
136
139
LoadType = t .Callable [[t .Union [bytes , str ]], t .Any ]
137
- ReceivesContext = t .Callable [[Context ], t .Any ]
140
+ ReceivesContext = t .Callable [[CtxType ], t .Any ]
138
141
VersionTuple = t .Tuple [int , ...]
0 commit comments