alfonsrv / mail-parser-reply

📧 Mail reply parser library for Python with multi-language support
https://pypi.org/project/mail-parser-reply/
MIT License
44 stars 17 forks source link

SyntaxWarning in constants.py #14

Closed Alexerson closed 4 weeks ago

Alexerson commented 1 month ago

Hello,

thanks for your lib! When running with all warnings enabled, I get the following 2 warnings:

mailparser_reply/constants.py:78: SyntaxWarning: invalid escape sequence '\*'
'[\* ]*Disclaimer[\* ]*',
mailparser_reply/constants.py:171: SyntaxWarning: invalid escape sequence '\s'
+ QUOTED_MATCH_INCLUDE + ')[* ]*(?:Von|An|Cc)(?:\s{,2}).*){2,})'

It’s very minor, but also, a very simple fix:

--- a/mailparser_reply/constants.py
+++ b/mailparser_reply/constants.py
@ 78
            'CONFIDENTIALITY:',
            '(?:Privileged|Confidential|Private|Sensitive|Important) (?:Notice|Note|Information):',
+            r'[\* ]*Disclaimer[\* ]*',
-            '[\* ]*Disclaimer[\* ]*',
        ],
        'signatures': [
@ 171
                       + r'(?:.*\n?){,2}'  # david's non-subject line + date wildcard identification
                       + r'(?:(?:^|\n|\n'
+                       + QUOTED_MATCH_INCLUDE + ')[* ]*(?:Von|An|Cc)(?:\s{,2}).*){2,})'
-                       + QUOTED_MATCH_INCLUDE + r')[* ]*(?:Von|An|Cc)(?:\s{,2}).*){2,})'
    },
}

Let me know if you want me to craft the PR.

alfonsrv commented 1 month ago

Heya, thanks for the heads-up! Sure, if you can find the time I'll be happy to merge it – otherwise I can implement it whenever I get around to it. 👍

Alexerson commented 1 month ago

Done!