| 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/optimizations/__pycache__/ |
Upload File : |
�
cR�a� � �F � d Z ddlmZ ddlmZ ddlZ G d� de� � ZdS )zN
RangeLoopUnfolding turns unfolded range of non unrolled loops back to range.
� )�Transformation)�isnumNc � � e Zd ZdZd� Zd� ZdS )�RangeLoopUnfoldinga�
Turns iteration over an incrementing list of literals into a range
>>> import gast as ast
>>> from pythran import passmanager, backend
>>> node = ast.parse("for i in [1,2,3]: print(i)")
>>> pm = passmanager.PassManager("test")
>>> _, node = pm.apply(RangeLoopUnfolding, node)
>>> print(pm.dump(backend.Python, node))
for i in builtins.range(1, 4, 1):
print(i)
c � � |sd S t d� |D � � � � sd S d� |D � � }|d }t |� � dk r||dz dfS |d |z
}|d |z }|t t |||� � � � k r|||fS d S )Nc 3 �h K � | ]-}t |� � ot |j t � � V � �.d S �N)r �
isinstance�value�int��.0�xs �L/usr/lib/python3/dist-packages/pythran/optimizations/range_loop_unfolding.py� <genexpr>z-RangeLoopUnfolding.isrange.<locals>.<genexpr> sM � � � � "� "�� ��8�8�8�
�1�7�C� 8� 8� "� "� "� "� "� "� c � � g | ] }|j ��
S � )r r
s r �
<listcomp>z.RangeLoopUnfolding.isrange.<locals>.<listcomp> s � �.�.�.�A���.�.�.r r � ���)�all�len�list�range)�self�elts�unboxed_ints�start�step�stops r �israngezRangeLoopUnfolding.isrange s� � �� ��4�� "� "� �"� "� "� "� "� ��4�.�.��.�.�.���Q����|����!�!��%�!�)�Q�&�&���?�U�*�D���#�d�*�D��t�E�%��t�$<�$<�=�=�=�=��d�D�(�(��tr c
� � t |j t j t j f� � r�| � |j j � � }|rpt j t j t j dt j
� � d d � � d|j j � � d� |D � � g � � |_ d| _ | �
|� � S )N�builtinsr c �8 � g | ]}t j |d � � ��S r )�ast�Constant)r �params r r z0RangeLoopUnfolding.visit_For.<locals>.<listcomp>3 s$ � �I�I�I�5�S�\�%��.�.�I�I�Ir T)r
�iterr&