| 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�aW � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl Z
ed d ed d ed d
ed d fZed d d
fZd� Z
d� Z G d� de� � ZdS )zH TupleToShap transforms some Tuple node into shape nodes when relevant. � )�Aliases)�MODULES)�Transformation)�pythran_builtin_attrN�numpy�full�ones�zeros�empty�ndarray�reshapec �6 � t | t j � � S )N)�
isinstance�ast�Tuple)�nodes �F/usr/lib/python3/dist-packages/pythran/optimizations/tuple_to_shape.py�istupler s � ��d�C�I�&�&�&� c �V � t d� � }t j || j g � � S )N�
make_shape)r r �Call�elts)r �bs r �toshaper s% � ��\�*�*�A��8�A�t�y�"�%�%�%r c �( � � e Zd ZdZ� fd�Zd� Z� xZS )�TupleToShapea�
Replace tuple nodes by shape when relevant
>>> import gast as ast
>>> from pythran import passmanager, backend
>>> node = ast.parse("def foo(n): import numpy; return numpy.ones((n,4))")
>>> pm = passmanager.PassManager("test")
>>> _, node = pm.apply(TupleToShape, node)
>>> print(pm.dump(backend.Python, node))
def foo(n):
import numpy
return numpy.ones(builtins.pythran.make_shape(n, 4))
c �p �� d| _ t t | � � � t � � d S )NF)�update�superr �__init__r )�self� __class__s �r r! zTupleToShape.__init__* s. �� ����
�l�D�!�!�*�*�7�3�3�3�3�3r c �4 � | j � |j d � � }|��|� t � � rDt |j d � � r)d| _ t |j d � � |j d<