BLUE
PHP 7.4.33
Path:
//usr/lib/python3/dist-packages/click
Run
Logout
Edit File
Size: 1.94 KB
Close
//usr/lib/python3/dist-packages/click/globals.py
Text
Base64
import typing import typing as t from threading import local if t.TYPE_CHECKING: import typing_extensions as te from .core import Context _local = local() @typing.overload def get_current_context(silent: "te.Literal[False]" = False) -> "Context": ... @typing.overload def get_current_context(silent: bool = ...) -> t.Optional["Context"]: ... def get_current_context(silent: bool = False) -> t.Optional["Context"]: """Returns the current click context. This can be used as a way to access the current context object from anywhere. This is a more implicit alternative to the :func:`pass_context` decorator. This function is primarily useful for helpers such as :func:`echo` which might be interested in changing its behavior based on the current context. To push the current context, :meth:`Context.scope` can be used. .. versionadded:: 5.0 :param silent: if set to `True` the return value is `None` if no context is available. The default behavior is to raise a :exc:`RuntimeError`. """ try: return t.cast("Context", _local.stack[-1]) except (AttributeError, IndexError) as e: if not silent: raise RuntimeError("There is no active click context.") from e return None def push_context(ctx: "Context") -> None: """Pushes a new context to the current stack.""" _local.__dict__.setdefault("stack", []).append(ctx) def pop_context() -> None: """Removes the top level from the stack.""" _local.stack.pop() def resolve_color_default(color: t.Optional[bool] = None) -> t.Optional[bool]: """Internal helper to get the default value of the color flag. If a value is passed it's returned unchanged, otherwise it's looked up from the current context. """ if color is not None: return color ctx = get_current_context(silent=True) if ctx is not None: return ctx.color return None
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 18
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2022-08-09 11:57:00
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
core.py
108.87 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
decorators.py
14.52 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
exceptions.py
8.95 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
formatting.py
9.48 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
globals.py
1.94 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parser.py
18.60 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
py.typed
0 B
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
shell_completion.py
17.58 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
termui.py
28.33 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
testing.py
15.64 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
types.py
34.56 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
utils.py
18.32 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_compat.py
18.37 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_termui_impl.py
22.90 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_textwrap.py
1.32 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_unicodefun.py
3.13 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_winconsole.py
7.68 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
3.17 KB
lrw-r--r--
2021-10-10 18:06:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).