| 174 | return True |
| 175 | |
| 176 | def get_identifiers(self): |
| 177 | ids = [] |
| 178 | for mo in self.pattern.finditer(self.template): |
| 179 | named = mo.group('named') or mo.group('braced') |
| 180 | if named is not None and named not in ids: |
| 181 | # add a named group only the first time it appears |
| 182 | ids.append(named) |
| 183 | elif (named is None |
| 184 | and mo.group('invalid') is None |
| 185 | and mo.group('escaped') is None): |
| 186 | # If all the groups are None, there must be |
| 187 | # another group we're not expecting |
| 188 | raise ValueError('Unrecognized named group in pattern', |
| 189 | self.pattern) |
| 190 | return ids |
| 191 | |
| 192 | |
| 193 | ######################################################################## |