From b18243915572b99a73e245c8863da7460b91acc4 Mon Sep 17 00:00:00 2001 From: Ian Hellen Date: Wed, 5 Apr 2023 08:15:31 -0700 Subject: [PATCH] Reverting to bokeh version 2.4.3 for default install (#650) Replacing NAs in process_tree DF - causes Bokeh 3.0 to fail --- conda/conda-reqs.txt | 2 +- msticpy/vis/process_tree.py | 20 ++++++++++++++++++-- requirements-all.txt | 2 +- requirements.txt | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/conda/conda-reqs.txt b/conda/conda-reqs.txt index 4c931e9cb..421b926bd 100644 --- a/conda/conda-reqs.txt +++ b/conda/conda-reqs.txt @@ -10,7 +10,7 @@ azure-mgmt-network>=2.7.0 azure-mgmt-resource>=16.1.0 azure-storage-blob>=12.5.0 beautifulsoup4>=4.0.0 -bokeh>=1.4.0, <=3.1.0 +bokeh>=1.4.0, <=2.4.3 cryptography>=3.1 deprecated>=1.2.4 dnspython>=2.0.0, <3.0.0 diff --git a/msticpy/vis/process_tree.py b/msticpy/vis/process_tree.py index 191c7910b..032537f04 100644 --- a/msticpy/vis/process_tree.py +++ b/msticpy/vis/process_tree.py @@ -361,6 +361,9 @@ def _pre_process_tree( _validate_plot_schema(proc_tree, schema) + # kludgy fix to prevent NaNs making it into the data - Bokeh 3.0 + # is very sensitive to this in some places. + proc_tree = proc_tree.fillna("NA") proc_tree = proc_tree.sort_values( by=["path", schema.time_stamp], ascending=True ).reset_index() @@ -400,12 +403,25 @@ def _pre_process_tree( def _pid_fmt(pid, pid_fmt): + """Format process ID in required string format.""" + if pid == np.nan: + pid = "" if pid_fmt == "hex": - return f"PID: {pid}" if str(pid).startswith("0x") else f"PID: 0x{int(pid):x}" + return ( + f"PID: {pid}" + if str(pid).startswith("0x") + else f"PID: 0x{int(pid):x}" + if isinstance(pid, int) + else "NA" + ) if pid_fmt == "guid": return f"GUID: {pid}" return ( - f"PID: {pid}" if not str(pid).startswith("0x") else f"PID: {int(pid, base=16)}" + f"PID: {pid}" + if not str(pid).startswith("0x") + else f"PID: {int(pid, base=16)}" + if isinstance(pid, int) + else "NA" ) diff --git a/requirements-all.txt b/requirements-all.txt index 5f30ce353..b9e2c299e 100644 --- a/requirements-all.txt +++ b/requirements-all.txt @@ -13,7 +13,7 @@ azure-mgmt-resourcegraph>=8.0.0 azure-mgmt-subscription>=3.0.0 azure-storage-blob>=12.5.0 beautifulsoup4>=4.0.0 -bokeh>=1.4.0, <=3.1.0 +bokeh>=1.4.0, <=2.4.3 cryptography>=3.1 deprecated>=1.2.4 dnspython>=2.0.0, <3.0.0 diff --git a/requirements.txt b/requirements.txt index d87691474..7e899fe0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ azure-core>=1.24.0 azure-identity>=1.10.0 azure-mgmt-subscription>=3.0.0 beautifulsoup4>=4.0.0 -bokeh>=1.4.0, <=3.1.0 +bokeh>=1.4.0, <=2.4.3 cryptography>=3.1 deprecated>=1.2.4 dnspython>=2.0.0, <3.0.0