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