コード例 #1
0
ファイル: bregex.py プロジェクト: lupescu/subtxt_pkg
 def parse_template(self, pattern):
     self.groups = []
     self.literals = regex._compile_replacement_helper(pattern, self._template)
     count = 0
     for part in self.literals:
         if isinstance(part, int):
             self.literals[count] = None
             self.groups.append((count, part))
         count += 1
コード例 #2
0
        def parse_template(self, pattern):
            """
            Parse template for the regex module.

            Do NOT edit the literal list returned by
            _compile_replacement_helper as you will edit
            the original cached value.  Copy the values
            instead.
            """

            self.groups = []
            self.literals = []
            literals = regex._compile_replacement_helper(pattern, self._template)
            count = 0
            for part in literals:
                if isinstance(part, int):
                    self.literals.append(None)
                    self.groups.append((count, part))
                else:
                    self.literals.append(part)
                count += 1
コード例 #3
0
ファイル: bregex.py プロジェクト: Jornathon0/sublime3
        def parse_template(self, pattern):
            """
            Parse template for the regex module.

            Do NOT edit the literal list returned by
            _compile_replacement_helper as you will edit
            the original cached value.  Copy the values
            instead.
            """

            self.groups = []
            self.literals = []
            literals = regex._compile_replacement_helper(pattern, self._template)
            count = 0
            for part in literals:
                if isinstance(part, int):
                    self.literals.append(None)
                    self.groups.append((count, part))
                else:
                    self.literals.append(part)
                count += 1
コード例 #4
0
    def regex_parse_template(self, template, pattern):
        """
        Parse template for the regex module.

        Do NOT edit the literal list returned by
        _compile_replacement_helper as you will edit
        the original cached value.  Copy the values
        instead.
        """

        groups = []
        literals = []
        replacements = _compile_replacement_helper(pattern, template)
        count = 0
        for part in replacements:
            if isinstance(part, int):
                literals.append(None)
                groups.append((count, part))
            else:
                literals.append(part)
            count += 1
        return groups, literals
コード例 #5
0
    def regex_parse_template(self, template, pattern):
        """
        Parse template for the regex module.

        Do NOT edit the literal list returned by
        _compile_replacement_helper as you will edit
        the original cached value.  Copy the values
        instead.
        """

        groups = []
        literals = []
        replacements = _compile_replacement_helper(pattern, template)
        count = 0
        for part in replacements:
            if isinstance(part, int):
                literals.append(None)
                groups.append((count, part))
            else:
                literals.append(part)
            count += 1
        return groups, literals