@@ -160,15 +160,15 @@ class RelationshipTool(Tool):
160160 """
161161 A relationship tool to be added to a Project's ontology.
162162
163- To instantiate, the "tool" and "name" parameters must
164- be passed in .
163+ The "tool" parameter is automatically set to Tool.Type.RELATIONSHIP
164+ and doesn't need to be passed during instantiation .
165165
166166 The "classifications" parameter holds a list of Classification objects.
167167 This can be used to add nested classifications to a tool.
168168
169169 Example(s):
170170 tool = RelationshipTool(
171- name = "Relationship Tool example")
171+ name = "Relationship Tool example",
172172 constraints = [
173173 ("source_tool_feature_schema_id_1", "target_tool_feature_schema_id_1"),
174174 ("source_tool_feature_schema_id_2", "target_tool_feature_schema_id_2")
@@ -180,7 +180,7 @@ class RelationshipTool(Tool):
180180 tool.add_classification(classification)
181181
182182 Attributes:
183- tool: Tool.Type.RELATIONSHIP
183+ tool: Tool.Type.RELATIONSHIP (automatically set)
184184 name: (str)
185185 required: (bool)
186186 color: (str)
@@ -191,13 +191,12 @@ class RelationshipTool(Tool):
191191 constraints: (list of [str, str])
192192 """
193193
194- tool : Type = Tool .Type .RELATIONSHIP
195194 constraints : Optional [List [Tuple [str , str ]]] = None
196195
197196 def __post_init__ (self ):
197+ # Ensure tool type is set to RELATIONSHIP
198+ self .tool = Tool .Type .RELATIONSHIP
198199 super ().__post_init__ ()
199- if self .tool != Tool .Type .RELATIONSHIP :
200- raise ValueError ("RelationshipTool can only be used with Tool.Type.RELATIONSHIP" )
201200
202201 def asdict (self ) -> Dict [str , Any ]:
203202 result = super ().asdict ()
0 commit comments