File indexing completed on 2024-04-28 15:53:57
0001 # AUTO-GENERATED FILE -- DO NOT EDIT 0002 0003 """ Functional tools for creating and using iterators. 0004 0005 Infinite iterators: 0006 count([n]) --> n, n+1, n+2, ... 0007 cycle(p) --> p0, p1, ... plast, p0, p1, ... 0008 repeat(elem [,n]) --> elem, elem, elem, ... endlessly or up to n times 0009 0010 Iterators terminating on the shortest input sequence: 0011 chain(p, q, ...) --> p0, p1, ... plast, q0, q1, ... 0012 compress(data, selectors) --> (d[0] if s[0]), (d[1] if s[1]), ... 0013 dropwhile(pred, seq) --> seq[n], seq[n+1], starting when pred fails 0014 groupby(iterable[, keyfunc]) --> sub-iterators grouped by value of keyfunc(v) 0015 ifilter(pred, seq) --> elements of seq where pred(elem) is True 0016 ifilterfalse(pred, seq) --> elements of seq where pred(elem) is False 0017 islice(seq, [start,] stop [, step]) --> elements from 0018 seq[start:stop:step] 0019 imap(fun, p, q, ...) --> fun(p0, q0), fun(p1, q1), ... 0020 starmap(fun, seq) --> fun(*seq[0]), fun(*seq[1]), ... 0021 tee(it, n=2) --> (it1, it2 , ... itn) splits one iterator into n 0022 takewhile(pred, seq) --> seq[0], seq[1], until pred fails 0023 izip(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... 0024 izip_longest(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... 0025 0026 Combinatoric generators: 0027 product(p, q, ... [repeat=1]) --> cartesian product 0028 permutations(p[, r]) 0029 combinations(p, r) 0030 combinations_with_replacement(p, r) 0031 """ 0032 0033 __package__ = None 0034 0035 class chain(object): 0036 """ chain(*iterables) --> chain object 0037 0038 Return a chain object whose .next() method returns elements from the 0039 first iterable until it is exhausted, then elements from the next 0040 iterable, until all of the iterables are exhausted. """ 0041 0042 def from_iterable(self, iterable): 0043 """ chain.from_iterable(iterable) --> chain object 0044 0045 Alternate chain() contructor taking a single iterable argument 0046 that evaluates lazily. """ 0047 return None 0048 0049 def next(self): 0050 """ x.next() -> the next value, or raise StopIteration """ 0051 return None 0052 0053 class combinations(object): 0054 """ combinations(iterable, r) --> combinations object 0055 0056 Return successive r-length combinations of elements in the iterable. 0057 0058 combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3) """ 0059 0060 def next(self): 0061 """ x.next() -> the next value, or raise StopIteration """ 0062 return None 0063 0064 class combinations_with_replacement(object): 0065 """ combinations_with_replacement(iterable, r) --> combinations_with_replacement object 0066 0067 Return successive r-length combinations of elements in the iterable 0068 allowing individual elements to have successive repeats. 0069 combinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC """ 0070 0071 def next(self): 0072 """ x.next() -> the next value, or raise StopIteration """ 0073 return None 0074 0075 class compress(object): 0076 """ compress(data, selectors) --> iterator over selected data 0077 0078 Return data elements corresponding to true selector elements. 0079 Forms a shorter iterator from selected data elements using the 0080 selectors to choose the data elements. """ 0081 0082 def next(self): 0083 """ x.next() -> the next value, or raise StopIteration """ 0084 return None 0085 0086 class count(object): 0087 """ count(start=0, step=1) --> count object 0088 0089 Return a count object whose .next() method returns consecutive values. 0090 Equivalent to: 0091 0092 def count(firstval=0, step=1): 0093 x = firstval 0094 while 1: 0095 yield x 0096 x += step 0097 """ 0098 0099 def next(self): 0100 """ x.next() -> the next value, or raise StopIteration """ 0101 return None 0102 0103 class cycle(object): 0104 """ cycle(iterable) --> cycle object 0105 0106 Return elements from the iterable until it is exhausted. 0107 Then repeat the sequence indefinitely. """ 0108 0109 def next(self): 0110 """ x.next() -> the next value, or raise StopIteration """ 0111 return None 0112 0113 class dropwhile(object): 0114 """ dropwhile(predicate, iterable) --> dropwhile object 0115 0116 Drop items from the iterable while predicate(item) is true. 0117 Afterwards, return every element until the iterable is exhausted. """ 0118 0119 def next(self): 0120 """ x.next() -> the next value, or raise StopIteration """ 0121 return None 0122 0123 class groupby(object): 0124 """ groupby(iterable[, keyfunc]) -> create an iterator which returns 0125 (key, sub-iterator) grouped by each value of key(value). 0126 """ 0127 0128 def next(self): 0129 """ x.next() -> the next value, or raise StopIteration """ 0130 return None 0131 0132 class filterfalse(object): 0133 """ filterfalse(function or None, sequence) --> ifilterfalse object 0134 0135 Return those items of sequence for which function(item) is false. 0136 If function is None, return the items that are false. """ 0137 0138 def next(self): 0139 """ x.next() -> the next value, or raise StopIteration """ 0140 return None 0141 0142 class slice(object): 0143 """ slice(iterable, [start,] stop [, step]) --> islice object 0144 0145 Return an iterator whose next() method returns selected values from an 0146 iterable. If start is specified, will skip all preceding elements; 0147 otherwise, start defaults to zero. Step defaults to one. If 0148 specified as another value, step determines how many values are 0149 skipped between successive calls. Works like a slice() on a list 0150 but returns an iterator. """ 0151 0152 def next(self): 0153 """ x.next() -> the next value, or raise StopIteration """ 0154 return None 0155 0156 class zip_longest(object): 0157 """ zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> izip_longest object 0158 0159 Return a zip_longest object whose .next() method returns a tuple where 0160 the i-th element comes from the i-th iterable argument. The .next() 0161 method continues until the longest iterable in the argument sequence 0162 is exhausted and then it raises StopIteration. When the shorter iterables 0163 are exhausted, the fillvalue is substituted in their place. The fillvalue 0164 defaults to None or can be specified by a keyword argument. 0165 """ 0166 0167 def next(self): 0168 """ x.next() -> the next value, or raise StopIteration """ 0169 return None 0170 0171 class permutations(object): 0172 """ permutations(iterable[, r]) --> permutations object 0173 0174 Return successive r-length permutations of elements in the iterable. 0175 0176 permutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1) """ 0177 0178 def next(self): 0179 """ x.next() -> the next value, or raise StopIteration """ 0180 return None 0181 0182 class product(object): 0183 """ product(*iterables) --> product object 0184 0185 Cartesian product of input iterables. Equivalent to nested for-loops. 0186 0187 For example, product(A, B) returns the same as: ((x,y) for x in A for y in B). 0188 The leftmost iterators are in the outermost for-loop, so the output tuples 0189 cycle in a manner similar to an odometer (with the rightmost element changing 0190 on every iteration). 0191 0192 To compute the product of an iterable with itself, specify the number 0193 of repetitions with the optional repeat keyword argument. For example, 0194 product(A, repeat=4) means the same as product(A, A, A, A). 0195 0196 product('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2) 0197 product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ... """ 0198 0199 def next(self): 0200 """ x.next() -> the next value, or raise StopIteration """ 0201 return None 0202 0203 class repeat(object): 0204 """ repeat(object [,times]) -> create an iterator which returns the object 0205 for the specified number of times. If not specified, returns the object 0206 endlessly. """ 0207 0208 def next(self): 0209 """ x.next() -> the next value, or raise StopIteration """ 0210 return None 0211 0212 class starmap(object): 0213 """ starmap(function, sequence) --> starmap object 0214 0215 Return an iterator whose values are returned from the function evaluated 0216 with a argument tuple taken from the given sequence. """ 0217 0218 def next(self): 0219 """ x.next() -> the next value, or raise StopIteration """ 0220 return None 0221 0222 class takewhile(object): 0223 """ takewhile(predicate, iterable) --> takewhile object 0224 0225 Return successive entries from an iterable as long as the 0226 predicate evaluates to true for each entry. """ 0227 0228 def next(self): 0229 """ x.next() -> the next value, or raise StopIteration """ 0230 return None 0231 0232 def tee(iterable, n=2): 0233 """ tee(iterable, n=2) --> tuple of n independent iterators. """ 0234 return () 0235