MCPcopy Create free account
hub / github.com/BerriAI/litellm / normalized_github_host

Function normalized_github_host

litellm/llms/github_copilot/github_host.py:31–44  ·  view source on GitHub ↗
(raw: object)

Source from the content-addressed store, hash-verified

29
30
31def normalized_github_host(raw: object) -> str | None:
32 if raw is None or raw == "":
33 return GITHUB_COPILOT_DEFAULT_HOST
34 if not isinstance(raw, str):
35 return None
36
37 host: Final = raw.lower()
38 if host == GITHUB_COPILOT_DEFAULT_HOST:
39 return host
40 if not host.endswith(".ghe.com"):
41 return None
42
43 subdomain: Final = host.removesuffix(".ghe.com")
44 return host if _GHE_SUBDOMAIN_PATTERN.fullmatch(subdomain) is not None else None
45
46
47def github_host_endpoints(host: str) -> GithubHostEndpoints:

Calls 1

lowerMethod · 0.45