Skip to content

Commit

Permalink
Add docstring for encode
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Feb 6, 2019
1 parent 89eb0e7 commit d166d6c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ssz/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def encode(value, sedes=None, cache=True):
of integers(as of now).
`sedes` parameter could be given as a string or as the
actual sedes object itself.
If `value` has an attribute :attr:`_cached_ssz` (as, notably,
:class:`ssz.sedes.Serializable`) and its value is not `None`, this value is
returned bypassing serialization and encoding, unless `sedes` is given (as
the cache is assumed to refer to the standard serialization which can be
replaced by specifying `sedes`).
If `value` is a :class:`ssz.sedes.Serializable` and `cache` is true, the result of
the encoding will be stored in :attr:`_cached_ssz` if it is empty.
"""
if isinstance(value, Serializable):
cached_ssz = value._cached_ssz
Expand Down

0 comments on commit d166d6c

Please sign in to comment.