Hacked By AnonymousFox
�
�܋f�$ � �� � d Z ddlmZmZmZ ddlmZmZ ddlZddlm Z ddl
mZ d� Zer$ddl
Z
d� Zd � Zd
� Zd� ZeZeZeZddlmZ eZg d
�ZdS ddlZej Zej Zej Zej Zej Zg ZdS )a,
This module is designed to be used as follows::
from past.builtins.noniterators import filter, map, range, reduce, zip
And then, for example::
assert isinstance(range(5), list)
The list-producing functions this brings in are::
- ``filter``
- ``map``
- ``range``
- ``reduce``
- ``zip``
� )�division�absolute_import�print_function)�chain�starmapN)�
basestring)�PY3c �F � t j t | |� � � � S �N)r �
from_iterable�map)�f�itemss �Q/opt/cloudlinux/venv/lib64/python3.11/site-packages/past/builtins/noniterators.py�flatmapr s � ���s�1�e�}�}�-�-�-� c �\ � t | d � � }t | d t � � r) |� � � t j | � � � S t | d t t f� � r |t j | � � � S t t j | � � � S )a*
filter(function or None, sequence) -> list, tuple, or string
Return those items of sequence for which function(item) is true.
If function is None, return the items that are true. If sequence
is a tuple or string, return the same type, else return a list.
� )�type�
isinstancer �join�builtins�filter�tuple�list)�args�mytypes r � oldfilterr $ s� � � �d�1�g�����d�1�g�z�*�*� 0��6�8�8�=�=���$�!7�8�8�8�
��Q��%���
/�
/� 0��6�(�/�4�0�1�1�1� ����.�/�/�/r c �\ � t j |� }t |� � }t |� � dk rg S | �|}nt t | |� � � � } t d� |D � � � � dk r!t t
j |� � � � S n# t $ r
}Y d}~nd}~ww xY w|S )a
map(function, sequence[, sequence, ...]) -> list
Return a list of the results of applying the function to the
items of the argument sequence(s). If more than one sequence is
given, the function is called with an argument list consisting of
the corresponding item of each sequence, substituting None for
missing values when not all sequences have the same length. If
the function is None, return a list of the items of the sequence
(or a list of tuples if more than one sequence).
Test cases:
>>> oldmap(None, 'hello world')
['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
>>> oldmap(None, range(4))
[0, 1, 2, 3]
More test cases are in test_past.test_builtins.
r Nc �, � g | ]}t |� � ��S � )�len)�.0�items r �
<listcomp>zoldmap.<locals>.<listcomp>X s � �1�1�1�$�C��I�I�1�1�1r r ) � itertools�zip_longestr r"