Open the context
Choose the project folder and name the files or behavior involved.
Find conservative boundary conflicts among up to 64 byte parts of at most 65536 bytes each using a 1–70-byte ASCII alphanumeric, underscore or hyphen marker. Test prefixes at the start or after CRLF, including longer prefix matches, and reject invalid markers without presenting this as a complete MIME validator.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
import re
def boundary_conflicts(boundary, parts):
if type(boundary) is not bytes or re.fullmatch(rb"[A-Za-z0-9_-]{1,70}", boundary) is None:
raise ValueError("mime.boundary")
if type(parts) is not list or len(parts) > 64 or any(type(p) is not bytes or len(p) > 65536 for p in parts):
raise ValueError("mime.parts")
marker = b"--"+boundary
return [i for i, part in enumerate(parts) if part.startswith(marker) or b"\r\n"+marker in part]
The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.