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
35
35
import betterproto2
36
36
{% if output_file .services %}
37
37
from betterproto2.grpc.grpclib_server import ServiceBase
38
+ import grpc
38
39
import grpclib
39
40
{% endif %}
40
41
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 %} ):
2
2
{% if service .comment %}
3
3
"""
4
4
{{ service.comment | indent(4) }}
@@ -7,6 +7,8 @@ class {% block class_name %}{% endblock %}(betterproto2.ServiceStub):
7
7
pass
8
8
{% endif %}
9
9
10
+ {% block class_content %}{% endblock %}
11
+
10
12
{% for method in service .methods %}
11
13
async def {{ method.py_name }}(self
12
14
{% - if not method .client_streaming -%}
Original file line number Diff line number Diff line change 1
1
{% extends "service_stub.py.j2" %}
2
2
3
+ {# Class definition #}
3
4
{% 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 1
1
{% extends "service_stub.py.j2" %}
2
2
3
+ {# Class definition #}
3
4
{% 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