add start and finish write method calls to base object serialize
This commit is contained in:
Vendored
+6
-2
@@ -4,6 +4,7 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Python: Current File",
|
||||
"type": "python",
|
||||
@@ -13,10 +14,13 @@
|
||||
"justMyCode": false
|
||||
},
|
||||
{
|
||||
"name": "Python: Test debug config",
|
||||
"name": "Pytest",
|
||||
"type": "python",
|
||||
"request": "test",
|
||||
"request": "launch",
|
||||
"program": "poetry",
|
||||
"args": ["run", "pytest"],
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,12 +7,10 @@ from warnings import warn
|
||||
from typing import Any, Dict, List, Tuple
|
||||
from specklepy.objects.base import Base, DataChunk
|
||||
from specklepy.logging.exceptions import (
|
||||
SerializationException,
|
||||
SpeckleException,
|
||||
SpeckleWarning,
|
||||
)
|
||||
from specklepy.transports.abstract_transport import AbstractTransport
|
||||
import specklepy.objects.geometry
|
||||
import specklepy.objects.other
|
||||
|
||||
PRIMITIVES = (int, float, str, bool)
|
||||
@@ -72,6 +70,10 @@ class BaseObjectSerializer:
|
||||
object_builder.update(speckle_type=base.speckle_type)
|
||||
obj, props = base, base.get_serializable_attributes()
|
||||
|
||||
if self.write_transports:
|
||||
for wt in self.write_transports:
|
||||
wt.begin_write()
|
||||
|
||||
while props:
|
||||
prop = props.pop(0)
|
||||
value = getattr(obj, prop, None)
|
||||
@@ -174,6 +176,11 @@ class BaseObjectSerializer:
|
||||
|
||||
del self.lineage[-1]
|
||||
|
||||
|
||||
if self.write_transports:
|
||||
for wt in self.write_transports:
|
||||
wt.end_write()
|
||||
|
||||
return hash, object_builder
|
||||
|
||||
def traverse_value(self, obj: Any, detach: bool = False) -> Any:
|
||||
|
||||
Reference in New Issue
Block a user