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
import pytz
import stix2.base
import stix2
from .exceptions import (
InvalidValueError, RevokeError, UnmodifiablePropertyError,
@ -233,14 +233,12 @@ def find_property_index(obj, search_key, search_value):
Returns:
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
# mappings. Use the int value of the key as the index.
if search_key.isdigit():
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:
idx = _find(obj.object_properties(), search_key)
else:

View File

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