Function
_unique_symbols
(used: Sequence[str], *bases: str)
Source from the content-addressed store, hash-verified
| 231 | |
| 232 | |
| 233 | def _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 | |
| 249 | def map_bits(fn: Callable[[int], Any], n: int) -> Iterator[Any]: |
Tested by
no test coverage detected