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.
93 lines
3.2 KiB
Python
Executable File
93 lines
3.2 KiB
Python
Executable File
from collections.abc import Mapping
|
|
from typing import TYPE_CHECKING, Any, Optional, Tuple
|
|
|
|
from .highlighter import ReprHighlighter
|
|
from .panel import Panel
|
|
from .pretty import Pretty
|
|
from .table import Table
|
|
from .text import Text, TextType
|
|
|
|
if TYPE_CHECKING:
|
|
from .console import ConsoleRenderable, OverflowMethod
|
|
|
|
|
|
def render_scope(
|
|
scope: "Mapping[str, Any]",
|
|
*,
|
|
title: Optional[TextType] = None,
|
|
sort_keys: bool = True,
|
|
indent_guides: bool = False,
|
|
max_length: Optional[int] = None,
|
|
max_string: Optional[int] = None,
|
|
max_depth: Optional[int] = None,
|
|
overflow: Optional["OverflowMethod"] = None,
|
|
) -> "ConsoleRenderable":
|
|
"""Render python variables in a given scope.
|
|
|
|
Args:
|
|
scope (Mapping): A mapping containing variable names and values.
|
|
title (str, optional): Optional title. Defaults to None.
|
|
sort_keys (bool, optional): Enable sorting of items. Defaults to True.
|
|
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
|
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
|
Defaults to None.
|
|
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
|
max_depth (int, optional): Maximum depths of locals before truncating, or None to disable. Defaults to None.
|
|
overflow (OverflowMethod, optional): How to handle overflowing locals, or None to disable. Defaults to None.
|
|
|
|
Returns:
|
|
ConsoleRenderable: A renderable object.
|
|
"""
|
|
highlighter = ReprHighlighter()
|
|
items_table = Table.grid(padding=(0, 1), expand=False)
|
|
items_table.add_column(justify="right")
|
|
|
|
def sort_items(item: Tuple[str, Any]) -> Tuple[bool, str]:
|
|
"""Sort special variables first, then alphabetically."""
|
|
key, _ = item
|
|
return (not key.startswith("__"), key.lower())
|
|
|
|
items = sorted(scope.items(), key=sort_items) if sort_keys else scope.items()
|
|
for key, value in items:
|
|
key_text = Text.assemble(
|
|
(key, "scope.key.special" if key.startswith("__") else "scope.key"),
|
|
(" =", "scope.equals"),
|
|
)
|
|
items_table.add_row(
|
|
key_text,
|
|
Pretty(
|
|
value,
|
|
highlighter=highlighter,
|
|
indent_guides=indent_guides,
|
|
max_length=max_length,
|
|
max_string=max_string,
|
|
max_depth=max_depth,
|
|
overflow=overflow,
|
|
),
|
|
)
|
|
return Panel.fit(
|
|
items_table,
|
|
title=title,
|
|
border_style="scope.border",
|
|
padding=(0, 1),
|
|
)
|
|
|
|
|
|
if __name__ == "__main__": # pragma: no cover
|
|
from rich import print
|
|
|
|
print()
|
|
|
|
def test(foo: float, bar: float) -> None:
|
|
list_of_things = [1, 2, 3, None, 4, True, False, "Hello World"]
|
|
dict_of_things = {
|
|
"version": "1.1",
|
|
"method": "confirmFruitPurchase",
|
|
"params": [["apple", "orange", "mangoes", "pomelo"], 1.123],
|
|
"id": "194521489",
|
|
}
|
|
print(render_scope(locals(), title="[i]locals", sort_keys=False))
|
|
|
|
test(20.3423, 3.1427)
|
|
print()
|