(fname)
return ast.parse(fstr, filename=fname)
Parse a python file into an AST.
        This is a very thin wrapper around ast.parse
            TODO: Handle encodings other than the default (issue #26)
Parse a python file into an AST.
        This is a very thin wrapper around ast.parse
            TODO: Handle encodings other than the default (issue #26)
Parse a python file into an AST . This is a very thin wrapper around ast . parse TODO : Handle encodings other than the default ( issue #26 )
def parse_file(fname):
        """Parse a python file into an AST.
        This is a very thin wrapper around ast.parse
            TODO: Handle encodings other than the default (issue #26)
        """
        try:
            with open(fname, 'r') as f:
                fstr = f.read()
        except IOError:
            if fname != 'stdin':
                raise
            sys.stdout.write('\nReading from stdin:\n\n')
            fstr = sys.stdin.read()
        fstr = fstr.replace('\r\n', '\n').replace('\r', '\n')
        if not fstr.endswith('\n'):
            fstr += '\n'
        return ast.parse(fstr, filename=fname)
def parse_file ( fname ) : try : with open ( fname , 'r' ) as f : fstr = f . read ( ) except IOError : if fname != 'stdin' : raise sys . stdout . write ( '\nReading from stdin:\n\n' ) fstr = sys . stdin . read ( ) fstr = fstr . replace ( '\r\n' , '\n' ) . replace ( '\r' , '\n' ) if not fstr . endswith ( '\n' ) : fstr += '\n' return ast . parse ( fstr , filename = fname )