summaryrefslogtreecommitdiff
path: root/codegen/opentelemetry-codegen-json/src
diff options
context:
space:
mode:
authorCarsten Schoenert <c.schoenert@t-online.de>2026-07-01 09:35:22 +0200
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2026-07-01 22:36:34 +0000
commit8f2c4118ad4f64f67b91d8e13b750b2fd4080613 (patch)
treed7988886e937c0a92eddbbc46cd6945f96a4b114 /codegen/opentelemetry-codegen-json/src
parentfa4b19cc510b29c1f5e59dce046a9ca22f38f9ad (diff)
Imported using git-ubuntu import.
Notes
Notes: * [11a6262] New upstream version 1.43.0
Diffstat (limited to 'codegen/opentelemetry-codegen-json/src')
-rw-r--r--codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py17
-rw-r--r--codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py5
2 files changed, 6 insertions, 16 deletions
diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py
index f026b89..b8be035 100644
--- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py
+++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py
@@ -296,18 +296,7 @@ class OtlpJsonGenerator:
writer.comment(
[
"Copyright The OpenTelemetry Authors",
- "",
- 'Licensed under the Apache License, Version 2.0 (the "License");',
- "you may not use this file except in compliance with the License.",
- "You may obtain a copy of the License at",
- "",
- " http://www.apache.org/licenses/LICENSE-2.0",
- "",
- "Unless required by applicable law or agreed to in writing, software",
- 'distributed under the License is distributed on an "AS IS" BASIS,',
- "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
- "See the License for the specific language governing permissions and",
- "limitations under the License.",
+ "SPDX-License-Identifier: Apache-2.0",
]
)
writer.blank_line()
@@ -890,8 +879,8 @@ class OtlpJsonGenerator:
if field_desc.label == descriptor.FieldDescriptorProto.LABEL_REPEATED:
return f"builtins.list[{base_type}]"
if field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM:
- return f"typing.Union[{base_type}, builtins.int, None]"
- return f"typing.Optional[{base_type}]"
+ return f"{base_type} | builtins.int | None"
+ return f"{base_type} | None"
def _resolve_message_type(self, type_name: str, proto_file: str) -> str:
"""
diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py
index 0a6c7c7..72c315d 100644
--- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py
+++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py
@@ -5,6 +5,7 @@ from __future__ import annotations
import abc
import base64
+import collections.abc
import json
import math
import typing
@@ -101,7 +102,7 @@ def encode_float(value: float) -> float | str:
def encode_repeated(
values: list[T] | None,
- map_fn: typing.Callable[[T], typing.Any],
+ map_fn: collections.abc.Callable[[T], typing.Any],
) -> list[typing.Any]:
"""
Helper to serialize repeated fields with a mapping function.
@@ -207,7 +208,7 @@ def decode_float(value: float | int | str | None, field_name: str) -> float:
def decode_repeated(
values: list[typing.Any] | None,
- item_parser: typing.Callable[[typing.Any], T],
+ item_parser: collections.abc.Callable[[typing.Any], T],
field_name: str,
) -> list[T]:
"""