ok
Direktori : /usr/lib64/python2.7/ |
Current File : //usr/lib64/python2.7/ast.pyc |
� \цdc @ s� d Z d d l Td d l m Z d d d � Z d � Z e e d � Z d � Z d � Z d d � Z d � Z d � Z e d � Z d � Z d e f d � � YZ d e f d � � YZ d S( sH ast ~~~ The `ast` module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like and allows modifications of it. An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as a flag to the `compile()` builtin function or by using the `parse()` function from this module. The result will be a tree of objects whose classes all inherit from `ast.AST`. A modified abstract syntax tree can be compiled into a Python code object using the built-in `compile()` function. Additionally various helper functions are provided that make working with the trees simpler. The main intention of the helper functions and this module in general is to provide an easy to use interface for libraries that work tightly with the python syntax (template engines for example). :copyright: Copyright 2008 by Armin Ronacher. :license: Python License. i����( t *( t __version__s <unknown>t execc C s t | | | t � S( sn Parse the source into an AST node. Equivalent to compile(source, filename, mode, PyCF_ONLY_AST). ( t compilet PyCF_ONLY_AST( t sourcet filenamet mode( ( s /usr/lib64/python2.7/ast.pyt parse s c sv i d d 6t d 6t d 6� t | t � r? t | d d �} n t | t � rZ | j } n � � f d � � � | � S( s� Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None. t Nonet Truet FalseR t evalc s� t | t � r | j St | t � r, | j St | t � rQ t t � | j � � St | t � rv t t � | j � � St | t � r� t � f d � t | j | j � D� � St | t � r� | j � k r�� | j Sn� t | t � r�t | j t t f � r�t | j t � r�t | j j t � r�t | j t � r�t | j j t t t f � r�| j j } | j j } t | j t � r�| | S| | Sn t d � � d S( Nc 3 s- | ]# \ } } � | � � | � f Vq d S( N( ( t .0t kt v( t _convert( s /usr/lib64/python2.7/ast.pys <genexpr>>