languages.py¶
clew/languages.py
WHAT CLEW INDEXES, DERIVED FROM THE ROUTERS RATHER THAN WRITTEN DOWN.
harvested_phrase
str clew.languages.harvested_phrase()
The harvested languages as one human-readable clause.
Source · 13 lines
def harvested_phrase() -> str:
"""AN OXFORD-FREE `and` BEFORE THE LAST ITEM, because this lands mid-sentence in the served
MCP instructions and in a PyPI description, where a trailing comma reads as truncation.
@brief Join the harvested language names.
@return The clause.
@version 1
"""
if len(HARVESTED) < 2:
return "".join(HARVESTED)
return f"{', '.join(HARVESTED[:-1])} and {HARVESTED[-1]}"
Activity · 3 steps
Flows
registered_phrase
str clew.languages.registered_phrase()
The registered-but-unharvested types as one human-readable clause.
Source · 10 lines
def registered_phrase() -> str:
"""@brief Join the registered-only type names.
@return The clause.
@version 1
"""
if len(REGISTERED_ONLY) < 2:
return "".join(REGISTERED_ONLY)
return f"{', '.join(REGISTERED_ONLY[:-1])} and {REGISTERED_ONLY[-1]}"
Activity · 3 steps
Flows
support_table
str clew.languages.support_table()
The language support table, as markdown.
Source · 24 lines
def support_table() -> str:
"""GENERATED, NEVER HAND-EDITED — `scripts/sync_metadata.py` writes it between markers and its
`--check` hook fails a commit that lets it drift. Each language links to its integration page,
so the table is also the README's index into the per-language detail.
REGISTERED-ONLY TYPES GET ONE ROW, honestly labelled: they are in the file set and findable by
name, and contribute no symbols — `dossier` on a Perl subroutine has nothing to return.
@brief Render the support table.
@return Markdown table text.
@version 1
"""
head = "| Language | " + " | ".join(title for _, title in SUPPORT_COLUMNS) + " |"
rule = "|---|" + "|".join(":-:" for _ in SUPPORT_COLUMNS) + "|"
rows = [head, rule]
for name, caps in CAPABILITIES.items():
cells = " | ".join("✓" if key in caps else "—" for key, _ in SUPPORT_COLUMNS)
rows.append(f"| [{name}]({REPO_URL}{DOC_PAGE[name]}) | {cells} |")
if REGISTERED_ONLY:
rest = " | ".join("—" for _ in SUPPORT_COLUMNS[1:])
rows.append(f"| {', '.join(REGISTERED_ONLY)} | name only | {rest} |")
return "\n".join(rows)