Replace nested function calls with chaining expression
Project description
chaintools
Function chaining
chaintools.F를 활용해 함수를 연결하는 할 수 있다.
def add(tar: int) -> Callable[[int], int]:
def _wrapper(src: int) -> int:
return src + tar
return _wrapper
f = F >> add(1) >> add(2)
assert f(3) == 6
함수의 반환 형태가
Tuple[Tuple, Dict[str, Any]]형태일때 다음 함수의*args, **kwargs에 값을 넣어줄 수 있다.
def function1() -> Tuple[Tuple, Dict[str, Any]]:
return (1, 2), {'c': 1, 'd': 2}
def function2(a, b, c, d) -> int:
return a + b + c + d
f = F >> function1 >> function2
assert f() == 6
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chaintools-0.0.1.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chaintools-0.0.1.tar.gz.
File metadata
- Download URL: chaintools-0.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3af095d2e3c45f41098dcbe3e23e45f73350ca7d69dc369a74c7f2ab25d164a
|
|
| MD5 |
26999801634b1d00208a803529412ca5
|
|
| BLAKE2b-256 |
20c0a6665fabc1188cebd1e193ceed056ad20b2dc8f60b33e44181969b44e241
|
File details
Details for the file chaintools-0.0.1-py3-none-any.whl.
File metadata
- Download URL: chaintools-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
067b24118cd1707b743dc1a69f050711565db168b66a1217435799a4ef2b1b5c
|
|
| MD5 |
7f5e36b4cd103c97fa2cf59236794f17
|
|
| BLAKE2b-256 |
ccaf604dd348b47eb9f1a689fdb6a2be77f1c0dc8f24480ba48ac9464da6ac3b
|