Remove some ugly python2 compatibilty code from stix2.versioning

module, since we no longer support python2.
pull/1/head
Michael Chisholm 2021-01-20 20:58:13 -05:00
parent 38067a6ec7
commit 404fcd04ca
1 changed files with 2 additions and 12 deletions

View File

@ -5,8 +5,7 @@ import datetime as dt
import itertools
import uuid
import six
from six.moves.collections_abc import Mapping
from collections.abc import Mapping
import stix2.base
import stix2.registry
@ -92,18 +91,9 @@ def _is_versionable(data):
# Then, determine versionability.
if six.PY2:
# dumb python2 compatibility: map.keys() returns a list, not a set!
# six.viewkeys() compatibility function uses dict.viewkeys() on
# python2, which is not a Mapping mixin method, so that doesn't
# work either (for our stix2 objects).
keys = set(data)
else:
keys = data.keys()
# This should be sufficient for STIX objects; maybe we get lucky with
# dicts here but probably not.
if keys >= _VERSIONING_PROPERTIES:
if data.keys() >= _VERSIONING_PROPERTIES:
is_versionable = True
# Tougher to handle dicts. We need to consider STIX version, map to a