浏览代码

Update contract for DataFor

Kirk Trombley 4 年之前
父节点
当前提交
c5fc7e67b7
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lib/rollbot/injection/data.py

+ 2 - 2
lib/rollbot/injection/data.py

@@ -85,13 +85,13 @@ class DataStore(Generic[DataType]):
         await self.connection.commit()
 
 
-class DataFor(Injector[Optional[DataType]]):
+class DataFor(Injector[DataType]):
     def __init__(self, datatype: Type[DataType], key: Injector[str], kwargs: dict[str, Any]):
         self.datatype = datatype
         self.key = key
         self.kwargs = kwargs
 
-    async def inject(self, message: Message, context: Context) -> DataStore[DataType]:
+    async def inject(self, message: Message, context: Context) -> DataType:
         key = await self.key.inject(message, context)
         async with context.database() as db:
             store = DataStore(self.datatype, db)