Closed younesdessia closed 7 months ago
@GhislainJ here is a case of reproduction
from typing import Optional
from dessia_common.core import DessiaObject
class ObjectTest(DessiaObject):
def __init__(self, name: str = "", measure: float = 1.1):
self.measure = measure
DessiaObject.__init__(self, name=name)
class InstantiateObject(DessiaObject):
def __init__(self, name: str = ""):
DessiaObject.__init__(self, name=name)
def compute(self, my_object: Optional[ObjectTest] = None):
return 404
from dessia_common.typings import MethodType
from dessia_common.workflow.blocks import InstantiateModel, ModelMethod
from dessia_common.workflow.core import Pipe, Workflow
from navalgroup_custom.dev_dc import InstantiateObject
block_0 = InstantiateModel(model_class=InstantiateObject, name="InstantateObject")
block_1 = ModelMethod(method_type=MethodType(InstantiateObject, 'compute'), name="compute")
blocks = [block_0, block_1]
pipe_1 = Pipe(block_0.outputs[0], block_1.inputs[0])
workflow = Workflow(blocks, [pipe_1], output=block_1.outputs[0], name="test")
Hi @GhislainJ
I checked with debug mode, for me there is no other problem except in the method object_default
, and the fix is correct.
to reprduce the issue you can just do this:
workflow.method_schemas
Another fix, replace None value of default_value
with UNDEFINED
in SchemaAttribute
class:
Approved but adding tests are needed to merge
Done !
What kind of changes does this PR introduce?
[X] Bug fix
[ ] new features
[ ] performance
[ ] docs update
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
[ ] Yes:
[X] No
Other information: