MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / normalize_source

Function normalize_source

logging_utils/core/rendering.py:22–32  ·  view source on GitHub ↗

Normalize source name to fixed 5-letter code.

(source: str)

Source from the content-addressed store, hash-verified

20
21
22def normalize_source(source: str) -> str:
23 """Normalize source name to fixed 5-letter code."""
24 key = source.lower().replace(" ", "_").replace("-", "_")
25 if key in SOURCE_MAP:
26 return SOURCE_MAP[key]
27 # Try partial match
28 for map_key, map_val in SOURCE_MAP.items():
29 if map_key in key or key in map_key:
30 return map_val
31 # Default: first 5 chars, uppercase, padded
32 return source[:5].upper().ljust(5)
33
34
35# =============================================================================

Callers 15

highlightMethod · 0.85
formatMethod · 0.85
formatMethod · 0.85
updateMethod · 0.85
formatMethod · 0.85
test_known_source_apiMethod · 0.85

Calls

no outgoing calls