Change default parameters from empty lists to None. Fixes #351

master
Desai, Kartikey H 2020-03-04 14:29:35 -05:00
parent 8810983ca0
commit fc95b400ff
2 changed files with 5 additions and 2 deletions

View File

@ -53,7 +53,7 @@ def _custom_marking_builder(cls, type, properties, version):
return _CustomMarking
def _custom_observable_builder(cls, type, properties, version, id_contrib_props=[]):
def _custom_observable_builder(cls, type, properties, version, id_contrib_props=None):
class _CustomObservable(cls, _Observable):
if not re.match(TYPE_REGEX, type):

View File

@ -966,7 +966,7 @@ class X509Certificate(_Observable):
self._check_at_least_one_property(att_list)
def CustomObservable(type='x-custom-observable', properties=None, id_contrib_props=[]):
def CustomObservable(type='x-custom-observable', properties=None, id_contrib_props=None):
"""Custom STIX Cyber Observable Object type decorator.
Example:
@ -980,6 +980,9 @@ def CustomObservable(type='x-custom-observable', properties=None, id_contrib_pro
... pass
"""
if id_contrib_props is None:
id_contrib_props = []
def wrapper(cls):
_properties = list(itertools.chain.from_iterable([
[('type', TypeProperty(type))],