This commit is contained in:
=
2025-09-02 08:29:42 -04:00
parent 7eeb072117
commit 6b8c849db8
4 changed files with 1 additions and 80 deletions
-10
View File
@@ -19,9 +19,6 @@ from itertools import chain
import ast
import re
def split_path(path):
parts = []
while True:
@@ -64,7 +61,6 @@ def local_common_pass(paths, min_parts=3):
results[path] = best
return results
def add_longest_common_two_local(df, col="filename_x", new_col="longestcfp", min_parts=3):
dirs_series = df[col].astype(str).apply(os.path.dirname)
first_pass = local_common_pass(dirs_series.tolist(), min_parts)
@@ -72,7 +68,6 @@ def add_longest_common_two_local(df, col="filename_x", new_col="longestcfp", min
df[new_col] = dirs_series.map(lambda d: second_pass[first_pass[d]])
return df
def export_groups_for_review(df, col, group_col, min_number_in_group, path_length_constant):
"""
Compute longest common paths, group filepaths, write CSV for review.
@@ -88,8 +83,6 @@ def export_groups_for_review(df, col, group_col, min_number_in_group, path_lengt
return filtered, df
def mask_from_csv(df, csv_path, filepath_col):
"""
Reads reviewed CSV of groups, keeps only files in approved groups.
@@ -120,7 +113,6 @@ def mask_from_csv(df, csv_path, filepath_col):
remainder = df[~df[filepath_col].isin(approved_files)].copy()
return remainder
def filter_and_drop(approved, eligiblepaths, min_hashes):
"""
Filters eligiblepaths to rows where all hashes are in approved,
@@ -136,7 +128,6 @@ def filter_and_drop(approved, eligiblepaths, min_hashes):
return filtered
def inspect_parquet(path):
try:
df = pd.read_parquet(path)
@@ -149,7 +140,6 @@ def inspect_parquet(path):
return pd.DataFrame()
def regulator(paths, case_insensitive=True):
"""
Build a Python raw string regex that matches any of the given Windows path fragments.