Improve the docstring for new_version(). Especially with the

three-value logic for allow_custom, it needed some much better
documentation.
pull/1/head
Michael Chisholm 2020-05-28 17:25:38 -04:00
parent d4cecd6f51
commit a05dbc42d5
1 changed files with 12 additions and 1 deletions

View File

@ -114,8 +114,19 @@ def _is_versionable(data):
def new_version(data, allow_custom=None, **kwargs):
"""Create a new version of a STIX object, by modifying properties and
"""
Create a new version of a STIX object, by modifying properties and
updating the ``modified`` property.
:param data: The object to create a new version of. Maybe a stix2 object
or dict.
:param allow_custom: Whether to allow custom properties on the new object.
If True, allow them (regardless of whether the original had custom
properties); if False disallow them; if None, propagate the preference
from the original object.
:param kwargs: The properties to change. Setting to None requests property
removal.
:return: The new object.
"""
is_versionable, is_21 = _is_versionable(data)