Skip to main content

A simple composition library

Project description

Compoz

Compoz is a lightweight composition package.

Overview

Compoz provides with two main functions:

  • composite (for standard composition)
  • pipe (for reversed composition)

'composite'

'composite' will run from last to the first function provided.

from compoz import composite


def multiply_by_3(n: int) -> int:
    return n * 3


def subtract_5(n: int) -> int:
    return n - 5


composite_func_1 = composite(subtract_5, multiply_by_3)
print(composite_func_1(10))
# Output will be 25

composite_func_2 = composite(multiply_by_3, subtract_5)
print(composite_func_2(10))
# Output will be 15

'pipe'

'pipe' will run from first to the last function provided.

from compoz import pipe


def multiply_by_3(n: int) -> int:
    return n * 3


def subtract_5(n: int) -> int:
    return n - 5


pipe_func_1 = pipe(subtract_5, multiply_by_3)
print(pipe_func_1(10))
# Output will be 15

pipe_func_2 = pipe(multiply_by_3, subtract_5)
print(pipe_func_2(10))
# Output will be 25

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compoz-0.1.0b3.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

compoz-0.1.0b3-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file compoz-0.1.0b3.tar.gz.

File metadata

  • Download URL: compoz-0.1.0b3.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for compoz-0.1.0b3.tar.gz
Algorithm Hash digest
SHA256 e880f9117ce6d0929e3286e37e0b5e32ef2866b4bf2752e9721a0998306347a4
MD5 39f6895fcccdf553558423d5a584a7dd
BLAKE2b-256 fbe6b0fc2dfdb8fd0049d35267f8a8f7b56f63148f12fe6402ed74bc556a1063

See more details on using hashes here.

File details

Details for the file compoz-0.1.0b3-py3-none-any.whl.

File metadata

  • Download URL: compoz-0.1.0b3-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for compoz-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c10e1c62fc77bfd1df67c1511c5369be655f99e56392ac63c0e19f2a41551d0
MD5 e664cad6461b538e8692387991a85741
BLAKE2b-256 93b2bac406e24f4345d929b7e0152a5f5d08f8caabd0de2bf133666a10188f1c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page