From 51d56bae4bf7ad1063a0dc25eb9dfd3b519a36ab Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 27 Aug 2025 21:37:21 -0400 Subject: [PATCH] new dummy function --- utils/pathfunctions.py | 9 ++++----- utils/policyfunctions.py | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 utils/policyfunctions.py diff --git a/utils/pathfunctions.py b/utils/pathfunctions.py index 82fa278..e15439a 100644 --- a/utils/pathfunctions.py +++ b/utils/pathfunctions.py @@ -72,18 +72,16 @@ def add_longest_common_two_local(df, col="filename_x", new_col="longestcfp", min return df -def export_groups_for_review(df, col="filename_x", group_col="longestcfp", csv_path="filegroups_review.csv"): +def export_groups_for_review(df, col="filename_x", group_col="longestcfp"): """ Compute longest common paths, group filepaths, write CSV for review. """ df = add_longest_common_two_local(df, col=col, new_col=group_col) grouped = df.groupby(group_col)[col].apply(list).reset_index() - grouped.to_csv(csv_path, index=False) - print(f"Grouped file list saved to: {csv_path}") return grouped, df -def mask_from_csv(df, csv_path, filepath_col="filename_x", group_col="longestcfp"): +def mask_from_csv(df, csv_path, filepath_col): """ Reads reviewed CSV of groups, keeps only files in approved groups. """ @@ -98,7 +96,8 @@ def mask_from_csv(df, csv_path, filepath_col="filename_x", group_col="longestcfp # Keep only rows in df that are in approved_files masked_df = df[df[filepath_col].isin(approved_files)].copy() - return masked_df + remainder = df[~df[filepath_col].isin(approved_files)].copy() + return masked_df, remainder def filter_and_drop(approved, eligiblepaths, min_hashes): """ diff --git a/utils/policyfunctions.py b/utils/policyfunctions.py new file mode 100644 index 0000000..aa75129 --- /dev/null +++ b/utils/policyfunctions.py @@ -0,0 +1,22 @@ +# Copyright (C) 2025 James Brotosky, Brandon Wickline +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + + + +def addHash(policy, hash): + pass + +def addPath(policy, hash): + pass \ No newline at end of file