MCPcopy
hub / github.com/tinygrad/tinygrad / pluralize

Function pluralize

tinygrad/helpers.py:149–149  ·  view source on GitHub ↗
(st:str, cnt:int)

Source from the content-addressed store, hash-verified

147 raise excs[0] if len(excs) == 1 else ExceptionGroup(err_msg + " is available", excs)
148
149def pluralize(st:str, cnt:int): return f"{cnt} {st}"+('' if cnt == 1 else 's')
150
151# for length N coefficients `p`, returns p[0] * x**(N-1) + p[1] * x**(N-2) + ... + p[-2] * x + p[-1]
152def polyN(x:T, p:list[float]) -> T: return functools.reduce(lambda acc,c: acc*x+c, p, 0.0) # type: ignore

Callers 4

enumerate_devices_strFunction · 0.90
__init__Method · 0.90
pci_probe_deviceMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…