added json encoder for PoyCubes
This commit is contained in:
9
python/polycube_encoder.py
Normal file
9
python/polycube_encoder.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from json import JSONEncoder
|
||||
from typing import Any
|
||||
from polycube import PolyCube
|
||||
|
||||
class PolyCubeEncdoder(JSONEncoder):
|
||||
def default(self, o: Any) -> Any:
|
||||
if isinstance(o, PolyCube):
|
||||
return list(o.cubes)
|
||||
return super().default(o)
|
||||
Reference in New Issue
Block a user