Update commons.py to new OrderedDict format, just in case.

stix2.1
Emmanuelle Vargas-Gonzalez 2017-08-11 15:11:54 -04:00
parent 5172f86a7b
commit 228f488f5b
1 changed files with 14 additions and 10 deletions

View File

@ -1,18 +1,22 @@
"""STIX 2 Common Data Types and Properties""" """STIX 2 Common Data Types and Properties"""
from collections import OrderedDict
from .other import ExternalReference, GranularMarking from .other import ExternalReference, GranularMarking
from .properties import (BooleanProperty, ListProperty, ReferenceProperty, from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
StringProperty, TimestampProperty) StringProperty, TimestampProperty)
from .utils import NOW from .utils import NOW
COMMON_PROPERTIES = { COMMON_PROPERTIES = OrderedDict()
COMMON_PROPERTIES.update([
# 'type' and 'id' should be defined on each individual type # 'type' and 'id' should be defined on each individual type
'created': TimestampProperty(default=lambda: NOW, precision='millisecond'), ('created_by_ref', ReferenceProperty(type="identity")),
'modified': TimestampProperty(default=lambda: NOW, precision='millisecond'), ('created', TimestampProperty(default=lambda: NOW, precision='millisecond')),
'external_references': ListProperty(ExternalReference), ('modified', TimestampProperty(default=lambda: NOW, precision='millisecond')),
'revoked': BooleanProperty(), ('revoked', BooleanProperty()),
'labels': ListProperty(StringProperty), ('labels', ListProperty(StringProperty)),
'created_by_ref': ReferenceProperty(type="identity"), ('external_references', ListProperty(ExternalReference)),
'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")), ('object_marking_refs', ListProperty(ReferenceProperty(type="marking-definition"))),
'granular_markings': ListProperty(GranularMarking), ('granular_markings', ListProperty(GranularMarking)),
} ])