new dummy function

This commit is contained in:
=
2025-08-27 21:37:21 -04:00
parent bae3d41e34
commit 51d56bae4b
2 changed files with 26 additions and 5 deletions
+4 -5
View File
@@ -72,18 +72,16 @@ def add_longest_common_two_local(df, col="filename_x", new_col="longestcfp", min
return df 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. Compute longest common paths, group filepaths, write CSV for review.
""" """
df = add_longest_common_two_local(df, col=col, new_col=group_col) df = add_longest_common_two_local(df, col=col, new_col=group_col)
grouped = df.groupby(group_col)[col].apply(list).reset_index() 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 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. 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 # Keep only rows in df that are in approved_files
masked_df = df[df[filepath_col].isin(approved_files)].copy() 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): def filter_and_drop(approved, eligiblepaths, min_hashes):
""" """
+22
View File
@@ -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 <https://www.gnu.org/licenses/>.
def addHash(policy, hash):
pass
def addPath(policy, hash):
pass