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

🐛 FIX: REST API date-time query #4959

Merged
merged 6 commits into from
Jul 28, 2021
Merged
Changes from 3 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
11 changes: 10 additions & 1 deletion aiida/common/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from functools import singledispatch
from itertools import chain
from operator import itemgetter

import pytz

from aiida.restapi.common.utils import DatetimePrecision
from aiida.common.constants import AIIDA_FLOAT_PRECISION
from aiida.common.exceptions import HashingError

Expand Down Expand Up @@ -279,6 +279,15 @@ def _(val, **kwargs):
return [_single_digest('uuid', val.bytes)]


@_make_hash.register(DatetimePrecision)
def _(datetime_precision, **kwargs):
""" Hashes for DatetimePrecision object
"""
return [_single_digest('dt_prec')] + list(
chain.from_iterable(_make_hash(i, **kwargs) for i in [datetime_precision.dtobj, datetime_precision.precision])
) + [_END_DIGEST]


@_make_hash.register(Folder)
def _(folder, **kwargs):
"""
Expand Down