Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 3ce8feb

Browse files
committed
Fix inheritance
1 parent 500062a commit 3ce8feb

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

src/betterproto2_compiler/plugin/models.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ def get_comment(
141141
return ""
142142

143143

144+
@dataclass(kw_only=True)
144145
class ProtoContentBase:
145146
"""Methods common to MessageCompiler, ServiceCompiler and ServiceMethodCompiler."""
146147

147148
source_file: FileDescriptorProto
148-
typing_compiler: TypingCompiler
149149
path: list[int]
150150

151151
def ready(self) -> None:
@@ -226,11 +226,8 @@ def input_filenames(self) -> list[str]:
226226
class MessageCompiler(ProtoContentBase):
227227
"""Representation of a protobuf message."""
228228

229-
source_file: FileDescriptorProto
230-
typing_compiler: TypingCompiler
231229
output_file: OutputTemplate
232230
proto_obj: DescriptorProto
233-
path: list[int]
234231
fields: list["FieldCompiler"] = field(default_factory=list)
235232
oneofs: list["OneofCompiler"] = field(default_factory=list)
236233
builtins_types: set[str] = field(default_factory=set)
@@ -295,9 +292,7 @@ def is_oneof(proto_field_obj: FieldDescriptorProto) -> bool:
295292

296293
@dataclass(kw_only=True)
297294
class FieldCompiler(ProtoContentBase):
298-
source_file: FileDescriptorProto
299295
typing_compiler: TypingCompiler
300-
path: list[int]
301296
builtins_types: set[str] = field(default_factory=set)
302297

303298
message: MessageCompiler
@@ -491,10 +486,6 @@ def repeated(self) -> bool:
491486

492487
@dataclass(kw_only=True)
493488
class OneofCompiler(ProtoContentBase):
494-
source_file: FileDescriptorProto
495-
typing_compiler: TypingCompiler
496-
path: list[int]
497-
498489
proto_obj: OneofDescriptorProto
499490

500491
@property
@@ -506,10 +497,8 @@ def name(self) -> str:
506497
class EnumDefinitionCompiler(ProtoContentBase):
507498
"""Representation of a proto Enum definition."""
508499

509-
source_file: FileDescriptorProto
510500
output_file: OutputTemplate
511501
proto_obj: EnumDescriptorProto
512-
path: list[int]
513502
entries: list["EnumDefinitionCompiler.EnumEntry"] = field(default_factory=list)
514503

515504
@dataclass(unsafe_hash=True, kw_only=True)
@@ -546,10 +535,8 @@ def deprecated(self) -> bool:
546535

547536
@dataclass(kw_only=True)
548537
class ServiceCompiler(ProtoContentBase):
549-
source_file: FileDescriptorProto
550538
output_file: OutputTemplate
551539
proto_obj: ServiceDescriptorProto
552-
path: list[int]
553540
methods: list["ServiceMethodCompiler"] = field(default_factory=list)
554541

555542
@property
@@ -563,10 +550,8 @@ def py_name(self) -> str:
563550

564551
@dataclass(kw_only=True)
565552
class ServiceMethodCompiler(ProtoContentBase):
566-
source_file: FileDescriptorProto
567553
parent: ServiceCompiler
568554
proto_obj: MethodDescriptorProto
569-
path: list[int]
570555

571556
@property
572557
def py_name(self) -> str:

src/betterproto2_compiler/plugin/parser.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def read_protobuf_type(
188188
output_file=output_package,
189189
proto_obj=item,
190190
path=path,
191-
typing_compiler=output_package.typing_compiler,
192191
)
193192
output_package.messages[message_data.proto_name] = message_data
194193

@@ -228,7 +227,6 @@ def read_protobuf_type(
228227
message_data.oneofs.append(
229228
OneofCompiler(
230229
source_file=source_file,
231-
typing_compiler=output_package.typing_compiler,
232230
path=path + [8, index],
233231
proto_obj=oneof,
234232
)

0 commit comments

Comments
 (0)