def __init__(self, actions, identifier=None): """ Basic analyzer which is extended to create other analyzer subclasses :param actions: A single action or a list of actions to be executed on every paste :param identifier: The name or unique identifier for this specific analyzer """ self.actions = listify(actions) self.identifier = identifier or self.name self.logger = logging.getLogger(self.name)
def __init__(self, actions, identifier=None): """Basic analyzer which is extended to create other analyzer subclasses. :param actions: A single action or a list of actions to be executed on every paste :param identifier: The name or unique identifier for this specific analyzer """ self.logger = logging.getLogger(__name__) self.actions = listify(actions) self.identifier = identifier or self.name # Check if passed action is an instance of an analyzer and not a class - see #175 # Raises an error if any action is not an object inheriting from BasicAaction for action in self.actions: self._check_action(action)
def __init__(self, actions, analyzers, merge_actions=False): """ Meta analyzer used to combine analyzers via a logical operator :param actions: A single action or a list of actions to be executed on every paste :param analyzers: A single analyzer or a list of analyzers used to match pastes """ super().__init__(actions) self.analyzers = listify(analyzers) if len(self.analyzers) == 0: self.logger.warning( "You have not specified any analyzers inside '{}'".format( self.name)) if merge_actions: self._merge_actions()
def __init__(self, actions, words, blacklist=None, case_sensitive=False): super().__init__(actions, "{0} ({1})".format(self.name, words)) self.words = listify(words) self.blacklist = blacklist or [] self.case_sensitive = case_sensitive