mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-25 18:39:55 +08:00
Hide fixed args, fix method description formatting (#667)
This commit is contained in:
1 parent
ce8985aeb6
commit
e9f56e127a
3 files changed
+25
-4
No files matched your search
@@ -21,6 +21,8 @@ from __future__ import annotations
|
||||
from dataclasses import field
|
||||
from typing import Any, Dict
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
# pylint: disable=import-outside-toplevel
|
||||
|
||||
# cannot use mutable types directly within dataclass; abstracting default factory calls
|
||||
@@ -31,3 +33,18 @@ def to_immutable_dict(d: Dict[str, Any]):
|
||||
d: dictionary to convert into default factory dict for dataclass
|
||||
"""
|
||||
return field(default_factory=lambda: dict(d))
|
||||
|
||||
|
||||
def convert_markup_to_ansi(markup_string: str) -> str:
|
||||
"""Convert rich-style markup to ANSI sequences for command-line formatting.
|
||||
|
||||
Args:
|
||||
markup_string: Text with rich-style markup.
|
||||
|
||||
Returns:
|
||||
Text formatted via ANSI sequences.
|
||||
"""
|
||||
console = Console()
|
||||
with console.capture() as out:
|
||||
console.print(markup_string, soft_wrap=True)
|
||||
return out.get()
|
||||
Reference in new issue
Block a user