@@ -30,6 +30,7 @@ def __init__(self, sequence, transform=None):
3030
3131 :param sequence: sequence of items to wrap in a FunctionalSequence
3232 :return: sequence wrapped in a FunctionalSequence
33+ :rtype FunctionalSequence
3334 """
3435 if isinstance (sequence , FunctionalSequence ):
3536 self ._base_sequence = sequence ._unwrap_sequence ()
@@ -127,6 +128,7 @@ def __reversed__(self):
127128 Return reversed sequence using sequence's reverse function
128129
129130 :return: reversed sequence
131+ :rtype FunctionalSequence
130132 """
131133 return self ._transform (transformations .reversed_t ())
132134
@@ -155,6 +157,12 @@ def _evaluate(self):
155157 return self ._lineage .evaluate (self ._base_sequence )
156158
157159 def _transform (self , transform ):
160+ """
161+ Copies the given FunctionalSequence and appends new transformation
162+ :param transform: transform to apply
163+ :return: transformed sequence
164+ :rtype FunctionalSequence
165+ """
158166 return FunctionalSequence (self , transform = transform )
159167
160168 @property
@@ -261,6 +269,7 @@ def init(self):
261269 [1, 2]
262270
263271 :return: sequence without last element
272+ :rtype FunctionalSequence
264273 """
265274 return self ._transform (transformations .init_t ())
266275
@@ -272,6 +281,7 @@ def tail(self):
272281 [2, 3]
273282
274283 :return: sequence without first element
284+ :rtype FunctionalSequence
275285 """
276286 return self ._transform (transformations .tail_t ())
277287
@@ -283,6 +293,7 @@ def inits(self):
283293 [[1, 2, 3], [1, 2], [1], []]
284294
285295 :return: consecutive init()s on sequence
296+ :rtype FunctionalSequence
286297 """
287298 return self ._transform (transformations .inits_t (_wrap ))
288299
@@ -294,6 +305,7 @@ def tails(self):
294305 [[1, 2, 3], [2, 3], [3], []]
295306
296307 :return: consecutive tail()s of the sequence
308+ :rtype FunctionalSequence
297309 """
298310 return self ._transform (transformations .tails_t (_wrap ))
299311
@@ -306,6 +318,7 @@ def drop(self, n):
306318
307319 :param n: number of elements to drop
308320 :return: sequence without first n elements
321+ :rtype FunctionalSequence
309322 """
310323 if n <= 0 :
311324 return self ._transform (transformations .drop_t (0 ))
@@ -321,6 +334,7 @@ def drop_right(self, n):
321334
322335 :param n: number of elements to drop
323336 :return: sequence with last n elements dropped
337+ :rtype FunctionalSequence
324338 """
325339 self .cache ()
326340 return self ._transform (transformations .drop_right_t (n ))
@@ -334,6 +348,7 @@ def drop_while(self, func):
334348
335349 :param func: truth returning function
336350 :return: elements including and after f evaluates to False
351+ :rtype FunctionalSequence
337352 """
338353 return self ._transform (transformations .drop_while_t (func ))
339354
@@ -346,6 +361,7 @@ def take(self, n):
346361
347362 :param n: number of elements to take
348363 :return: first n elements of sequence
364+ :rtype FunctionalSequence
349365 """
350366 if n <= 0 :
351367 return self ._transform (transformations .take_t (0 ))
@@ -361,6 +377,7 @@ def take_while(self, func):
361377
362378 :param func: truth returning function
363379 :return: elements taken until f evaluates to False
380+ :rtype FunctionalSequence
364381 """
365382 return self ._transform (transformations .take_while_t (func ))
366383
@@ -373,6 +390,7 @@ def union(self, other):
373390
374391 :param other: sequence to union with
375392 :return: union of sequence and other
393+ :rtype FunctionalSequence
376394 """
377395 return self ._transform (transformations .union_t (other ))
378396
@@ -385,6 +403,7 @@ def intersection(self, other):
385403
386404 :param other: sequence to perform intersection with
387405 :return: intersection of sequence and other
406+ :rtype FunctionalSequence
388407 """
389408 return self ._transform (transformations .intersection_t (other ))
390409
@@ -397,6 +416,7 @@ def difference(self, other):
397416
398417 :param other: sequence to perform difference with
399418 :return: difference of sequence and other
419+ :rtype FunctionalSequence
400420 """
401421 return self ._transform (transformations .difference_t (other ))
402422
@@ -409,6 +429,7 @@ def symmetric_difference(self, other):
409429
410430 :param other: sequence to perform symmetric difference with
411431 :return: symmetric difference of sequence and other
432+ :rtype FunctionalSequence
412433 """
413434 return self ._transform (transformations .symmetric_difference_t (other ))
414435
@@ -421,6 +442,7 @@ def map(self, f):
421442
422443 :param f: function to map with
423444 :return: sequence with f mapped onto it
445+ :rtype FunctionalSequence
424446 """
425447 return self ._transform (transformations .map_t (f ))
426448
@@ -448,6 +470,7 @@ def filter(self, func):
448470
449471 :param func: function to filter on
450472 :return: filtered sequence
473+ :rtype FunctionalSequence
451474 """
452475 return self ._transform (transformations .filter_t (func ))
453476
@@ -460,6 +483,7 @@ def filter_not(self, func):
460483
461484 :param func: function to filter_not on
462485 :return: filtered sequence
486+ :rtype FunctionalSequence
463487 """
464488 return self ._transform (transformations .filter_not_t (func ))
465489
@@ -717,6 +741,7 @@ def flatten(self):
717741 [1, 2, 3, 4, 5, 6]
718742
719743 :return: flattened sequence
744+ :rtype FunctionalSequence
720745 """
721746 return self ._transform (transformations .flatten_t ())
722747
@@ -736,6 +761,7 @@ def flat_map(self, func):
736761
737762 :param func: function to apply to each sequence in the sequence
738763 :return: application of f to elements followed by flattening
764+ :rtype FunctionalSequence
739765 """
740766 return self ._transform (transformations .flat_map_t (func ))
741767
@@ -749,6 +775,7 @@ def group_by(self, func):
749775
750776 :param func: group by result of this function
751777 :return: grouped sequence
778+ :rtype FunctionalSequence
752779 """
753780 return self ._transform (transformations .group_by_t (func ))
754781
@@ -760,6 +787,7 @@ def group_by_key(self):
760787 [('a', [1]), ('c', [3, 0]), ('b', [2, 3, 4])]
761788
762789 :return: sequence grouped by key
790+ :rtype FunctionalSequence
763791 """
764792 return self ._transform (transformations .group_by_key_t ())
765793
@@ -773,6 +801,7 @@ def reduce_by_key(self, func):
773801
774802 :param func: reduce each list of values using two parameter, associative f
775803 :return: Sequence of tuples where the value is reduced with f
804+ :rtype FunctionalSequence
776805 """
777806 return self ._transform (transformations .reduce_by_key_t (func ))
778807
@@ -785,6 +814,7 @@ def reduce(self, func):
785814
786815 :param func: two parameter, associative reduce function
787816 :return: reduced value using f
817+ :rtype FunctionalSequence
788818 """
789819 return _wrap (reduce (func , self ))
790820
@@ -862,6 +892,7 @@ def fold_right(self, zero_value, func):
862892 :param func: Two parameter function. First parameter is value to be accumulated into result.
863893 Second parameter is the current result
864894 :return: value from folding values with f into zero_value
895+ :rtype FunctionalSequence
865896 """
866897 return self .reverse ().fold_left (zero_value , func )
867898
@@ -874,6 +905,7 @@ def zip(self, sequence):
874905
875906 :param sequence: second sequence to zip
876907 :return: stored sequence zipped with given sequence
908+ :rtype FunctionalSequence
877909 """
878910 return self ._transform (transformations .zip_t (sequence ))
879911
@@ -885,6 +917,7 @@ def zip_with_index(self):
885917 [(0, 'a'), (1, 'b'), (2, 'c')]
886918
887919 :return: sequence zipped to its index
920+ :rtype FunctionalSequence
888921 """
889922 return self ._transform (transformations .zip_with_index_t ())
890923
@@ -897,6 +930,7 @@ def enumerate(self, start=0):
897930
898931 :param start: Beginning of zip
899932 :return: enumerated sequence starting at start
933+ :rtype FunctionalSequence
900934 """
901935 return self ._transform (transformations .enumerate_t (start ))
902936
@@ -912,6 +946,7 @@ def inner_join(self, other):
912946
913947 :param other: sequence to join with
914948 :return: joined sequence of (K, (V, W)) pairs
949+ :rtype FunctionalSequence
915950 """
916951 return self .join (other , 'inner' )
917952
@@ -942,6 +977,7 @@ def join(self, other, join_type="inner"):
942977 :param other: sequence to join with
943978 :param join_type: specifies join_type, may be "left", "right", or "outer"
944979 :return: side joined sequence of (K, (V, W)) pairs
980+ :rtype FunctionalSequence
945981 """
946982 return self ._transform (transformations .join_t (other , join_type ))
947983
@@ -956,6 +992,7 @@ def left_join(self, other):
956992
957993 :param other: sequence to join with
958994 :return: left joined sequence of (K, (V, W)) pairs
995+ :rtype FunctionalSequence
959996 """
960997 return self .join (other , "left" )
961998
@@ -970,6 +1007,7 @@ def right_join(self, other):
9701007
9711008 :param other: sequence to join with
9721009 :return: right joined sequence of (K, (V, W)) pairs
1010+ :rtype FunctionalSequence
9731011 """
9741012 return self .join (other , "right" )
9751013
@@ -984,6 +1022,7 @@ def outer_join(self, other):
9841022
9851023 :param other: sequence to join with
9861024 :return: outer joined sequence of (K, (V, W)) pairs
1025+ :rtype FunctionalSequence
9871026 """
9881027 return self .join (other , "outer" )
9891028
@@ -996,6 +1035,7 @@ def partition(self, func):
9961035
9971036 :param func: predicate to partition on
9981037 :return: tuple of partitioned sequences
1038+ :rtype FunctionalSequence
9991039 """
10001040 return self ._transform (transformations .partition_t (_wrap , func ))
10011041
@@ -1012,6 +1052,7 @@ def grouped(self, size):
10121052 The last partition will be at least of size 1 and no more than length size
10131053 :param size: size of the partitions
10141054 :return: sequence partitioned into groups of length size
1055+ :rtype FunctionalSequence
10151056 """
10161057 return self ._transform (transformations .grouped_t (_wrap , size ))
10171058
@@ -1025,6 +1066,7 @@ def sorted(self, key=None, reverse=False):
10251066 :param key:
10261067 :param reverse: return list reversed or not
10271068 :return: sorted sequence
1069+ :rtype FunctionalSequence
10281070 """
10291071 return self ._transform (transformations .sorted_t (key = key , reverse = reverse ))
10301072
@@ -1036,6 +1078,7 @@ def reverse(self):
10361078 [3, 2, 1]
10371079
10381080 :return: reversed sequence
1081+ :rtype FunctionalSequence
10391082 """
10401083 return reversed (self )
10411084
@@ -1047,6 +1090,7 @@ def distinct(self):
10471090 [1, 2, 3, 4]
10481091
10491092 :return: sequence of distinct elements
1093+ :rtype FunctionalSequence
10501094 """
10511095 return self ._transform (transformations .distinct_t ())
10521096
@@ -1062,6 +1106,7 @@ def slice(self, start, until):
10621106 :param start: starting index
10631107 :param until: ending index
10641108 :return: slice including start until but not including until
1109+ :rtype FunctionalSequence
10651110 """
10661111 return self ._transform (transformations .slice_t (start , until ))
10671112
@@ -1199,6 +1244,7 @@ def seq(*args):
11991244 1) Iterable which is then directly wrapped as a FunctionalSequence
12001245 2) A list of arguments is converted to a FunctionalSequence
12011246 3) A single non-iterable is converted to a single element FunctionalSequence
1247+ :rtype FunctionalSequence
12021248 :return: wrapped sequence
12031249 """
12041250 if len (args ) == 0 :
0 commit comments