文件操作 - cycler.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/__pycache__/cycler.cpython-311.pyc
编辑文件内容
� �k{a�8 � �t � d Z ddlZddlmZ ddlmZmZ ddlmZm Z dZ d� Zd� Z G d � d � � Z d� Zd� ZdS ) a� Cycler ====== Cycling through combinations of values, producing dictionaries. You can add cyclers:: from cycler import cycler cc = (cycler(color=list('rgb')) + cycler(linestyle=['-', '--', '-.'])) for d in cc: print(d) Results in:: {'color': 'r', 'linestyle': '-'} {'color': 'g', 'linestyle': '--'} {'color': 'b', 'linestyle': '-.'} You can multiply cyclers:: from cycler import cycler cc = (cycler(color=list('rgb')) * cycler(linestyle=['-', '--', '-.'])) for d in cc: print(d) Results in:: {'color': 'r', 'linestyle': '-'} {'color': 'r', 'linestyle': '--'} {'color': 'r', 'linestyle': '-.'} {'color': 'g', 'linestyle': '-'} {'color': 'g', 'linestyle': '--'} {'color': 'g', 'linestyle': '-.'} {'color': 'b', 'linestyle': '-'} {'color': 'b', 'linestyle': '--'} {'color': 'b', 'linestyle': '-.'} � N)�reduce)�product�cycle)�mul�addz0.10.0c �8 � | �t t | � � � � ni }|�t t |� � � � ni }t |� � � � � }t |� � � � � }||z rt d� � �||z S )a Helper function to compose cycler keys. Parameters ---------- left, right : iterable of dictionaries or None The cyclers to be composed. Returns ------- keys : set The keys in the composition of the two cyclers. Nz"Can not compose overlapping cycles)�next�iter�set�keys� ValueError)�left�right�l_peek�r_peek�l_key�r_keys �(/usr/lib/python3/dist-packages/cycler.py� _process_keysr 4 s� � � "&�!1�T�$�t�*�*� � � �r�F�"'�"3�T�$�u�+�+� � � ��F����� � ���E����� � ���E��u�}� ?��=�>�>�>��5�=�� c �@ ��� | j |j k r>t d� | j |j z | j |j z �� � � � �| � � � �|� � � �t t ��fd�| j D � � � � S )aS Concatenate `Cycler`\s, as if chained using `itertools.chain`. The keys must match exactly. Examples -------- >>> num = cycler('a', range(3)) >>> let = cycler('a', 'abc') >>> num.concat(let) cycler('a', [0, 1, 2, 'a', 'b', 'c']) Returns ------- `Cycler` The concatenated cycler. zBKeys do not match: Intersection: {both!r} Disjoint: {just_one!r})�both�just_onec 3 �V �K � | ]#}t |�| �| z � � V � �$d S �N��_cycler)�.0�k�_l�_rs ��r � <genexpr>zconcat.<locals>.<genexpr>e s9 �� � � �E�E�a���2�a�5�2�a�5�=�1�1�E�E�E�E�E�Er )r r �format�by_keyr r )r r r r! s @@r �concatr% K s� ��� �$ �y�E�J���� 4�4:�F�"&�)�e�j�"8�&*�i�%�*�&<� 5;� 5>� 5>�?� ?� ?� �����B� �����B��#�E�E�E�E�E�4�9�E�E�E�F�F�Fr c � � e Zd ZdZd� Zdd�Zd� Zed� � � Zd� Z e d� � � Zd � Zd � Z d� Zd� Zd � Zd� Zd� Zd� Zd� Zd� ZdZd� Zd� Zd� ZeZd� ZeZdS )�Cyclera� Composable cycles. This class has compositions methods: ``+`` for 'inner' products (zip) ``+=`` in-place ``+`` ``*`` for outer products (`itertools.product`) and integer multiplication ``*=`` in-place ``*`` and supports basic slicing via ``[]``. Parameters ---------- left, right : Cycler or None The 'left' and 'right' cyclers. op : func or None Function which composes the 'left' and 'right' cyclers. c � � t | � � S r )r ��selfs r �__call__zCycler.__call__� s � ��T�{�{�r Nc � � t |t � � r&t |j |j |j � � | _ n|�d� |D � � | _ nd| _ t |t � � r&t |j |j |j � � | _ n|�d� |D � � | _ nd| _ t | j | j � � | _ || _ dS )zf Semi-private init. Do not use this directly, use `cycler` function instead. Nc �6 � g | ]}t j |� � ��S � ��copy�r �vs r � <listcomp>z#Cycler.__init__.<locals>.<listcomp>� s � �5�5�5�1�$�)�A�,�,�5�5�5r c �6 � g | ]}t j |� � ��S r. r/ r1 s r r3 z#Cycler.__init__.<locals>.<listcomp>� s � �7�7�7�A�4�9�Q�<�<�7�7�7r )� isinstancer'