Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/scrape_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class MachineScraper:

def __init__(self, project_root):
self.project_root = project_root
self.re_machine_module_name = re.compile(f"{self.project_root}/(.*).py$")
sanitized_path = self.project_root.replace("\\", "\\\\")
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using re.escape(self.project_root) to properly escape all regex metacharacters in the project path instead of manually replacing backslashes.

Suggested change
sanitized_path = self.project_root.replace("\\", "\\\\")
sanitized_path = re.escape(self.project_root)

Copilot uses AI. Check for mistakes.
self.re_machine_module_name = re.compile(f"{sanitized_path}/(.*).py$")
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex uses .py without escaping the dot, matching any character before 'py'. Escape the dot (e.g., \\.py$) to match the literal file extension.

Suggested change
self.re_machine_module_name = re.compile(f"{sanitized_path}/(.*).py$")
self.re_machine_module_name = re.compile(f"{sanitized_path}/(.*)\\.py$")

Copilot uses AI. Check for mistakes.
self.seen = set()

def __repr__(self):
Expand Down
Loading