Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generator/src/generator/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ def header(self, text, level, raw=None):
def docstring(text):
if not text:
return text
return (
converted = (
m2r2.convert((text or "").replace("\\n", "\\\\n"), renderer=CustomRenderer())[1:-1]
.replace("\\ ", " ")
.replace("\\`", "\\\\`")
.replace("\n\n\n", "\n\n")
)
return converted.replace("\\", "\\\\")


def _merge_imports(a, b):
Expand Down
7 changes: 6 additions & 1 deletion .generator/tests/test_formatter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import pytest
from collections import defaultdict
from generator.formatter import _is_valid_identifier, format_data_with_schema
from generator.formatter import _is_valid_identifier, docstring, format_data_with_schema


class TestDocstring:
def test_escapes_backslashes_for_python_string_literals(self):
assert "``\\\\s``" in docstring(r"regex pattern like ``\s`` for spaces")


class TestIsValidIdentifier:
Expand Down
2 changes: 1 addition & 1 deletion src/datadog_api_client/v1/api/logs_pipelines_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LogsPipelinesApi:
returned data to be configured before using in a request.**
For example, if you are using the data returned from a
request for another request body, and have a parsing rule
that uses a regex pattern like ``\s`` for spaces, you will
that uses a regex pattern like ``\\s`` for spaces, you will
need to configure all escaped spaces as ``%{space}`` to use
in the body data.
"""
Expand Down