Memory Optimization Draft one complete
This commit is contained in:
@@ -17,6 +17,7 @@ import pandas as pd
|
||||
import os
|
||||
from itertools import chain
|
||||
import ast
|
||||
import re
|
||||
|
||||
|
||||
|
||||
@@ -134,3 +135,28 @@ def filter_and_drop(approved, eligiblepaths, min_hashes):
|
||||
filtered = filtered[filtered['sha256'].apply(len) >= min_hashes]
|
||||
|
||||
return filtered
|
||||
|
||||
|
||||
def inspect_parquet(path):
|
||||
try:
|
||||
df = pd.read_parquet(path)
|
||||
print(f"✅ Successfully read: {path}")
|
||||
print(f"📄 Columns: {df.columns.tolist()}")
|
||||
print(f"🔢 Rows: {len(df)}")
|
||||
return df
|
||||
except Exception as e:
|
||||
print(f"❌ Error reading {path}: {e}")
|
||||
return pd.DataFrame()
|
||||
|
||||
|
||||
|
||||
def regulator(paths, case_insensitive=True):
|
||||
"""
|
||||
Build a Python raw string regex that matches any of the given Windows path fragments.
|
||||
"""
|
||||
escaped = [re.escape(p) for p in paths]
|
||||
pattern = "(?:" + "|".join(escaped) + ")"
|
||||
if case_insensitive:
|
||||
pattern = pattern
|
||||
print(f"Regulator is providing {pattern}")
|
||||
return f'r"{pattern}"'
|
||||
|
||||
Reference in New Issue
Block a user