🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

pipe-fp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipe-fp

Functional piping for Python. ➡️

1.1.7
PyPI
Maintainers
1

➡️ Pipe fp

Functional piping for Python.

Simple ⬦ Clear ⬦ Concise

GitHub Actions Workflow Status PyPI - Version PyPI - Python Version

Background

Piping is a method targeting code composition style, taking input data and passing it through a series of functions to produce a final output data.

Usage

Pipe fp is a tool to compose code in a simple, clear, and concise manner.

Features

  • Composable pipelines; build it.
  • Lazy evaluation; call any time later.
  • Lambda functions with type hinting via generics! ✨

Example

Without Generics

from pipe_fp import pipe


pipe(
  str.lower,
  str.title,
  str.split
)('WHY, HELLO THERE! 🐰')

Returns

['Why,', 'Hello', 'There!', '🐰']

Using Generics

from pipe_fp import pipe


# msg will be of type str; not Any! 😲
pipe[str](
  lambda msg: msg.lower(),
  lambda msg: msg.title(),
  lambda msg: msg.split()
)('WHY, HELLO THERE! 🐰')

Returns

['Why,', 'Hello', 'There!', '🐰']

Keywords

python

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