Skip to content

Commit

Permalink
Remove useless function
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienVannson committed Sep 19, 2024
1 parent 1161803 commit 84aee0a
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/betterproto/plugin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,35 +500,6 @@ def field_type(self) -> str:
.replace("type_", "")
)

@property
def default_value_string(self) -> str:
"""Python representation of the default proto value."""
if self.repeated:
return "[]"
if self.optional:
return "None"
if self.py_type == "int":
return "0"
if self.py_type == "float":
return "0.0"
elif self.py_type == "bool":
return "False"
elif self.py_type == "str":
return '""'
elif self.py_type == "bytes":
return 'b""'
elif self.field_type == "enum":
enum_proto_obj_name = self.proto_obj.type_name.split(".").pop()
enum = next(
e
for e in self.output_file.enums
if e.proto_obj.name == enum_proto_obj_name
)
return enum.default_value_string
else:
# Message type
return "None"

@property
def packed(self) -> bool:
"""True if the wire representation is a packed format."""
Expand Down Expand Up @@ -687,14 +658,6 @@ def __post_init__(self) -> None:
]
super().__post_init__() # call MessageCompiler __post_init__

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


@dataclass
class ServiceCompiler(ProtoContentBase):
Expand Down

0 comments on commit 84aee0a

Please sign in to comment.