File tree Expand file tree Collapse file tree 6 files changed +34
-18
lines changed Expand file tree Collapse file tree 6 files changed +34
-18
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ def _get_project_meta():
76
76
77
77
# Set `typing.TYPE_CHECKING` to `True`:
78
78
# https://pypi.org/project/sphinx-autodoc-typehints/
79
- set_type_checking_flag = True
79
+ set_type_checking_flag = False
80
80
81
81
# Add any paths that contain templates here, relative to this directory.
82
82
templates_path = ['_templates' ]
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ Contents
25
25
26
26
pages/maybe.rst
27
27
pages/result.rst
28
- pages/context.rst
29
28
pages/io.rst
29
+ pages/context.rst
30
30
31
31
.. toctree ::
32
32
:maxdepth: 2
Original file line number Diff line number Diff line change @@ -317,8 +317,11 @@ Once applied, it transforms the return type to be ``IOResultE``:
317
317
Use for impure operations that might fail.
318
318
319
319
320
+ Helpers
321
+ -------
322
+
320
323
io_squash
321
- ---------
324
+ ~~~~~~~~~
322
325
323
326
This function allows to squash several ``IO `` containers together.
324
327
@@ -348,7 +351,7 @@ We support up to 9 typed parameters to this function.
348
351
.. _unsafe_perform_io :
349
352
350
353
unsafe_perform_io
351
- -----------------
354
+ ~~~~~~~~~~~~~~~~~
352
355
353
356
Sometimes you really need to get the raw value from ``IO `` container.
354
357
For example:
Original file line number Diff line number Diff line change @@ -91,8 +91,18 @@ It looks way uglier and can grow even more uglier and complex
91
91
when new logic will be introduced.
92
92
93
93
94
- @maybe decorator
95
- ----------------
94
+ Decorators
95
+ ----------
96
+
97
+ Limitations
98
+ ~~~~~~~~~~~
99
+
100
+ Typing will only work correctly
101
+ if :ref: `decorator_plugin <type-safety >` is used.
102
+ This happens due to `mypy issue <https://github.com/python/mypy/issues/3157 >`_.
103
+
104
+ maybe
105
+ ~~~~~
96
106
97
107
Sometimes we have to deal with functions
98
108
that dears to return ``Optional `` values!
Original file line number Diff line number Diff line change @@ -56,8 +56,18 @@ There are several useful alises for ``Result`` type with some common values:
56
56
and ``ResultError `` at the same time.
57
57
58
58
59
+ Decorators
60
+ ----------
61
+
62
+ Limitations
63
+ ~~~~~~~~~~~
64
+
65
+ Typing will only work correctly
66
+ if :ref: `decorator_plugin <type-safety >` is used.
67
+ This happens due to `mypy issue <https://github.com/python/mypy/issues/3157 >`_.
68
+
59
69
safe
60
- ----
70
+ ~~~~
61
71
62
72
:func: `safe <returns.functions.safe> ` is used to convert
63
73
regular functions that can throw exceptions to functions
@@ -79,13 +89,6 @@ Supports both async and regular functions.
79
89
>> > str (divide(0 ))
80
90
' <Failure: division by zero>'
81
91
82
- Limitations
83
- ~~~~~~~~~~~
84
-
85
- Typing will only work correctly
86
- if :ref: `decorator_plugin <type-safety >` is used.
87
- This happens due to `mypy issue <https://github.com/python/mypy/issues/3157 >`_.
88
-
89
92
90
93
FAQ
91
94
---
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ class IOResult(
206
206
Explicit marker for impure function results that might fail.
207
207
208
208
Definition
209
- ----------
209
+ ~~~~~~~~~~
210
210
211
211
We call it "marker" since once it is marked, it cannot be unmarked.
212
212
@@ -238,14 +238,14 @@ class IOResult(
238
238
with :meth:`~IOResult.from_failed_io`
239
239
and :meth:`IOResult.from_successful_io`
240
240
- You can construct ``IOResult`` from ``Result`` values
241
- with :meth:`~IOResult.__init__ `
241
+ with :meth:`~IOResult.from_result `
242
242
243
243
We also have a lot of utility methods for better function composition like:
244
244
245
245
- :meth:`~IOResult.bind_result` to work
246
246
with functions which return ``Result``
247
247
- :meth:`~IOResult.from_typecast` to work with ``IO[Result[...]]`` values
248
- - :meth:`~IOResult.lift` and `~IOResult.lift_result` to allow
248
+ - :meth:`~IOResult.lift` and :meth: `~IOResult.lift_result` to allow
249
249
indirect function composition
250
250
with regular and ``Result`` based functions.
251
251
@@ -254,7 +254,7 @@ class IOResult(
254
254
255
255
256
256
Implementation
257
- --------------
257
+ ~~~~~~~~~~~~~~
258
258
259
259
This class contains all the methods that can be delegated to ``Result``.
260
260
But, some methods have ``raise NotImplementedError`` which means
You can’t perform that action at this time.
0 commit comments