From c9dfe9ab1ff6f4fac2e0dd3f46999c3712235e53 Mon Sep 17 00:00:00 2001 From: Adrien Date: Sat, 5 Oct 2024 14:10:22 +0200 Subject: [PATCH] Remove unused compiler functions (#619) --- src/betterproto/plugin/models.py | 37 -------------------------------- 1 file changed, 37 deletions(-) diff --git a/src/betterproto/plugin/models.py b/src/betterproto/plugin/models.py index 6356f90..c1eb9d7 100644 --- a/src/betterproto/plugin/models.py +++ b/src/betterproto/plugin/models.py @@ -500,35 +500,6 @@ class FieldCompiler(MessageCompiler): .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.""" @@ -687,14 +658,6 @@ class EnumDefinitionCompiler(MessageCompiler): ] 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):