vX4dZddlmZmZmZddlmZmZddlZddlm Z ddl m Z dZ e r$ddl Z dZd Zd Zd ZeZeZeZdd lmZeZgd ZdSddlZejZejZejZejZejZgZdS)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`` )divisionabsolute_importprint_function)chainstarmapN) basestring)PY3cFtjt||SN)r from_iterablemap)fitemss l/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/past/builtins/noniterators.pyflatmaprs  s1e}} - --c\t|d}t|dtr)|t j|St|dt tfr|t j|Stt 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 isinstancerjoinbuiltinsfiltertuplelist)argsmytypes r oldfilterr$sd1g d1gz * * 0688==$!788 8 Q% / / 06(/4011 1.// /rc\tj|}t|}t|dkrgS||}ntt ||} t d|Ddkr!tt j|Sn#t$r }Yd}~nd}~wwxYw|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. rNc,g|]}t|S)len).0items r zoldmap..Xs111$CII111rr) itertools zip_longestrr"rmaxrr TypeError)func iterableszippedlresultes roldmapr08s*& 2 LL q66Q;;I <FF'$**++F 11&11122a77E/778888    DDDD  s=B B)$B)c>ttj|i|Sr )rrrangerkwargss roldranger5sHND3F33444rc>ttj|i|Sr )rrzipr3s roldzipr8sHL$1&11222r)reduce)rr r2r9r7)__doc__ __future__rrrr&rr past.typesr past.utilsr rrrr0r5r8rr r2 functoolsr9r7__all__ __builtin__r!rrrAsL&A@@@@@@@@@$$$$$$$$!!!!!!...pOOO000(&&&F555333F C E      C999GGG  F /C  E  F /CGGGr