| Server IP : 217.160.0.135 / Your IP : 216.73.216.115 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/pythran/transformations/__pycache__/ |
Upload File : |
�
cR�a � �d � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl Z
d� Z G d� de� � ZdS ) z= NormalizeCompare turns complex compare into function calls. � )�ImportedIds)�Transformation)�path_to_attrNc � � t j | � � dS # t $ r Y nw xY wt | t j t j f� � rdS dS )NTF)�ast�literal_eval�
ValueError�
isinstance�Name� Attribute)�nodes �K/usr/lib/python3/dist-packages/pythran/transformations/normalize_compare.py�is_trivially_copiedr sb � �
��������t���
�
�
���
�����$���3�=�1�2�2� ��t��5s � �
%�%c �* � e Zd ZdZd� Zd� Zd� Zd� ZdS )�NormalizeComparea�
Turns multiple compare into a function with proper temporaries.
>>> import gast as ast
>>> from pythran import passmanager, backend
>>> node = ast.parse("def foo(a): return 0 < a + 1 < 3")
>>> pm = passmanager.PassManager("test")
>>> _, node = pm.apply(NormalizeCompare, node)
>>> print(pm.dump(backend.Python, node))
def foo(a):
return foo_compare0(a)
def foo_compare0(a):
$1 = (a + 1)
if (0 < $1):
pass
else:
return builtins.False
if ($1 < 3):
pass
else:
return builtins.False
return builtins.True
c �� � t � � | _ | � |� � |j � | j � � | xj t
| j � � z c_ |S �N)�list�compare_functions�
generic_visit�body�extend�update�bool��selfr
s r �visit_ModulezNormalizeCompare.visit_Module0 s[ � �!%��������4� � � �� ����/�0�0�0����t�D�2�3�3�3����� c �H � |j | _ | � |� � |S r )�name�prefixr r s r �visit_FunctionDefz"NormalizeCompare.visit_FunctionDef7 s$ � ��i������4� � � ��r c � � |S r � r s r �visit_AssertzNormalizeCompare.visit_Assert<