def get(self, context_id, address_list):
        """Get the values associated with list of addresses, for a specific
        context referenced by context_id.

        Args:
            context_id (str): the return value of create_context, referencing
                a particular context.
            address_list (list): a list of address strs

        Returns:
            values_list (list): a list of (address, value) tuples

        Raises:
            AuthorizationException: Raised when an address in address_list is
                not authorized either by not being in the inputs for the
                txn associated with this context, or it is under a namespace
                but the characters that are under the namespace are not valid
                address characters.
        """

        if context_id not in self._contexts:
            return []
        for add in address_list:
            if not self.address_is_valid(address=add):
                raise AuthorizationException(address=add)

        context = self._contexts[context_id]

        addresses_in_ctx = [add for add in address_list if add in context]
        addresses_not_in_ctx = list(set(address_list) - set(addresses_in_ctx))

        values = context.get(addresses_in_ctx)
        values_list = list(zip(addresses_in_ctx, values))
        if addresses_not_in_ctx:
            # Validate the addresses that won't be validated by a direct get on
            # the context.
            for address in addresses_not_in_ctx:
                context.validate_read(address)
            try:
                address_values, reads = self._find_address_values_in_chain(
                    base_contexts=[context_id],
                    addresses_to_find=addresses_not_in_ctx)
            except KeyError:
                # This is in the exceptional case when a txn is in flight
                # and so the context may not exist but the tp is asking
                # about it.
                return []

            values_list.extend(address_values)

            if reads:
                tree = MerkleDatabase(self._database, context.merkle_root)
                add_values = []
                for add in reads:
                    value = None
                    try:
                        value = tree.get(add)
                    except KeyError:
                        # The address is not in the radix tree/merkle tree
                        pass
                    add_values.append((add, value))
                values_list.extend(add_values)

            values_list.sort(key=lambda x: address_list.index(x[0]))

        return values_list
def get ( self , context_id , address_list ) : if context_id not in self . _contexts : return [ ] for add in address_list : if not self . address_is_valid ( address = add ) : raise AuthorizationException ( address = add ) context = self . _contexts [ context_id ] addresses_in_ctx = [ add for add in address_list if add in context ] addresses_not_in_ctx = list ( set ( address_list ) - set ( addresses_in_ctx ) ) values = context . get ( addresses_in_ctx ) values_list = list ( zip ( addresses_in_ctx , values ) ) if addresses_not_in_ctx : for address in addresses_not_in_ctx : context . validate_read ( address ) try : address_values , reads = self . _find_address_values_in_chain ( base_contexts = [ context_id ] , addresses_to_find = addresses_not_in_ctx ) except KeyError : return [ ] values_list . extend ( address_values ) if reads : tree = MerkleDatabase ( self . _database , context . merkle_root ) add_values = [ ] for add in reads : value = None try : value = tree . get ( add ) except KeyError : pass add_values . append ( ( add , value ) ) values_list . extend ( add_values ) values_list . sort ( key = lambda x : address_list . index ( x [ 0 ] ) ) return values_list
Get the values associated with list of addresses, for a specific
        context referenced by context_id.

        Args:
            context_id (str): the return value of create_context, referencing
                a particular context.
            address_list (list): a list of address strs

        Returns:
            values_list (list): a list of (address, value) tuples

        Raises:
            AuthorizationException: Raised when an address in address_list is
                not authorized either by not being in the inputs for the
                txn associated with this context, or it is under a namespace
                but the characters that are under the namespace are not valid
                address characters.