-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: object_default/schema #677
Conversation
younesdessia
commented
Feb 28, 2024
- What kind of changes does this PR introduce?
- 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:
- No
- Other information:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need more context about this, as None as default value should directly happen with objects. We should normally have an Optional schema
@GhislainJ 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 to reprduce the issue you can just do this: |
Approved but adding tests are needed to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests using you simplified repro case should be added
Done ! |