Remove unused code.

stix2.1
Greg Back 2017-02-24 13:08:18 -06:00
parent a79df01449
commit aa1ecfa235
2 changed files with 1 additions and 26 deletions

View File

@ -36,10 +36,6 @@ def get_required_properties(properties):
class _STIXBase(collections.Mapping):
"""Base class for STIX object types"""
@classmethod
def _make_id(cls):
return cls._type + "--" + str(uuid.uuid4())
# TODO: remove this
def _handle_old_style_property(self, prop_name, prop_metadata, kwargs):
cls = self.__class__
@ -50,10 +46,6 @@ class _STIXBase(collections.Mapping):
default = prop_metadata['default']
if default == NOW:
kwargs[prop_name] = self.__now
else:
kwargs[prop_name] = default(cls)
elif prop_metadata.get('fixed'):
kwargs[prop_name] = prop_metadata['fixed']
if prop_metadata.get('validate'):
if (prop_name in kwargs and
@ -121,8 +113,6 @@ class _STIXBase(collections.Mapping):
# Handle attribute access just like key access
def __getattr__(self, name):
if name.startswith('_'):
return super(_STIXBase, self).__getattr__(name)
return self.get(name)
def __setattr__(self, name, value):

View File

@ -49,7 +49,7 @@ class Property(object):
raise ValueError("must equal '{0}'.".format(self._fixed_value))
return value
def __init__(self, required=False, fixed=None, clean=None, validate=None, default=None):
def __init__(self, required=False, fixed=None, clean=None, default=None):
self.required = required
if fixed:
self._fixed_value = fixed
@ -57,8 +57,6 @@ class Property(object):
self.default = lambda: fixed
if clean:
self.clean = clean
if validate:
self.validate = validate
if default:
self.default = default
@ -73,19 +71,6 @@ class Property(object):
return value
class TypeProperty(Property):
def __init__(self, type):
self.type = type
def validate(self, value):
if value != self.type:
raise ValueError("Invalid type value")
def default(self):
return self.type
class List(Property):
def __init__(self, contained):