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
Release files for chaintools 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chaintools-0.0.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chaintools-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / chaintools-0.0.1.tar.gz
| Download URL | chaintools-0.0.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3af095d2e3c45f41098dcbe3e23e45f73350ca7d69dc369a74c7f2ab25d164a
|
|
BLAKE2b-256 checksum How to use checksums |
20c0a6665fabc1188cebd1e193ceed056ad20b2dc8f60b33e44181969b44e241
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / chaintools-0.0.1-py3-none-any.whl
| Download URL | chaintools-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
067b24118cd1707b743dc1a69f050711565db168b66a1217435799a4ef2b1b5c
|
|
BLAKE2b-256 checksum How to use checksums |
ccaf604dd348b47eb9f1a689fdb6a2be77f1c0dc8f24480ba48ac9464da6ac3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|