Skip to content

Commit ec2d191

Browse files
Renames property empty to no_args of ReaderLike2 and ReaderLike3 interfaces (#668)
1 parent 8a038c1 commit ec2d191

File tree

21 files changed

+110
-108
lines changed

21 files changed

+110
-108
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ See [0Ver](https://0ver.org/).
4343
- **Breaking**: Removes ``.from_iterable`` method from all containers,
4444
instead adds better `iterables` support,
4545
we now have `returns.iterables` module with `Fold` helper
46+
- **Breaking**: Renames property `empty` to `no_args` of
47+
all `RequiresContext`-based classes
4648

4749
- Adds new public interfaces: see `returns.interfaces`
4850
- Adds `methods` package with several helpful things inside

returns/context/requires_context.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class RequiresContext(
8181
_inner_value: Callable[[RequiresContext, _EnvType], _ReturnType]
8282

8383
#: A convenient placeholder to call methods created by `.from_value()`:
84-
empty: ClassVar[NoDeps] = object()
84+
no_args: ClassVar[NoDeps] = object()
8585

8686
def __init__(
8787
self,
@@ -319,14 +319,14 @@ def from_value(
319319
320320
Consider this method as some kind of factory.
321321
Passed value will be a return type.
322-
Make sure to use :attr:`~RequiresContext.empty`
322+
Make sure to use :attr:`~RequiresContext.no_args`
323323
for getting the unit value.
324324
325325
.. code:: python
326326
327327
>>> from returns.context import RequiresContext
328328
>>> unit = RequiresContext.from_value(5)
329-
>>> assert unit(RequiresContext.empty) == 5
329+
>>> assert unit(RequiresContext.no_args) == 5
330330
331331
Might be used with or without direct type hint.
332332
"""
@@ -424,7 +424,7 @@ def from_requires_context_future_result(
424424
... RequiresContextFutureResult.from_value(1),
425425
... )
426426
>>> assert anyio.run(
427-
... container, RequiresContext.empty,
427+
... container, RequiresContext.no_args,
428428
... ) == IOSuccess(1)
429429
430430
Can be reverted with ``RequiresContextFutureResult.from_typecast``.

0 commit comments

Comments
 (0)