Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 19acf0b

Browse files
committed
Add blocks
1 parent 2c988e5 commit 19acf0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/betterproto2_compiler/templates/service_stub.py.j2

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
class {% block class_name %}{% endblock %}({% block inherit_from %}{% endblock %}):
2+
{% block service_docstring scoped %}
23
{% if service.comment %}
34
"""
45
{{ service.comment | indent(4) }}
56
"""
67
{% elif not service.methods %}
78
pass
89
{% endif %}
10+
{% endblock %}
911

1012
{% block class_content %}{% endblock %}
1113

1214
{% for method in service.methods %}
1315
{% block method_definition scoped required %}{% endblock %}
16+
{% block method_docstring scoped %}
1417
{% if method.comment %}
1518
"""
1619
{{ method.comment | indent(8) }}
1720
"""
1821
{% endif %}
19-
22+
{% endblock %}
23+
{% block deprecation_warning scoped %}
2024
{% if method.proto_obj.options and method.proto_obj.options.deprecated %}
2125
warnings.warn("{{ service.py_name }}.{{ method.py_name }} is deprecated", DeprecationWarning)
2226
{% endif %}
27+
{% endblock %}
2328

2429
{% if method.server_streaming %}
2530
{% if method.client_streaming %}

0 commit comments

Comments
 (0)