Skip to content

Commit

Permalink
Add types to our context variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ramnes committed Jul 26, 2023
1 parent dc597d2 commit 7f46abc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/chainlit/context.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import contextvars
from asyncio import AbstractEventLoop
from contextvars import ContextVar
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand All @@ -11,8 +11,8 @@ def __init__(self, msg="Chainlit context not found", *args, **kwargs):
super().__init__(msg, *args, **kwargs)


emitter_var = contextvars.ContextVar("emitter")
loop_var = contextvars.ContextVar("loop")
emitter_var: ContextVar["ChainlitEmitter"] = ContextVar("emitter")
loop_var: ContextVar[AbstractEventLoop] = ContextVar("loop")


def get_emitter() -> "ChainlitEmitter":
Expand Down

0 comments on commit 7f46abc

Please sign in to comment.