[New-bugs-announce] [issue24674] pyclbr not recursively showing classes in packages
David Worenklein
report at bugs.python.org
Mon Jul 20 15:26:41 CEST 2015
New submission from David Worenklein:
In the following example, pyclbr does not report that foo.module.A is a superclass of C:
__module2.py__
import foo.module
class C(foo.module.B):
pass
__foo/module.py__
class A(object):
def foo(self):
print "bar"
class B(A):
pass
__test.py__
import pyclbr
def superclasses_of(class_data):
classes = [ class_data ]
super_classes = []
while classes:
class_data = classes.pop()
if isinstance(class_data, basestring):
super_classes.append(class_data)
else:
super_classes.append( class_data.module+'.'+class_data.name )
for c in class_data.super:
classes.append( c )
return super_classes
module = pyclbr.readmodule('module2',['.','./foo'])
for class_name, class_data in module.items():
print "%s => %s" % (class_name, superclasses_of(class_data))
__results__
C => ['foo.module.B']
I've attached a patch to pyclbr.py to fix this.
----------
files: pyclbr.patch
keywords: patch
messages: 246990
nosy: worenklein
priority: normal
severity: normal
status: open
title: pyclbr not recursively showing classes in packages
versions: Python 2.7
Added file: http://bugs.python.org/file39961/pyclbr.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24674>
_______________________________________
More information about the New-bugs-announce
mailing list