Extract a structure from a match object, while translating the types in the process.
(self, mo)
| 836 | _float_re = re.compile(r'^\d+\.\d+$') |
| 837 | |
| 838 | def translate(self, mo): |
| 839 | """Extract a structure from a match object, while translating the types in the process.""" |
| 840 | attrs = {} |
| 841 | groupdict = mo.groupdict() |
| 842 | for name, value in groupdict.items(): |
| 843 | if value is None: |
| 844 | value = None |
| 845 | elif self._int_re.match(value): |
| 846 | value = int(value) |
| 847 | elif self._float_re.match(value): |
| 848 | value = float(value) |
| 849 | attrs[name] = (value) |
| 850 | return Struct(attrs) |
| 851 | |
| 852 | _cg_header_re = re.compile( |
| 853 | # original gprof header |
no test coverage detected