3
3
# Distributed under the terms of the Modified BSD License.
4
4
5
5
from contextvars import Context , ContextVar , copy_context
6
- from typing import Any , Dict , List
6
+ from typing import Any
7
7
8
8
9
9
class CallContext :
@@ -22,7 +22,7 @@ class CallContext:
22
22
# easier management over maintaining a set of ContextVar instances, since the Context is a
23
23
# map of ContextVar instances to their values, and the "name" is no longer a lookup key.
24
24
_NAME_VALUE_MAP = "_name_value_map"
25
- _name_value_map : ContextVar [Dict [str , Any ]] = ContextVar (_NAME_VALUE_MAP )
25
+ _name_value_map : ContextVar [dict [str , Any ]] = ContextVar (_NAME_VALUE_MAP )
26
26
27
27
@classmethod
28
28
def get (cls , name : str ) -> Any :
@@ -65,7 +65,7 @@ def set(cls, name: str, value: Any) -> None:
65
65
name_value_map [name ] = value
66
66
67
67
@classmethod
68
- def context_variable_names (cls ) -> List [str ]:
68
+ def context_variable_names (cls ) -> list [str ]:
69
69
"""Returns a list of variable names set for this call context.
70
70
71
71
Returns
@@ -77,7 +77,7 @@ def context_variable_names(cls) -> List[str]:
77
77
return list (name_value_map .keys ())
78
78
79
79
@classmethod
80
- def _get_map (cls ) -> Dict [str , Any ]:
80
+ def _get_map (cls ) -> dict [str , Any ]:
81
81
"""Get the map of names to their values from the _NAME_VALUE_MAP context var.
82
82
83
83
If the map does not exist in the current context, an empty map is created and returned.
0 commit comments