Ensure id is unique in set of ids. Append '_1', '_2'... if not
(id: str, ids: MutableSet[str])
| 54 | |
| 55 | |
| 56 | def unique(id: str, ids: MutableSet[str]) -> str: |
| 57 | """ Ensure id is unique in set of ids. Append '_1', '_2'... if not """ |
| 58 | while id in ids or not id: |
| 59 | m = IDCOUNT_RE.match(id) |
| 60 | if m: |
| 61 | id = '%s_%d' % (m.group(1), int(m.group(2))+1) |
| 62 | else: |
| 63 | id = '%s_%d' % (id, 1) |
| 64 | ids.add(id) |
| 65 | return id |
| 66 | |
| 67 | |
| 68 | @deprecated('Use `render_inner_html` and `striptags` instead.') |
no outgoing calls
searching dependent graphs…