Genesis
Genesis copied to clipboard
Fix:Remove ANSI sequences and format issues in RBC.__repr
Problem description
ANSI escape sequences (color and format control characters) used in the __repr__ method may appear garbled in unsupported environments in debugging or terminal output, affecting the readability of debugger output or logging.
Problem
- The console of a debugger such as PyCharm or VSCode does not parse ANSI escape sequences correctly.
- Attribute values are displayed inconsistently across multiple lines, with some members being displayed as “gibberish”.
- Some property values may throw exceptions when accessed, resulting in no display.
Changes
Determine whether the current environment is a debug environment, so as to solve the problem of ANSI garbled code in the debug environment.
Example of modified output:
<gs.Scene> t=<int>: 0 dt=<float>: 0.02 requires_grad=<bool>: False substeps=<int>: 2 visualizer=<gs.

Problem description
ANSI escape sequences (color and format control characters) used in the __repr__ method may appear garbled in unsupported environments in debugging or terminal output, affecting the readability of debugger output or logging.
Problem
- The console of a debugger such as PyCharm or VSCode does not parse ANSI escape sequences correctly.
- Attribute values are displayed inconsistently across multiple lines, with some members being displayed as “gibberish”.
- Some property values may throw exceptions when accessed, resulting in no display.
Changes
Determine whether the current environment is a debug environment, so as to solve the problem of ANSI garbled code in the debug environment.
Example of modified output:
Looks useful! @zswang666 could you double check and merge?