betterproto2-compiler 0.2.3__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/PKG-INFO +4 -3
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/pyproject.toml +26 -15
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/known_types/any.py +25 -5
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/known_types/timestamp.py +2 -2
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/lib/google/protobuf/__init__.py +27 -56
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/lib/google/protobuf/compiler/__init__.py +1 -1
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/models.py +1 -1
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/templates/header.py.j2 +1 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/templates/template.py.j2 +1 -1
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/LICENSE.md +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/README.md +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/__init__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/casing.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/compile/__init__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/compile/importing.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/compile/naming.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/known_types/__init__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/known_types/duration.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/lib/__init__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/lib/google/__init__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/lib/message_pool.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/__init__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/__main__.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/compiler.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/main.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/module_validation.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/parser.py +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/plugin.bat +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/py.typed +0 -0
- {betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/settings.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: betterproto2_compiler
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: Compiler for betterproto2
|
5
5
|
License: MIT
|
6
6
|
Keywords: protobuf,gRPC,compiler
|
@@ -13,11 +13,12 @@ Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
16
|
-
Requires-Dist: betterproto2 (>=0.
|
16
|
+
Requires-Dist: betterproto2 (>=0.3.0,<0.4.0)
|
17
17
|
Requires-Dist: grpclib (>=0.4.1,<0.5.0)
|
18
18
|
Requires-Dist: jinja2 (>=3.0.3)
|
19
|
-
Requires-Dist: ruff (>=0.
|
19
|
+
Requires-Dist: ruff (>=0.9.3,<0.10.0)
|
20
20
|
Requires-Dist: typing-extensions (>=4.7.1,<5.0.0)
|
21
|
+
Project-URL: Documentation, https://betterproto.github.io/python-betterproto2-compiler/
|
21
22
|
Project-URL: Repository, https://github.com/betterproto/python-betterproto2-compiler
|
22
23
|
Description-Content-Type: text/markdown
|
23
24
|
|
@@ -1,21 +1,35 @@
|
|
1
|
-
[
|
1
|
+
[project]
|
2
2
|
name = "betterproto2_compiler"
|
3
|
-
version = "0.
|
3
|
+
version = "0.3.0"
|
4
4
|
description = "Compiler for betterproto2"
|
5
|
-
authors = [
|
5
|
+
authors = [
|
6
|
+
{ name = "Adrien Vannson", email = "adrien.vannson@protonmail.com" },
|
7
|
+
{ name = "Daniel G. Taylor", email = "danielgtaylor@gmail.com" },
|
8
|
+
]
|
6
9
|
readme = "README.md"
|
7
|
-
repository = "https://github.com/betterproto/python-betterproto2-compiler"
|
8
10
|
keywords = ["protobuf", "gRPC", "compiler"]
|
9
11
|
license = "MIT"
|
12
|
+
requires-python = ">=3.10,<4.0"
|
13
|
+
dynamic = ["dependencies"]
|
14
|
+
|
15
|
+
[project.urls]
|
16
|
+
Documentation = "https://betterproto.github.io/python-betterproto2-compiler/"
|
17
|
+
Repository = "https://github.com/betterproto/python-betterproto2-compiler"
|
18
|
+
|
19
|
+
[project.scripts]
|
20
|
+
protoc-gen-python_betterproto2 = "betterproto2_compiler.plugin:main"
|
21
|
+
|
22
|
+
[tool.poetry]
|
10
23
|
packages = [
|
11
24
|
{ include = "betterproto2_compiler", from = "src" }
|
12
25
|
]
|
13
26
|
|
14
27
|
[tool.poetry.dependencies]
|
15
28
|
python = "^3.10"
|
16
|
-
betterproto2 = "^0.
|
29
|
+
betterproto2 = "^0.3.0"
|
30
|
+
# betterproto2 = { git="https://github.com/betterproto/python-betterproto2" }
|
17
31
|
# The Ruff version is pinned. To update it, also update it in .pre-commit-config.yaml
|
18
|
-
ruff = "~0.
|
32
|
+
ruff = "~0.9.3"
|
19
33
|
grpclib = "^0.4.1"
|
20
34
|
jinja2 = ">=3.0.3"
|
21
35
|
typing-extensions = "^4.7.1"
|
@@ -23,18 +37,15 @@ typing-extensions = "^4.7.1"
|
|
23
37
|
[tool.poetry.group.dev.dependencies]
|
24
38
|
pre-commit = "^2.17.0"
|
25
39
|
grpcio-tools = "^1.54.2"
|
26
|
-
mkdocs-material = {version = "^9.5.49"
|
27
|
-
mkdocstrings = {version = "^0.27.0",
|
28
|
-
poethepoet = "
|
40
|
+
mkdocs-material = {version = "^9.5.49"}
|
41
|
+
mkdocstrings = {version = "^0.27.0", extras = ["python"]}
|
42
|
+
poethepoet = "^0.32.2"
|
29
43
|
pyright = "^1.1.391"
|
30
44
|
ipykernel = "^6.29.5"
|
31
45
|
|
32
46
|
[tool.poetry.group.test.dependencies]
|
33
|
-
pytest = "^
|
34
|
-
protobuf = "^
|
35
|
-
|
36
|
-
[tool.poetry.scripts]
|
37
|
-
protoc-gen-python_betterproto2 = "betterproto2_compiler.plugin:main"
|
47
|
+
pytest = "^8.3.4"
|
48
|
+
protobuf = "^5.29.3"
|
38
49
|
|
39
50
|
[tool.ruff]
|
40
51
|
extend-exclude = ["tests/output_*", "src/betterproto2_compiler/lib"]
|
@@ -137,7 +148,7 @@ cmd = "mkdocs serve"
|
|
137
148
|
help = "Serve the documentation locally"
|
138
149
|
|
139
150
|
[build-system]
|
140
|
-
requires = ["poetry-core>=
|
151
|
+
requires = ["poetry-core>=2.0.0,<3"]
|
141
152
|
build-backend = "poetry.core.masonry.api"
|
142
153
|
|
143
154
|
# python -m grpc.tools.protoc \
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import typing
|
2
|
+
|
1
3
|
import betterproto2
|
2
4
|
|
3
5
|
from betterproto2_compiler.lib.google.protobuf import Any as VanillaAny
|
@@ -18,19 +20,37 @@ class Any(VanillaAny):
|
|
18
20
|
self.type_url = message_pool.type_to_url[type(message)]
|
19
21
|
self.value = bytes(message)
|
20
22
|
|
21
|
-
def unpack(self, message_pool: "betterproto2.MessagePool | None" = None) -> betterproto2.Message:
|
23
|
+
def unpack(self, message_pool: "betterproto2.MessagePool | None" = None) -> betterproto2.Message | None:
|
22
24
|
"""
|
23
25
|
Return the message packed inside the `Any` object.
|
24
26
|
|
25
27
|
The target message type must be registered in the message pool, which is done automatically when the module
|
26
28
|
defining the message type is imported.
|
27
29
|
"""
|
30
|
+
if not self.type_url:
|
31
|
+
return None
|
32
|
+
|
28
33
|
message_pool = message_pool or default_message_pool
|
29
34
|
|
30
|
-
|
35
|
+
try:
|
36
|
+
message_type = message_pool.url_to_type[self.type_url]
|
37
|
+
except KeyError:
|
38
|
+
raise TypeError(f"Can't unpack unregistered type: {self.type_url}")
|
31
39
|
|
32
40
|
return message_type().parse(self.value)
|
33
41
|
|
34
|
-
def to_dict(self) -> dict
|
35
|
-
#
|
36
|
-
|
42
|
+
def to_dict(self, **kwargs) -> dict[str, typing.Any]:
|
43
|
+
# TODO allow passing a message pool to `to_dict`
|
44
|
+
output: dict[str, typing.Any] = {"@type": self.type_url}
|
45
|
+
|
46
|
+
value = self.unpack()
|
47
|
+
|
48
|
+
if value is None:
|
49
|
+
return output
|
50
|
+
|
51
|
+
if type(value).to_dict == betterproto2.Message.to_dict:
|
52
|
+
output.update(value.to_dict(**kwargs))
|
53
|
+
else:
|
54
|
+
output["value"] = value.to_dict(**kwargs)
|
55
|
+
|
56
|
+
return output
|
@@ -37,9 +37,9 @@ class Timestamp(VanillaTimestamp):
|
|
37
37
|
return f"{result}Z"
|
38
38
|
if (nanos % 1e6) == 0:
|
39
39
|
# Serialize 3 fractional digits.
|
40
|
-
return f"{result}.{int(nanos // 1e6)
|
40
|
+
return f"{result}.{int(nanos // 1e6):03d}Z"
|
41
41
|
if (nanos % 1e3) == 0:
|
42
42
|
# Serialize 6 fractional digits.
|
43
|
-
return f"{result}.{int(nanos // 1e3)
|
43
|
+
return f"{result}.{int(nanos // 1e3):06d}Z"
|
44
44
|
# Serialize 9 fractional digits.
|
45
45
|
return f"{result}.{nanos:09d}"
|
@@ -98,7 +98,7 @@ import betterproto2
|
|
98
98
|
|
99
99
|
from ...message_pool import default_message_pool
|
100
100
|
|
101
|
-
betterproto2.check_compiler_version("0.
|
101
|
+
betterproto2.check_compiler_version("0.3.0")
|
102
102
|
|
103
103
|
|
104
104
|
class Edition(betterproto2.Enum):
|
@@ -724,35 +724,6 @@ class Any(betterproto2.Message):
|
|
724
724
|
Must be a valid serialized protocol buffer of the above specified type.
|
725
725
|
"""
|
726
726
|
|
727
|
-
def pack(self, message: betterproto2.Message, message_pool: "betterproto2.MessagePool | None" = None) -> None:
|
728
|
-
"""
|
729
|
-
Pack the given message in the `Any` object.
|
730
|
-
|
731
|
-
The message type must be registered in the message pool, which is done automatically when the module defining
|
732
|
-
the message type is imported.
|
733
|
-
"""
|
734
|
-
message_pool = message_pool or default_message_pool
|
735
|
-
|
736
|
-
self.type_url = message_pool.type_to_url[type(message)]
|
737
|
-
self.value = bytes(message)
|
738
|
-
|
739
|
-
def unpack(self, message_pool: "betterproto2.MessagePool | None" = None) -> betterproto2.Message:
|
740
|
-
"""
|
741
|
-
Return the message packed inside the `Any` object.
|
742
|
-
|
743
|
-
The target message type must be registered in the message pool, which is done automatically when the module
|
744
|
-
defining the message type is imported.
|
745
|
-
"""
|
746
|
-
message_pool = message_pool or default_message_pool
|
747
|
-
|
748
|
-
message_type = message_pool.url_to_type[self.type_url]
|
749
|
-
|
750
|
-
return message_type().parse(self.value)
|
751
|
-
|
752
|
-
def to_dict(self) -> dict: # pyright: ignore [reportIncompatibleMethodOverride]
|
753
|
-
# TOOO improve when dict is updated
|
754
|
-
return {"@type": self.type_url, "value": self.unpack().to_dict()}
|
755
|
-
|
756
727
|
|
757
728
|
default_message_pool.register_message("google.protobuf", "Any", Any)
|
758
729
|
|
@@ -821,7 +792,7 @@ class Api(betterproto2.Message):
|
|
821
792
|
Included interfaces. See [Mixin][].
|
822
793
|
"""
|
823
794
|
|
824
|
-
syntax: "Syntax" = betterproto2.field(7, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax
|
795
|
+
syntax: "Syntax" = betterproto2.field(7, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax(0))
|
825
796
|
"""
|
826
797
|
The source syntax of the service.
|
827
798
|
"""
|
@@ -1111,7 +1082,7 @@ class Enum(betterproto2.Message):
|
|
1111
1082
|
The source context.
|
1112
1083
|
"""
|
1113
1084
|
|
1114
|
-
syntax: "Syntax" = betterproto2.field(5, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax
|
1085
|
+
syntax: "Syntax" = betterproto2.field(5, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax(0))
|
1115
1086
|
"""
|
1116
1087
|
The source syntax.
|
1117
1088
|
"""
|
@@ -1328,7 +1299,7 @@ class ExtensionRangeOptions(betterproto2.Message):
|
|
1328
1299
|
"""
|
1329
1300
|
|
1330
1301
|
verification: "ExtensionRangeOptionsVerificationState" = betterproto2.field(
|
1331
|
-
3, betterproto2.TYPE_ENUM, default_factory=lambda: ExtensionRangeOptionsVerificationState
|
1302
|
+
3, betterproto2.TYPE_ENUM, default_factory=lambda: ExtensionRangeOptionsVerificationState(0)
|
1332
1303
|
)
|
1333
1304
|
"""
|
1334
1305
|
The verification state of the range.
|
@@ -1394,27 +1365,27 @@ class FeatureSet(betterproto2.Message):
|
|
1394
1365
|
"""
|
1395
1366
|
|
1396
1367
|
field_presence: "FeatureSetFieldPresence" = betterproto2.field(
|
1397
|
-
1, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetFieldPresence
|
1368
|
+
1, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetFieldPresence(0)
|
1398
1369
|
)
|
1399
1370
|
|
1400
1371
|
enum_type: "FeatureSetEnumType" = betterproto2.field(
|
1401
|
-
2, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetEnumType
|
1372
|
+
2, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetEnumType(0)
|
1402
1373
|
)
|
1403
1374
|
|
1404
1375
|
repeated_field_encoding: "FeatureSetRepeatedFieldEncoding" = betterproto2.field(
|
1405
|
-
3, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetRepeatedFieldEncoding
|
1376
|
+
3, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetRepeatedFieldEncoding(0)
|
1406
1377
|
)
|
1407
1378
|
|
1408
1379
|
utf8_validation: "FeatureSetUtf8Validation" = betterproto2.field(
|
1409
|
-
4, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetUtf8Validation
|
1380
|
+
4, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetUtf8Validation(0)
|
1410
1381
|
)
|
1411
1382
|
|
1412
1383
|
message_encoding: "FeatureSetMessageEncoding" = betterproto2.field(
|
1413
|
-
5, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetMessageEncoding
|
1384
|
+
5, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetMessageEncoding(0)
|
1414
1385
|
)
|
1415
1386
|
|
1416
1387
|
json_format: "FeatureSetJsonFormat" = betterproto2.field(
|
1417
|
-
6, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetJsonFormat
|
1388
|
+
6, betterproto2.TYPE_ENUM, default_factory=lambda: FeatureSetJsonFormat(0)
|
1418
1389
|
)
|
1419
1390
|
|
1420
1391
|
|
@@ -1435,7 +1406,7 @@ class FeatureSetDefaults(betterproto2.Message):
|
|
1435
1406
|
)
|
1436
1407
|
|
1437
1408
|
minimum_edition: "Edition" = betterproto2.field(
|
1438
|
-
4, betterproto2.TYPE_ENUM, default_factory=lambda: Edition
|
1409
|
+
4, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0)
|
1439
1410
|
)
|
1440
1411
|
"""
|
1441
1412
|
The minimum supported edition (inclusive) when this was constructed.
|
@@ -1443,7 +1414,7 @@ class FeatureSetDefaults(betterproto2.Message):
|
|
1443
1414
|
"""
|
1444
1415
|
|
1445
1416
|
maximum_edition: "Edition" = betterproto2.field(
|
1446
|
-
5, betterproto2.TYPE_ENUM, default_factory=lambda: Edition
|
1417
|
+
5, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0)
|
1447
1418
|
)
|
1448
1419
|
"""
|
1449
1420
|
The maximum known edition (inclusive) when this was constructed. Editions
|
@@ -1463,7 +1434,7 @@ class FeatureSetDefaultsFeatureSetEditionDefault(betterproto2.Message):
|
|
1463
1434
|
be used. This field must be in strict ascending order by edition.
|
1464
1435
|
"""
|
1465
1436
|
|
1466
|
-
edition: "Edition" = betterproto2.field(3, betterproto2.TYPE_ENUM, default_factory=lambda: Edition
|
1437
|
+
edition: "Edition" = betterproto2.field(3, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
|
1467
1438
|
|
1468
1439
|
features: "Optional[FeatureSet]" = betterproto2.field(2, betterproto2.TYPE_MESSAGE, optional=True)
|
1469
1440
|
|
@@ -1479,13 +1450,13 @@ class Field(betterproto2.Message):
|
|
1479
1450
|
A single field of a message type.
|
1480
1451
|
"""
|
1481
1452
|
|
1482
|
-
kind: "FieldKind" = betterproto2.field(1, betterproto2.TYPE_ENUM, default_factory=lambda: FieldKind
|
1453
|
+
kind: "FieldKind" = betterproto2.field(1, betterproto2.TYPE_ENUM, default_factory=lambda: FieldKind(0))
|
1483
1454
|
"""
|
1484
1455
|
The field type.
|
1485
1456
|
"""
|
1486
1457
|
|
1487
1458
|
cardinality: "FieldCardinality" = betterproto2.field(
|
1488
|
-
2, betterproto2.TYPE_ENUM, default_factory=lambda: FieldCardinality
|
1459
|
+
2, betterproto2.TYPE_ENUM, default_factory=lambda: FieldCardinality(0)
|
1489
1460
|
)
|
1490
1461
|
"""
|
1491
1462
|
The field cardinality.
|
@@ -1548,11 +1519,11 @@ class FieldDescriptorProto(betterproto2.Message):
|
|
1548
1519
|
number: "int" = betterproto2.field(3, betterproto2.TYPE_INT32)
|
1549
1520
|
|
1550
1521
|
label: "FieldDescriptorProtoLabel" = betterproto2.field(
|
1551
|
-
4, betterproto2.TYPE_ENUM, default_factory=lambda: FieldDescriptorProtoLabel
|
1522
|
+
4, betterproto2.TYPE_ENUM, default_factory=lambda: FieldDescriptorProtoLabel(0)
|
1552
1523
|
)
|
1553
1524
|
|
1554
1525
|
type: "FieldDescriptorProtoType" = betterproto2.field(
|
1555
|
-
5, betterproto2.TYPE_ENUM, default_factory=lambda: FieldDescriptorProtoType
|
1526
|
+
5, betterproto2.TYPE_ENUM, default_factory=lambda: FieldDescriptorProtoType(0)
|
1556
1527
|
)
|
1557
1528
|
"""
|
1558
1529
|
If type_name is set, this need not be set. If both this and type_name
|
@@ -1842,7 +1813,7 @@ default_message_pool.register_message("google.protobuf", "FieldMask", FieldMask)
|
|
1842
1813
|
@dataclass(eq=False, repr=False)
|
1843
1814
|
class FieldOptions(betterproto2.Message):
|
1844
1815
|
ctype: "FieldOptionsCType" = betterproto2.field(
|
1845
|
-
1, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsCType
|
1816
|
+
1, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsCType(0)
|
1846
1817
|
)
|
1847
1818
|
"""
|
1848
1819
|
The ctype option instructs the C++ code generator to use a different
|
@@ -1865,7 +1836,7 @@ class FieldOptions(betterproto2.Message):
|
|
1865
1836
|
"""
|
1866
1837
|
|
1867
1838
|
jstype: "FieldOptionsJsType" = betterproto2.field(
|
1868
|
-
6, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsJsType
|
1839
|
+
6, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsJsType(0)
|
1869
1840
|
)
|
1870
1841
|
"""
|
1871
1842
|
The jstype option determines the JavaScript type used for values of the
|
@@ -1942,7 +1913,7 @@ class FieldOptions(betterproto2.Message):
|
|
1942
1913
|
"""
|
1943
1914
|
|
1944
1915
|
retention: "FieldOptionsOptionRetention" = betterproto2.field(
|
1945
|
-
17, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsOptionRetention
|
1916
|
+
17, betterproto2.TYPE_ENUM, default_factory=lambda: FieldOptionsOptionRetention(0)
|
1946
1917
|
)
|
1947
1918
|
|
1948
1919
|
targets: "List[FieldOptionsOptionTargetType]" = betterproto2.field(19, betterproto2.TYPE_ENUM, repeated=True)
|
@@ -1969,7 +1940,7 @@ default_message_pool.register_message("google.protobuf", "FieldOptions", FieldOp
|
|
1969
1940
|
|
1970
1941
|
@dataclass(eq=False, repr=False)
|
1971
1942
|
class FieldOptionsEditionDefault(betterproto2.Message):
|
1972
|
-
edition: "Edition" = betterproto2.field(3, betterproto2.TYPE_ENUM, default_factory=lambda: Edition
|
1943
|
+
edition: "Edition" = betterproto2.field(3, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
|
1973
1944
|
|
1974
1945
|
value: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)
|
1975
1946
|
"""
|
@@ -2041,7 +2012,7 @@ class FileDescriptorProto(betterproto2.Message):
|
|
2041
2012
|
If `edition` is present, this value must be "editions".
|
2042
2013
|
"""
|
2043
2014
|
|
2044
|
-
edition: "Edition" = betterproto2.field(14, betterproto2.TYPE_ENUM, default_factory=lambda: Edition
|
2015
|
+
edition: "Edition" = betterproto2.field(14, betterproto2.TYPE_ENUM, default_factory=lambda: Edition(0))
|
2045
2016
|
"""
|
2046
2017
|
The edition of the proto file.
|
2047
2018
|
"""
|
@@ -2142,7 +2113,7 @@ class FileOptions(betterproto2.Message):
|
|
2142
2113
|
"""
|
2143
2114
|
|
2144
2115
|
optimize_for: "FileOptionsOptimizeMode" = betterproto2.field(
|
2145
|
-
9, betterproto2.TYPE_ENUM, default_factory=lambda: FileOptionsOptimizeMode
|
2116
|
+
9, betterproto2.TYPE_ENUM, default_factory=lambda: FileOptionsOptimizeMode(0)
|
2146
2117
|
)
|
2147
2118
|
|
2148
2119
|
go_package: "str" = betterproto2.field(11, betterproto2.TYPE_STRING)
|
@@ -2318,7 +2289,7 @@ class GeneratedCodeInfoAnnotation(betterproto2.Message):
|
|
2318
2289
|
"""
|
2319
2290
|
|
2320
2291
|
semantic: "GeneratedCodeInfoAnnotationSemantic" = betterproto2.field(
|
2321
|
-
5, betterproto2.TYPE_ENUM, default_factory=lambda: GeneratedCodeInfoAnnotationSemantic
|
2292
|
+
5, betterproto2.TYPE_ENUM, default_factory=lambda: GeneratedCodeInfoAnnotationSemantic(0)
|
2322
2293
|
)
|
2323
2294
|
|
2324
2295
|
|
@@ -2511,7 +2482,7 @@ class Method(betterproto2.Message):
|
|
2511
2482
|
Any metadata attached to the method.
|
2512
2483
|
"""
|
2513
2484
|
|
2514
|
-
syntax: "Syntax" = betterproto2.field(7, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax
|
2485
|
+
syntax: "Syntax" = betterproto2.field(7, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax(0))
|
2515
2486
|
"""
|
2516
2487
|
The source syntax of this method.
|
2517
2488
|
"""
|
@@ -2568,7 +2539,7 @@ class MethodOptions(betterproto2.Message):
|
|
2568
2539
|
"""
|
2569
2540
|
|
2570
2541
|
idempotency_level: "MethodOptionsIdempotencyLevel" = betterproto2.field(
|
2571
|
-
34, betterproto2.TYPE_ENUM, default_factory=lambda: MethodOptionsIdempotencyLevel
|
2542
|
+
34, betterproto2.TYPE_ENUM, default_factory=lambda: MethodOptionsIdempotencyLevel(0)
|
2572
2543
|
)
|
2573
2544
|
|
2574
2545
|
features: "Optional[FeatureSet]" = betterproto2.field(35, betterproto2.TYPE_MESSAGE, optional=True)
|
@@ -3191,7 +3162,7 @@ class Type(betterproto2.Message):
|
|
3191
3162
|
The source context.
|
3192
3163
|
"""
|
3193
3164
|
|
3194
|
-
syntax: "Syntax" = betterproto2.field(6, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax
|
3165
|
+
syntax: "Syntax" = betterproto2.field(6, betterproto2.TYPE_ENUM, default_factory=lambda: Syntax(0))
|
3195
3166
|
"""
|
3196
3167
|
The source syntax.
|
3197
3168
|
"""
|
@@ -320,7 +320,7 @@ class FieldCompiler(ProtoContentBase):
|
|
320
320
|
elif self.repeated:
|
321
321
|
args.append("repeated=True")
|
322
322
|
elif self.field_type == FieldType.TYPE_ENUM:
|
323
|
-
args.append(f"default_factory=lambda: {self.py_type}
|
323
|
+
args.append(f"default_factory=lambda: {self.py_type}(0)")
|
324
324
|
return args
|
325
325
|
|
326
326
|
@property
|
@@ -235,7 +235,7 @@ class {{ service.py_name }}Base(ServiceBase):
|
|
235
235
|
|
236
236
|
{% endfor %}
|
237
237
|
|
238
|
-
def __mapping__(self) -> "dict[str, grpclib.const.Handler":
|
238
|
+
def __mapping__(self) -> "dict[str, grpclib.const.Handler]":
|
239
239
|
return {
|
240
240
|
{% for method in service.methods %}
|
241
241
|
"{{ method.route }}": grpclib.const.Handler(
|
File without changes
|
File without changes
|
{betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/__init__.py
RENAMED
File without changes
|
{betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/casing.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/plugin/main.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/py.typed
RENAMED
File without changes
|
{betterproto2_compiler-0.2.3 → betterproto2_compiler-0.3.0}/src/betterproto2_compiler/settings.py
RENAMED
File without changes
|