8000 Remove unused compiler functions (#619) · AdrienVannson/python-betterproto@c9dfe9a · GitHub
[go: up one dir, main page]

Skip to content

Commit c9dfe9a

Browse files
Remove unused compiler functions (danielgtaylor#619)
1 parent 32d642d commit c9dfe9a

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

src/betterproto/plugin/models.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -500,35 +500,6 @@ def field_type(self) -> str:
500500
.replace("type_", "")
501501
)
502502

503-
@property
504-
def default_value_string(self) -> str:
505-
"""Python representation of the default proto value."""
506-
if self.repeated:
507-
return "[]"
508-
if self.optional:
509-
return "None"
510-
if self.py_type == "int":
511-
return "0"
512-
if self.py_type == "float":
513-
return "0.0"
514-
elif self.py_type == "bool":
515-
return "False"
516-
elif self.py_type == "str":
517-
return '""'
518-
elif self.py_type == "bytes":
519-
return 'b""'
520-
elif self.field_type == "enum":
521-
enum_proto_obj_name = self.proto_obj.type_name.split(".").pop()
522-
enum = next(
523-
e
524-
for e in self.output_file.enums
525-
if e.proto_obj.name == enum_proto_obj_name
526-
)
527-
return enum.default_value_string
528-
else:
529-
# Message type
530-
return "None"
531-
532503
@property
533504
def packed(self) -> bool:
534505
"""True if the wire representation is a packed format."""
@@ -687,14 +658,6 @@ def __post_init__(self) -> None:
687658
]
688659
super().__post_init__() # call MessageCompiler __post_init__
689660

690-
@property
691-
def default_value_string(self) -> str:
692-
"""Python representation of the default value for Enums.
693-
694-
As per the spec, this is the first value of the Enum.
695-
"""
696-
return str(self.entries[0].value) # ideally, should ALWAYS be int(0)!
697-
698661

699662
@dataclass
700663
class ServiceCompiler(ProtoContentBase):

0 commit comments

Comments
 (0)
0