Skip to content

Commit cfcd128

Browse files
committed
[client] rename objects_max_deps to objects_max_refs
1 parent 2cf20e3 commit cfcd128

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def import_bundle_from_json(
221221
update: bool = False,
222222
types: List = None,
223223
work_id: str = None,
224-
objects_max_deps: int = 0,
224+
objects_max_refs: int = 0,
225225
) -> Tuple[list, list]:
226226
"""import a stix2 bundle from JSON data
227227
@@ -232,13 +232,13 @@ def import_bundle_from_json(
232232
:param types: list of stix2 types, defaults to None
233233
:type types: list, optional
234234
:param work_id work_id: str, optional
235-
:param objects_max_deps: max deps amount of objects, reject object import if larger than configured amount
236-
:type objects_max_deps: int, optional
235+
:param objects_max_refs: max deps amount of objects, reject object import if larger than configured amount
236+
:type objects_max_refs: int, optional
237237
:return: list of imported stix2 objects and a list of stix2 objects with too many deps
238238
:rtype: Tuple[List,List]
239239
"""
240240
data = json.loads(json_data)
241-
return self.import_bundle(data, update, types, work_id, objects_max_deps)
241+
return self.import_bundle(data, update, types, work_id, objects_max_refs)
242242

243243
def resolve_author(self, title: str) -> Optional[Identity]:
244244
if "fireeye" in title.lower() or "mandiant" in title.lower():
@@ -3057,7 +3057,7 @@ def import_bundle(
30573057
update: bool = False,
30583058
types: List = None,
30593059
work_id: str = None,
3060-
objects_max_deps: int = 0,
3060+
objects_max_refs: int = 0,
30613061
) -> Tuple[list, list]:
30623062
# Check if the bundle is correctly formatted
30633063
if "type" not in stix_bundle or stix_bundle["type"] != "bundle":
@@ -3070,7 +3070,7 @@ def import_bundle(
30703070
else None
30713071
)
30723072

3073-
stix2_splitter = OpenCTIStix2Splitter(objects_max_deps)
3073+
stix2_splitter = OpenCTIStix2Splitter(objects_max_refs)
30743074
_, incompatible_elements, bundles, too_large_elements_bundles = (
30753075
stix2_splitter.split_bundle_with_expectations(
30763076
stix_bundle, False, event_version

pycti/utils/opencti_stix2_splitter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class OpenCTIStix2Splitter: # pylint: disable=too-many-instance-attributes
3939
Splits large STIX2 bundles into smaller chunks for processing.
4040
"""
4141

42-
def __init__(self, objects_max_deps: int = 0):
43-
self.objects_max_deps = objects_max_deps
42+
def __init__(self, objects_max_refs: int = 0):
43+
self.objects_max_refs = objects_max_refs
4444
self.cache_index = {}
4545
self.cache_refs = {}
4646
self.elements = []
@@ -203,7 +203,7 @@ def enlist_element(
203203
)
204204
else:
205205
is_compatible = is_id_supported(item_id)
206-
if 0 < self.objects_max_deps <= raw_nb_refs:
206+
if 0 < self.objects_max_refs <= raw_nb_refs:
207207
self.too_large_elements.append(item)
208208
elif is_compatible:
209209
self.elements.append(item)

0 commit comments

Comments
 (0)