FunctionalMaybe
A simple Maybe wrapper class that works. Creates a wrapper around variable and allows transformation of said variable to different values and supplying it to functions.
Usage:
import sys
from FunctionalMaybe import FunctionalMaybe as Maybe
joined = Maybe(["one", "two", "three"])\
.transform(lambda list_: ", ".join(list_))\ # Transform the values to something with lambda
.run(lambda result: print(result))\ # Run functions with the contained value
.unwrap() # Return the wrapped value
# We can easily e.g. print, if the wrapped value was an empty
if isinstance(joined, Maybe.Empty):
print(str(joined), file=sys.stderr)
Also supports calling the constructure inside the Maybe-class, which enables error handling via Maybe.Empty:
from FunctionalMaybe import FunctionalMaybe as Maybe
class Foo:
def __init__(self, x, y, z=None, w=1):
self.x = x
self.y = y
self.z = z
self.w = w
def __str__(self):
return f"{self.x}, {self.y}, {self.z}, {self.w}"
def log(val):
print(val)
Maybe().construct(Foo, 1, "one", w=4).transform(lambda foo: str(foo)).run(log)
# or could utilize the Maybe.Unwrapper in the following way:
Maybe("one").construct(Foo, 1, Maybe.Unwrapper, w=4).transform(lambda foo: str(foo)).run(log)
# When ever Maybe.Unwrapper is supplied as an argument, the Maybe.Unwrapper object
# is mapped to the wrapped value contained by the Maybe
Metadata
Release files for functional-maybe 1.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| functional_maybe-1.1.8.tar.gz | 5.4 kB | With provenance | Details for functional_maybe-1.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| functional_maybe-1.1.8-py3-none-any.whl | Python 3 | none | any | Details for functional_maybe-1.1.8-py3-none-any.whl |
Total release size: 11.7 kB
Release files / functional_maybe-1.1.8.tar.gz
| Download URL | functional_maybe-1.1.8.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1194ba56a4717a4e50a2c787b4406e54b2faf8550adb7e74379fe18b63d321d
|
|
BLAKE2b-256 checksum How to use checksums |
36393bbb2caec057de79ef3802d80b243de48fff94918b1ccd2eb94d3fff295b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 14, 2024.
Transparency logRelease files / functional_maybe-1.1.8-py3-none-any.whl
| Download URL | functional_maybe-1.1.8-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a24d66146c43ec0a404e2a2ad57021c36d520464c9f3fc7ac589234ea851ebf
|
|
BLAKE2b-256 checksum How to use checksums |
ba44ce74fd4ba936b2fdaea45975e1022817056f933ccb162803abd9ccecedb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 14, 2024.
Transparency logSecurity for functional-maybe 1.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for functional_maybe-1.1.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 14, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.