MCPcopy Create free account
hub / github.com/Roy3838/Observer / normalize_code

Function normalize_code

api/remote.py:81–88  ·  view source on GitHub ↗

The canonical code if `text` is one ("Tree Book-shower golden" counts), else None.

(text: str | None)

Source from the content-addressed store, hash-verified

79
80
81def normalize_code(text: str | None) -> str | None:
82 """The canonical code if `text` is one ("Tree Book-shower golden" counts), else None."""
83 if not text:
84 return None
85 parts = [p for p in re.split(r"[\s\-]+", text.strip().lower()) if p]
86 if len(parts) == 4 and all(p in _WORDS for p in parts):
87 return "-".join(parts)
88 return None
89
90
91def _owner_key(code: str) -> str: return f"remote:owner:{code}"

Callers 2

route_inboundFunction · 0.85
_require_ownerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected