email-forward-parser 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/.githooks/pre-push +7 -1
- email_forward_parser-0.2.3/.python-version +1 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/PKG-INFO +7 -2
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/README.md +5 -1
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/utils.py +11 -1
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/pyproject.toml +3 -2
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/tests/coverage_edges_test.py +10 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/uv.lock +1 -1
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/.github/dependabot.yml +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/.github/workflows/ci.yml +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/.github/workflows/workflow.yml +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/.gitignore +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/LICENSE +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/NOTICE +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/__init__.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/client.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/forward_parser.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/literals.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/loop.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/regexs.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/tests/__init__.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/tests/client_test.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/tests/forward_parser_test.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/tests/literals_test.py +0 -0
- {email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/tests/regressions_test.py +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
# Style and
|
|
2
|
+
# Style, type and test checks on the commits being pushed, on the newest Python (.python-version); GitHub Actions
|
|
3
|
+
# runs the tests on the oldest one the package supports.
|
|
3
4
|
# Turn it on once per clone: git config core.hooksPath .githooks
|
|
4
5
|
|
|
5
6
|
fix='uv run black . && uv run isort . && uv run ruff check --fix .'
|
|
@@ -14,6 +15,11 @@ checks() {
|
|
|
14
15
|
check uv run isort --check-only .
|
|
15
16
|
check uv run ruff check .
|
|
16
17
|
check uv run mypy
|
|
18
|
+
# The coverage gate runs with the JIT off: under it, CPython 3.15 reports a loop's exit branch from the wrong
|
|
19
|
+
# instruction (coveragepy/coveragepy#2249). Callers may run Python with the JIT on, so the suite runs again
|
|
20
|
+
# under it, without coverage.
|
|
21
|
+
check env PYTHON_JIT=0 uv run pytest
|
|
22
|
+
check env PYTHON_JIT=1 uv run pytest --no-cov
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
# --- the same in every repo from here ---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.15
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: email-forward-parser
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Python Library to parse forwarded email messages
|
|
5
5
|
Project-URL: Homepage, https://github.com/felipehertzer/email-forward-parser-py
|
|
6
6
|
Project-URL: Repository, https://github.com/felipehertzer/email-forward-parser-py
|
|
@@ -213,6 +213,7 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
213
213
|
Classifier: Operating System :: OS Independent
|
|
214
214
|
Classifier: Programming Language :: Python :: 3
|
|
215
215
|
Classifier: Programming Language :: Python :: 3.14
|
|
216
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
216
217
|
Classifier: Topic :: Communications :: Email
|
|
217
218
|
Classifier: Topic :: Text Processing
|
|
218
219
|
Requires-Python: >=3.14
|
|
@@ -524,7 +525,11 @@ python -m mypy
|
|
|
524
525
|
python -m pytest
|
|
525
526
|
```
|
|
526
527
|
|
|
527
|
-
`pytest` is configured to require 100% statement and branch coverage.
|
|
528
|
+
`pytest` is configured to require 100% statement and branch coverage. On Python 3.15,
|
|
529
|
+
measure it with the JIT off (`PYTHON_JIT=0 python -m pytest`): with the JIT on, CPython
|
|
530
|
+
3.15 reports some branches from the wrong instruction (coveragepy/coveragepy#2249). The
|
|
531
|
+
pre-push hook runs the gate that way, then the suite again with `PYTHON_JIT=1` and
|
|
532
|
+
`--no-cov`.
|
|
528
533
|
|
|
529
534
|
`emailforwardparser/literals.py` lists the text each pattern in `regexs.py` needs
|
|
530
535
|
before it can match, so a pattern is not run on a string without it. After changing
|
|
@@ -304,7 +304,11 @@ python -m mypy
|
|
|
304
304
|
python -m pytest
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
-
`pytest` is configured to require 100% statement and branch coverage.
|
|
307
|
+
`pytest` is configured to require 100% statement and branch coverage. On Python 3.15,
|
|
308
|
+
measure it with the JIT off (`PYTHON_JIT=0 python -m pytest`): with the JIT on, CPython
|
|
309
|
+
3.15 reports some branches from the wrong instruction (coveragepy/coveragepy#2249). The
|
|
310
|
+
pre-push hook runs the gate that way, then the suite again with `PYTHON_JIT=1` and
|
|
311
|
+
`--no-cov`.
|
|
308
312
|
|
|
309
313
|
`emailforwardparser/literals.py` lists the text each pattern in `regexs.py` needs
|
|
310
314
|
before it can match, so a pattern is not run on a string without it. After changing
|
|
@@ -30,8 +30,18 @@ def decode_encoded_words(match: Match[str]) -> str:
|
|
|
30
30
|
return words
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
def remove_non_graphic(s: str) -> str:
|
|
34
|
+
"""Drop every character is_graphic() rejects.
|
|
35
|
+
|
|
36
|
+
Each distinct character is judged once: a body has thousands of characters but
|
|
37
|
+
rarely more than a few hundred distinct ones, and str.translate() does the rest.
|
|
38
|
+
"""
|
|
39
|
+
rejected = {ord(char): None for char in set(s) if not is_graphic(char)}
|
|
40
|
+
return s.translate(rejected) if rejected else s
|
|
41
|
+
|
|
42
|
+
|
|
33
43
|
def preprocess_string(s: str) -> str:
|
|
34
|
-
s =
|
|
44
|
+
s = remove_non_graphic(s)
|
|
35
45
|
s = s.replace("\ufeff", "")
|
|
36
46
|
# Decode encoded words in place. email.header.decode_header() on the whole
|
|
37
47
|
# text would join every line into one (so no line-anchored pattern could
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "email-forward-parser"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Python Library to parse forwarded email messages"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.14"
|
|
@@ -14,6 +14,7 @@ keywords = ["email", "forwarded-email", "parser", "eml", "mime"]
|
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
16
|
"Programming Language :: Python :: 3.14",
|
|
17
|
+
"Programming Language :: Python :: 3.15",
|
|
17
18
|
"License :: OSI Approved :: Apache Software License",
|
|
18
19
|
"Topic :: Communications :: Email",
|
|
19
20
|
"Topic :: Text Processing",
|
|
@@ -51,7 +52,7 @@ show_missing = true
|
|
|
51
52
|
|
|
52
53
|
[tool.black]
|
|
53
54
|
line-length = 100
|
|
54
|
-
target-version = ["py314"]
|
|
55
|
+
target-version = ["py314", "py315"]
|
|
55
56
|
|
|
56
57
|
[tool.isort]
|
|
57
58
|
combine_as_imports = true
|
|
@@ -406,6 +406,16 @@ def test_utils_regex_helpers_cover_empty_limited_and_duplicate_splits() -> None:
|
|
|
406
406
|
assert utils.is_graphic("\n") is True
|
|
407
407
|
|
|
408
408
|
|
|
409
|
+
def test_remove_non_graphic_keeps_text_and_whitespace_and_drops_the_rest() -> None:
|
|
410
|
+
kept = "Café 中文 🙂\n\r\t \u00a0\u2028\u2029¶€\u0301"
|
|
411
|
+
# Controls, soft hyphen, zero-width space, BOM, a lone surrogate, private use, unassigned.
|
|
412
|
+
dropped = "\x00\x07\x1b\x7f\x85\u00ad\u200b\ufeff\ud800\ue000\U000f0000\U0010ffff"
|
|
413
|
+
|
|
414
|
+
assert utils.remove_non_graphic(kept) is kept
|
|
415
|
+
assert utils.remove_non_graphic(dropped + kept[:6] + dropped + kept[6:] + dropped) == kept
|
|
416
|
+
assert utils.remove_non_graphic(dropped) == ""
|
|
417
|
+
|
|
418
|
+
|
|
409
419
|
def test_parser_unusual_empty_match_paths() -> None:
|
|
410
420
|
with patch(
|
|
411
421
|
"emailforwardparser.forward_parser.parse_mailbox",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{email_forward_parser-0.2.2 → email_forward_parser-0.2.3}/emailforwardparser/forward_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|