From 2babde168fd52b21b4938a84a55982818935ba90 Mon Sep 17 00:00:00 2001 From: Paul Coccoli Date: Thu, 15 Jun 2023 16:33:20 -0400 Subject: [PATCH 1/4] fast translate: fix final ound of reference resolution --- firepit/aio/ingest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firepit/aio/ingest.py b/firepit/aio/ingest.py index f28581c..5f8e891 100644 --- a/firepit/aio/ingest.py +++ b/firepit/aio/ingest.py @@ -220,7 +220,6 @@ def translate( # (flattened) native results. # Columns to duplicate (assume same Transformer?) - #dup_cols = {} dup_cols = defaultdict(list) # Transformers @@ -503,15 +502,18 @@ def translate( if not obj: continue # i.e. skip observed-data _make_ids(df, obj, obj_key, sco_type, ref_ids) - _resolve_refs(df, sco_type, ref_cols, ref_ids, obj_set, obj_renames) + tmp = _resolve_refs(df, sco_type, ref_cols, ref_ids, obj_set, obj_renames) + unresolved.update(tmp) # Maybe we can now resolve the unresolved refs? + logger.debug('Try ref resolution one last time (last round)') still_unresolved = {} for ref_col, value in unresolved.items(): obj_key, _, _ = ref_col.rpartition(':') obj, _, sco_type = obj_key.rpartition('#') tmp = _resolve_refs(df, sco_type, ref_cols, ref_ids, obj_set, obj_renames) still_unresolved.update(tmp) + logger.debug('Still unresolved: %s', still_unresolved) # Remove any unresolved refs at this point unresolved_ref_cols = list(still_unresolved.keys()) From 76f70cfba0460df557c19ae4d75fea671224015f Mon Sep 17 00:00:00 2001 From: Paul Coccoli Date: Fri, 16 Jun 2023 14:53:24 -0400 Subject: [PATCH 2/4] fast translate: handle 'truth value of an array' error --- firepit/aio/ingest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firepit/aio/ingest.py b/firepit/aio/ingest.py index 5f8e891..b90c125 100644 --- a/firepit/aio/ingest.py +++ b/firepit/aio/ingest.py @@ -393,7 +393,7 @@ def translate( for new_col, orig_cols in group.items(): # Combine columns into single list column logger.debug('Group %s into "%s"', orig_cols, new_col) - df[new_col] = df[orig_cols].agg(lambda x: [i for i in list(x) if not pd.isna(i)], axis=1) #.values.tolist() + df[new_col] = [[i for i in row if i == i or not pd.isna(i)] for row in df[orig_cols].values.tolist()] df = df.drop(orig_cols, axis=1) # Run transformers From 238748e28dfa287b2fe8e8726e4eb6c1f46c9fe6 Mon Sep 17 00:00:00 2001 From: Paul Coccoli Date: Mon, 19 Jun 2023 16:27:27 -0400 Subject: [PATCH 3/4] =?UTF-8?q?Bump=20version:=202.3.21=20=E2=86=92=202.3.?= =?UTF-8?q?22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firepit/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/firepit/__init__.py b/firepit/__init__.py index ad20bcd..f27b715 100644 --- a/firepit/__init__.py +++ b/firepit/__init__.py @@ -2,7 +2,7 @@ __author__ = """IBM Security""" __email__ = 'pcoccoli@us.ibm.com' -__version__ = '2.3.21' +__version__ = '2.3.22' import re diff --git a/setup.cfg b/setup.cfg index 91fdeeb..70792f9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.21 +current_version = 2.3.22 commit = True tag = True diff --git a/setup.py b/setup.py index 00f7c70..b5dc40f 100644 --- a/setup.py +++ b/setup.py @@ -65,6 +65,6 @@ test_suite='tests', tests_require=test_requirements, url='https://github.com/opencybersecurityalliance/firepit', - version='2.3.21', + version='2.3.22', zip_safe=False, ) From 11cad90198a3cbe648030464982017dcecedbf4e Mon Sep 17 00:00:00 2001 From: Paul Coccoli Date: Mon, 19 Jun 2023 16:39:51 -0400 Subject: [PATCH 4/4] Update testing.yml - remove 3.7 Remove support for Python 3.7 since ujson won't build on macos w/3.7 --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 974ef09..d1eed2d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 - name: Set up Python