Skip to content

Commit 73632d7

Browse files
committed
import changes to prevent deprecation warnings
collections module. Fixed #367
1 parent c1f4634 commit 73632d7

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_long_description():
3030
install_requires = [
3131
'lxml>=2.2.3 ; python_version == "2.7" or python_version >= "3.5"',
3232
'lxml>=2.2.3,<4.4.0 ; python_version > "2.7" and python_version < "3.5"',
33-
'mixbox>=1.0.2',
33+
'mixbox>=1.0.4',
3434
'cybox>=2.1.0.13,<2.1.1.0',
3535
'python-dateutil',
3636
]

stix/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from sys import version_info
99

1010
# mixbox
11+
from mixbox import compat
1112
from mixbox import idgen
1213
from mixbox import entities
1314
from mixbox import fields
@@ -311,7 +312,7 @@ def istypeof(cls, obj):
311312
return isinstance(obj, cls)
312313

313314

314-
class TypedList(TypedCollection, collections.MutableSequence):
315+
class TypedList(TypedCollection, compat.MutableSequence):
315316
def __init__(self, *args):
316317
TypedCollection.__init__(self, *args)
317318

stix/common/profiles.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
import collections
55

6+
from mixbox import compat
67
from mixbox import fields
78

89
import stix
910
from stix.bindings import stix_common as stix_common_binding
1011

1112

12-
class Profiles(collections.MutableSequence, stix.Entity):
13+
class Profiles(compat.MutableSequence, stix.Entity):
1314
_binding = stix_common_binding
1415
_binding_class = stix_common_binding.ProfilesType
1516
_namespace = 'http://stix.mitre.org/common-1'

stix/common/references.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
# See LICENSE.txt for complete terms.
33
import collections
44

5+
from mixbox import compat
56
from mixbox import fields
67

78
import stix
89
from stix.bindings import stix_common as stix_common_binding
910

1011

11-
class References(collections.MutableSequence, stix.Entity):
12+
class References(compat.MutableSequence, stix.Entity):
1213
_binding = stix_common_binding
1314
_binding_class = stix_common_binding.ReferencesType
1415
_namespace = 'http://stix.mitre.org/common-1'

stix/common/structured_text.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
import stix
1111
import stix.utils as utils
1212
import stix.bindings.stix_common as stix_common_binding
13-
from mixbox.vendor.six import text_type
13+
from mixbox.vendor.six import PY2, PY3, text_type
14+
15+
16+
if PY2:
17+
from collections import Sequence
18+
elif PY3:
19+
from collections.abc import Sequence
1420

1521

1622
#: Default ordinality value for StructuredText.
@@ -105,7 +111,7 @@ def _unset_default(text):
105111
text.ordinality = ordinality
106112

107113

108-
class StructuredTextList(stix.TypedCollection, collections.Sequence):
114+
class StructuredTextList(stix.TypedCollection, Sequence):
109115
"""A sequence type used to store StructureText objects.
110116
111117
Args:

0 commit comments

Comments
 (0)