You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/05/14 16:13:00 UTC

[incubator-ponymail-foal] branch master updated: Use raw strings for RE

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 13eedb0  Use raw strings for RE
13eedb0 is described below

commit 13eedb0c1438e50eec36f251070795cb4ef83d0e
Author: Sebb <se...@apache.org>
AuthorDate: Fri May 14 17:12:45 2021 +0100

    Use raw strings for RE
---
 tools/import-mbox.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 66b7a82..743fc5f 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -739,8 +739,8 @@ elif re.match(r"imaps?://", source):
     results = imap4.uid("fetch", uids, "(BODY[HEADER.FIELDS (MESSAGE-ID)])")
 
     mail = {}
-    uid_re = re.compile(b"^\d+ \(UID (\d+) BODY\[")
-    mid_re = re.compile(b"^Message-ID:\s*(.*?)\s*$", re.I)
+    uid_re = re.compile(r"^\d+ \(UID (\d+) BODY\[")
+    mid_re = re.compile(r"^Message-ID:\s*(.*?)\s*$", re.I)
     uid = None
     for result in results[1]:
         for line in result:

Re: [incubator-ponymail-foal] branch master updated: Use raw strings for RE

Posted by Daniel Gruno <hu...@apache.org>.
This breaks the code and subsequently our CI, please revert.
The regex test is against bytestrings, so must be b"", not r"".

On 14/05/2021 18.13, sebb@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> sebb pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
> 
> 
> The following commit(s) were added to refs/heads/master by this push:
>       new 13eedb0  Use raw strings for RE
> 13eedb0 is described below
> 
> commit 13eedb0c1438e50eec36f251070795cb4ef83d0e
> Author: Sebb <se...@apache.org>
> AuthorDate: Fri May 14 17:12:45 2021 +0100
> 
>      Use raw strings for RE
> ---
>   tools/import-mbox.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/import-mbox.py b/tools/import-mbox.py
> index 66b7a82..743fc5f 100755
> --- a/tools/import-mbox.py
> +++ b/tools/import-mbox.py
> @@ -739,8 +739,8 @@ elif re.match(r"imaps?://", source):
>       results = imap4.uid("fetch", uids, "(BODY[HEADER.FIELDS (MESSAGE-ID)])")
>   
>       mail = {}
> -    uid_re = re.compile(b"^\d+ \(UID (\d+) BODY\[")
> -    mid_re = re.compile(b"^Message-ID:\s*(.*?)\s*$", re.I)
> +    uid_re = re.compile(r"^\d+ \(UID (\d+) BODY\[")
> +    mid_re = re.compile(r"^Message-ID:\s*(.*?)\s*$", re.I)
>       uid = None
>       for result in results[1]:
>           for line in result:
>