1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
""" An example of using the Enthought class browser (enclbr) module. """
# Standard library imports.
import sys, time
# Enthought library imports.
from enthought.envisage.developer.code_browser.api import CodeBrowser
def main(argv):
""" Do it! """
if len(argv) != 2:
print 'Usage: python example.py module_name'
print
print 'e.g., python example.py enthought.traits'
else:
# Create a code browser.
code_browser = CodeBrowser(filename='data.pickle')
# Parse the specified package.
start = time.time()
contents = code_browser.read_package(sys.argv[1])
stop = time.time()
print 'Time taken to parse', sys.argv[1], 'was', stop - start, 'secs'
# Save the cache.
code_browser.save('data.pickle')
return
# Entry point for testing.
if __name__ == '__main__':
main(sys.argv)
#### EOF ######################################################################
|