Fix deprecated datetime.utcnow() and test assertion for clean_text
This commit is contained in:
+4
-4
@@ -4,7 +4,7 @@ import logging
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
|
||||
from .models import (
|
||||
Document, ExtractedTool, TTP, Tradecraft, Entity,
|
||||
@@ -172,7 +172,7 @@ class MosaicDB:
|
||||
def update_document_extraction_time(self, doc_id: str):
|
||||
self.conn.execute(
|
||||
"UPDATE documents SET last_extracted_at = ? WHERE id = ?",
|
||||
(datetime.utcnow().isoformat(), doc_id)
|
||||
(datetime.datetime.datetime.now(datetime.timezone.utc).isoformat(), doc_id)
|
||||
)
|
||||
self.conn.commit()
|
||||
|
||||
@@ -289,8 +289,8 @@ class MosaicDB:
|
||||
ON CONFLICT(doc_id, extractor)
|
||||
DO UPDATE SET status = ?, error = ?, last_run = ?, token_count = ?
|
||||
""", (
|
||||
doc_id, extractor, status, error, datetime.utcnow().isoformat(), token_count,
|
||||
status, error, datetime.utcnow().isoformat(), token_count
|
||||
doc_id, extractor, status, error, datetime.datetime.now(datetime.timezone.utc).isoformat(), token_count,
|
||||
status, error, datetime.datetime.now(datetime.timezone.utc).isoformat(), token_count
|
||||
))
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user