parent
50df6f1474
commit
b4700e6d00
|
@ -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:
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue