Skip to content
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

Failure to serialize EmailQueryFilterCondition with just "before" value #109

Closed
EliRibble opened this issue Jan 8, 2024 · 1 comment
Closed

Comments

@EliRibble
Copy link

call = EmailQuery(
            filter=EmailQueryFilterCondition(
                before=datetime.now(),
            ),
        )
APIRequest.from_calls("account_id", calls)

Fails with a stack trace:

jmapc/api.py:93: in from_calls
method_calls = [
jmapc/api.py:96: in
c.method.to_dict(
jmapc/serializer.py:130: in to_dict
return todict.postprocess(super().to_dict(*args, **kwargs))
../../.cache/pypoetry/virtualenvs/jmapc-xqsIUHeQ-py3.9/lib/python3.9/site-packages/dataclasses_json/api.py:73: in to_dict
return _asdict(self, encode_json=encode_json)
../../.cache/pypoetry/virtualenvs/jmapc-xqsIUHeQ-py3.9/lib/python3.9/site-packages/dataclasses_json/core.py:393: in _asdict
value = _asdict(
../../.cache/pypoetry/virtualenvs/jmapc-xqsIUHeQ-py3.9/lib/python3.9/site-packages/dataclasses_json/core.py:401: in _asdict
return _encode_overrides(dict(result), _user_overrides_or_exts(obj),
../../.cache/pypoetry/virtualenvs/jmapc-xqsIUHeQ-py3.9/lib/python3.9/site-packages/dataclasses_json/core.py:122: in _encode_overrides
v = encoder(v) if encoder is not None else v

dt = None

def datetime_encode(dt: datetime) -> str:
return f"{dt.replace(tzinfo=None).isoformat()}Z"
E AttributeError: 'NoneType' object has no attribute 'replace'

jmapc/serializer.py:18: AttributeError

@EliRibble
Copy link
Author

Nevermind, problem on my branch only.

smkent added a commit that referenced this issue Jan 15, 2025
Applied updates from upstream project template commits:

smkent/cookie-python@dee411e...2db1e07

*   2db1e07 Merge pull request #115 from smkent/pypi-fix
|\
| * fea08ad Fix cruft metadata, disable test PyPI publishing
|/
*   8b31163 Merge pull request #114 from smkent/manage-cookie
|\
| * b94ce61 Update project template cruft, dependencies
|/
*   45a5e60 Merge pull request #113 from smkent/pypi
|\
| * 5a7067d Configure PyPI trusted publishing
|/
*   b1f4625 Merge pull request #112 from smkent/pypi
|\
| * 25c7106 Update `gh-action-pypi-publish` argument names to resolve warnings
|/
*   1e22b05 Merge pull request #111 from smkent/python3.13
|\
| * b8f3c04 Add Python 3.13 to CI jobs
|/
*   51f6060 Merge pull request #110 from smkent/manage-cookie
|\
| * 44dc53a Update project template cruft, dependencies
|/
* 2921bf1 Merge pull request #109 from smkent/poetry
* 3ebdf29 Set `pyupgrade` minimum Python version to 3.9
* 695dd72 Update README for poetry-dynamic-versioning
* d67bbc5 Require `toml` dependency on Python < 3.11
* 024fe58 Clean up Poetry environments at end of `manage-cookie update`
* 3cb4ee6 Clean up Poetry environments at end of `new_cookie` fixture
* f6bdc98 Migrate `new_cookie` fixture to `conftest.py`
* c375378 Convert `temp_dir` to `Path` in unit tests
* 145dc85 Update virtual env management in unit tests for Poetry 2.0
* eda1848 Migrate to Poetry 2.0

Updated project dependencies via `poetry update`:

Package operations: 0 installs, 42 updates, 0 removals

- Updating six (1.16.0 -> 1.17.0)
- Updating certifi (2024.7.4 -> 2024.12.14)
- Updating charset-normalizer (3.3.2 -> 3.4.1)
- Updating idna (3.7 -> 3.10)
- Updating markupsafe (2.1.5 -> 3.0.2)
- Updating pygments (2.18.0 -> 2.19.1)
- Updating smmap (5.0.1 -> 5.0.2)
- Updating types-python-dateutil (2.9.0.20240316 -> 2.9.0.20241206)
- Updating urllib3 (2.2.2 -> 2.3.0)
- Updating click (8.1.7 -> 8.1.8)
- Updating distlib (0.3.8 -> 0.3.9)
- Updating filelock (3.15.4 -> 3.16.1)
- Updating jinja2 (3.1.4 -> 3.1.5)
- Updating packaging (24.1 -> 24.2)
- Updating gitdb (4.0.11 -> 4.0.12)
- Updating pycodestyle (2.9.1 -> 2.12.1)
- Updating platformdirs (4.2.2 -> 4.3.6)
- Updating pyyaml (6.0.1 -> 6.0.2)
- Updating rich (13.7.1 -> 13.9.4)
- Updating pyflakes (2.5.0 -> 3.2.0)
- Updating pbr (6.0.0 -> 6.1.0)
- Updating attrs (23.2.0 -> 24.3.0)
- Updating coverage (7.5.4 -> 7.6.10)
- Updating flake8 (5.0.4 -> 7.1.1)
- Updating gitpython (3.1.43 -> 3.1.44)
- Updating identify (2.6.0 -> 2.6.5)
- Updating marshmallow (3.21.3 -> 3.25.1)
- Updating pytest (8.2.2 -> 8.3.4)
- Updating stevedore (5.2.0 -> 5.4.0)
- Updating termcolor (2.4.0 -> 2.5.0)
- Updating typer (0.12.3 -> 0.15.1)
- Updating virtualenv (20.26.3 -> 20.28.1)
- Updating bandit (1.7.9 -> 1.8.2)
- Updating black (24.4.2 -> 24.10.0)
- Updating flake8-bugbear (23.3.12 -> 24.12.12)
- Updating cruft (2.15.0 -> 2.16.0)
- Updating mypy (1.10.1 -> 1.14.1)
- Updating poethepoet (0.27.0 -> 0.32.1)
- Updating pre-commit (3.5.0 -> 4.0.1)
- Updating pytest-cov (5.0.0 -> 6.0.0)
- Updating responses (0.25.3 -> 0.25.6)
- Updating types-requests (2.32.0.20240622 -> 2.32.0.20241016)

Writing lock file
smkent added a commit that referenced this issue Jan 15, 2025
Applied updates from upstream project template commits:

smkent/cookie-python@dee411e...7025e55

*   7025e55 Merge pull request #116 from smkent/python-versions
|\
| * 0679182 Set python version constraints to exclude 4.0 and above
|/
*   2db1e07 Merge pull request #115 from smkent/pypi-fix
|\
| * fea08ad Fix cruft metadata, disable test PyPI publishing
|/
*   8b31163 Merge pull request #114 from smkent/manage-cookie
|\
| * b94ce61 Update project template cruft, dependencies
|/
*   45a5e60 Merge pull request #113 from smkent/pypi
|\
| * 5a7067d Configure PyPI trusted publishing
|/
*   b1f4625 Merge pull request #112 from smkent/pypi
|\
| * 25c7106 Update `gh-action-pypi-publish` argument names to resolve warnings
|/
*   1e22b05 Merge pull request #111 from smkent/python3.13
|\
| * b8f3c04 Add Python 3.13 to CI jobs
|/
*   51f6060 Merge pull request #110 from smkent/manage-cookie
|\
| * 44dc53a Update project template cruft, dependencies
|/
* 2921bf1 Merge pull request #109 from smkent/poetry
* 3ebdf29 Set `pyupgrade` minimum Python version to 3.9
* 695dd72 Update README for poetry-dynamic-versioning
* d67bbc5 Require `toml` dependency on Python < 3.11
* 024fe58 Clean up Poetry environments at end of `manage-cookie update`
* 3cb4ee6 Clean up Poetry environments at end of `new_cookie` fixture
* f6bdc98 Migrate `new_cookie` fixture to `conftest.py`
* c375378 Convert `temp_dir` to `Path` in unit tests
* 145dc85 Update virtual env management in unit tests for Poetry 2.0
* eda1848 Migrate to Poetry 2.0

Updated project dependencies via `poetry update`:

Package operations: 0 installs, 42 updates, 0 removals

- Updating six (1.16.0 -> 1.17.0)
- Updating certifi (2024.7.4 -> 2024.12.14)
- Updating charset-normalizer (3.3.2 -> 3.4.1)
- Updating idna (3.7 -> 3.10)
- Updating markupsafe (2.1.5 -> 3.0.2)
- Updating pygments (2.18.0 -> 2.19.1)
- Updating smmap (5.0.1 -> 5.0.2)
- Updating types-python-dateutil (2.9.0.20240316 -> 2.9.0.20241206)
- Updating urllib3 (2.2.2 -> 2.3.0)
- Updating click (8.1.7 -> 8.1.8)
- Updating distlib (0.3.8 -> 0.3.9)
- Updating filelock (3.15.4 -> 3.16.1)
- Updating gitdb (4.0.11 -> 4.0.12)
- Updating jinja2 (3.1.4 -> 3.1.5)
- Updating pbr (6.0.0 -> 6.1.0)
- Updating platformdirs (4.2.2 -> 4.3.6)
- Updating pycodestyle (2.9.1 -> 2.12.1)
- Updating packaging (24.1 -> 24.2)
- Updating pyflakes (2.5.0 -> 3.2.0)
- Updating rich (13.7.1 -> 13.9.4)
- Updating pyyaml (6.0.1 -> 6.0.2)
- Updating attrs (23.2.0 -> 24.3.0)
- Updating coverage (7.5.4 -> 7.6.10)
- Updating flake8 (5.0.4 -> 7.1.1)
- Updating gitpython (3.1.43 -> 3.1.44)
- Updating identify (2.6.0 -> 2.6.5)
- Updating pytest (8.2.2 -> 8.3.4)
- Updating stevedore (5.2.0 -> 5.4.0)
- Updating marshmallow (3.21.3 -> 3.25.1)
- Updating typer (0.12.3 -> 0.15.1)
- Updating termcolor (2.4.0 -> 2.5.0)
- Updating virtualenv (20.26.3 -> 20.28.1)
- Updating bandit (1.7.9 -> 1.8.2)
- Updating black (24.4.2 -> 24.10.0)
- Updating cruft (2.15.0 -> 2.16.0)
- Updating flake8-bugbear (23.3.12 -> 24.12.12)
- Updating mypy (1.10.1 -> 1.14.1)
- Updating poethepoet (0.27.0 -> 0.32.1)
- Updating pre-commit (3.5.0 -> 4.0.1)
- Updating pytest-cov (5.0.0 -> 6.0.0)
- Updating responses (0.25.3 -> 0.25.6)
- Updating types-requests (2.32.0.20240622 -> 2.32.0.20241016)

Writing lock file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant