INNER CODE UNIT · Python

force_tuple_validator

DogsTailFarmer/martin-binance · martin_binance/backup.py:282

def force_tuple_validator(v: Any) -> tuple:
    """Safely intercepts corrupted or legacy string '0' markers, forcing a clean tuple."""
    if v is None or v == "0" or v == 0:
        return ()
    if isinstance(v, (list, tuple)):
        return tuple(v)
    return ()

# =====================================================================
# 2. AUTOMATIC AST PARSER FOR STRATEGY SOURCE CODE
# =====================================================================


def get_init_self_annotations(strategy_instance) -> Dict[str, str]:
    """
    AST Parser with textwrap protection.
    Traverses the class hierarchy and extracts all 'self.attr: Type' definitions
    directly from the source code of __init__ methods.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…