From 8d7c835ddf6e9e31b74ba45ed988f3e47a2f1cc9 Mon Sep 17 00:00:00 2001 From: "v.kaukin" Date: Wed, 12 May 2021 11:28:38 +0500 Subject: [PATCH] improve readme --- README.rst | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 9a7c430..3eb35f1 100644 --- a/README.rst +++ b/README.rst @@ -129,19 +129,26 @@ You can use 3 approaches to build search criteria: mailbox.fetch(b'TEXT "\xd1\x8f"') # bytes, *charset arg is ignored The "charset" is argument used for encode criteria to this encoding. -You can pass criteria as bytes in desired encoding - charset will be ignored. +You can pass the criteria as bytes in the desired encoding - in this case, the encoding will be ignored. + +.. code-block:: python + + mailbox.fetch(A(subject='жёлтый'), charset='utf8') Query builder implements all search logic described in `rfc3501 `_. +It uses this classes: -======== ===== ========================================== ============================================================ +======== ===== ========================================== ====================================== Class Alias Usage Arguments -======== ===== ========================================== ============================================================ -AND A combines keys by logical "AND" condition Search keys (see below) | str -OR O combines keys by logical "OR" condition Search keys (see below) | str +======== ===== ========================================== ====================================== +AND A combines keys by logical "AND" condition Search keys (see table below) | str +OR O combines keys by logical "OR" condition Search keys (see table below) | str NOT N invert the result of a logical expression AND/OR instances | str Header H for search by headers name: str, value: str UidRange U for search by UID range start: str, end: str -======== ===== ========================================== ============================================================ +======== ===== ========================================== ====================================== + +See `query examples `_. A few examples: .. code-block:: python @@ -154,13 +161,9 @@ UidRange U for search by UID range start: str, end: str NOT(text='hello', new=True) # 'NOT (TEXT "hello" NEW)' # complex A(OR(from_='from@ya.ru', text='"the text"'), NOT(OR(A(answered=False), A(new=True))), to='to@ya.ru') - # encoding - mailbox.fetch(A(subject='привет'), charset='utf8') # python note: you can't do: A(text='two', NOT(subject='one')) A(NOT(subject='one'), text='two') # use kwargs after logic classes (args) -See more `query examples `_. - Search key table. Key types marked with `*` can accepts a sequence of values like list, tuple, set or generator. ============= =============== ====================== =================================================================