INNER CODE UNIT · Python

parse_workout_activity_types

viticci/shortcuts-playground-plugin · claude/skills/shortcuts-playground/scripts/generate_healthkit_reference.py:272

def parse_workout_activity_types(header: Path) -> list[dict[str, object]]:
    text = header.read_text(encoding="utf-8")
    match = re.search(
        r"typedef NS_ENUM\(NSUInteger,\s*HKWorkoutActivityType\)\s*\{(?P<body>.*?)\}",
        text,
        re.S,
    )
    if not match:
        return []
    values: list[dict[str, object]] = []
    previous_int: int | None = None
    for raw_line in match.group("body").splitlines():
        line = raw_line.strip()
        if not line.startswith("HKWorkoutActivityType"):
            continue
        const = line.split(None, 1)[0].rstrip(",")
        suffix = const[len("HKWorkoutActivityType") :]
        expr = None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…