mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-28 18:14:19 -05:00
* Enable PEP604 Ruff rules * Fix harcoded signature in test * Hack CLVMStreamable test with note to fast follow
16 lines
379 B
Python
16 lines
379 B
Python
# Package: utils
|
|
|
|
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import logging
|
|
|
|
|
|
def cancel_task_safe(task: asyncio.Task[None] | None, log: logging.Logger | None = None) -> None:
|
|
if task is not None:
|
|
try:
|
|
task.cancel()
|
|
except Exception as e:
|
|
if log is not None:
|
|
log.error(f"Error while canceling task.{e} {task}")
|