method: code.Source.isparseable

 return True if source is parseable, heuristically
            deindenting it by default. 
        
    def isparseable(self, deindent=True):

origin: code.Source

where:

exceptions that might appear during execution:

function source:

def isparseable(self, deindent=True):
    """ return True if source is parseable, heuristically
            deindenting it by default. 
        """
    import parser
    if deindent:
        source = str(self.deindent())
    else:
        source = str(self)
    try:
        ast = parser.suite(source+'\n')
        ast.compile('XXX.py')
    except (parser.ParserError, SyntaxError):
        return False
    else:
        return True

call sites:

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.0

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.1

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.isparseable.2

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.3

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.4

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.5

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.isparseable.6

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.7

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.8

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.isparseable.9

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.isparseable.10

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.11

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.12

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.13

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.14

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.15

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.isparseable.16

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.17

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.18

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.isparseable.19

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.isparseable.20