Skip to content

Commit 132da83

Browse files
authored
➕ ✨ ⚡ replace json with orjson (#214)
* ➕ ✨ ⚡ replace json with orjson * ⬆️ Update version to 1.1.1b1 * 🎨 * ⬆️ Upgrade aiohttp_retry
1 parent 323154b commit 132da83

File tree

356 files changed

+714
-713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

356 files changed

+714
-713
lines changed

aries_cloudcontroller/api_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import datetime
1616
import decimal
17-
import json
1817
import mimetypes
1918
import os
2019
import re
@@ -23,6 +22,7 @@
2322
from typing import Dict, List, Optional, Tuple, Union
2423
from urllib.parse import quote
2524

25+
import orjson
2626
from dateutil.parser import parse
2727
from pydantic import SecretStr
2828

@@ -389,7 +389,7 @@ def deserialize(
389389
# fetch data from response object
390390
if content_type is None:
391391
try:
392-
data = json.loads(response_text)
392+
data = orjson.loads(response_text)
393393
except ValueError:
394394
data = response_text
395395
elif re.match(
@@ -400,7 +400,7 @@ def deserialize(
400400
if response_text == "":
401401
data = ""
402402
else:
403-
data = json.loads(response_text)
403+
data = orjson.loads(response_text)
404404
elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE):
405405
data = response_text
406406
else:
@@ -500,7 +500,7 @@ def parameters_to_url_query(self, params, collection_formats):
500500
if isinstance(v, (int, float)):
501501
v = str(v)
502502
if isinstance(v, dict):
503-
v = json.dumps(v)
503+
v = orjson.dumps(v).decode()
504504

505505
if k in collection_formats:
506506
collection_format = collection_formats[k]

aries_cloudcontroller/models/action_menu_fetch_result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field
2222
from typing_extensions import Self
2323

@@ -46,7 +46,7 @@ def to_json(self) -> str:
4646
@classmethod
4747
def from_json(cls, json_str: str) -> Optional[Self]:
4848
"""Create an instance of ActionMenuFetchResult from a JSON string"""
49-
return cls.from_dict(json.loads(json_str))
49+
return cls.from_dict(orjson.loads(json_str))
5050

5151
def to_dict(self) -> Dict[str, Any]:
5252
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/add_proof.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel
2222
from typing_extensions import Self
2323

@@ -49,7 +49,7 @@ def to_json(self) -> str:
4949
@classmethod
5050
def from_json(cls, json_str: str) -> Optional[Self]:
5151
"""Create an instance of AddProof from a JSON string"""
52-
return cls.from_dict(json.loads(json_str))
52+
return cls.from_dict(orjson.loads(json_str))
5353

5454
def to_dict(self) -> Dict[str, Any]:
5555
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/add_proof_response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel
2222
from typing_extensions import Self
2323

@@ -45,7 +45,7 @@ def to_json(self) -> str:
4545
@classmethod
4646
def from_json(cls, json_str: str) -> Optional[Self]:
4747
"""Create an instance of AddProofResponse from a JSON string"""
48-
return cls.from_dict(json.loads(json_str))
48+
return cls.from_dict(orjson.loads(json_str))
4949

5050
def to_dict(self) -> Dict[str, Any]:
5151
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/admin_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field
2222
from typing_extensions import Self
2323

@@ -45,7 +45,7 @@ def to_json(self) -> str:
4545
@classmethod
4646
def from_json(cls, json_str: str) -> Optional[Self]:
4747
"""Create an instance of AdminConfig from a JSON string"""
48-
return cls.from_dict(json.loads(json_str))
48+
return cls.from_dict(orjson.loads(json_str))
4949

5050
def to_dict(self) -> Dict[str, Any]:
5151
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/admin_modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field, StrictStr
2222
from typing_extensions import Self
2323

@@ -47,7 +47,7 @@ def to_json(self) -> str:
4747
@classmethod
4848
def from_json(cls, json_str: str) -> Optional[Self]:
4949
"""Create an instance of AdminModules from a JSON string"""
50-
return cls.from_dict(json.loads(json_str))
50+
return cls.from_dict(orjson.loads(json_str))
5151

5252
def to_dict(self) -> Dict[str, Any]:
5353
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/admin_status.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field, StrictStr
2222
from typing_extensions import Self
2323

@@ -50,7 +50,7 @@ def to_json(self) -> str:
5050
@classmethod
5151
def from_json(cls, json_str: str) -> Optional[Self]:
5252
"""Create an instance of AdminStatus from a JSON string"""
53-
return cls.from_dict(json.loads(json_str))
53+
return cls.from_dict(orjson.loads(json_str))
5454

5555
def to_dict(self) -> Dict[str, Any]:
5656
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/admin_status_liveliness.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field, StrictBool
2222
from typing_extensions import Self
2323

@@ -45,7 +45,7 @@ def to_json(self) -> str:
4545
@classmethod
4646
def from_json(cls, json_str: str) -> Optional[Self]:
4747
"""Create an instance of AdminStatusLiveliness from a JSON string"""
48-
return cls.from_dict(json.loads(json_str))
48+
return cls.from_dict(orjson.loads(json_str))
4949

5050
def to_dict(self) -> Dict[str, Any]:
5151
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/admin_status_readiness.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field, StrictBool
2222
from typing_extensions import Self
2323

@@ -45,7 +45,7 @@ def to_json(self) -> str:
4545
@classmethod
4646
def from_json(cls, json_str: str) -> Optional[Self]:
4747
"""Create an instance of AdminStatusReadiness from a JSON string"""
48-
return cls.from_dict(json.loads(json_str))
48+
return cls.from_dict(orjson.loads(json_str))
4949

5050
def to_dict(self) -> Dict[str, Any]:
5151
"""Return the dictionary representation of the model using alias.

aries_cloudcontroller/models/aml_record.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
import json
1817
import pprint
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

20+
import orjson
2121
from pydantic import BaseModel, Field, StrictStr
2222
from typing_extensions import Self
2323

@@ -47,7 +47,7 @@ def to_json(self) -> str:
4747
@classmethod
4848
def from_json(cls, json_str: str) -> Optional[Self]:
4949
"""Create an instance of AMLRecord from a JSON string"""
50-
return cls.from_dict(json.loads(json_str))
50+
return cls.from_dict(orjson.loads(json_str))
5151

5252
def to_dict(self) -> Dict[str, Any]:
5353
"""Return the dictionary representation of the model using alias.

0 commit comments

Comments
 (0)