Ruff
Some checks failed
Run Python tests (through Pytest) / Test (push) Successful in 25s
Verify Python project can be installed, loaded and have version checked / Test (push) Has been cancelled

This commit is contained in:
Jon Michael Aanes 2025-04-13 18:42:40 +02:00
parent 8d46519784
commit fc85c982b9

View File

@ -15,19 +15,19 @@ DEFAULT_DB_PATH = 'output/seen_issues.db'
class SeenIssuesDB:
"""
Database handler for tracking processed issues.
This class manages a SQLite database that stores hashes of issues that have
already been processed. It provides methods to mark issues as seen and check
if an issue has been seen before, helping to prevent duplicate processing.
Attributes:
conn: SQLite database connection
"""
def __init__(self, db_path=DEFAULT_DB_PATH):
"""
Initialize the database connection.
Args:
db_path: Path to the SQLite database file. Defaults to 'output/seen_issues.db'.
"""
@ -37,7 +37,7 @@ class SeenIssuesDB:
def _create_table(self):
"""
Create the seen_issues table if it doesn't exist.
Creates a table with a single column for storing issue hashes.
"""
with self.conn:
@ -50,10 +50,10 @@ class SeenIssuesDB:
def mark_as_seen(self, issue_text: str):
"""
Mark an issue as seen in the database.
Computes a hash of the issue text and stores it in the database.
If the issue has already been marked as seen, this operation has no effect.
Args:
issue_text: The text content of the issue to mark as seen.
"""
@ -67,12 +67,12 @@ class SeenIssuesDB:
def has_seen(self, issue_text: str) -> bool:
"""
Check if an issue has been seen before.
Computes a hash of the issue text and checks if it exists in the database.
Args:
issue_text: The text content of the issue to check.
Returns:
True if the issue has been seen before, False otherwise.
"""
@ -86,10 +86,10 @@ class SeenIssuesDB:
def _compute_hash(self, text: str) -> str:
"""
Compute a SHA-256 hash of the given text.
Args:
text: The text to hash.
Returns:
A hexadecimal string representation of the hash.
"""