Skip to content

Commit

Permalink
Merge pull request #99 from smkent/manage-cookie
Browse files Browse the repository at this point in the history
Update project template cruft, dependencies
  • Loading branch information
smkent authored Feb 23, 2023
2 parents 1750d15 + 88d041e commit 479d634
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/smkent/cookie-python",
"commit": "4fe836a1166d38f1e6aab9fba38d7a5bfce95213",
"commit": "ae5c42761c7903b4c6238c1c6e8f91121866db89",
"context": {
"cookiecutter": {
"project_name": "jmapc",
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/actions/python-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
python-version: ${{ inputs.python_version }}
cache: poetry

- name: 🛠️ Install project dependencies
- name: 🛠️ Install project and dependencies
shell: bash
env:
# https://github.com/python-poetry/poetry/issues/1917
Expand All @@ -35,8 +35,10 @@ runs:
run: |
poetry install
poetry lock --check
[ "$(poetry version -s)" != "0.0.0" ] \
PROJECT_VERSION=$(poetry version -s)
[ "${PROJECT_VERSION}" != "0.0.0" ] \
|| { echo "Versioning broken"; exit 1; }
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_ENV
- name: 🪝 Cache pre-commit hooks
uses: actions/cache@v3
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ repos:
- flake8-pyproject
- flake8-simplify
- pep8-naming
- repo: https://github.com/pycqa/autoflake
rev: v2.0.1
hooks:
- id: autoflake
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--keep-runtime-typing"]
- repo: local
hooks:
- id: mypy
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class CoreBase:
method_namespace: Optional[str] = "Core"
using = set([constants.JMAP_URN_CORE])
using = {constants.JMAP_URN_CORE}


class EchoMethod:
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class EmailBase:
method_namespace: Optional[str] = "Email"
using = set([constants.JMAP_URN_MAIL])
using = {constants.JMAP_URN_MAIL}


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/email_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class EmailSubmissionBase:
method_namespace: Optional[str] = "EmailSubmission"
using = set([constants.JMAP_URN_SUBMISSION])
using = {constants.JMAP_URN_SUBMISSION}


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class IdentityBase:
method_namespace: Optional[str] = "Identity"
using = set([constants.JMAP_URN_SUBMISSION])
using = {constants.JMAP_URN_SUBMISSION}


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class MailboxBase:
method_namespace: Optional[str] = "Mailbox"
using = set([constants.JMAP_URN_MAIL])
using = {constants.JMAP_URN_MAIL}


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/search_snippet.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class SearchSnippetBase:
method_namespace: Optional[str] = "SearchSnippet"
using = set([constants.JMAP_URN_MAIL])
using = {constants.JMAP_URN_MAIL}


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion jmapc/methods/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class ThreadBase:
method_namespace: Optional[str] = "Thread"
using = set([constants.JMAP_URN_MAIL])
using = {constants.JMAP_URN_MAIL}


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion jmapc/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def postprocess(
and isinstance(value, list)
and len(value) > 0
and isinstance(value[0], dict)
and set(value[0].keys()) == set(["name", "value"])
and set(value[0].keys()) == {"name", "value"}
):
data = self.fix_email_headers(data, key, value)
return data
Expand Down
116 changes: 58 additions & 58 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["poetry-core>=1.2.0", "poetry-dynamic-versioning"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry]
name = "jmapc"
Expand Down
4 changes: 2 additions & 2 deletions tests/methods/test_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_custom_method(
expect_jmap_call(http_responses, expected_request, response)
method = CustomMethod(data=test_data)
method.jmap_method = "Custom/method"
method.using = set([constants.JMAP_URN_MAIL])
method.using = {constants.JMAP_URN_MAIL}
assert method.to_dict() == test_data
resp = client.request(method)
assert resp == CustomResponse(account_id="u1138", data=test_data)
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_custom_method_as_result_reference_target(
expect_jmap_call(http_responses, expected_request, response)
method = CustomMethod(data=test_data)
method.jmap_method = "Custom/method"
method.using = set([constants.JMAP_URN_MAIL])
method.using = {constants.JMAP_URN_MAIL}
assert method.to_dict() == test_data
resp = client.request([method, MailboxGet(ids=Ref("/example"))])
assert resp == [
Expand Down

0 comments on commit 479d634

Please sign in to comment.