Skip to content

Commit

Permalink
Merge 65b0a7f into 14bad09
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] committed Nov 2, 2021
2 parents 14bad09 + 65b0a7f commit 47f114b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions lib/jaraco/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def compose(*funcs):
Compose any number of unary functions into a single unary function.
>>> import textwrap
>>> stripped = str.strip(textwrap.dedent(compose.__doc__))
>>> compose(str.strip, textwrap.dedent)(compose.__doc__) == stripped
>>> expected = str.strip(textwrap.dedent(compose.__doc__))
>>> strip_and_dedent = compose(str.strip, textwrap.dedent)
>>> strip_and_dedent(compose.__doc__) == expected
True
Compose also allows the innermost function to take arbitrary arguments.
Expand Down Expand Up @@ -210,13 +211,16 @@ def apply(transform):
>>> @apply(reversed)
... def get_numbers(start):
... "doc for get_numbers"
... return range(start, start+3)
>>> list(get_numbers(4))
[6, 5, 4]
>>> get_numbers.__doc__
'doc for get_numbers'
"""

def wrap(func):
return compose(transform, func)
return functools.wraps(func)(compose(transform, func))

return wrap

Expand All @@ -233,6 +237,8 @@ def result_invoke(action):
... return a + b
>>> x = add_two(2, 3)
5
>>> x
5
"""

def wrap(func):
Expand Down
2 changes: 1 addition & 1 deletion requirements/libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ importlib-metadata==4.8.1
importlib-resources==5.4.0
jaraco.classes==3.2.1
jaraco.collections==3.4.0
jaraco.functools==3.3.0
jaraco.functools==3.4.0
jaraco.text==3.5.1
jsonpickle==2.0.0
langdetect==1.0.9
Expand Down

0 comments on commit 47f114b

Please sign in to comment.