simbiot-harness/venv/lib/python3.12/site-packages/strands/_exception_notes.py
Simbiot Harness b60439152b Simbiot Harness v0.1: тактовая лестница на Strands + CQRS/ES-спина
- harness/es.py: append-only event store + проекции (образец — кооп-портал)
- harness/levels.py: уровни 1с/1м/1ч/1д, контекст ∝ масштабу
- harness/scheduler.py: уровневые потоки, идемпотентные тики, absorbed-стабы
- harness/isolated_runner.py + _llm_worker.py: LLM-тик в сабпроцессе
  (глобальный asyncio-рантайм Strands не переживает 2+ create_harness)
- cli.py: init/task/tasks/status/events + requeue (написан самим минутным агентом)
- 9router: отдельный ключ sk-simbiot, модель auto (glm-5.3 первым)
2026-09-29 15:28:50 +00:00

21 lines
926 B
Python

"""Exception note utilities for Python 3.10+ compatibility."""
# add_note was added in 3.11 - we hoist to a constant to facilitate testing
supports_add_note = hasattr(Exception, "add_note")
def add_exception_note(exception: Exception, note: str) -> None:
"""Add a note to an exception, compatible with Python 3.10+.
Uses add_note() if it's available (Python 3.11+) or modifies the exception message if it is not.
"""
if supports_add_note:
# we ignore the mypy error because the version-check for add_note is extracted into a constant up above and
# mypy doesn't detect that
exception.add_note(note) # type: ignore
else:
# For Python 3.10, append note to the exception message
if hasattr(exception, "args") and exception.args:
exception.args = (f"{exception.args[0]}\n{note}",) + exception.args[1:]
else:
exception.args = (note,)