From b0b5ef8814cfac7505c2b67026d853124971b7d3 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 13 May 2026 16:26:38 -0700 Subject: [PATCH] Fix mypy error with requests 2.34.1 HeadersType change requests 2.34.1 changed HeadersType from Mapping[str, str | bytes] to MutableMapping[str, str | bytes], which causes mypy to reject dict[str, str] due to MutableMapping's invariant value type parameter. Update the _post_with_retries signature to match the new expected type. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../opentelemetry/a365/core/exporters/agent365_exporter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/microsoft/opentelemetry/a365/core/exporters/agent365_exporter.py b/src/microsoft/opentelemetry/a365/core/exporters/agent365_exporter.py index 4e9dc8fc..463e10bd 100644 --- a/src/microsoft/opentelemetry/a365/core/exporters/agent365_exporter.py +++ b/src/microsoft/opentelemetry/a365/core/exporters/agent365_exporter.py @@ -15,7 +15,7 @@ import logging import threading import time -from collections.abc import Callable, Sequence +from collections.abc import Callable, MutableMapping, Sequence from typing import Any, final import requests @@ -227,7 +227,7 @@ def _truncate_text(text: str, max_length: int) -> str: return text[:max_length] + "..." return text - def _post_with_retries(self, url: str, body: str, headers: dict[str, str]) -> bool: + def _post_with_retries(self, url: str, body: str, headers: MutableMapping[str, str | bytes]) -> bool: for attempt in range(DEFAULT_MAX_RETRIES + 1): try: resp = self._session.post(