diff --git a/stix2/properties.py b/stix2/properties.py index dd6cd44..b013b7e 100644 --- a/stix2/properties.py +++ b/stix2/properties.py @@ -11,7 +11,7 @@ from six import string_types, text_type import stix2 -from .base import _Observable, _STIXBase +from .base import _STIXBase from .core import STIX2_OBJ_MAPS, parse, parse_observable from .exceptions import ( CustomContentError, DictionaryKeyError, MissingPropertiesError, @@ -219,19 +219,6 @@ class ListProperty(Property): return result -class CallableValues(list): - """Wrapper to allow `values()` method on WindowsRegistryKey objects. - Needed because `values` is also a property. - """ - - def __init__(self, parent_instance, *args, **kwargs): - self.parent_instance = parent_instance - super(CallableValues, self).__init__(*args, **kwargs) - - def __call__(self): - return _Observable.values(self.parent_instance) - - class StringProperty(Property): def __init__(self, **kwargs): diff --git a/stix2/test/v20/test_observed_data.py b/stix2/test/v20/test_observed_data.py index a822efb..bfe9c34 100644 --- a/stix2/test/v20/test_observed_data.py +++ b/stix2/test/v20/test_observed_data.py @@ -1301,9 +1301,9 @@ def test_windows_registry_key_example(): values=[v], ) assert w.key == "hkey_local_machine\\system\\bar\\foo" - assert w.values[0].name == "Foo" - assert w.values[0].data == "qwerty" - assert w.values[0].data_type == "REG_SZ" + assert w["values"][0].name == "Foo" + assert w["values"][0].data == "qwerty" + assert w["values"][0].data_type == "REG_SZ" # ensure no errors in serialization because of 'values' assert "Foo" in str(w) diff --git a/stix2/test/v21/test_observed_data.py b/stix2/test/v21/test_observed_data.py index c1f15cd..371018c 100644 --- a/stix2/test/v21/test_observed_data.py +++ b/stix2/test/v21/test_observed_data.py @@ -1382,9 +1382,9 @@ def test_windows_registry_key_example(): values=[v], ) assert w.key == "hkey_local_machine\\system\\bar\\foo" - assert w.values[0].name == "Foo" - assert w.values[0].data == "qwerty" - assert w.values[0].data_type == "REG_SZ" + assert w["values"][0].name == "Foo" + assert w["values"][0].data == "qwerty" + assert w["values"][0].data_type == "REG_SZ" # ensure no errors in serialization because of 'values' assert "Foo" in str(w) diff --git a/stix2/v20/observables.py b/stix2/v20/observables.py index dc2b4aa..81e2c48 100644 --- a/stix2/v20/observables.py +++ b/stix2/v20/observables.py @@ -12,7 +12,7 @@ from ..base import _Extension, _Observable, _STIXBase from ..custom import _custom_extension_builder, _custom_observable_builder from ..exceptions import AtLeastOnePropertyError, DependentPropertiesError from ..properties import ( - BinaryProperty, BooleanProperty, CallableValues, DictionaryProperty, + BinaryProperty, BooleanProperty, DictionaryProperty, EmbeddedObjectProperty, EnumProperty, ExtensionsProperty, FloatProperty, HashesProperty, HexProperty, IntegerProperty, ListProperty, ObjectReferenceProperty, StringProperty, TimestampProperty, TypeProperty, @@ -723,11 +723,6 @@ class WindowsRegistryKey(_Observable): ('extensions', ExtensionsProperty(spec_version="2.0", enclosing_type=_type)), ]) - @property - def values(self): - # Needed because 'values' is a property on collections.Mapping objects - return CallableValues(self, self._inner['values']) - class X509V3ExtenstionsType(_STIXBase): """For more detailed information on this object's properties, see diff --git a/stix2/v21/observables.py b/stix2/v21/observables.py index 6f53255..1703263 100644 --- a/stix2/v21/observables.py +++ b/stix2/v21/observables.py @@ -15,7 +15,7 @@ from ..exceptions import ( AtLeastOnePropertyError, DependentPropertiesError, STIXDeprecationWarning, ) from ..properties import ( - BinaryProperty, BooleanProperty, CallableValues, DictionaryProperty, + BinaryProperty, BooleanProperty, DictionaryProperty, EmbeddedObjectProperty, EnumProperty, ExtensionsProperty, FloatProperty, HashesProperty, HexProperty, IDProperty, IntegerProperty, ListProperty, ObjectReferenceProperty, ReferenceProperty, StringProperty, @@ -935,11 +935,6 @@ class WindowsRegistryKey(_Observable): ]) _id_contributing_properties = ["key", "values"] - @property - def values(self): - # Needed because 'values' is a property on collections.Mapping objects - return CallableValues(self, self._inner['values']) - class X509V3ExtenstionsType(_STIXBase): # TODO: Add link