Fix black formatting and target Python 3.12 in CI
Reformat 8 files and add --target-version py312 to avoid 3.13 AST parsing issues with Python 3.12 container. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -433,9 +433,7 @@ class ChainStore:
|
||||
if prev_record is not None:
|
||||
expected_hash = compute_record_hash(prev_record)
|
||||
if record.prev_hash != expected_hash:
|
||||
raise ChainIntegrityError(
|
||||
f"Record {record.chain_index}: prev_hash mismatch"
|
||||
)
|
||||
raise ChainIntegrityError(f"Record {record.chain_index}: prev_hash mismatch")
|
||||
elif record.chain_index == 0:
|
||||
if record.prev_hash != ChainState.GENESIS_PREV_HASH:
|
||||
raise ChainIntegrityError("Genesis record has non-zero prev_hash")
|
||||
|
||||
@@ -47,9 +47,7 @@ class DeadmanSwitch:
|
||||
state["grace_hours"] = grace_hours
|
||||
state["last_checkin"] = datetime.now(UTC).isoformat()
|
||||
self._save_state(state)
|
||||
logger.info(
|
||||
"Dead man's switch armed: %dh interval, %dh grace", interval_hours, grace_hours
|
||||
)
|
||||
logger.info("Dead man's switch armed: %dh interval, %dh grace", interval_hours, grace_hours)
|
||||
|
||||
def disarm(self) -> None:
|
||||
"""Disarm the dead man's switch."""
|
||||
@@ -83,9 +81,7 @@ class DeadmanSwitch:
|
||||
if not state["armed"] or not state["last_checkin"]:
|
||||
return False
|
||||
last = datetime.fromisoformat(state["last_checkin"])
|
||||
deadline = last + timedelta(
|
||||
hours=state["interval_hours"] + state["grace_hours"]
|
||||
)
|
||||
deadline = last + timedelta(hours=state["interval_hours"] + state["grace_hours"])
|
||||
return datetime.now(UTC) > deadline
|
||||
|
||||
def status(self) -> dict:
|
||||
|
||||
@@ -92,14 +92,16 @@ def execute_purge(scope: PurgeScope = PurgeScope.ALL, reason: str = "manual") ->
|
||||
]
|
||||
|
||||
if scope == PurgeScope.ALL:
|
||||
steps.extend([
|
||||
("destroy_auth_db", lambda: _secure_delete_file(paths.AUTH_DB)),
|
||||
("destroy_attestation_log", lambda: _secure_delete_dir(paths.ATTESTATIONS_DIR)),
|
||||
("destroy_chain_data", lambda: _secure_delete_dir(paths.CHAIN_DIR)),
|
||||
("destroy_temp_files", lambda: _secure_delete_dir(paths.TEMP_DIR)),
|
||||
("destroy_config", lambda: _secure_delete_file(paths.CONFIG_FILE)),
|
||||
("clear_journald", _clear_system_logs),
|
||||
])
|
||||
steps.extend(
|
||||
[
|
||||
("destroy_auth_db", lambda: _secure_delete_file(paths.AUTH_DB)),
|
||||
("destroy_attestation_log", lambda: _secure_delete_dir(paths.ATTESTATIONS_DIR)),
|
||||
("destroy_chain_data", lambda: _secure_delete_dir(paths.CHAIN_DIR)),
|
||||
("destroy_temp_files", lambda: _secure_delete_dir(paths.TEMP_DIR)),
|
||||
("destroy_config", lambda: _secure_delete_file(paths.CONFIG_FILE)),
|
||||
("clear_journald", _clear_system_logs),
|
||||
]
|
||||
)
|
||||
|
||||
for name, action in steps:
|
||||
try:
|
||||
|
||||
@@ -135,9 +135,7 @@ class KeystoreManager:
|
||||
from datetime import UTC, datetime
|
||||
|
||||
meta_path = self._identity_meta_path()
|
||||
meta_path.write_text(
|
||||
json.dumps({"created_at": datetime.now(UTC).isoformat()}, indent=None)
|
||||
)
|
||||
meta_path.write_text(json.dumps({"created_at": datetime.now(UTC).isoformat()}, indent=None))
|
||||
|
||||
return self.get_identity()
|
||||
|
||||
@@ -263,8 +261,7 @@ class KeystoreManager:
|
||||
from datetime import UTC, datetime
|
||||
|
||||
(archive_dir / "rotation.txt").write_text(
|
||||
f"Rotated at: {datetime.now(UTC).isoformat()}\n"
|
||||
f"Old fingerprint: {old_fp}\n"
|
||||
f"Rotated at: {datetime.now(UTC).isoformat()}\n" f"Old fingerprint: {old_fp}\n"
|
||||
)
|
||||
|
||||
new_key = self.generate_channel_key()
|
||||
|
||||
Reference in New Issue
Block a user