mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
fix: replace deprecated datetime.utcnow() with timezone-aware datetime.now(timezone.utc) (#816)
Python 3.14 deprecates datetime.utcnow(). Replace all 9 occurrences with datetime.now(timezone.utc) and normalize the output to preserve the existing ISO-8601 "Z"-suffixed format so downstream parsers are unaffected. Fixes #814
This commit is contained in:
parent
95e4839da7
commit
ef8bb3aed4
6 changed files with 15 additions and 15 deletions
|
|
@ -13,7 +13,7 @@ Agent provenance tracks the reasoning trace of agent sessions:
|
|||
"""
|
||||
|
||||
import json
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Optional, Dict, Any
|
||||
|
||||
from .. schema import Triple, Term, IRI, LITERAL
|
||||
|
|
@ -87,7 +87,7 @@ def agent_session_triples(
|
|||
List of Triple objects
|
||||
"""
|
||||
if timestamp is None:
|
||||
timestamp = datetime.utcnow().isoformat() + "Z"
|
||||
timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
triples = [
|
||||
_triple(session_uri, RDF_TYPE, _iri(PROV_ENTITY)),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Helper functions to build PROV-O triples for extraction-time provenance.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Optional
|
||||
|
||||
from .. schema import Triple, Term, IRI, LITERAL, TRIPLE
|
||||
|
|
@ -192,7 +192,7 @@ def derived_entity_triples(
|
|||
List of Triple objects
|
||||
"""
|
||||
if timestamp is None:
|
||||
timestamp = datetime.utcnow().isoformat() + "Z"
|
||||
timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
act_uri = activity_uri()
|
||||
agt_uri = agent_uri(component_name)
|
||||
|
|
@ -309,7 +309,7 @@ def subgraph_provenance_triples(
|
|||
List of Triple objects for the provenance
|
||||
"""
|
||||
if timestamp is None:
|
||||
timestamp = datetime.utcnow().isoformat() + "Z"
|
||||
timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
act_uri = activity_uri()
|
||||
agt_uri = agent_uri(component_name)
|
||||
|
|
@ -386,7 +386,7 @@ def question_triples(
|
|||
List of Triple objects
|
||||
"""
|
||||
if timestamp is None:
|
||||
timestamp = datetime.utcnow().isoformat() + "Z"
|
||||
timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
triples = [
|
||||
_triple(question_uri, RDF_TYPE, _iri(PROV_ENTITY)),
|
||||
|
|
@ -640,7 +640,7 @@ def docrag_question_triples(
|
|||
List of Triple objects
|
||||
"""
|
||||
if timestamp is None:
|
||||
timestamp = datetime.utcnow().isoformat() + "Z"
|
||||
timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
triples = [
|
||||
_triple(question_uri, RDF_TYPE, _iri(PROV_ENTITY)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue