MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _unique_symbols

Function _unique_symbols

lib/sqlalchemy/util/langhelpers.py:233–246  ·  view source on GitHub ↗
(used: Sequence[str], *bases: str)

Source from the content-addressed store, hash-verified

231
232
233def _unique_symbols(used: Sequence[str], *bases: str) -> Iterator[str]:
234 used_set = set(used)
235 for base in bases:
236 pool = itertools.chain(
237 (base,),
238 map(lambda i: base + str(i), range(1000)),
239 )
240 for sym in pool:
241 if sym not in used_set:
242 used_set.add(sym)
243 yield sym
244 break
245 else:
246 raise NameError("exhausted namespace for symbol base %s" % base)
247
248
249def map_bits(fn: Callable[[int], Any], n: int) -> Iterator[Any]:

Callers 1

decorateFunction · 0.85

Calls 2

chainMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected