Skip to content

Commit 5ef1281

Browse files
committed
style: Fix some weird formatting when backslash ends a docstring
1 parent 1512ec2 commit 5ef1281

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

end_to_end_tests/golden-record/my_test_api_client/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
""" A client library for accessing My Test API """
2-
32
from .client import AuthenticatedClient, Client
43

54
__all__ = (

end_to_end_tests/golden-record/my_test_api_client/models/model_with_backslash_in_description.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class ModelWithBackslashInDescription:
1010
r""" Description with special character: \
1111
12-
"""
12+
"""
1313

1414
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
1515

integration-tests/integration_tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
""" A client library for accessing OpenAPI Test Server """
2-
32
from .client import AuthenticatedClient, Client
43

54
__all__ = (
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{% macro safe_docstring(content) %}
22
{# This macro returns the provided content as a docstring, set to a raw string if it contains a backslash #}
3-
{% if '\\' in content %}
3+
{% if '\\' in content -%}
44
r""" {{ content }} """
5-
{% else %}
5+
{%- else -%}
66
""" {{ content }} """
7-
{% endif %}
7+
{%- endif -%}
88
{% endmacro %}

openapi_python_client/templates/model.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ T = TypeVar("T", bound="{{ class_name }}")
6060

6161
@attr.s(auto_attribs=True)
6262
class {{ class_name }}:
63-
{{ safe_docstring(class_docstring_content(model)) }}
63+
{{ safe_docstring(class_docstring_content(model)) | indent(4) }}
6464

6565
{% for property in model.required_properties + model.optional_properties %}
6666
{% if property.default is none and property.required %}

0 commit comments

Comments
 (0)