INNER CODE UNIT · Python

split_camel

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

def split_camel(name: str) -> str:
    if name in LABEL_OVERRIDES:
        return LABEL_OVERRIDES[name]
    working = name
    if working.startswith("Dietary") and len(working) > len("Dietary"):
        working = working[len("Dietary") :]
    working = re.sub(r"(?<=[a-z0-9])(?=[A-Z])", " ", working)
    working = re.sub(r"(?<=[A-Z])(?=[A-Z][a-z])", " ", working)
    working = working.replace(" VO 2 ", " VO2 ")
    working = working.replace(" S D N N", " SDNN")
    return working.strip()


def parse_types(header: Path) -> dict[str, list[dict[str, str]]]:
    out: dict[str, list[dict[str, str]]] = {bucket: [] for bucket in TYPE_PREFIXES.values()}
    line_re = re.compile(
        r"HK_EXTERN\s+"
        r"(?P<prefix>HK(?:Quantity|Category|Characteristic|Correlation|Document)TypeIdentifier)"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…