(cls, text=None)
| 382 | # at the end of the module. It *is* internal, so we could drop that... |
| 383 | @classmethod |
| 384 | def _make_boundary(cls, text=None): |
| 385 | # Craft a random boundary. If text is given, ensure that the chosen |
| 386 | # boundary doesn't appear in the text. |
| 387 | token = random.randrange(sys.maxsize) |
| 388 | boundary = ('=' * 15) + (_fmt % token) + '==' |
| 389 | if text is None: |
| 390 | return boundary |
| 391 | b = boundary |
| 392 | counter = 0 |
| 393 | while True: |
| 394 | cre = cls._compile_re('^--' + re.escape(b) + '(--)?$', re.MULTILINE) |
| 395 | if not cre.search(text): |
| 396 | break |
| 397 | b = boundary + '.' + str(counter) |
| 398 | counter += 1 |
| 399 | return b |
| 400 | |
| 401 | @classmethod |
| 402 | def _compile_re(cls, s, flags): |
no test coverage detected