MCPcopy
hub / github.com/celery/celery / host_format

Function host_format

celery/utils/nodenames.py:99–114  ·  view source on GitHub ↗

Format host %x abbreviations.

(s: str, host: str | None = None, name: str | None = None, **extra: dict)

Source from the content-addressed store, hash-verified

97
98
99def host_format(s: str, host: str | None = None, name: str | None = None, **extra: dict) -> str:
100 """Format host %x abbreviations."""
101 host = host or gethostname()
102 hname, _, domain = host.partition('.')
103 name = name or hname
104 keys = dict(
105 {
106 'h': host,
107 'n': name,
108 'd': domain,
109 'i': _fmt_process_index,
110 'I': _fmt_process_index_with_prefix,
111 },
112 **extra,
113 )
114 return simple_format(s, keys)

Callers 3

build_nodenameFunction · 0.90
convertMethod · 0.90
node_formatFunction · 0.85

Calls 1

simple_formatFunction · 0.85

Tested by

no test coverage detected