Skip to content

Commit

Permalink
switch to simplejson
Browse files Browse the repository at this point in the history
  • Loading branch information
jeriox committed Feb 9, 2024
1 parent d82d4fc commit ed2ad54
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 14 deletions.
109 changes: 108 additions & 1 deletion poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packages = [{include = "yaramo"}]
[tool.poetry.dependencies]
python = "^3.9"
pyproj = "^3.6.1"
simplejson = "^3.19.2"


[tool.poetry.group.dev.dependencies]
Expand Down
6 changes: 2 additions & 4 deletions yaramo/base_element.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import json
import simplejson as json
from typing import Tuple
from uuid import uuid4

from yaramo.utils import CustomJSONEncoder


class BaseElement(object):
def __init__(self, uuid: str = None, name: str = None, **kwargs) -> None:
Expand All @@ -28,4 +26,4 @@ def to_serializable(self) -> Tuple[dict, dict]:
return self.__dict__, {}

def to_json(self) -> str:
return json.dumps(self.to_serializable()[0], cls=CustomJSONEncoder)
return json.dumps(self.to_serializable()[0], iterable_as_array=True)
2 changes: 1 addition & 1 deletion yaramo/topology.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json
import simplejson as json

from yaramo.base_element import BaseElement
from yaramo.edge import Edge
Expand Down
8 changes: 0 additions & 8 deletions yaramo/utils.py

This file was deleted.

0 comments on commit ed2ad54

Please sign in to comment.