def parseTypes(self, proto):
        defaults={}
        names=[]
        types ={}
        typeQualifiers={}
        tmpTypes=[]
        # TYPES
        for paramtype in proto.findAll( 'td', **{'class':'paramtype'} ) :
            buf = []
            [ buf.extend(x.split()) for x in paramtype.findAll( text=True ) ] #if x.strip() not in ['', '*', '&', 'const', 'unsigned'] ]
            buf = [ x.strip().encode('ascii', 'ignore') for x in buf if x.strip() ]

            i=0
            for i, each in enumerate(buf):
                if each not in [ '*', '&', 'const', 'unsigned']:
                    argtype = buf.pop(i)
                    break
            else:
                # We didn't find any arg type - therefore everything
                # in buf is in the set('*', '&', 'const', 'unsigned')
                # ... so it's implicitly an unsigned int
                argtype = 'int'

            if 'unsigned' in buf and argtype in ('char','int', 'int2',
                                                 'int3', 'int4'):
                argtype = 'u' + argtype

            argtype = self.handleEnums(argtype)

            #print '\targtype', argtype, buf
            tmpTypes.append( (argtype, buf) )

        # ARGUMENT NAMES
        i = 0
        for paramname in  proto.findAll( 'td', **{'class':'paramname'} )  :
            buf = [ x.strip().encode('ascii', 'ignore') for x in paramname.findAll( text=True ) if x.strip() not in['',','] ]
            if not buf: continue
            argname = buf[0]
            data = buf[1:]

            type, qualifiers = tmpTypes[i]
            default=None
            joined = ''.join(data).strip()

            if joined:
                joined = joined.encode('ascii', 'ignore')
                # break apart into index and defaults :  '[3] = NULL'
                brackets, default = re.search( '([^=]*)(?:\s*=\s*(.*))?', joined ).groups()

                if brackets:
                    numbuf = re.split( r'\[|\]', brackets)
                    if len(numbuf) > 1:
                        # Note that these two args need to be cast differently:
                        #   int2 foo;
                        #   int bar[2];
                        # ... so, instead of storing the type of both as
                        # 'int2', we make the second one 'int__array2'
                        type = type + '__array' + numbuf[1]
                    else:
                        print "this is not a bracketed number", repr(brackets), joined

                if default is not None:
                    try:
                        # Constants
                        default = {
                            'true' : True,
                            'false': False,
                            'NULL' : None
                        }[default]
                    except KeyError:
                        try:
                            if type in ['int', 'uint','long', 'uchar']:
                                default = int(default)
                            elif type in ['float', 'double']:
                                # '1.0 / 24.0'
                                if '/' in default:
                                    default = eval(default)
                                # '1.0e-5F'  --> '1.0e-5'
                                elif default.endswith('F'):
                                    default = float(default[:-1])
                                else:
                                    default = float(default)
                            else:
                                default = self.handleEnumDefaults(default, type)
                        except ValueError:
                            default = self.handleEnumDefaults(default, type)
                    # default must be set here, because 'NULL' may be set to back to None, but this is in fact the value we want
                    self.xprint('DEFAULT', default)
                    defaults[argname] = default

            types[argname] = type
            typeQualifiers[argname] = qualifiers
            names.append(argname)
            i+=1
        assert sorted(names) == sorted(types.keys()), 'name-type mismatch %s %s' %  (sorted(names), sorted(types.keys()) )
        return names, types, typeQualifiers, defaults
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/internal/parsers.py/ApiDocParser.parseTypes/original