Registry / serialization / opytional

opytional

JSON →
library0.1.0pypypi✓ verified 83d ago

opytional makes working with values that might be None safer and easier. Current version 0.1.0, released about 2020-07-28. Low release cadence.

pip install opytional
INSTALL
IMPORT
SIG · OPYTIONAL
O
opytional
serializationpythonv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

apply_if
from opytional import apply_if
from opytional import opytionalize
or_else
from opytional import or_else
or_value
from opytional import or_value

Decorator that makes functions return None if any argument is None, avoiding manual None checks.

from opytional import opytionalize @opytionalize def maybe_divide(a, b): return a / b result = maybe_divide(10, None) # returns None instead of raising TypeError
Debug
Known issues
gotchaopytionalize only works if None is passed as an argument; it does not handle None returned from a called function inside the decorated function.
fix
Manually check return values or chain opytionalize on nested calls.
affects: all
gotchaLibrary is minimal and not actively maintained; last release 2020, few downloads. Consider using more robust alternatives like pydantic or more-itertools?
fix
Evaluate if the library meets your needs; for critical projects, prefer actively maintained alternatives.
affects: all
Upgrade
Version history
0.1.0latest on PyPI · released Feb 23, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
opytional — pip install opytional · libregistry