gh-153521: Support structured arguments in imaplib commands#153522
gh-153521: Support structured arguments in imaplib commands#153522serhiy-storchaka wants to merge 6 commits into
Conversation
Command methods now accept a structured *message_set* (an integer, or a sequence of integers, (start, stop) ranges and range objects) and lists of flags or other atoms in place of preformatted parenthesized strings. The search, fetch, sort, thread and uid methods gain a keyword-only *params* argument that substitutes and quotes '?' placeholders in their value-bearing arguments, in the manner of sqlite3 parameter substitution. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview
21 files changed ·
|
bitdancer
left a comment
There was a problem hiding this comment.
I've only reviewed the docs (so far? ;)
|
When you're done making the requested changes, leave the comment: |
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
GitHub could only attach each suggestion to a line within the PR diff, so David's multi-line suggestions landed next to the nearest changed line and left the original prose duplicated. Merge each into clean text, wrap to the line limit with semantic line breaks, and move the substitution note into the versionadded directive. Co-authored-by: R. David Murray <rdmurray@bitdance.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Keep every changed line within the 79-character limit and break at clause boundaries, without splitting into overly short fragments. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thank you David. I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @bitdancer: please review the changes made to this pull request. |
|
When you're done making the requested changes, leave the comment: |
|
Initially I considered different design for structural search criteria: |
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
Let _format_astring() fall through to the generic TypeError for a bool value instead of a special-case message (suggested by David Murray), and move the substitution note back into the body rather than the versionadded directive. Co-authored-by: R. David Murray <rdmurray@bitdance.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
imaplib command methods now accept structured arguments, so the module takes care of quoting and the caller no longer has to preformat and quote strings by hand. This matters not only because hand-quoting is error-prone, but because a pre-quoted string cannot represent every value: one containing a newline or NUL, binary data, or a value too large for a single line must be sent as a literal or literal8, which the caller cannot express in a plain string. Owning the value keeps that door open for future literal support.
Two things change:
A message_set and lists of flags or other atoms can be passed as sequences instead of preformatted parenthesized strings. A message set may be an integer, or a sequence of integers,
(start, stop)ranges (withNoneor'*'meaning the last message) andrangeobjects.The
search,fetch,sort,threadanduidmethods gain a keyword-only params argument that substitutes and quotes?placeholders in their value-bearing arguments, in the manner ofsqlite3parameter substitution.?fsubstitutes a flag or list of flags,?sa structured message set, and??a literal?. Substitution runs only when params is given, so existing calls that contain a literal?are unaffected.Both preformatted strings and the pre-existing behaviour continue to work, so the change is backward compatible.