28 |
__docformat__ = 'reStructuredText' |
__docformat__ = 'reStructuredText' |
29 |
|
|
30 |
import re, random, string |
import re, random, string |
31 |
|
import navidoc |
32 |
|
|
33 |
def match_remove(p, s): |
def match_remove(p, s): |
34 |
""" |
""" |
86 |
stack.append(new) |
stack.append(new) |
87 |
return stack[0][1] |
return stack[0][1] |
88 |
|
|
89 |
def keys_for_classes(module): |
def keys_for_classes(module, top_class): |
90 |
""" |
""" |
91 |
Gather a key -> class dictionary for all classes containing |
Gather a key -> class dictionary for all classes containing |
92 |
'key' in the given module. |
'key' in the given module. |
94 |
d = {} |
d = {} |
95 |
for element in dir(module): |
for element in dir(module): |
96 |
element = getattr(module, element) |
element = getattr(module, element) |
97 |
if type(element) == type(Element) \ |
if type(element) == type(top_class) \ |
98 |
and issubclass(element, Element): |
and issubclass(element, top_class): |
|
print element |
|
99 |
if hasattr(element, "key") \ |
if hasattr(element, "key") \ |
100 |
and type(element.key) == type(''): |
and type(element.key) == type(''): |
101 |
d[element.key] = element |
d[element.key] = element |