def available(self, *, resources: ResourceSet): rc = self.get_control_by_type(rtype=resources.get_type()) if rc is not None: rc.available(resource_set=resources) else: raise AuthorityException( Constants.UNSUPPORTED_RESOURCE_TYPE.format( resources.get_type()))
def abstract_clone_return(rset: ResourceSet) -> ResourceSet: """ Clones the resource set, but without any of the concrete sets. Preserves only the configuration properties. This method should be used when sending a redeem/extend/close request to an authority. @param rset resource set @return a resources set that is a copy of the current but without any concrete sets. """ return ResourceSet(units=rset.get_units(), rtype=rset.get_type(), sliver=rset.get_sliver())
def translate_resource_set(*, resource_set: ResourceSet) -> ResourceSetAvro: avro_rset = ResourceSetAvro() avro_rset.type = str(resource_set.get_type()) avro_rset.units = resource_set.get_units() avro_rset.set_sliver(sliver=resource_set.get_sliver()) return avro_rset