Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
68 lines
1.9 KiB
Python
Executable File
68 lines
1.9 KiB
Python
Executable File
from __future__ import annotations
|
|
|
|
import typing as t
|
|
from threading import local
|
|
|
|
if t.TYPE_CHECKING:
|
|
from .core import Context
|
|
|
|
_local = local()
|
|
|
|
|
|
@t.overload
|
|
def get_current_context(silent: t.Literal[False] = False) -> Context: ...
|
|
|
|
|
|
@t.overload
|
|
def get_current_context(silent: bool = ...) -> Context | None: ...
|
|
|
|
|
|
def get_current_context(silent: bool = False) -> Context | None:
|
|
"""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: bool | None = None) -> bool | None:
|
|
"""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
|