Skip to content

Commit

Permalink
Merge branch 'main' into feat/3013
Browse files Browse the repository at this point in the history
  • Loading branch information
jamshale authored Jun 5, 2024
2 parents 6f9d0c8 + d232e60 commit 17e250f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from datetime import datetime
from typing import Dict, List, Optional, Sequence, Tuple, Union

import pytz
from dateutil import tz
from dateutil.parser import ParserError
from dateutil.parser import parse as dateutil_parser
from jsonpath_ng import parse
Expand Down Expand Up @@ -613,10 +613,9 @@ def string_to_timezone_aware_datetime(self, datetime_str: str) -> datetime:
if PYTZ_TIMEZONE_PATTERN.search(datetime_str):
result = PYTZ_TIMEZONE_PATTERN.search(datetime_str).group(1)
datetime_str = datetime_str.replace(result, "")
return dateutil_parser(datetime_str).replace(tzinfo=pytz.timezone(result))
return dateutil_parser(datetime_str).replace(tzinfo=tz.gettz(result))
else:
utc = pytz.UTC
return dateutil_parser(datetime_str).replace(tzinfo=utc)
return dateutil_parser(datetime_str).replace(tzinfo=tz.UTC)

def validate_patch(self, to_check: any, _filter: Filter) -> bool:
"""Apply filter on match_value.
Expand Down
11 changes: 5 additions & 6 deletions aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
"""BbsBlsSignature2020 class."""

from datetime import datetime, timezone
from pytz import utc
from datetime import datetime
from typing import List, Optional, Union

from ....wallet.util import b64_to_bytes, bytes_to_b64
from dateutil import tz

from ....wallet.util import b64_to_bytes, bytes_to_b64
from ..crypto import _KeyPair as KeyPair
from ..document_loader import DocumentLoaderMethod
from ..error import LinkedDataProofException
from ..purposes import _ProofPurpose as ProofPurpose
from ..validation_result import ProofResult

from .bbs_bls_signature_2020_base import BbsBlsSignature2020Base


Expand Down Expand Up @@ -60,9 +59,9 @@ async def create_proof(
# Set created if not already set
if not proof.get("created"):
# Use class date, or now
date = self.date or datetime.now(timezone.utc)
date = self.date or datetime.now(tz.UTC)
if not date.tzinfo:
date = utc.localize(date)
date = date.replace(tzinfo=tz.UTC)
proof["created"] = date.isoformat(timespec="seconds")

# Allow purpose to update the proof; the `proof` is in the
Expand Down
8 changes: 4 additions & 4 deletions aries_cloudagent/vc/ld_proofs/suites/linked_data_signature.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"""Linked Data Signature class."""

from abc import abstractmethod, ABCMeta
from abc import ABCMeta, abstractmethod
from datetime import datetime, timezone
from hashlib import sha256
from pytz import utc
from typing import Optional, Union

from dateutil import tz

from ..constants import SECURITY_CONTEXT_URL
from ..document_loader import DocumentLoaderMethod
from ..error import LinkedDataProofException
from ..purposes import _ProofPurpose as ProofPurpose
from ..validation_result import ProofResult

from .linked_data_proof import LinkedDataProof


Expand Down Expand Up @@ -99,7 +99,7 @@ async def create_proof(
# Use class date, or now
date = self.date or datetime.now(timezone.utc)
if not date.tzinfo:
date = utc.localize(date)
date = date.replace(tzinfo=tz.UTC)
proof["created"] = date.isoformat(timespec="seconds")

# Allow purpose to update the proof; the `proof` is in the
Expand Down
11 changes: 5 additions & 6 deletions aries_cloudagent/vc/vc_ld/models/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
from datetime import datetime
from typing import List, Optional, Union

from pytz import utc

from dateutil import tz
from marshmallow import INCLUDE, ValidationError, fields, post_dump

from ....messaging.models.base import BaseModel, BaseModelSchema
from ....messaging.valid import (
CREDENTIAL_CONTEXT_EXAMPLE,
CREDENTIAL_CONTEXT_VALIDATE,
CREDENTIAL_SUBJECT_EXAMPLE,
CREDENTIAL_SUBJECT_VALIDATE,
CREDENTIAL_STATUS_EXAMPLE,
CREDENTIAL_STATUS_VALIDATE,
CREDENTIAL_SUBJECT_EXAMPLE,
CREDENTIAL_SUBJECT_VALIDATE,
CREDENTIAL_TYPE_EXAMPLE,
CREDENTIAL_TYPE_VALIDATE,
RFC3339_DATETIME_EXAMPLE,
Expand Down Expand Up @@ -176,7 +175,7 @@ def issuance_date(self, date: Union[str, datetime]):
"""Setter for issuance date."""
if isinstance(date, datetime):
if not date.tzinfo:
date = utc.localize(date)
date = date.replace(tzinfo=tz.UTC)
date = date.isoformat()

self._issuance_date = date
Expand All @@ -191,7 +190,7 @@ def expiration_date(self, date: Union[str, datetime, None]):
"""Setter for expiration date."""
if isinstance(date, datetime):
if not date.tzinfo:
date = utc.localize(date)
date = date.replace(tzinfo=tz.UTC)
date = date.isoformat()

self._expiration_date = date
Expand Down
59 changes: 29 additions & 30 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,47 @@
sys.path.insert(0, os.path.abspath(".."))

autodoc_mock_imports = [
"setup",
"nacl",
"indy",
"aiohttp_apispec",
"aiohttp_cors",
"aiohttp",
"aiohttp_apispec",
"base58",
"msgpack",
"pytest",
"aioredis",
"anoncreds",
"aries_askar",
"async_timeout",
"asynctest",
"markdown",
"prompt_toolkit",
"multicodec",
"base58",
"configargparse",
"pyld",
"pydid",
"aries_askar",
"indy_vdr",
"aioredis",
"dateutil",
"deepmerge",
"did_peer_2",
"did_peer_4",
"ecdsa",
"indy_credx",
"dateutil",
"packaging",
"indy_vdr",
"indy",
"jsonpath_ng",
"unflatten",
"qrcode",
"rlp",
"nest_asyncio",
"jwt",
"markdown",
"marshmallow",
"typing_extensions",
"async_timeout",
"msgpack",
"multicodec",
"multiformats",
"nacl",
"nest_asyncio",
"packaging",
"portalocker",
"prompt_toolkit",
"pydid",
"pyld",
"pytest",
"pythonjsonlogger",
"jwt",
"yaml",
"pytz",
"multiformats",
"qrcode",
"rlp",
"sd_jwt",
"anoncreds",
"did_peer_2",
"did_peer_4",
"setup",
"typing_extensions",
"unflatten",
"yaml",
]

# "aries_cloudagent.tests.test_conductor",
Expand Down
16 changes: 3 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pyld="^2.0.4"
pynacl="~1.5.0"
python-dateutil="~2.8.1"
python-json-logger="~2.0.7"
pytz="~2021.1"
pyyaml="~6.0.1"
qrcode = {version = ">=6.1,<7.0", extras = ["pil"]}
requests="~2.31.0"
Expand Down

0 comments on commit 17e250f

Please sign in to comment.