home *** CD-ROM | disk | FTP | other *** search
/ One Click 11 / OneClick11.iso / Bancos de Dados / Conversao / Mysql2Excel / Setup.exe / Mysql2Excel.exe / win32com / client / build.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2003-06-23  |  22.7 KB  |  581 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.2)
  3.  
  4. '''Contains knowledge to build a COM object definition.
  5.  
  6. This module is used by both the @dynamic@ and @makepy@ modules to build
  7. all knowledge of a COM object.
  8.  
  9. This module contains classes which contain the actual knowledge of the object.
  10. This include parameter and return type information, the COM dispid and CLSID, etc.
  11.  
  12. Other modules may use this information to generate .py files, use the information
  13. dynamically, or possibly even generate .html documentation for objects.
  14. '''
  15. import sys
  16. import string
  17. import types
  18. from keyword import iskeyword
  19. from win32com.client import NeedUnicodeConversions
  20. import pythoncom
  21. from pywintypes import UnicodeType, TimeType
  22.  
  23. def _safeQuotedString(s):
  24.     if s[-1] == '"':
  25.         s = s[:-1] + '\\"'
  26.     
  27.     return '"""%s"""' % s
  28.  
  29. error = 'PythonCOM.Client.Build error'
  30.  
  31. class NotSupportedException(Exception):
  32.     pass
  33.  
  34. DropIndirection = 'DropIndirection'
  35. NoTranslateTypes = [
  36.     pythoncom.VT_BOOL,
  37.     pythoncom.VT_CLSID,
  38.     pythoncom.VT_CY,
  39.     pythoncom.VT_DATE,
  40.     pythoncom.VT_DECIMAL,
  41.     pythoncom.VT_EMPTY,
  42.     pythoncom.VT_ERROR,
  43.     pythoncom.VT_FILETIME,
  44.     pythoncom.VT_HRESULT,
  45.     pythoncom.VT_I1,
  46.     pythoncom.VT_I2,
  47.     pythoncom.VT_I4,
  48.     pythoncom.VT_I8,
  49.     pythoncom.VT_INT,
  50.     pythoncom.VT_NULL,
  51.     pythoncom.VT_R4,
  52.     pythoncom.VT_R8,
  53.     pythoncom.VT_NULL,
  54.     pythoncom.VT_STREAM,
  55.     pythoncom.VT_UI1,
  56.     pythoncom.VT_UI2,
  57.     pythoncom.VT_UI4,
  58.     pythoncom.VT_UI8,
  59.     pythoncom.VT_UINT,
  60.     pythoncom.VT_VOID,
  61.     pythoncom.VT_UNKNOWN]
  62. NoTranslateMap = { }
  63. for v in NoTranslateTypes:
  64.     NoTranslateMap[v] = None
  65.  
  66.  
  67. class MapEntry:
  68.     '''Simple holder for named attibutes - items in a map.'''
  69.     
  70.     def __init__(self, desc_or_id, names = None, doc = None, resultCLSID = pythoncom.IID_NULL, resultDoc = None, hidden = 0):
  71.         if type(desc_or_id) == type(0):
  72.             self.dispid = desc_or_id
  73.             self.desc = None
  74.         else:
  75.             self.dispid = desc_or_id[0]
  76.             self.desc = desc_or_id
  77.         self.names = names
  78.         self.doc = doc
  79.         self.resultCLSID = resultCLSID
  80.         self.resultDocumentation = resultDoc
  81.         self.wasProperty = 0
  82.         self.hidden = hidden
  83.  
  84.     
  85.     def GetResultCLSID(self):
  86.         rc = self.resultCLSID
  87.         if rc == pythoncom.IID_NULL:
  88.             return None
  89.         
  90.         return rc
  91.  
  92.     
  93.     def GetResultCLSIDStr(self):
  94.         rc = self.GetResultCLSID()
  95.         if rc is None:
  96.             return 'None'
  97.         
  98.         return repr(str(rc))
  99.  
  100.     
  101.     def GetResultName(self):
  102.         if self.resultDocumentation is None:
  103.             return None
  104.         
  105.         return self.resultDocumentation[0]
  106.  
  107.  
  108.  
  109. class OleItem:
  110.     typename = 'OleItem'
  111.     
  112.     def __init__(self, doc = None):
  113.         self.doc = doc
  114.         if self.doc:
  115.             self.python_name = MakePublicAttributeName(self.doc[0])
  116.         else:
  117.             self.python_name = None
  118.         self.bWritten = 0
  119.         self.bIsDispatch = 0
  120.         self.bIsSink = 0
  121.         self.clsid = None
  122.  
  123.  
  124.  
  125. class DispatchItem(OleItem):
  126.     typename = 'DispatchItem'
  127.     
  128.     def __init__(self, typeinfo = None, attr = None, doc = None, bForUser = 1):
  129.         OleItem.__init__(self, doc)
  130.         self.propMap = { }
  131.         self.propMapGet = { }
  132.         self.propMapPut = { }
  133.         self.mapFuncs = { }
  134.         self.defaultDispatchName = None
  135.         self.hidden = 0
  136.         if typeinfo:
  137.             self.Build(typeinfo, attr, bForUser)
  138.         
  139.  
  140.     
  141.     def _propMapPutCheck_(self, key, item):
  142.         (ins, outs, opts) = self.CountInOutOptArgs(item.desc[2])
  143.         if ins > 1:
  144.             if opts + 1 == ins or ins == item.desc[6] + 1:
  145.                 newKey = 'Set' + key
  146.                 deleteExisting = 0
  147.             else:
  148.                 deleteExisting = 1
  149.                 if self.mapFuncs.has_key(key) or self.propMapGet.has_key(key):
  150.                     newKey = 'Set' + key
  151.                 else:
  152.                     newKey = key
  153.             item.wasProperty = 1
  154.             self.mapFuncs[newKey] = item
  155.             if deleteExisting:
  156.                 del self.propMapPut[key]
  157.             
  158.         
  159.  
  160.     
  161.     def _propMapGetCheck_(self, key, item):
  162.         (ins, outs, opts) = self.CountInOutOptArgs(item.desc[2])
  163.         if ins > 0:
  164.             if item.desc[6] == ins or ins == opts:
  165.                 newKey = 'Get' + key
  166.                 deleteExisting = 0
  167.             else:
  168.                 deleteExisting = 1
  169.                 if self.mapFuncs.has_key(key):
  170.                     newKey = 'Get' + key
  171.                 else:
  172.                     newKey = key
  173.             item.wasProperty = 1
  174.             self.mapFuncs[newKey] = item
  175.             if deleteExisting:
  176.                 del self.propMapGet[key]
  177.             
  178.         
  179.  
  180.     
  181.     def _AddFunc_(self, typeinfo, fdesc, bForUser):
  182.         id = fdesc.memid
  183.         funcflags = fdesc.wFuncFlags
  184.         if funcflags & pythoncom.FUNCFLAG_FRESTRICTED and id != pythoncom.DISPID_NEWENUM:
  185.             return None
  186.         
  187.         
  188.         try:
  189.             names = typeinfo.GetNames(id)
  190.             name = names[0]
  191.         except pythoncom.ole_error:
  192.             name = ''
  193.             names = None
  194.  
  195.         doc = None
  196.         
  197.         try:
  198.             if bForUser:
  199.                 doc = typeinfo.GetDocumentation(id)
  200.         except pythoncom.ole_error:
  201.             pass
  202.  
  203.         if id == 0 and name:
  204.             self.defaultDispatchName = name
  205.         
  206.         invkind = fdesc.invkind
  207.         (typerepr, flag, defval) = fdesc.rettype
  208.         (typerepr, resultCLSID, resultDoc) = _ResolveType(typerepr, typeinfo)
  209.         fdesc.rettype = (typerepr, flag, defval)
  210.         argList = []
  211.         for argDesc in fdesc.args:
  212.             (typerepr, flag, defval) = argDesc
  213.             argDesc = (_ResolveType(typerepr, typeinfo)[0], flag, defval)
  214.             argList.append(argDesc)
  215.         
  216.         fdesc.args = tuple(argList)
  217.         hidden = funcflags & pythoncom.FUNCFLAG_FHIDDEN != 0
  218.         if id == pythoncom.DISPID_NEWENUM:
  219.             map = self.mapFuncs
  220.         elif invkind == pythoncom.INVOKE_PROPERTYGET:
  221.             map = self.propMapGet
  222.         elif invkind in (pythoncom.INVOKE_PROPERTYPUT, pythoncom.INVOKE_PROPERTYPUTREF):
  223.             existing = self.propMapPut.get(name, None)
  224.             if existing is not None:
  225.                 if existing.desc[4] == pythoncom.INVOKE_PROPERTYPUT:
  226.                     map = self.mapFuncs
  227.                     name = 'Set' + name
  228.                 else:
  229.                     existing.wasProperty = 1
  230.                     self.mapFuncs['Set' + name] = existing
  231.                     map = self.propMapPut
  232.             else:
  233.                 map = self.propMapPut
  234.         elif invkind == pythoncom.INVOKE_FUNC:
  235.             map = self.mapFuncs
  236.         else:
  237.             map = None
  238.         if not (map is None):
  239.             map[name] = MapEntry(tuple(fdesc), names, doc, resultCLSID, resultDoc, hidden)
  240.             if fdesc.funckind != pythoncom.FUNC_DISPATCH:
  241.                 return None
  242.             
  243.             return (name, map)
  244.         
  245.         return None
  246.  
  247.     
  248.     def _AddVar_(self, typeinfo, fdesc, bForUser):
  249.         if fdesc.varkind == pythoncom.VAR_DISPATCH:
  250.             id = fdesc.memid
  251.             names = typeinfo.GetNames(id)
  252.             (typerepr, flags, defval) = fdesc.elemdescVar
  253.             (typerepr, resultCLSID, resultDoc) = _ResolveType(typerepr, typeinfo)
  254.             fdesc.elemdescVar = (typerepr, flags, defval)
  255.             doc = None
  256.             
  257.             try:
  258.                 if bForUser:
  259.                     doc = typeinfo.GetDocumentation(id)
  260.             except pythoncom.ole_error:
  261.                 pass
  262.  
  263.             if id == pythoncom.DISPID_NEWENUM:
  264.                 map = self.mapFuncs
  265.                 fdesc = (fdesc[0], None, None, None, pythoncom.INVOKE_PROPERTYGET)
  266.             else:
  267.                 map = self.propMap
  268.             hidden = 0
  269.             if hasattr(fdesc, 'wVarFlags'):
  270.                 hidden = fdesc.wVarFlags & 64 != 0
  271.             
  272.             map[names[0]] = MapEntry(tuple(fdesc), names, doc, resultCLSID, resultDoc, hidden)
  273.             return (names[0], map)
  274.         else:
  275.             return None
  276.  
  277.     
  278.     def Build(self, typeinfo, attr, bForUser = 1):
  279.         self.clsid = attr[0]
  280.         self.bIsDispatch = attr.wTypeFlags & pythoncom.TYPEFLAG_FDISPATCHABLE != 0
  281.         if typeinfo is None:
  282.             return None
  283.         
  284.         for j in xrange(attr[6]):
  285.             fdesc = typeinfo.GetFuncDesc(j)
  286.             self._AddFunc_(typeinfo, fdesc, bForUser)
  287.         
  288.         for j in xrange(attr[7]):
  289.             fdesc = typeinfo.GetVarDesc(j)
  290.             self._AddVar_(typeinfo, fdesc, bForUser)
  291.         
  292.         for key, item in self.propMapGet.items():
  293.             self._propMapGetCheck_(key, item)
  294.         
  295.         for key, item in self.propMapPut.items():
  296.             self._propMapPutCheck_(key, item)
  297.         
  298.  
  299.     
  300.     def CountInOutOptArgs(self, argTuple):
  301.         '''Return tuple counting in/outs/OPTS.  Sum of result may not be len(argTuple), as some args may be in/out.'''
  302.         ins = out = opts = 0
  303.         for argCheck in argTuple:
  304.             inOut = argCheck[1]
  305.             if inOut == 0:
  306.                 ins = ins + 1
  307.                 out = out + 1
  308.             elif inOut & pythoncom.PARAMFLAG_FIN:
  309.                 ins = ins + 1
  310.             
  311.             if inOut & pythoncom.PARAMFLAG_FOPT:
  312.                 opts = opts + 1
  313.             
  314.             if inOut & pythoncom.PARAMFLAG_FOUT:
  315.                 out = out + 1
  316.             
  317.         
  318.         return (ins, out, opts)
  319.  
  320.     
  321.     def MakeFuncMethod(self, entry, name, bMakeClass = 1):
  322.         if entry.desc is not None and len(entry.desc) < 6 or entry.desc[6] != -1:
  323.             return self.MakeDispatchFuncMethod(entry, name, bMakeClass)
  324.         else:
  325.             return self.MakeVarArgsFuncMethod(entry, name, bMakeClass)
  326.  
  327.     
  328.     def MakeDispatchFuncMethod(self, entry, name, bMakeClass = 1):
  329.         fdesc = entry.desc
  330.         doc = entry.doc
  331.         names = entry.names
  332.         ret = []
  333.         if bMakeClass:
  334.             linePrefix = '\t'
  335.             defNamedOptArg = 'defaultNamedOptArg'
  336.             defNamedNotOptArg = 'defaultNamedNotOptArg'
  337.             defUnnamedArg = 'defaultUnnamedArg'
  338.         else:
  339.             linePrefix = ''
  340.             defNamedOptArg = 'pythoncom.Missing'
  341.             defNamedNotOptArg = 'pythoncom.Missing'
  342.             defUnnamedArg = 'pythoncom.Missing'
  343.         id = fdesc[0]
  344.         s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg) + '):'
  345.         ret.append(s)
  346.         if doc and doc[1]:
  347.             ret.append(linePrefix + '\t' + _safeQuotedString(doc[1]))
  348.         
  349.         resclsid = entry.GetResultCLSID()
  350.         if resclsid:
  351.             resclsid = "'%s'" % resclsid
  352.         else:
  353.             resclsid = 'None'
  354.         retDesc = fdesc[8][:2]
  355.         argsDesc = tuple(map((lambda what: what[:2]), fdesc[2]))
  356.         param_flags = map((lambda what: what[1]), fdesc[2])
  357.         bad_params = filter((lambda flag: flag & (pythoncom.PARAMFLAG_FOUT | pythoncom.PARAMFLAG_FRETVAL) != 0), param_flags)
  358.         s = None
  359.         if len(bad_params) == 0 and len(retDesc) == 2 and retDesc[1] == 0:
  360.             rd = retDesc[0]
  361.             if NoTranslateMap.has_key(rd):
  362.                 s = '%s\treturn self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, _BuildArgList(fdesc, names))
  363.             elif rd == pythoncom.VT_DISPATCH:
  364.                 s = '%s\tret = self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s)\n' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names))
  365.                 s = s + '%s\tif ret is not None: ret = win32com.client.Dispatch(ret, %s, %s, UnicodeToString=%d)\n' % (linePrefix, `name`, resclsid, NeedUnicodeConversions)
  366.                 s = s + '%s\treturn ret' % linePrefix
  367.             elif rd == pythoncom.VT_BSTR:
  368.                 if NeedUnicodeConversions:
  369.                     s = '%s\t# Result is a Unicode object - perform automatic string conversion\n' % (linePrefix,)
  370.                     s = s + '%s\treturn str(self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s))' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names))
  371.                 else:
  372.                     s = '%s\t# Result is a Unicode object - return as-is for this version of Python\n' % (linePrefix,)
  373.                     s = s + '%s\treturn self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names))
  374.             
  375.         
  376.         if s is None:
  377.             s = '%s\treturn self._ApplyTypes_(0x%x, %s, %s, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, `name`, resclsid, _BuildArgList(fdesc, names))
  378.         
  379.         ret.append(s)
  380.         ret.append('')
  381.         return ret
  382.  
  383.     
  384.     def MakeVarArgsFuncMethod(self, entry, name, bMakeClass = 1):
  385.         fdesc = entry.desc
  386.         names = entry.names
  387.         doc = entry.doc
  388.         ret = []
  389.         argPrefix = 'self'
  390.         if bMakeClass:
  391.             linePrefix = '\t'
  392.         else:
  393.             linePrefix = ''
  394.         ret.append(linePrefix + 'def ' + name + '(' + argPrefix + ', *args):')
  395.         if doc and doc[1]:
  396.             ret.append(linePrefix + '\t' + _safeQuotedString(doc[1]))
  397.         
  398.         if fdesc:
  399.             invoketype = fdesc[4]
  400.         else:
  401.             invoketype = pythoncom.DISPATCH_METHOD
  402.         s = linePrefix + '\treturn self._get_good_object_(apply(self._oleobj_.Invoke,('
  403.         ret.append(s + hex(entry.dispid) + ",0,%d,1)+args),'%s')" % (invoketype, names[0]))
  404.         ret.append('')
  405.         return ret
  406.  
  407.  
  408.  
  409. class VTableItem(DispatchItem):
  410.     
  411.     def Build(self, typeinfo, attr, bForUser = 1):
  412.         DispatchItem.Build(self, typeinfo, attr, bForUser)
  413.         if not __debug__ and typeinfo is not None:
  414.             raise AssertionError, 'Cant build vtables without type info!'
  415.         
  416.         def cmp_vtable_off(m1, m2):
  417.             return cmp(m1.desc[7], m2.desc[7])
  418.  
  419.         meth_list = self.mapFuncs.values()
  420.         meth_list.sort(cmp_vtable_off)
  421.         self.vtableFuncs = []
  422.         for entry in meth_list:
  423.             self.vtableFuncs.append((entry.names[0], entry.dispid, entry.desc[2], entry.desc[8], entry.names[1:]))
  424.         
  425.  
  426.  
  427.  
  428. class LazyDispatchItem(DispatchItem):
  429.     typename = 'LazyDispatchItem'
  430.     
  431.     def __init__(self, attr, doc):
  432.         self.clsid = attr[0]
  433.         DispatchItem.__init__(self, None, attr, doc, 0)
  434.  
  435.  
  436. typeSubstMap = {
  437.     pythoncom.VT_INT: pythoncom.VT_I4,
  438.     pythoncom.VT_UINT: pythoncom.VT_I4,
  439.     pythoncom.VT_HRESULT: pythoncom.VT_I4 }
  440.  
  441. def _ResolveType(typerepr, itypeinfo):
  442.     if type(typerepr) == types.TupleType:
  443.         (indir_vt, subrepr) = typerepr
  444.         if indir_vt == pythoncom.VT_PTR:
  445.             if type(subrepr) == types.TupleType:
  446.                 pass
  447.             was_user = subrepr[0] == pythoncom.VT_USERDEFINED
  448.             (subrepr, sub_clsid, sub_doc) = _ResolveType(subrepr, itypeinfo)
  449.             if was_user and subrepr in [
  450.                 pythoncom.VT_DISPATCH,
  451.                 pythoncom.VT_UNKNOWN,
  452.                 pythoncom.VT_RECORD]:
  453.                 return (subrepr, sub_clsid, sub_doc)
  454.             
  455.             return (subrepr | pythoncom.VT_BYREF, sub_clsid, sub_doc)
  456.         
  457.         if indir_vt == pythoncom.VT_SAFEARRAY:
  458.             (subrepr, sub_clsid, sub_doc) = _ResolveType(subrepr, itypeinfo)
  459.             return (pythoncom.VT_ARRAY | subrepr, sub_clsid, sub_doc)
  460.         
  461.         if indir_vt == pythoncom.VT_USERDEFINED:
  462.             resultTypeInfo = itypeinfo.GetRefTypeInfo(subrepr)
  463.             resultAttr = resultTypeInfo.GetTypeAttr()
  464.             typeKind = resultAttr.typekind
  465.             if typeKind == pythoncom.TKIND_ALIAS:
  466.                 tdesc = resultAttr.tdescAlias
  467.                 return _ResolveType(tdesc, resultTypeInfo)
  468.             elif typeKind in [
  469.                 pythoncom.TKIND_ENUM,
  470.                 pythoncom.TKIND_MODULE]:
  471.                 return (pythoncom.VT_I4, None, None)
  472.             elif typeKind in [
  473.                 pythoncom.TKIND_DISPATCH,
  474.                 pythoncom.TKIND_INTERFACE,
  475.                 pythoncom.TKIND_COCLASS]:
  476.                 clsid = resultTypeInfo.GetTypeAttr()[0]
  477.                 retdoc = resultTypeInfo.GetDocumentation(-1)
  478.                 return (pythoncom.VT_DISPATCH, clsid, retdoc)
  479.             elif typeKind == pythoncom.TKIND_RECORD:
  480.                 return (pythoncom.VT_RECORD, None, None)
  481.             
  482.             raise NotSupportedException('Can not resolve alias or user-defined type')
  483.         
  484.     
  485.     return (typeSubstMap.get(typerepr, typerepr), None, None)
  486.  
  487.  
  488. def _BuildArgList(fdesc, names):
  489.     '''Builds list of args to the underlying Invoke method.'''
  490.     numArgs = max(fdesc[6], len(fdesc[2]))
  491.     names = list(names)
  492.     while None in names:
  493.         i = names.index(None)
  494.         names[i] = 'arg%d' % (i,)
  495.     names = map(MakePublicAttributeName, names[1:])
  496.     while len(names) < numArgs:
  497.         names.append('arg%d' % (len(names),))
  498.     return ',' + string.join(names, ', ')
  499.  
  500. valid_identifier_chars = string.letters + string.digits + '_'
  501.  
  502. def MakePublicAttributeName(className):
  503.     if className[:2] == '__' and className[-2:] != '__':
  504.         return className[1:] + '_'
  505.     elif iskeyword(className):
  506.         return string.capitalize(className)
  507.     
  508.     return filter((lambda char: char in valid_identifier_chars), className)
  509.  
  510.  
  511. def MakeDefaultArgRepr(defArgVal):
  512.     
  513.     try:
  514.         inOut = defArgVal[1]
  515.     except IndexError:
  516.         inOut = pythoncom.PARAMFLAG_FIN
  517.  
  518.     if inOut & pythoncom.PARAMFLAG_FHASDEFAULT:
  519.         val = defArgVal[2]
  520.         if type(val) is UnicodeType:
  521.             return repr(str(val))
  522.         elif type(val) is TimeType:
  523.             year = val.year
  524.             month = val.month
  525.             day = val.day
  526.             hour = val.hour
  527.             minute = val.minute
  528.             second = val.second
  529.             msec = val.msec
  530.             return 'pythoncom.MakeTime((%(year)d, %(month)d, %(day)d, %(hour)d, %(minute)d, %(second)d,0,0,0,%(msec)d))' % locals()
  531.         else:
  532.             return repr(val)
  533.     
  534.     return None
  535.  
  536.  
  537. def BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg):
  538.     '''Builds a Python declaration for a method.'''
  539.     numArgs = len(fdesc[2])
  540.     numOptArgs = fdesc[6]
  541.     strval = ''
  542.     if numOptArgs == -1:
  543.         numArgs = numArgs - 1
  544.     else:
  545.         firstOptArg = numArgs - numOptArgs
  546.     for arg in xrange(numArgs):
  547.         
  548.         try:
  549.             argName = names[arg + 1]
  550.             namedArg = argName is not None
  551.         except IndexError:
  552.             namedArg = 0
  553.  
  554.         if not namedArg:
  555.             argName = 'arg%d' % arg
  556.         
  557.         defArgVal = MakeDefaultArgRepr(fdesc[2][arg])
  558.         if defArgVal is None:
  559.             if namedArg:
  560.                 if arg >= firstOptArg:
  561.                     defArgVal = defNamedOptArg
  562.                 else:
  563.                     defArgVal = defNamedNotOptArg
  564.             else:
  565.                 defArgVal = defUnnamedArg
  566.         
  567.         argName = MakePublicAttributeName(argName)
  568.         strval = strval + ', ' + argName
  569.         if defArgVal:
  570.             strval = strval + '=' + defArgVal
  571.         
  572.     
  573.     if numOptArgs == -1:
  574.         strval = strval + ', *' + names[-1]
  575.     
  576.     return strval
  577.  
  578. if __name__ == '__main__':
  579.     print "Use 'makepy.py' to generate Python code - this module is just a helper"
  580.  
  581.