diff --git a/.travis.yml b/.travis.yml index c05ec72..d57fca7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ python: - "3.5" - "3.6" - "3.7" + - "3.8" install: - pip install -U pip setuptools - pip install tox-travis pre-commit diff --git a/setup.py b/setup.py index 23fab97..66bf302 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,7 @@ setup( 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], keywords='stix stix2 json cti cyber threat intelligence', packages=find_packages(exclude=['*.test', '*.test.*']), diff --git a/stix2/base.py b/stix2/base.py index dba5d71..a283902 100644 --- a/stix2/base.py +++ b/stix2/base.py @@ -1,6 +1,5 @@ """Base classes for type definitions in the STIX2 library.""" -import collections import copy import datetime as dt import uuid @@ -20,6 +19,12 @@ from .utils import NOW, find_property_index, format_datetime, get_timestamp from .utils import new_version as _new_version from .utils import revoke as _revoke +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + + __all__ = ['STIXJSONEncoder', '_STIXBase'] DEFAULT_ERROR = "{type} must have {property}='{expected}'." @@ -68,7 +73,7 @@ def get_required_properties(properties): return (k for k, v in properties.items() if v.required) -class _STIXBase(collections.Mapping): +class _STIXBase(Mapping): """Base class for STIX object types""" def object_properties(self): diff --git a/stix2/properties.py b/stix2/properties.py index bd1e114..a5fe475 100644 --- a/stix2/properties.py +++ b/stix2/properties.py @@ -2,7 +2,6 @@ import base64 import binascii -import collections import copy import inspect import re @@ -20,6 +19,11 @@ from .exceptions import ( ) from .utils import _get_dict, get_class_hierarchy_names, parse_into_datetime +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + ERROR_INVALID_ID = ( "not a valid STIX identifier, must match --: {}" ) @@ -198,7 +202,7 @@ class ListProperty(Property): else: obj_type = self.contained - if isinstance(valid, collections.Mapping): + if isinstance(valid, Mapping): try: valid._allow_custom except AttributeError: diff --git a/tox.ini b/tox.ini index 4ee0da5..bc5bf32 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py34,py35,py36,py37,style,isort-check,packaging +envlist = py27,py34,py35,py36,py37,py38,style,isort-check,packaging [testenv] deps = @@ -11,6 +11,7 @@ deps = taxii2-client fuzzywuzzy haversine + python-Levenshtein medallion commands = python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning @@ -42,7 +43,8 @@ commands = [travis] python = 2.7: py27, style - 3.4: py34, style - 3.5: py35, style - 3.6: py36, style, packaging - 3.7: py37, style + 3.4: py34 + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.7: py38, style, packaging