Fix import errors

And pin medallion version for testing.
master
Chris Lenk 2020-03-27 06:33:29 -04:00
parent 50df6f1474
commit b4700e6d00
2 changed files with 3 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import re
from dateutil import parser from dateutil import parser
import pytz import pytz
import stix2.base import stix2
from .exceptions import ( from .exceptions import (
InvalidValueError, RevokeError, UnmodifiablePropertyError, InvalidValueError, RevokeError, UnmodifiablePropertyError,
@ -233,14 +233,12 @@ def find_property_index(obj, search_key, search_value):
Returns: Returns:
int: An index; -1 if the key and value aren't found int: An index; -1 if the key and value aren't found
""" """
from .base import _STIXBase
# Special-case keys which are numbers-as-strings, e.g. for cyber-observable # Special-case keys which are numbers-as-strings, e.g. for cyber-observable
# mappings. Use the int value of the key as the index. # mappings. Use the int value of the key as the index.
if search_key.isdigit(): if search_key.isdigit():
return int(search_key) return int(search_key)
if isinstance(obj, _STIXBase): if isinstance(obj, stix2.base._STIXBase):
if search_key in obj and obj[search_key] == search_value: if search_key in obj and obj[search_key] == search_value:
idx = _find(obj.object_properties(), search_key) idx = _find(obj.object_properties(), search_key)
else: else:

View File

@ -12,7 +12,7 @@ deps =
fuzzywuzzy fuzzywuzzy
haversine haversine
python-Levenshtein python-Levenshtein
medallion medallion<2.0.0
commands = commands =
python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning