�
���c�4 � �B � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z m
Z
e
de def �� � Zd� Z
d� Zd� Z e j � � fd ed
e egef defd�Zd
� Zd� Zd� Zd� Z G d� d� � Zd� Zd� d dfd�Zd� Zd� Zd� Zd� Zd� Zddd�d�ZdS )� N)�Callable�TypeVar� CallableT.)�boundc �2 � d� }t j || � � S )a;
Compose any number of unary functions into a single unary function.
>>> import textwrap
>>> 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.
>>> round_three = lambda x: round(x, ndigits=3)
>>> f = compose(round_three, int.__truediv__)
>>> [f(3*x, x+1) for x in range(1,10)]
[1.5, 2.0, 2.25, 2.4, 2.5, 2.571, 2.625, 2.667, 2.7]
c � � �� � �fd�S )Nc �& |