Skip to content

Commit 360d28d

Browse files
committed
Update .gitignore to include test files and modify regex pattern for XML policy extraction
1 parent 6b37cb6 commit 360d28d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ __pycache__/
55
.backup/
66
.vscode/
77
doc/
8+
__test__.py
9+
eval_policy_gen.py

datasets/process.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def load_datasets(self, datasets_dir_path: Path) -> dict[str, pd.DataFrame]:
4040
print(f"Loaded {file_name} with shape: {df.shape}")
4141
elif file_name.endswith(".xml"):
4242
with open(file_path, "r", encoding="utf-8") as file:
43-
policy_pattern = re.compile(r"<Policy[\s\S]*?<\/Policy>")
43+
policy_pattern = re.compile(
44+
r"<Policy\s[^>]*>[\s\S]*?<\/Policy>"
45+
)
4446
xacml_content = file.read()
4547
policies = policy_pattern.findall(xacml_content)
4648
datasets[file_name] = pd.DataFrame({"policy": policies})

0 commit comments

Comments
 (0)