Skip to content

Commit 6f491a6

Browse files
author
thatguysimon
authored
Explicitly mention the required usage of "memo" (#598)
1 parent 88a2b96 commit 6f491a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/providers/custom.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ To create a custom provider you need to follow these rules:
1616
1. New provider class should inherit :py:class:`Provider`.
1717
2. You need to implement the ``Provider._provide()`` method.
1818
3. You need to implement the ``Provider.__deepcopy__()`` method. It should return an
19-
equivalent copy of a provider. All providers must be copied with a ``deepcopy()`` function
20-
from the ``providers`` module. After the a new provider object is created use
19+
equivalent copy of a provider. All providers must be copied with the ``deepcopy()`` function
20+
from the ``providers`` module. It's essential to pass ``memo`` into ``deepcopy`` in order to keep the preconfigured ``args`` and ``kwargs`` of stored providers. After the a new provider object is created, use
2121
``Provider._copy_overriding()`` method to copy all overriding providers. See the example
2222
below.
2323
4. If new provider has a ``__init__()`` method, it should call the parent
@@ -33,7 +33,7 @@ To create a custom provider you need to follow these rules:
3333
.. note::
3434
1. Prefer delegation over inheritance. If you choose between inheriting a ``Factory`` or
3535
inheriting a ``Provider`` and use ``Factory`` internally - the last is better.
36-
2. When create a new provider follow the ``Factory``-like injections style. Consistency matters.
36+
2. When creating a new provider follow the ``Factory``-like injections style. Consistency matters.
3737
3. Use the ``__slots__`` attribute to make sure nothing could be attached to your provider. You
3838
will also save some memory.
3939

0 commit comments

Comments
 (0)