diff --git a/stix2/parsing.py b/stix2/parsing.py index fa2df71..850e8d7 100644 --- a/stix2/parsing.py +++ b/stix2/parsing.py @@ -71,7 +71,7 @@ def _detect_spec_version(stix_dict): _detect_spec_version(obj) for obj in stix_dict["objects"] ), ) - elif obj_type in registry.STIX2_OBJ_MAPS["v21"]["observables"]: + elif obj_type in registry.STIX2_OBJ_MAPS["2.1"]["observables"]: # Non-bundle object with an ID and without spec_version. Could be a # 2.1 SCO or 2.0 SDO/SRO/marking. Check for 2.1 SCO... v = "2.1" diff --git a/stix2/registration.py b/stix2/registration.py index 6d426f2..4ec019a 100644 --- a/stix2/registration.py +++ b/stix2/registration.py @@ -86,7 +86,7 @@ def _register_observable(new_observable, version=DEFAULT_VERSION): properties = new_observable._properties if not version: - version = stix2.DEFAULT_VERSION + version = DEFAULT_VERSION if version == "2.0": # If using STIX2.0, check properties ending in "_ref/s" are ObjectReferenceProperties diff --git a/stix2/utils.py b/stix2/utils.py index fdbbf42..8cb6291 100644 --- a/stix2/utils.py +++ b/stix2/utils.py @@ -8,7 +8,7 @@ import re import pytz import six -import stix2 +import stix2.version try: import stix2.registry as mappings except ImportError: @@ -340,7 +340,7 @@ def _stix_type_of(value): return type_ -def is_sdo(value, stix_version=stix2.DEFAULT_VERSION): +def is_sdo(value, stix_version=stix2.version.DEFAULT_VERSION): """ Determine whether the given object, type, or ID is/is for an SDO. @@ -360,7 +360,7 @@ def is_sdo(value, stix_version=stix2.DEFAULT_VERSION): return result -def is_sco(value, stix_version=stix2.DEFAULT_VERSION): +def is_sco(value, stix_version=stix2.version.DEFAULT_VERSION): """ Determine whether the given object, type, or ID is/is for an SCO. @@ -377,7 +377,7 @@ def is_sco(value, stix_version=stix2.DEFAULT_VERSION): return result -def is_sro(value, stix_version=stix2.DEFAULT_VERSION): +def is_sro(value, stix_version=stix2.version.DEFAULT_VERSION): """ Determine whether the given object, type, or ID is/is for an SRO. @@ -395,7 +395,7 @@ def is_sro(value, stix_version=stix2.DEFAULT_VERSION): return result -def is_object(value, stix_version=stix2.DEFAULT_VERSION): +def is_object(value, stix_version=stix2.version.DEFAULT_VERSION): """ Determine whether an object, type, or ID is/is for any STIX object. This includes all SDOs, SCOs, meta-objects, and bundle. @@ -413,7 +413,7 @@ def is_object(value, stix_version=stix2.DEFAULT_VERSION): return result -def is_marking(value, stix_version=stix2.DEFAULT_VERSION): +def is_marking(value, stix_version=stix2.version.DEFAULT_VERSION): """Determines whether the given value is/is for a marking definition. :param value: A STIX object, object ID, or type as a string. @@ -437,7 +437,7 @@ class STIXTypeClass(enum.Enum): SRO = 2 -def is_stix_type(value, stix_version=stix2.DEFAULT_VERSION, *types): +def is_stix_type(value, stix_version=stix2.version.DEFAULT_VERSION, *types): """ Determine whether the type of the given value satisfies the given constraints. 'types' must contain STIX types as strings, and/or the