MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / add_property

Method add_property

monai/bundle/workflows.py:214–230  ·  view source on GitHub ↗

Besides the default predefined properties, some 3rd party applications may need the bundle definition to provide additional properties for the specific use cases, if the bundle can't provide the property, means it can't work with the application. This utility adds th

(self, name: str, required: str, desc: str | None = None)

Source from the content-addressed store, hash-verified

212 return self.meta_file
213
214 def add_property(self, name: str, required: str, desc: str | None = None) -> None:
215 """
216 Besides the default predefined properties, some 3rd party applications may need the bundle
217 definition to provide additional properties for the specific use cases, if the bundle can't
218 provide the property, means it can't work with the application.
219 This utility adds the property for the application requirements check and access.
220
221 Args:
222 name: the name of target property.
223 required: whether the property is "must-have".
224 desc: descriptions for the property.
225 """
226 if self.properties is None:
227 self.properties = {}
228 if name in self.properties:
229 logger.warning(f"property '{name}' already exists in the properties list, overriding it.")
230 self.properties[name] = {BundleProperty.DESC: desc, BundleProperty.REQUIRED: required}
231
232 def check_properties(self) -> list[str] | None:
233 """

Callers 2

add_propertyMethod · 0.45

Calls

no outgoing calls

Tested by 1