Skip to content

Commit

Permalink
Fix type error for py310 and py311. Increase pre-commit versions. Bum…
Browse files Browse the repository at this point in the history
…p version.
  • Loading branch information
fkantelberg committed Jun 14, 2023
1 parent de13521 commit 40cabf5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ repos:
- id: flake8
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.8.0
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.7.4
- repo: https://github.com/pylint-dev/pylint
rev: v2.17.4
hooks:
- id: pylint
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ include_package_data = True
package_dir =
= src
packages = find:
python_requires = >=3.7
python_requires = >=3.10
install_requires =
aiohttp-jinja2
aiosmtpd
pymap
passlib

[options.package_data]
* = *.js, *.css, *.html
Expand Down
2 changes: 1 addition & 1 deletion src/mail_devel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .service import Service

VERSION = "0.2.0"
VERSION = "0.3.0"
25 changes: 18 additions & 7 deletions src/mail_devel/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import logging
import signal
import sys
from argparse import Namespace
from contextlib import suppress

Expand All @@ -12,17 +13,27 @@
_logger = logging.getLogger(__name__)


# Manual patch for https://github.com/icgood/pymap/pull/138
original_func = SearchKey.__init__
# Manual patch for https://github.com/icgood/pymap/pull/138 for py3.10
if sys.version_info[:2] == (3, 10):
original_func = SearchKey.__init__

def patched_searchkey(self, key, filter_=None, inverse=False):
if isinstance(filter_, list):
filter_ = frozenset(filter_)
return original_func(self, key, filter_, inverse)

def patched_searchkey(self, key, filter_=None, inverse=False):
if isinstance(filter_, list):
filter_ = tuple(filter_)
return original_func(self, key, filter_, inverse)
SearchKey.__init__ = patched_searchkey

# Manual patch for https://github.com/icgood/pymap/issues/158 for py3.11
if sys.version_info[:2] == (3, 11):
original_func = SearchKey._get_filter

SearchKey.__init__ = patched_searchkey
def patched_get_filter(self, cls):
if cls == frozenset:
cls = tuple
return original_func(self, cls)

SearchKey._get_filter = patched_get_filter


async def sleep_forever() -> None:
Expand Down
1 change: 1 addition & 0 deletions src/mail_devel/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async def imap_context(args: argparse.Namespace) -> argparse.Namespace:
debug=args.debug,
cert=args.cert,
key=args.key,
passlib_cfg=None,
tls=False,
proxy_protocol=None,
inherited_sockets=None,
Expand Down

0 comments on commit 40cabf5

Please sign in to comment.