gramfuzz/gramfuzz/__init__.py
def add_definition(self, cat, def_name, def_val, no_prune=False, gram_file="default"):
        """Add a new rule definition named ``def_name`` having value ``def_value`` to
        the category ``cat``.

        :param str cat: The category to add the rule to
        :param str def_name: The name of the rule definition
        :param def_val: The value of the rule definition
        :param bool no_prune: If the rule should explicitly *NOT*
            be pruned even if it has been determined to be unreachable (default=``False``)
        :param str gram_file: The file the rule was defined in (default=``"default"``).
        """
        self._rules_processed = False

        self.add_to_cat_group(cat, gram_file, def_name)

        if no_prune:
            self.no_prunes.setdefault(cat, {}).setdefault(def_name, True)

        if self._staged_defs is not None:
            # if we're tracking changes during rule generation, add any new rules
            # to _staged_defs so they can be reverted if something goes wrong
            self._staged_defs.append((cat, def_name, def_val))
        else:
            self.defs.setdefault(cat, {}).setdefault(def_name, deque()).append(def_val)
def add_definition(self, cat, def_name, def_val, no_prune=False, gram_file="default"):
        self._rules_processed = False

        self.add_to_cat_group(cat, gram_file, def_name)

        if no_prune:
            self.no_prunes.setdefault(cat, {}).setdefault(def_name, True)

        if self._staged_defs is not None:
            # if we're tracking changes during rule generation, add any new rules
            # to _staged_defs so they can be reverted if something goes wrong
            self._staged_defs.append((cat, def_name, def_val))
        else:
            self.defs.setdefault(cat, {}).setdefault(def_name, deque()).append(def_val)
def add_definition ( self , cat , def_name , def_val , no_prune = False , gram_file = "default" ) : self . _rules_processed = False self . add_to_cat_group ( cat , gram_file , def_name ) if no_prune : self . no_prunes . setdefault ( cat , { } ) . setdefault ( def_name , True ) if self . _staged_defs is not None : # if we're tracking changes during rule generation, add any new rules # to _staged_defs so they can be reverted if something goes wrong self . _staged_defs . append ( ( cat , def_name , def_val ) ) else : self . defs . setdefault ( cat , { } ) . setdefault ( def_name , deque ( ) ) . append ( def_val )
Add a new rule definition named ``def_name`` having value ``def_value`` to
        the category ``cat``.

        :param str cat: The category to add the rule to
        :param str def_name: The name of the rule definition
        :param def_val: The value of the rule definition
        :param bool no_prune: If the rule should explicitly *NOT*
            be pruned even if it has been determined to be unreachable (default=``False``)
        :param str gram_file: The file the rule was defined in (default=``"default"``).
Add a new rule definition named def_name having value def_value to the category cat .