File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import sys
2+ import os
3+
4+ from test_parser import *
5+
6+ os .chdir (os .path .split (os .path .abspath (__file__ ))[0 ])
7+ sys .path .insert (0 , os .path .abspath (os .path .join (os .pardir , "src" )))
8+ import parser
9+
10+ if __name__ == "__main__" :
11+ p = parser .HTMLParser ()
12+ if len (sys .argv ) > 1 :
13+ x = sys .argv [1 ]
14+ if len (sys .argv ) > 2 :
15+ import hotshot
16+ import hotshot .stats
17+ prof = hotshot .Profile ('stats.prof' )
18+ prof .runcall (p .parse , x , False )
19+ prof .close ()
20+ stats = hotshot .stats .load ('stats.prof' )
21+ stats .strip_dirs ()
22+ stats .sort_stats ('time' )
23+ stats .print_stats ()
24+ else :
25+ document = p .parse (x )
26+ print convertTreeDump (document .printTree ())
27+ else :
28+ print """Pass one argument to parse the document and two to get an
29+ indication on what's going on.
30+ """
You can’t perform that action at this time.
0 commit comments