@@ -141,11 +141,11 @@ def get_comment(
141
141
return ""
142
142
143
143
144
+ @dataclass (kw_only = True )
144
145
class ProtoContentBase :
145
146
"""Methods common to MessageCompiler, ServiceCompiler and ServiceMethodCompiler."""
146
147
147
148
source_file : FileDescriptorProto
148
- typing_compiler : TypingCompiler
149
149
path : list [int ]
150
150
151
151
def ready (self ) -> None :
@@ -226,11 +226,8 @@ def input_filenames(self) -> list[str]:
226
226
class MessageCompiler (ProtoContentBase ):
227
227
"""Representation of a protobuf message."""
228
228
229
- source_file : FileDescriptorProto
230
- typing_compiler : TypingCompiler
231
229
output_file : OutputTemplate
232
230
proto_obj : DescriptorProto
233
- path : list [int ]
234
231
fields : list ["FieldCompiler" ] = field (default_factory = list )
235
232
oneofs : list ["OneofCompiler" ] = field (default_factory = list )
236
233
builtins_types : set [str ] = field (default_factory = set )
@@ -295,9 +292,7 @@ def is_oneof(proto_field_obj: FieldDescriptorProto) -> bool:
295
292
296
293
@dataclass (kw_only = True )
297
294
class FieldCompiler (ProtoContentBase ):
298
- source_file : FileDescriptorProto
299
295
typing_compiler : TypingCompiler
300
- path : list [int ]
301
296
builtins_types : set [str ] = field (default_factory = set )
302
297
303
298
message : MessageCompiler
@@ -491,10 +486,6 @@ def repeated(self) -> bool:
491
486
492
487
@dataclass (kw_only = True )
493
488
class OneofCompiler (ProtoContentBase ):
494
- source_file : FileDescriptorProto
495
- typing_compiler : TypingCompiler
496
- path : list [int ]
497
-
498
489
proto_obj : OneofDescriptorProto
499
490
500
491
@property
@@ -506,10 +497,8 @@ def name(self) -> str:
506
497
class EnumDefinitionCompiler (ProtoContentBase ):
507
498
"""Representation of a proto Enum definition."""
508
499
509
- source_file : FileDescriptorProto
510
500
output_file : OutputTemplate
511
501
proto_obj : EnumDescriptorProto
512
- path : list [int ]
513
502
entries : list ["EnumDefinitionCompiler.EnumEntry" ] = field (default_factory = list )
514
503
515
504
@dataclass (unsafe_hash = True , kw_only = True )
@@ -546,10 +535,8 @@ def deprecated(self) -> bool:
546
535
547
536
@dataclass (kw_only = True )
548
537
class ServiceCompiler (ProtoContentBase ):
549
- source_file : FileDescriptorProto
550
538
output_file : OutputTemplate
551
539
proto_obj : ServiceDescriptorProto
552
- path : list [int ]
553
540
methods : list ["ServiceMethodCompiler" ] = field (default_factory = list )
554
541
555
542
@property
@@ -563,10 +550,8 @@ def py_name(self) -> str:
563
550
564
551
@dataclass (kw_only = True )
565
552
class ServiceMethodCompiler (ProtoContentBase ):
566
- source_file : FileDescriptorProto
567
553
parent : ServiceCompiler
568
554
proto_obj : MethodDescriptorProto
569
- path : list [int ]
570
555
571
556
@property
572
557
def py_name (self ) -> str :
0 commit comments