X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..609b563c8b9ade4fcde9160f11c7deaf16a9f7b6:/wxPython/wx/py/introspect.py diff --git a/wxPython/wx/py/introspect.py b/wxPython/wx/py/introspect.py index 3bdff3a460..ebb756999e 100644 --- a/wxPython/wx/py/introspect.py +++ b/wxPython/wx/py/introspect.py @@ -13,12 +13,6 @@ import sys import tokenize import types -try: - True -except NameError: - True = 1==1 - False = 1==0 - def getAutoCompleteList(command='', locals=None, includeMagic=1, includeSingle=1, includeDouble=1): """Return list of auto-completion options for command. @@ -61,6 +55,10 @@ def getAttributeNames(object, includeMagic=1, includeSingle=1, for item in attributes: dict[item] = None attributes = dict.keys() + # new-style swig wrappings can result in non-string attributes + # e.g. ITK http://www.itk.org/ + attributes = [attribute for attribute in attributes \ + if type(attribute) == str] attributes.sort(lambda x, y: cmp(x.upper(), y.upper())) if not includeSingle: attributes = filter(lambda item: item[0]!='_' \ @@ -169,6 +167,8 @@ def getCallTip(command='', locals=None): temp = argspec.split(',') if len(temp) == 1: # No other arguments. argspec = '()' + elif temp[0][:2] == '(*': # first param is like *args, not self + pass else: # Drop the first argument. argspec = '(' + ','.join(temp[1:]).lstrip() tip1 = name + argspec @@ -184,7 +184,7 @@ def getCallTip(command='', locals=None): # tip3 is the rest of the docstring, like: # "The call tip information will be based on ... firstline = doc.split('\n')[0].lstrip() - if tip1 == firstline: + if tip1 == firstline or firstline[:len(name)+1] == name+'(': tip1 = '' else: tip1 += '\n\n'