Skip to main content

Utility functions for common tasks when composing functions.

Project description

composetools

A library of utility functions for Pythonic function composition.
Most utilities are focused on transforming and dealing with iterables.

Install

pip install composetools

Functions

  • compose

    Compose functions such that compose(f, g)(x) is equivalent to g(f(x))

  • pipe

    Compose functions such that pipe(f, g)(x) is equivalent to f(g(x))

Utilities

  • unique - Yield unique items of an iterable.
  • each - Curried map.
  • keep - Curried filter.
  • mask - Curried itertools.compress.
  • drop - Curried itertools.filterfalse.
  • sort - Curried sorted.
  • flat - Flatten an arbitrarily nested iterable to a desired depth.
  • also - Call a function and return its input, eg. also(print)(4) will print 4 and return 4.

Develop

$ gh repo clone SeparateRecords/python-composetools
$ poetry install
$ poetry run python -m pytest tests.py

Licence

ISC

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

composetools-0.5.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

composetools-0.5.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file composetools-0.5.0.tar.gz.

File metadata

  • Download URL: composetools-0.5.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.5 Windows/10

File hashes

Hashes for composetools-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0264814d8a73eb5fe8bb4fc051b02dc1bea59f68f9d8b4ab7a73fdfb8d5ee210
MD5 88b2a7fec28bf726b951fdc17adc7c77
BLAKE2b-256 754092911a83a990636d95b5bf887e7647a707c81ba760a0d0a35c6cfe032817

See more details on using hashes here.

File details

Details for the file composetools-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: composetools-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.5 Windows/10

File hashes

Hashes for composetools-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fec6dba598593d7901feaf8218078fd1fab10efc150fa72011e171f37445537
MD5 f4724b59b0c0a5234dd3bcc467d32416
BLAKE2b-256 07a42c147b54eb13f5536cc46a0b1533d54a10c20c073f0cefc033b49a216244

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