(self, mo)
return Struct(attrs)
Extract a structure from a match object, while translating the types in the process.
Extract a structure from a match object, while translating the types in the process.
Extract a structure from a match object while translating the types in the process .
def translate(self, mo):
        """Extract a structure from a match object, while translating the types in the process."""
        attrs = {}
        groupdict = mo.groupdict()
        for name, value in groupdict.iteritems():
            if value is None:
                value = None
            elif self._int_re.match(value):
                value = int(value)
            elif self._float_re.match(value):
                value = float(value)
            attrs[name] = (value)
        return Struct(attrs)
def translate ( self , mo ) : attrs = { } groupdict = mo . groupdict ( ) for name , value in groupdict . iteritems ( ) : if value is None : value = None elif self . _int_re . match ( value ) : value = int ( value ) elif self . _float_re . match ( value ) : value = float ( value ) attrs [ name ] = ( value ) return Struct ( attrs )