Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compoz

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compoz

A simple composition library

  • 0.1.0b3
  • PyPI
  • Socket score

Maintainers
1

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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc