-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added some methods and functions to option
and result
#172
Added some methods and functions to option
and result
#172
Conversation
Hey @dbrattli . Are you accepting PRs to this project? If so and you would be interested in merging this functionality, I can update my branch. If not then I can close the PR. |
expression/core/result.py
Outdated
@@ -28,6 +28,7 @@ | |||
|
|||
from typing_extensions import TypeAlias, TypeGuard | |||
|
|||
from . import option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not happy with option import result and result importing option. Can we use if TYPE_CHECKING:
here to avoid getting circular dependencies in the running code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review. I've updated the PR with your suggestion.
* Convert `Option`s to `Result`s and vice versa * Added `Option#to_optional` for easy convertion to Python's `Optional[T]` * Added a `Result#swap` method * Added tests for all of the above Also: * Fixed some documentation for `Result#default_values` and `Result#default_with`
fd39da5
to
b6f2fea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks for contributing!
Thank you for the great library 🙂 |
Option
s toResult
s and vice versaOption#to_optional
for easy convertion to Python'sOptional[T]
Result#swap
methodAlso:
Result#default_values
andResult#default_with