File: globals.py

package info (click to toggle)
python-dynaconf 3.1.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,116 kB
  • sloc: python: 12,959; makefile: 4
file content (14 lines) | stat: -rw-r--r-- 475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
_A=None
from threading import local
_local=local()
def get_current_context(silent=False):
	try:return _local.stack[-1]
	except (AttributeError,IndexError):
		if not silent:raise RuntimeError('There is no active click context.')
def push_context(ctx):_local.__dict__.setdefault('stack',[]).append(ctx)
def pop_context():_local.stack.pop()
def resolve_color_default(color=_A):
	A=color
	if A is not _A:return A
	B=get_current_context(silent=True)
	if B is not _A:return B.color