MCPcopy Index your code
hub / github.com/RustPython/RustPython / getcontext

Function getcontext

Lib/_pydecimal.py:353–365  ·  view source on GitHub ↗

Returns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext.

()

Source from the content-addressed store, hash-verified

351)
352
353def getcontext():
354 """Returns this thread's context.
355
356 If this thread does not yet have a context, returns
357 a new context and sets this thread's context.
358 New contexts are copies of DefaultContext.
359 """
360 try:
361 return _current_context_var.get()
362 except LookupError:
363 context = Context()
364 _current_context_var.set(context)
365 return context
366
367def setcontext(context):
368 """Set this thread's context to context."""

Callers 15

localcontextFunction · 0.85
__new__Method · 0.85
_check_nansMethod · 0.85
_compare_check_nansMethod · 0.85
__str__Method · 0.85
__neg__Method · 0.85
__pos__Method · 0.85
__add__Method · 0.85
__mul__Method · 0.85
__truediv__Method · 0.85
__divmod__Method · 0.85
__mod__Method · 0.85

Calls 3

ContextClass · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by 13

thfunc1Function · 0.68
thfunc2Function · 0.68
test_implicit_contextMethod · 0.68
test_localcontextMethod · 0.68
test_localcontextargMethod · 0.68
test_default_contextMethod · 0.68
test_canonicalMethod · 0.68
test_radixMethod · 0.68
test_c_context_errorsMethod · 0.68