8000 Added support for Python 3.11 and updated dependencies #355 by mjcaley · Pull Request #356 · mjcaley/aiospamc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added support for Python 3.11 and updated dependencies #355 #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.x'
- name: Install Poetry
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.x'
- name: Install Poetry
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.x'
- name: Install Poetry
run: |
python -m pip install --upgrade pip --disable-pip-version-check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.7', '3.8', '3.9', '3.10']
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Setup Python
Expand Down
2 changes: 1 addition & 1 deletion aiospamc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
symbols,
tell,
)
from .options import ActionOption, MessageClassOption
from .header_values import ActionOption, MessageClassOption


__author__ = "Michael Caley"
Expand Down
3 changes: 1 addition & 2 deletions aiospamc/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

from .client import Client
from .connections import Timeout
from .header_values import MessageClassValue
from .options import ActionOption, MessageClassOption
from .header_values import ActionOption, MessageClassOption, MessageClassValue
from .incremental_parser import parse_set_remove_value
from .responses import Response
from .requests import Request
Expand Down
26 changes: 22 additions & 4 deletions aiospamc/header_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

"""Collection of request and response header value objects."""

from enum import Enum
import getpass
from dataclasses import dataclass, asdict
from typing import Any, Dict

from .options import ActionOption, MessageClassOption
from typing import Any, Dict, Optional


class HeaderValue:
Expand Down Expand Up @@ -70,6 +69,13 @@ def __bytes__(self) -> bytes:
return str(self.length).encode("ascii")


class MessageClassOption(Enum):
"""Option to be used for the MessageClass header."""

spam = "spam"
ham = "ham"


@dataclass
class MessageClassValue(HeaderValue):
"""MessageClass header. Used to specify whether a message is 'spam' or
Expand All @@ -87,11 +93,23 @@ def to_dict(self) -> Dict[str, Any]:
return {"value": self.value.value}


@dataclass
class ActionOption:
"""Option to be used in the DidRemove, DidSet, Set, and Remove headers.

:param local: An action will be performed on the SPAMD service's local database.
:param remote: An action will be performed on the SPAMD service's remote database.
"""

local: Optional[bool]
remote: Optional[bool]


@dataclass
class SetOrRemoveValue(HeaderValue):
"""Base class for headers that implement "local" and "remote" rules."""

action: ActionOption = ActionOption(local=False, remote=False)
action: ActionOption

def __bytes__(self) -> bytes:
if not self.action.local and not self.action.remote:
Expand Down
3 changes: 2 additions & 1 deletion aiospamc/incremental_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@

from .exceptions import ParseError, NotEnoughDataError, TooMuchDataError
from .header_values import (
ActionOption,
BytesHeaderValue,
CompressValue,
ContentLengthValue,
GenericHeaderValue,
HeaderValue,
MessageClassOption,
MessageClassValue,
SetOrRemoveValue,
SpamValue,
UserValue,
)
from .options import ActionOption, MessageClassOption


class States(Enum):
Expand Down
25 changes: 0 additions & 25 deletions aiospamc/options.py

This file was deleted.

10 changes: 1 addition & 9 deletions docs/aiospamc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ aiospamc.exceptions module
:show-inheritance:

aiospamc.frontend module
----------------------
------------------------

.. automodule:: aiospamc.frontend
:members:
Expand All @@ -44,14 +44,6 @@ aiospamc.incremental\_parser module
:undoc-members:
:show-inheritance:

aiospamc.options module
-----------------------

.. automodule:: aiospamc.options
:members:
:undoc-members:
:show-inheritance:

aiospamc.requests module
------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx==5.0.2
sphinx==5.3.0
reno==3.5.0
Loading
0