def timeParseOfPythonLibrary(path):
    import time
    t1 = time.time()
    files = getFilesForName(path)
    import sys
    for fname in files:
        if fname.endswith("bdist_wininst.py"): continue
        src = file(fname).read()
        fastparser(src)
    print "\n", time.time()-t1
 def test_doesntGetClassDeclsInMLStrings(self):
     src = trimLines('''
     """
     class foo bah
     """
     ''')
     root = fastparser(src)
     assert root.getChildNodes() == []
 def test_evaluatesMLStringWithQuoteInIt(self):
     src = trimLines('''
     """some ml comment inclosing a " """
     def foo:
         pass 
     " hello "
     ''')
     root = fastparser(src)
     assert root.getChildNodes() != []
def compareCompilerWithFastparserOverPath(path):
    from bike.parsing.load import getFilesForName
    files = getFilesForName(path)
    for fname in files:
        if fname.endswith("bdist_wininst.py"): continue
        log.info(fname)
        src = file(fname).read()
        try:
            compiler_root = compiler.parse(src)
        except SyntaxError:
            continue
        fastparse_root = fastparser(src)
        str1 = fastparsetreeToString(fastparse_root)
        str2 = compilerParseTreeToString(compiler_root)
        assert str1 == str2, "\n"+"-"*70+"\n"+str1+"-"*70+"\n"+str2
def load(path):
    files = getFilesForName(path)
    for fname in files:
        src = file(fname).read()
        fastparser(src)
 def test_handlesFnDefsWithTwoSpacesInDecl(self):
     src = trimLines('''
     def  foo: pass
     ''')
     root = fastparser(src)
     assert root.getChildNodes() != []