Factor code template compilation out into a separate module
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							80bef7c94f
						
					
				
				
					commit
					c93351ef21
				
			| @@ -1,26 +1,26 @@ | ||||
| # Generated by the protocol buffer compiler.  DO NOT EDIT! | ||||
| # sources: {{ ', '.join(description.input_filenames) }} | ||||
| # sources: {{ ', '.join(output_file.input_filenames) }} | ||||
| # plugin: python-betterproto | ||||
| {% for i in description.python_module_imports|sort %} | ||||
| {% for i in output_file.python_module_imports|sort %} | ||||
| import {{ i }} | ||||
| {% endfor %} | ||||
| from dataclasses import dataclass | ||||
| {% if description.datetime_imports %} | ||||
| from datetime import {% for i in description.datetime_imports|sort %}{{ i }}{% if not loop.last %}, {% endif %}{% endfor %} | ||||
| {% if output_file.datetime_imports %} | ||||
| from datetime import {% for i in output_file.datetime_imports|sort %}{{ i }}{% if not loop.last %}, {% endif %}{% endfor %} | ||||
|  | ||||
| {% endif%} | ||||
| {% if description.typing_imports %} | ||||
| from typing import {% for i in description.typing_imports|sort %}{{ i }}{% if not loop.last %}, {% endif %}{% endfor %} | ||||
| {% if output_file.typing_imports %} | ||||
| from typing import {% for i in output_file.typing_imports|sort %}{{ i }}{% if not loop.last %}, {% endif %}{% endfor %} | ||||
|  | ||||
| {% endif %} | ||||
|  | ||||
| import betterproto | ||||
| {% if description.services %} | ||||
| {% if output_file.services %} | ||||
| import grpclib | ||||
| {% endif %} | ||||
|  | ||||
|  | ||||
| {% if description.enums %}{% for enum in description.enums %} | ||||
| {% if output_file.enums %}{% for enum in output_file.enums %} | ||||
| class {{ enum.py_name }}(betterproto.Enum): | ||||
|     {% if enum.comment %} | ||||
| {{ enum.comment }} | ||||
| @@ -36,7 +36,7 @@ class {{ enum.py_name }}(betterproto.Enum): | ||||
|  | ||||
| {% endfor %} | ||||
| {% endif %} | ||||
| {% for message in description.messages %} | ||||
| {% for message in output_file.messages %} | ||||
| @dataclass | ||||
| class {{ message.py_name }}(betterproto.Message): | ||||
|     {% if message.comment %} | ||||
| @@ -67,7 +67,7 @@ class {{ message.py_name }}(betterproto.Message): | ||||
|  | ||||
|  | ||||
| {% endfor %} | ||||
| {% for service in description.services %} | ||||
| {% for service in output_file.services %} | ||||
| class {{ service.py_name }}Stub(betterproto.ServiceStub): | ||||
|     {% if service.comment %} | ||||
| {{ service.comment }} | ||||
| @@ -154,6 +154,6 @@ class {{ service.py_name }}Stub(betterproto.ServiceStub): | ||||
|     {% endfor %} | ||||
| {% endfor %} | ||||
|  | ||||
| {% for i in description.imports|sort %} | ||||
| {% for i in output_file.imports|sort %} | ||||
| {{ i }} | ||||
| {% endfor %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user