def autoclear(self):
        """Clear Redis and ThreatConnect data from staging data."""
        for sd in self.staging_data:
            data_type = sd.get('data_type', 'redis')
            if data_type == 'redis':
                self.clear_redis(sd.get('variable'), 'auto-clear')
            elif data_type == 'redis-array':
                self.clear_redis(sd.get('variable'), 'auto-clear')
                for variables in sd.get('data', {}).get('variables') or []:
                    self.clear_redis(variables.get('value'), 'auto-clear')
            elif data_type == 'threatconnect':
                # self.clear_tc(sd.get('data_owner'), sd.get('data', {}), 'auto-clear')
                # self.clear_redis(sd.get('variable'), 'auto-clear')
                pass
            elif data_type == 'threatconnect-association':
                # assuming these have already been cleared
                pass
            elif data_type == 'threatconnect-batch':
                for group in sd.get('data', {}).get('group') or []:
                    self.clear_tc(sd.get('data_owner'), group, 'auto-clear')
                    self.clear_redis(group.get('variable'), 'auto-clear')
                for indicator in sd.get('data', {}).get('indicator') or []:
                    self.clear_tc(sd.get('data_owner'), indicator, 'auto-clear')
                    self.clear_redis(indicator.get('variable'), 'auto-clear')
        for vd in self.profile.get('validations') or []:
            data_type = vd.get('data_type', 'redis')
            variable = vd.get('variable')
            if data_type == 'redis':
                self.clear_redis(variable, 'auto-clear')
def autoclear ( self ) : for sd in self . staging_data : data_type = sd . get ( 'data_type' , 'redis' ) if data_type == 'redis' : self . clear_redis ( sd . get ( 'variable' ) , 'auto-clear' ) elif data_type == 'redis-array' : self . clear_redis ( sd . get ( 'variable' ) , 'auto-clear' ) for variables in sd . get ( 'data' , { } ) . get ( 'variables' ) or [ ] : self . clear_redis ( variables . get ( 'value' ) , 'auto-clear' ) elif data_type == 'threatconnect' : pass elif data_type == 'threatconnect-association' : pass elif data_type == 'threatconnect-batch' : for group in sd . get ( 'data' , { } ) . get ( 'group' ) or [ ] : self . clear_tc ( sd . get ( 'data_owner' ) , group , 'auto-clear' ) self . clear_redis ( group . get ( 'variable' ) , 'auto-clear' ) for indicator in sd . get ( 'data' , { } ) . get ( 'indicator' ) or [ ] : self . clear_tc ( sd . get ( 'data_owner' ) , indicator , 'auto-clear' ) self . clear_redis ( indicator . get ( 'variable' ) , 'auto-clear' ) for vd in self . profile . get ( 'validations' ) or [ ] : data_type = vd . get ( 'data_type' , 'redis' ) variable = vd . get ( 'variable' ) if data_type == 'redis' : self . clear_redis ( variable , 'auto-clear' )
Clear Redis and ThreatConnect data from staging data.