Skip to main content

A functional interface for python iterator

Project description

functionalstream

Installation

pip install functionalstream

Example

Stream

from functionalstream import Stream

# lst1 = [0, 6, 12, 18, 24]
lst1 = Stream(range(10)).filter(lambda x: x % 2 == 0).map(lambda x: x * 3).to_list()

# lst2 = [(1, 2), (3, 4)]
lst2 = Stream([(1,2), (3,4), (6,5)]).filter(lambda x, y: x < y, star=True).to_list()

# array = array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
array = Stream(range(10)).to_numpy_array(dtype=float)

# for function which has side effect
Stream(range(10)).apply(lambda x: print(x))

PathStream

from functionalstream import PathStream

video_paths = PathStream.from_path('./').filter_extension(extensions={".jpeg"})

Pipeline

from functionalstream.functions import increment
from functionalstream import Stream

# x = 3
x = Stream([increment] * 3).pipeline(0)

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

functionalstream-0.1.8.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

functionalstream-0.1.8-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file functionalstream-0.1.8.tar.gz.

File metadata

  • Download URL: functionalstream-0.1.8.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.3

File hashes

Hashes for functionalstream-0.1.8.tar.gz
Algorithm Hash digest
SHA256 1ed9704f7f4c64ed8e83021feaea4719a2a686aa6205996e8c3cf21827d47eba
MD5 d8f9c3a1ee725184db6106726d4bad2c
BLAKE2b-256 8741c48ef7316416e11c0eedae8fc1a619aa652e9637b8c2d40310babb9f2246

See more details on using hashes here.

File details

Details for the file functionalstream-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: functionalstream-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.3

File hashes

Hashes for functionalstream-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2735ed290f71f70998d1f8d515b00ada5b5b583b44517e3327d059514195b7
MD5 2045f07f520dd52c59e467233b942b5d
BLAKE2b-256 5993c01f90468ac9217d2919ce3a69286cdc153edbf1a93973d631120521143f

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