Don't unnecessarily deprecate the getMetaDataEntry functionality

If possible you should group the metadata queries but otherwise this is still fine to use.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-23 13:43:30 +02:00
parent 99bf82dee3
commit 40b562093d
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276

View File

@ -26,17 +26,17 @@ class ContainerNode:
## Gets the metadata of the container that this node represents. ## Gets the metadata of the container that this node represents.
# Getting the metadata from the container directly is about 10x as fast. # Getting the metadata from the container directly is about 10x as fast.
# \return The metadata of the container in this node. # \return The metadata of the container in this node.
@deprecated("Get the metadata from the container with the ID of this node yourself.", "4.3")
def getMetadata(self): def getMetadata(self):
return ContainerRegistry.getInstance().findContainersMetadata(id = self.container_id)[0] return ContainerRegistry.getInstance().findContainersMetadata(id = self.container_id)[0]
## Get an entry from the metadata of the container that this node contains. ## Get an entry from the metadata of the container that this node contains.
#
# This is just a convenience function.
# \param entry The metadata entry key to return. # \param entry The metadata entry key to return.
# \param default If the metadata is not present or the container is not # \param default If the metadata is not present or the container is not
# found, the value of this default is returned. # found, the value of this default is returned.
# \return The value of the metadata entry, or the default if it was not # \return The value of the metadata entry, or the default if it was not
# present. # present.
@deprecated("Get the metadata from the container with the ID of this node yourself.", "4.3")
def getMetaDataEntry(self, entry: str, default: Any = None) -> Any: def getMetaDataEntry(self, entry: str, default: Any = None) -> Any:
container_metadata = ContainerRegistry.getInstance().findContainersMetadata(id = self.container_id) container_metadata = ContainerRegistry.getInstance().findContainersMetadata(id = self.container_id)
if len(container_metadata) == 0: if len(container_metadata) == 0: