(self)
| 39 | self.iidx = 0 # indent index |
| 40 | |
| 41 | def run(self): |
| 42 | print('Writting python protocol code to ', self.output_path) |
| 43 | self.output_file = open(self.output_path, 'w', encoding='utf-8') |
| 44 | self.make_header() |
| 45 | for enum in self.model.enums: |
| 46 | if enum.name not in IgnoredEnums: |
| 47 | self.generate_enum_code(enum) |
| 48 | for struct in self.model.structs: |
| 49 | if struct.name in IgnoredStructs: |
| 50 | continue |
| 51 | if struct.name.endswith('Node') or struct.name.endswith('NodeId'): |
| 52 | continue |
| 53 | self.generate_struct_code(struct) |
| 54 | |
| 55 | self.iidx = 0 |
| 56 | self.write("") |
| 57 | self.write("") |
| 58 | for struct in self.model.structs: |
| 59 | if struct.name in IgnoredStructs: |
| 60 | continue |
| 61 | if struct.name.endswith('Node') or struct.name.endswith('NodeId'): |
| 62 | continue |
| 63 | if 'ExtensionObject' in struct.parents: |
| 64 | self.write(f"nid = FourByteNodeId(ObjectIds.{struct.name}_Encoding_DefaultBinary)") |
| 65 | self.write(f"extension_object_classes[nid] = {struct.name}") |
| 66 | self.write(f"extension_object_ids['{struct.name}'] = nid") |
| 67 | |
| 68 | def write(self, line): |
| 69 | if line: |
no test coverage detected