コード例 #1
0
ファイル: wildcard.py プロジェクト: LombeC/program-r
 def __init__(self, wildcard, userid='*'):
     PatternNode.__init__(self, userid)
     if wildcard not in self.matching_wildcards():
         raise ParserException(
             "%s not in valid wildcards %s" %
             (wildcard, ", ".join(self.matching_wildcards())))
     self._wildcard = wildcard
コード例 #2
0
 def __init__(self, attribs, text, userid='*'):
     PatternNode.__init__(self, userid)
     if 'name' in attribs:
         self._set_name = attribs['name'].upper()
     elif text:
         self._set_name = text.upper()
     else:
         raise ParserException(
             "Invalid set node, no name specified as attribute or text")
コード例 #3
0
ファイル: bot.py プロジェクト: LombeC/program-r
 def __init__(self, attribs, text, userid='*'):
     PatternNode.__init__(self, userid)
     if 'name' in attribs:
         self._property = attribs['name']
     elif 'property' in attribs:
         self._property = attribs['property']
     elif text:
         self._property = text
     else:
         raise ParserException(
             "Invalid bot node, neither name or property specified as attribute or text"
         )
コード例 #4
0
ファイル: iset.py プロジェクト: LombeC/program-r
    def __init__(self, attribs, text, userid='*'):
        PatternNode.__init__(self, userid)
        self._words = []

        if 'words' in attribs:
            words = attribs['words'].upper()
        elif text:
            words = text.upper()
        else:
            raise ParserException(
                "Invalid iset node, no words specified as attribute or text")

        self._parse_words(words)
        self._iset_name = "iset_%d" % (PatternISetNode.iset_count)
        PatternISetNode.iset_count += 1
コード例 #5
0
ファイル: regex.py プロジェクト: LombeC/program-r
    def __init__(self, attribs, text, userid='*'):
        PatternNode.__init__(self, userid)
        self._pattern_text = None
        self._pattern_template = None
        self._pattern = None
        if 'pattern' in attribs:
            self._pattern_text = attribs['pattern']
        elif 'template' in attribs:
            self._pattern_template = attribs['template']
        elif text:
            self._pattern_text = text
        else:
            raise ParserException("Invalid regex node, neither pattern or template specified as attribute or text")

        if self._pattern_text is not None:
            self._pattern = re.compile(self._pattern_text)
コード例 #6
0
ファイル: topic.py プロジェクト: LombeC/program-r
 def __init__(self, userid='*'):
     PatternNode.__init__(self, userid)
コード例 #7
0
 def __init__(self, template, userid='*'):
     PatternNode.__init__(self, userid)
     self._template = template
コード例 #8
0
 def __init__(self, word, userid='*'):
     PatternNode.__init__(self, userid)
     self._priority_word = word