INNER CODE UNIT · Python

env_color

Far-Se/tabame · plugins/api-client/main.py:228

def env_color(name=None):
    name = name or STATE["activeEnv"]
    return STATE["environments"].get(name, {}).get("color", "#6B7280")


def extract_json_path(body_text, path):
    try:
        data = json.loads(body_text)
    except Exception:
        return None
    cur = data
    if not path:
        return cur if not isinstance(cur, (dict, list)) else None
    for tok in re.findall(r"[^.\[\]]+|\[\d+\]", path):
        if tok.startswith("[") and tok.endswith("]"):
            idx = int(tok[1:-1])
            if isinstance(cur, list) and 0 <= idx < len(cur):
                cur = cur[idx]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…