_bootstrap.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Copyright (c) 2025-2026 Buf Technologies, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Generated from google/protobuf/descriptor.proto. DO NOT EDIT.
  15. # Run `uv run poe bootstrap` to regenerate.
  16. from __future__ import annotations
  17. from typing import TYPE_CHECKING, Final, Literal
  18. if TYPE_CHECKING:
  19. from collections.abc import Mapping
  20. # google.protobuf.FieldDescriptorProto.Type
  21. _TYPE_STRING: Final[int] = 9
  22. _TYPE_GROUP: Final[int] = 10
  23. _TYPE_MESSAGE: Final[int] = 11
  24. _TYPE_BYTES: Final[int] = 12
  25. _TYPE_ENUM: Final[int] = 14
  26. # google.protobuf.FieldDescriptorProto.Label
  27. _LABEL_REQUIRED: Final[int] = 2
  28. _LABEL_REPEATED: Final[int] = 3
  29. # google.protobuf.Edition
  30. _EDITION_PROTO2: Final[int] = 998
  31. _EDITION_PROTO3: Final[int] = 999
  32. _EDITION_UNSTABLE: Final[int] = 9999
  33. # google.protobuf.FeatureSet.EnumType
  34. _ENUM_TYPE_OPEN: Final[int] = 1
  35. # google.protobuf.FeatureSet.RepeatedFieldEncoding
  36. _REPEATED_FIELD_ENCODING_PACKED: Final[int] = 1
  37. # google.protobuf.FeatureSet.MessageEncoding
  38. _MESSAGE_ENCODING_DELIMITED: Final[int] = 2
  39. # google.protobuf.MethodOptions.IdempotencyLevel
  40. _IDEMPOTENCY_UNKNOWN: Final[int] = 0
  41. # Minimum and maximum supported editions
  42. _MINIMUM_EDITION: Final[int] = 998 # Edition.PROTO2
  43. _MAXIMUM_EDITION: Final[int] = 1001 # Edition.EDITION_2024
  44. _FeatureKey = Literal[
  45. "field_presence",
  46. "enum_type",
  47. "repeated_field_encoding",
  48. "utf8_validation",
  49. "message_encoding",
  50. "json_format",
  51. "enforce_naming_style",
  52. "default_symbol_visibility",
  53. ]
  54. # Sourced from descriptor.proto via protoc --edition_defaults_out.
  55. _feature_defaults: Final[Mapping[int, Mapping[_FeatureKey, int]]] = {
  56. # LEGACY
  57. 900: {
  58. "field_presence": 1, # EXPLICIT
  59. "enum_type": 2, # CLOSED
  60. "repeated_field_encoding": 2, # EXPANDED
  61. "utf8_validation": 3, # NONE
  62. "message_encoding": 1, # LENGTH_PREFIXED
  63. "json_format": 2, # LEGACY_BEST_EFFORT
  64. "enforce_naming_style": 2, # STYLE_LEGACY
  65. "default_symbol_visibility": 1, # EXPORT_ALL
  66. },
  67. # PROTO3
  68. 999: {
  69. "field_presence": 2, # IMPLICIT
  70. "enum_type": 1, # OPEN
  71. "repeated_field_encoding": 1, # PACKED
  72. "utf8_validation": 2, # VERIFY
  73. "message_encoding": 1, # LENGTH_PREFIXED
  74. "json_format": 1, # ALLOW
  75. "enforce_naming_style": 2, # STYLE_LEGACY
  76. "default_symbol_visibility": 1, # EXPORT_ALL
  77. },
  78. # EDITION_2023
  79. 1000: {
  80. "field_presence": 1, # EXPLICIT
  81. "enum_type": 1, # OPEN
  82. "repeated_field_encoding": 1, # PACKED
  83. "utf8_validation": 2, # VERIFY
  84. "message_encoding": 1, # LENGTH_PREFIXED
  85. "json_format": 1, # ALLOW
  86. "enforce_naming_style": 2, # STYLE_LEGACY
  87. "default_symbol_visibility": 1, # EXPORT_ALL
  88. },
  89. # EDITION_2024
  90. 1001: {
  91. "field_presence": 1, # EXPLICIT
  92. "enum_type": 1, # OPEN
  93. "repeated_field_encoding": 1, # PACKED
  94. "utf8_validation": 2, # VERIFY
  95. "message_encoding": 1, # LENGTH_PREFIXED
  96. "json_format": 1, # ALLOW
  97. "enforce_naming_style": 1, # STYLE2024
  98. "default_symbol_visibility": 2, # EXPORT_TOP_LEVEL
  99. },
  100. }