def apply_to(self,
                 db: Union[BaseDB, ABC_Mutable_Mapping],
                 apply_deletes: bool = True) -> None:
        """
        Apply the changes in this diff to the given database.
        You may choose to opt out of deleting any underlying keys.

        :param apply_deletes: whether the pending deletes should be
            applied to the database
        """
        for key, value in self._changes.items():
            if value is DELETED:
                if apply_deletes:
                    try:
                        del db[key]
                    except KeyError:
                        pass
                else:
                    pass
            else:
                db[key] = value
def apply_to ( self , db : Union [ BaseDB , ABC_Mutable_Mapping ] , apply_deletes : bool = True ) -> None : for key , value in self . _changes . items ( ) : if value is DELETED : if apply_deletes : try : del db [ key ] except KeyError : pass else : pass else : db [ key ] = value
Apply the changes in this diff to the given database.
        You may choose to opt out of deleting any underlying keys.

        :param apply_deletes: whether the pending deletes should be
            applied to the database