Change query dict style for Filter namedtuple.

stix2.1
Emmanuelle Vargas-Gonzalez 2017-08-18 12:05:12 -04:00
parent 681be1a5d9
commit c64b7de761
3 changed files with 7 additions and 23 deletions

View File

@ -13,7 +13,7 @@ import json
import os
from stix2 import Bundle
from stix2.sources import DataSink, DataSource, DataStore
from stix2.sources import DataSink, DataSource, DataStore, Filter
class FileSystemStore(DataStore):
@ -78,11 +78,7 @@ class FileSystemSource(DataSource):
"""
"""
query = [
{
"field": "id",
"op": "=",
"value": stix_id
}
Filter("id", "=", stix_id)
]
all_data = self.query(query=query, _composite_filters=_composite_filters)

View File

@ -22,7 +22,7 @@ import json
import os
from stix2 import Bundle
from stix2.sources import DataSink, DataSource, DataStore
from stix2.sources import DataSink, DataSource, DataStore, Filter
from stix2validator import validate_string
@ -205,11 +205,7 @@ class MemorySource(DataSource):
# if there are filters from the composite level, process full query
query = [
{
"field": "id",
"op": "=",
"value": stix_id
}
Filter("id", "=", stix_id)
]
all_data = self.query(query=query, _composite_filters=_composite_filters)

View File

@ -12,7 +12,7 @@ TODO: Test everything
import json
from stix2.sources import DataSink, DataSource, DataStore, make_id
from stix2.sources import DataSink, DataSource, DataStore, Filter, make_id
TAXII_FILTERS = ['added_after', 'id', 'type', 'version']
@ -89,16 +89,8 @@ class TAXIICollectionSource(DataSource):
"""
# make query in TAXII query format since 'id' is TAXII field
query = [
{
"field": "match[id]",
"op": "=",
"value": stix_id
},
{
"field": "match[version]",
"op": "=",
"value": "all"
}
Filter("match[id]", "=", stix_id),
Filter("match[version]", "=", "all")
]
all_data = self.query(query=query, _composite_filters=_composite_filters)