Skip to content

Commit

Permalink
Use update wrapper to copy some informations like docstring to Pipe w…
Browse files Browse the repository at this point in the history
…rapper.
  • Loading branch information
JulienPalard committed May 12, 2017
1 parent dc0146c commit a4d0634
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pipe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env python

import functools


""" Infix programming toolkit
Module enabling a sh like infix syntax (using pipes).
Expand Down Expand Up @@ -278,7 +282,7 @@ def stdout(x):
passed
Like Python's pass.
>>> "something" | passed
index
Returns index of value in iterable
Expand Down Expand Up @@ -400,6 +404,7 @@ class Pipe:
"""
def __init__(self, function):
self.function = function
functools.update_wrapper(self, function)

def __ror__(self, other):
return self.function(other)
Expand All @@ -426,7 +431,7 @@ def tail(iterable, qte):
if len(out) > qte:
out.pop(0)
return out

@Pipe
def skip(iterable, qte):
"Skip qte elements in the given iterable, then yield others."
Expand Down

0 comments on commit a4d0634

Please sign in to comment.