Skip to content

Commit 7cac5b9

Browse files
authored
Moved definitions of K and V outside of TYPE_CHECKING condition (#935)
1 parent ff5b879 commit 7cac5b9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

traitlets/traitlets.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ def instance_init(self, obj: t.Any) -> None:
505505

506506
K = TypeVar("K", default=str)
507507
V = TypeVar("V", default=t.Any)
508+
else:
509+
# This is required to avoid warnings about unresolved references when generating
510+
# the documentation of downstream projects.
511+
K = TypeVar("K")
512+
V = TypeVar("V")
508513

509514

510515
# We use a type for the getter (G) and setter (G) because we allow

0 commit comments

Comments
 (0)