Releases: mplanchard/safetywrap
Releases · mplanchard/safetywrap
v1.5.0 - Covariance of Wrapped Types
1.5.0 - 2020-09-23
Added
- Type inference now allows covariance for
ResultandOptionwrapped types- Allows a function of type
Callable[[int], RuntimeError]to be applied
via flatmap (.and_then()) to a result of typeResult[int, Exception] - Allows e.g. any of the following to be assigned to a type of
Result[Number, Exception]:Result[int, RuntimeError]Result[float, TypeError]- etc.
- This makes
.and_then()/.flatmap(),.map(),.map_err(), and so on
much more convenient to use in result chains.
- Allows a function of type
v1.4.0 - Add new Option.collect() constructor
1.4.0 - 2020-03-09
Added
- New
Option.collectconstructor to create anOption[Tuple[T, ...]]
from an iterable ofOption[T]. If all Options in the iterator areSome[T],
they are collected into a tuple in the resultingSome. If any are
Nothing(), the result isNothing().
v1.3.1 - Fix pylint `assignment-from-no-return` warning
1.3.1 - 2020-02-21
Fixed
- Fix pylint
assignment-from-no-returnwarnings for methods that can only
raise, seen when pylint can determine whether a value is an Ok/Err or
Some/Nothing and you try to e.g.Err(5).expect("no good").
v1.3.0 - Python 3.8 Support, Option.raise_if_nothing()
1.3.0 - 2019-01-12
Added
- Testing in CI for Python 3.8
Option.raise_if_nothing(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
added as a semantically friendly alias forOption.expect.
Deprecated
Option.raise_if_erris deprecated in favor ofOption.raise_if_nothing.
Will be removed in2.0.0
v1.2.0 - raise_if_err() alias for expect()
Added
Result.raise_if_err(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
added as a semantically friendly alias forResult.expect(thanks @MustardForBreakfast!)Option.raise_if_err(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
added as a semantically friendly alias forOption.expect(thanks @MustardForBreakfast!)
v1.1.0 - Result.collect() constructor
1.1.0 - 2019-01-03
Added
Result.collect(iterable: Iterable[T, E]) -> Result[Tuple[T, ...], E]added
to collect an iterable of results into a single result, short-circuiting
if any errors are encountered
v1.0.2 - Include context in expect output
Fixed
Result.expect()andResult.expect_err()now appends the stringified
ErrorOkresult to the providedmsg.
v1.0.1 - Improve Type Hinting
Fixed
- All interface methods now, through the magic of dependent imports, specify
that they should return implementation instances. This makes working with
functions specified to return aResultor anOptionmuch easier (1780999)
v1.0.0 - Initial Release
Added
- Result and Option generic type interfaces
- Ok and Err Result implementations
- Some and Nothing Option implementations
- CI pipeline with Azure pipelines
- Full public interface testing
- Makefile for common operations, including venv setup, linting, formatting,
and testing - Basic benchmarks for analyzing performance
- Apache license