flawless/lib/storage/base.py
def migrate_thrift_obj(self, obj):
        """Helper function that can be called when serializing/deserializing thrift objects whose definitions
        have changed, we need to make sure we initialize the new attributes to their default value"""
        if not hasattr(obj, "thrift_spec"):
            return

        obj_key_set = set(obj.__dict__.keys())
        thrift_field_map = {t[2]: t[4] for t in obj.thrift_spec if t}
        obj.__dict__.update({f: copy.copy(thrift_field_map[f]) for f in set(thrift_field_map.keys()) - obj_key_set})
        for value in obj.__dict__.values():
            self.migrate_thrift_obj(value)
def migrate_thrift_obj(self, obj):
        """Helper function that can be called when serializing/deserializing thrift objects whose definitions
        have changed, we need to make sure we initialize the new attributes to their default value"""
        if not hasattr(obj, "thrift_spec"):
            return

        obj_key_set = set(obj.__dict__.keys())
        thrift_field_map = {t[2]: t[4] for t in obj.thrift_spec if t}
        obj.__dict__.update({f: copy.copy(thrift_field_map[f]) for f in set(thrift_field_map.keys()) - obj_key_set})
        for value in obj.__dict__.values():
            self.migrate_thrift_obj(value)
def migrate_thrift_obj ( self , obj ) : if not hasattr ( obj , "thrift_spec" ) : return obj_key_set = set ( obj . __dict__ . keys ( ) ) thrift_field_map = { t [ 2 ] : t [ 4 ] for t in obj . thrift_spec if t } obj . __dict__ . update ( { f : copy . copy ( thrift_field_map [ f ] ) for f in set ( thrift_field_map . keys ( ) ) - obj_key_set } ) for value in obj . __dict__ . values ( ) : self . migrate_thrift_obj ( value )
Helper function that can be called when serializing/deserializing thrift objects whose definitions
        have changed, we need to make sure we initialize the new attributes to their default value
Helper function that can be called when serializing / deserializing thrift objects whose definitions have changed we need to make sure we initialize the new attributes to their default value