MCPcopy Create free account
hub / github.com/MagicStack/contextvars / Token

Class Token

contextvars/__init__.py:158–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158class Token(metaclass=TokenMeta):
159
160 MISSING = object()
161
162 def __init__(self, context, var, old_value):
163 self._context = context
164 self._var = var
165 self._old_value = old_value
166 self._used = False
167
168 @property
169 def var(self):
170 return self._var
171
172 @property
173 def old_value(self):
174 return self._old_value
175
176 def __repr__(self):
177 r = '<Token '
178 if self._used:
179 r += ' used'
180 r += ' var={!r} at {:0x}>'.format(self._var, id(self))
181 return r
182
183
184def copy_context():

Callers 1

setMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…