This repository was archived by the owner on Jun 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +13
-1
lines changed
src/betterproto2_compiler/templates Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ from dataclasses import dataclass
3535import betterproto2
3636{% if output_file .services %}
3737from betterproto2.grpc.grpclib_server import ServiceBase
38+ import grpc
3839import grpclib
3940{% endif %}
4041
Original file line number Diff line number Diff line change 1- class {% block class_name %}{% endblock %} (betterproto2.ServiceStub ):
1+ class {% block class_name %}{% endblock %} ({% block inherit_from %}{% endblock %} ):
22 {% if service .comment %}
33 """
44 {{ service.comment | indent(4) }}
@@ -7,6 +7,8 @@ class {% block class_name %}{% endblock %}(betterproto2.ServiceStub):
77 pass
88 {% endif %}
99
10+ {% block class_content %}{% endblock %}
11+
1012 {% for method in service .methods %}
1113 async def {{ method.py_name }}(self
1214 {% - if not method .client_streaming -%}
Original file line number Diff line number Diff line change 11{% extends "service_stub.py.j2" %}
22
3+ {# Class definition #}
34{% block class_name %} {{ service.py_name }}Stub{% endblock %}
5+ {% block inherit_from %} betterproto2.ServiceStub{% endblock %}
Original file line number Diff line number Diff line change 11{% extends "service_stub.py.j2" %}
22
3+ {# Class definition #}
34{% block class_name %} {{ service.py_name }}SyncStub{% endblock %}
5+
6+ {% block class_content %}
7+ {# TODO move to parent class #}
8+ def __init__(self, channel: grpc.Channel):
9+ self._channel = channel
10+ {% endblock %}
You can’t perform that action at this time.
0 commit comments