예제 #1
0
파일: source.py 프로젝트: zx996/-cs1531
    def isparseable(self, deindent=True):
        """ return True if source is parseable, heuristically
            deindenting it by default.
        """
        from parser import suite as syntax_checker

        if deindent:
            source = str(self.deindent())
        else:
            source = str(self)
        try:
            # compile(source+'\n', "x", "exec")
            syntax_checker(source + "\n")
        except KeyboardInterrupt:
            raise
        except Exception:
            return False
        else:
            return True
예제 #2
0
파일: source.py 프로젝트: Coder206/servo
    def isparseable(self, deindent=True):
        """ return True if source is parseable, heuristically
            deindenting it by default.
        """
        from parser import suite as syntax_checker

        if deindent:
            source = str(self.deindent())
        else:
            source = str(self)
        try:
            # compile(source+'\n', "x", "exec")
            syntax_checker(source + "\n")
        except KeyboardInterrupt:
            raise
        except Exception:
            return False
        else:
            return True