Add ordereddict dependency for 2.6 support. Import change in utils.py

stix2.1
Emmanuelle Vargas-Gonzalez 2017-08-15 14:12:21 -04:00
parent 15b5e107d5
commit a18804a195
7 changed files with 22 additions and 7 deletions

View File

@ -47,6 +47,7 @@ setup(
keywords="stix stix2 json cti cyber threat intelligence",
packages=find_packages(),
install_requires=[
'ordereddict'
'python-dateutil',
'pytz',
'requests',

View File

@ -1,6 +1,9 @@
"""STIX 2 Common Data Types and Properties"""
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .base import _STIXBase
from .properties import (BooleanProperty, HashesProperty, IDProperty,

View File

@ -1,6 +1,9 @@
"""STIX 2.0 Objects that are neither SDOs nor SROs"""
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from . import exceptions
from .base import _STIXBase

View File

@ -5,7 +5,10 @@ embedded in Email Message objects, inherit from _STIXBase instead of Observable
and do not have a '_type' attribute.
"""
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .base import _Extension, _Observable, _STIXBase
from .exceptions import (AtLeastOnePropertyError, DependentPropertiesError,

View File

@ -1,6 +1,9 @@
"""STIX 2.0 Domain Objects"""
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import stix2

View File

@ -1,6 +1,9 @@
"""STIX 2.0 Relationship Objects."""
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .base import _STIXBase
from .common import ExternalReference, GranularMarking

View File

@ -6,8 +6,6 @@ import json
from dateutil import parser
import pytz
from .base import _STIXBase
# Sentinel value for properties that should be set to the current time.
# We can't use the standard 'default' approach, since if there are multiple
# timestamps in a single object, the timestamps will vary by a few microseconds.
@ -124,6 +122,7 @@ def find_property_index(obj, properties, tuple_to_find):
according to the _properties OrderedDict. If its a list look for
individual objects.
"""
from .base import _STIXBase
try:
if tuple_to_find[1] in obj._inner.values():
return properties.index(tuple_to_find[0])