Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d98ef95b5e9a47af25b0564a60ab6461d549f8eb
Author: Georges Toth <[email protected]>
Date:   Wed Oct 2 23:50:56 2024 +0200

    remove deprecated note; fix rtd config

commit 17d65599708ebc4098c328d26613e8e483f82a87
Author: Georges Toth <[email protected]>
Date:   Wed Oct 2 23:46:15 2024 +0200

    add type casts

commit 70aef6fa0cf079e6855374843a5e942186846ba0
Author: Georges Toth <[email protected]>
Date:   Wed Oct 2 23:29:44 2024 +0200

    upgrade typings to new format

commit 7d2e9d880a808680b235721914cddccb04657c9c
Author: Georges Toth <[email protected]>
Date:   Wed Oct 2 23:29:08 2024 +0200

    remove pyre2; upgrade typings to new format
  • Loading branch information
sim0nx committed Oct 2, 2024
1 parent a0edaa7 commit 81e821d
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]


steps:
Expand Down
7 changes: 6 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

mkdocs:
configuration: mkdocs.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: "3"
install:
- method: pip
path: .
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]
### Breaking
- Set minimum supported Python version to 3.9
- Remove pyre2 as it hasn't been updated in a long time and regex seems to be the better lib here
- Remove long deprecated methods "decode_email", "decode_email_b"

### Changes
- Add ruff config
- Set minimum supported Python version to 3.8
- Add PY3.12 to tests

## [v1.17.5]
### Changes
Expand Down
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Code Health](https://codebeat.co/badges/d631cfb2-a7f8-476a-9d2e-58e58db95bc8)](https://codebeat.co/projects/github-com-govcert-lu-eml_parser-master)
[![Travis CI](https://travis-ci.com/GOVCERT-LU/eml_parser.svg?branch=master)](https://travis-ci.com/GOVCERT-LU/eml_parser)
[![Documentation Status](https://readthedocs.org/projects/eml-parser/badge/)](http://eml-parser.readthedocs.io)
[![PyPI](https://badge.fury.io/py/eml-parser.svg)](https://badge.fury.io/py/eml-parser)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/eml-parser.svg)](https://pypi.python.org/pypi/eml-parser/)
Expand Down Expand Up @@ -34,15 +33,6 @@ pip install eml_parser
#### **OSX** users
Make sure to install libmagic, else eml_parser will not work.

#### Python <=3.7.4 "rare header field parsing issue"
It has been reported (in #60) that there are parsing issues in some particular cases which seem
to be caused by a bug in the *email* module of the Python standard library. At least versions <=3.7.4 are affected.

Python versions >=3.7.11 are not affected. If you do get *KeyError* exceptions on header field parsing, you should
consider upgrading to a more recent version of Python.

-> Please open an issue if the error persists after upgrading.


### Example usage:
```python
Expand Down
10 changes: 0 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# eml_parser

[![Code Health](https://codebeat.co/badges/d631cfb2-a7f8-476a-9d2e-58e58db95bc8)](https://codebeat.co/projects/github-com-govcert-lu-eml_parser-master)
[![Travis CI](https://travis-ci.com/GOVCERT-LU/eml_parser.svg?branch=master)](https://travis-ci.com/GOVCERT-LU/eml_parser)
[![Documentation Status](https://readthedocs.org/projects/eml-parser/badge/)](http://eml-parser.readthedocs.io)
[![PyPI](https://badge.fury.io/py/eml-parser.svg)](https://badge.fury.io/py/eml-parser)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/eml-parser.svg)](https://pypi.python.org/pypi/eml-parser/)
Expand Down Expand Up @@ -43,15 +42,6 @@ pip install eml_parser[filemagic]
#### **OSX** users
Make sure to install libmagic, else eml_parser will not work.

#### Python <=3.7.4 "rare header field parsing issue"
It has been reported (in #60) that there are parsing issues in some particular cases which seem
to be caused by a bug in the *email* module of the Python standard library. At least versions <=3.7.4 are affected.

Python versions >=3.7.11 are not affected. If you do get *KeyError* exceptions on header field parsing, you should
consider upgrading to a more recent version of Python.

-> Please open an issue if the error persists after upgrading.

### Example usage
```python
import datetime
Expand Down
6 changes: 3 additions & 3 deletions eml_parser/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def decode_string(string: bytes, encoding: typing.Optional[str] = None) -> str:
return value


def workaround_bug_27257(msg: email.message.Message, header: str) -> typing.List[str]:
def workaround_bug_27257(msg: email.message.Message, header: str) -> list[str]:
"""Function to work around bug 27257 and just tries its best using the compat32 policy to extract any meaningful information, i.e. e-mail addresses.
Args:
Expand All @@ -136,7 +136,7 @@ def workaround_bug_27257(msg: email.message.Message, header: str) -> typing.List
Returns:
list: Returns a list of strings which represent e-mail addresses.
"""
return_value: typing.List[str] = []
return_value: list[str] = []

for value in workaround_field_value_parsing_errors(msg, header):
if value != '':
Expand All @@ -147,7 +147,7 @@ def workaround_bug_27257(msg: email.message.Message, header: str) -> typing.List
return return_value


def workaround_field_value_parsing_errors(msg: email.message.Message, header: str) -> typing.List[str]:
def workaround_field_value_parsing_errors(msg: email.message.Message, header: str) -> list[str]:
"""Function to work around field value parsing errors by trying a best effort parsing using the compat32 policy to extract any meaningful information.
Args:
Expand Down
Loading

0 comments on commit 81e821d

Please sign in to comment.