Skip to content

Commit

Permalink
docs(fix): update usage examples
Browse files Browse the repository at this point in the history
- use mutable=True instead of immutable=False
  • Loading branch information
pity7736 committed Mar 2, 2022
1 parent 740fee8 commit 552b84b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You can do this:
class Example(Entity):
_value = fields.StrField()
_other_value = fields.IntField(immutable=False)
_other_value = fields.IntField(mutable=True)
_default = fields.StrField(private=True, default_value='hello')
def do_something(self):
Expand All @@ -70,8 +70,8 @@ Visibility

All fields are public and immutable by default, so it will create getter,
property but not setter. You can change this behavior with ``private=True`` or
``immutable=False`` arguments on fields. Fields with ``private=True`` will not
create getter or setter. Fields with ``immutable=False`` will create getter,
``mutable=True`` arguments on fields. Fields with ``private=True`` will not
create getter or setter. Fields with ``mutable=True`` will create getter,
setter and property.

.. code-block:: python
Expand All @@ -80,7 +80,7 @@ setter and property.
class Example(Entity):
_attr = fields.StrField()
_mutable_attr = fields.StrField(immutable=False)
_mutable_attr = fields.StrField(mutable=True)
_private_attr = fields.StrField(private=True)
An ``Example`` instance will have ``get_attr`` method and ``attr`` property
Expand Down Expand Up @@ -119,7 +119,7 @@ setter in ``get_{field_name}`` or ``set_{field_name}`` way. Example:
class Example(Entity):
_private = fields.IntField(private=True)
_public = fields.IntField()
_mutable = fields.IntField(immutable=False)
_mutable = fields.IntField(mutable=True)
def get_public(self):
if self._private:
Expand Down

0 comments on commit 552b84b

Please sign in to comment.