示例#1
0
文件: util.py 项目: buzzfeed/caliendo
def recache( methodname=None, filename=None ):
    """
    Deletes entries corresponding to methodname in filename. If no arguments are passed it recaches the entire table.

    :param str methodname: The name of the method to target. This will delete ALL entries this method appears in the stack trace for.
    :param str filename: The filename the method is executed in. (include .py extension)

    :rtype int: The number of deleted entries
    """
    if not methodname and not filename:
        hashes = get_unique_hashes()
        deleted = 0
        for hash in hashes:
            delete_io(hash)
            deleted = deleted + 1
    else:
        reqd_strings = []
        if methodname:
            reqd_strings.append( methodname )
        if filename:
            reqd_strings.append( filename )
        hashes = get_unique_hashes()
        deleted = 0
        for hash in hashes:
            cd = call_descriptor.fetch( hash )
            if all( [ s in cd.stack for s in reqd_strings ] ):
                delete_io( hash )
                deleted = deleted + 1
        return deleted
示例#2
0
def recache(methodname=None, filename=None):
    """
    Deletes entries corresponding to methodname in filename. If no arguments are passed it recaches the entire table.

    :param str methodname: The name of the method to target. This will delete ALL entries this method appears in the stack trace for.
    :param str filename: The filename the method is executed in. (include .py extension)

    :rtype int: The number of deleted entries
    """
    if not methodname and not filename:
        hashes = get_unique_hashes()
        deleted = 0
        for hash in hashes:
            delete_io(hash)
            deleted = deleted + 1
    else:
        reqd_strings = []
        if methodname:
            reqd_strings.append(methodname)
        if filename:
            reqd_strings.append(filename)
        hashes = get_unique_hashes()
        deleted = 0
        for hash in hashes:
            cd = call_descriptor.fetch(hash)
            if all([s in cd.stack for s in reqd_strings]):
                delete_io(hash)
                deleted = deleted + 1
        return deleted
示例#3
0
    def save( self ):
        """
        Save method for the CallDescriptor.

        If the CallDescriptor matches a past CallDescriptor it updates the existing
        database record corresponding to the hash. If it doesn't already exist it'll
        be INSERT'd.
        """
        packets = self.__enumerate_packets( )
        delete_io( self.hash )
        for packet in packets:
            packet['hash'] = self.hash
            insert_io( packet )

        return self # Supports chaining
示例#4
0
    def save( self ):
        """
        Save method for the CallDescriptor.

        If the CallDescriptor matches a past CallDescriptor it updates the existing
        database record corresponding to the hash. If it doesn't already exist it'll
        be INSERT'd.
        """
        packets = self.__enumerate_packets( )
        delete_io( self.hash )
        for packet in packets:
            packet['hash'] = self.hash
            insert_io( packet )

        return self # Supports chaining
示例#5
0
 def wrapper__delete_last_cached(self):
     """
     Deletes the last object that was cached by this instance of caliendo's Facade
     """
     return delete_io( self.last_cached )
示例#6
0
文件: facade.py 项目: pahko/caliendo
 def wrapper__delete_last_cached(self):
     """
     Deletes the last object that was cached by this instance of caliendo's Facade
     """
     return delete_io( self.last_cached )