Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #215 from Clariteia/0.0.11
Browse files Browse the repository at this point in the history
0.0.11
  • Loading branch information
andrea-mucci authored May 12, 2021
2 parents beafa17 + c29dc50 commit 1438d52
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@ History
* Added JSON Binary format
* Improved LMDB support for Saga Binary format

0.0.11 (2021-05-12)
------------------

* EventModel modified the list of items from Aggregate to MinosModel, for better compatibility
* Added DB Storage Abstract class
* Added code documentation
7 changes: 6 additions & 1 deletion minos/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Minos framework can not be copied and/or distributed without the express permission of Clariteia SL.
"""

__version__ = "0.0.10"
__version__ = "0.0.11"

from .broker import (
MinosBaseBroker,
Expand Down Expand Up @@ -63,6 +63,11 @@
MinosRPCHeadersRequest,
MinosRPCResponse,
)
from .meta import (
classproperty,
property_or_classproperty,
self_or_classmethod,
)
from .model import (
ARRAY,
BOOLEAN,
Expand Down
11 changes: 4 additions & 7 deletions minos/common/protocol/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
Minos framework can not be copied and/or distributed without the express permission of Clariteia SL.
"""
import json
from base64 import (
b64decode,
b64encode,
)
from typing import (
Any,
)

import orjson

from .abc import (
MinosBinaryProtocol,
)
Expand All @@ -31,7 +28,7 @@ def encode(cls, data: Any, *args, **kwargs) -> bytes:
:param kwargs: Additional named arguments.
:return: A bytes instance.
"""
return b64encode(json.dumps(data).encode())
return orjson.dumps(data)

@classmethod
def decode(cls, data: bytes) -> Any:
Expand All @@ -40,4 +37,4 @@ def decode(cls, data: bytes) -> Any:
:param data: bytes data to be decoded.
:return: De decoded data.
"""
return json.loads(b64decode(data.decode()))
return orjson.loads(data)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
setup_requires=setup_requirements,
test_suite="tests",
tests_require=test_requirements,
version="0.0.10",
version="0.0.11",
zip_safe=False,
)
2 changes: 1 addition & 1 deletion tests/test_common/test_protocol/test_avro.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_encode_raises(self):

def test_decode_raises(self):
with self.assertRaises(MinosProtocolException):
MinosAvroValuesDatabase.decode(bytes())
MinosAvroProtocol.decode(bytes())


class TestMinosAvroValuesDatabase(unittest.TestCase):
Expand Down

0 comments on commit 1438d52

Please sign in to comment.