Skip to content

Commit 15431b4

Browse files
Apply suggestion from @herin049
Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
1 parent f36b484 commit 15431b4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_logger_provider.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,19 @@ def _parse_headers(
9090
return result
9191

9292

93+
class CompressionT(Protocol[T]):
94+
@property
95+
def Gzip(self) -> T: ...
96+
97+
9398
def _map_compression(
94-
value: Optional[str], compression_enum: type
95-
) -> Optional[object]:
99+
value: Optional[str], compression_enum: CompressionT[T]
100+
) -> Optional[T]:
96101
"""Map a compression string to the given Compression enum value."""
97102
if value is None or value.lower() == "none":
98103
return None
99104
if value.lower() == "gzip":
100-
return compression_enum.Gzip # type: ignore[attr-defined]
105+
return compression_enum.Gzip
101106
raise ConfigurationError(
102107
f"Unsupported compression value '{value}'. Supported values: 'gzip', 'none'."
103108
)

0 commit comments

Comments
 (0)