Skip to main content

Lens 1.2.1

Purpose

The purpose of this project is to implement the "Lens" functional pattern in Python and supply that implementation as a package that can be imported into any other python project.

Install

pip install simplelens

Uninstall

pip uninstall simplelens

Usage

Install the package from PyPi via pip install
import lens

The lens function expects a collection of some form, as well as a list of keys and/or indexes to use to extract data from the collection.

collection = {'a': {'b': [{'a': 1}, {'b': 2}, {'c': 3}]
lens.focus(collection, ['a', 'b', 2, 'c'])
#=> 3

Also a feature is returning a tuple of multiple key sequences.

collection = {'a': {'b': [{'a': 1}, {'b': 2}, {'c': 3}]
lens.multi_focus(collection, (['a', 'b', 2, 'c'], ['a', 'b', 0, 'a']))
#=> (3, 1)

Changelog

See changelog here: Changelog.md

License

Copyright 2024 Nathan Menge - nathan.menge@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release files for simplelens 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplelens 1.2.1
File Size Uploaded
simplelens-1.2.1.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simplelens 1.2.1
File Interpreter ABI Platform
simplelens-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / simplelens-1.2.1.tar.gz

Download URL simplelens-1.2.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ed8202d9838a8ed835a63787b9b452c1f1f81f454d92e0431ca2f641813266d5
BLAKE2b-256 checksum
How to use checksums
15efb17d1abf3510ee7e1c903d40ee50ceed62b2b11764f03d6863c010481294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / simplelens-1.2.1-py3-none-any.whl

Download URL simplelens-1.2.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
952b669e52b1ca1f55b3820b06059975b72f6d9b371b6a1fbafac0c12989082b
BLAKE2b-256 checksum
How to use checksums
64a87683e93894875b7c66dfae1fd6590990c6b22ecb384bf8b0e76dde64b1d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page