✏️ 正在编辑: optimizer.cpython-37.pyc
路径:
/opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/optimizer.cpython-37.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
B �:�`r � @ s` d Z ddlZddlmZ ddlmZ ejr6ddlm Z ej dej d�d d �ZG dd� de�ZdS ) a� The optimizer tries to constant fold expressions and modify the AST in place so that it should be faster to evaluate. Because the AST does not contain all the scoping information and the compiler has to find that out, we cannot do all the optimizations we want. For example, loop unrolling doesn't work because unrolled loops would have a different scope. The solution would be a second syntax tree that stored the scoping rules. � N� )�nodes)�NodeTransformer)�Environmentr )�node�environment�returnc C s t |�}t�tj|�| ��S )z^The context hint can be used to perform an static optimization based on the context given.)� Optimizer�t�castr �Node�visit)r r Z optimizer� r �A/opt/alt/python37/lib/python3.7/site-packages/jinja2/optimizer.py�optimize s r c s@ e Zd Zddd�dd�Zejejejejd�� fdd�Z� Z S ) r zt.Optional[Environment]N)r r c C s || _ d S )N)r )�selfr r r r �__init__ s zOptimizer.__init__)r �args�kwargsr c sd t � j|f|�|�}t|tj�r`y(tjj|�|r8|d nd �|j| j d�S tj k r^ Y nX |S )Nr )�linenor )�super� generic_visit� isinstancer �ExprZConstZfrom_untrustedZas_constr r Z Impossible)r r r r )� __class__r r r s zOptimizer.generic_visit) �__name__� __module__�__qualname__r r r r �Anyr � __classcell__r r )r r r s r ) �__doc__�typingr � r �visitorr � TYPE_CHECKINGr r r r r r r r r �<module> s
💾 保存文件
← 返回文件管理器