'Return list of classes and functions in the module.
The dictionary output from pyclbr is re-written as a
list of tuples in the form (lineno, name) and
then sorted so that the classes and functions are
processed in line number order.  The returned list only
contains the name and not the line number.  An instance
variable self.classes contains the pyclbr dictionary values,
which are instances of Class and Function.'

def listclasses(self):

    (dir, file) = os.path.split(self.file)
    (name, ext) = os.path.splitext(file)
    if (os.path.normcase(ext) != '.py'):
        return []
    try:
        dict = pyclbr.readmodule_ex(name, ([dir] + sys.path))
    except ImportError:
        return []
    items = []
    self.classes = {}
    for (key, cl) in dict.items():
        if (cl.module == name):
            s = key
            if (hasattr(cl, 'super') and cl.super):
                supers = []
                for sup in cl.super:
                    if (type(sup) is type('')):
                        sname = sup
                    else:
                        sname = sup.name
                        if (sup.module != cl.module):
                            sname = ('%s.%s' % (sup.module, sname))
                    supers.append(sname)
                s = (s + ('(%s)' % ',    '.join(supers)))
            items.append((cl.lineno, s))
            self.classes[s] = cl
    items.sort()
    list = []
    for (item, s) in items:
        list.append(s)
    return list
