File: example.py

package info (click to toggle)
python-envisageplugins 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,616 kB
  • ctags: 1,970
  • sloc: python: 7,047; makefile: 11; sh: 11; lisp: 1
file content (42 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download | duplicates (2)
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 ######################################################################