[Bug]: Docstring generated without expected escape character (or with an unnecessary one?) #6084
Open
4 tasks done
Labels
bug
Something isn't working
emitter:client:python
Issue for the Python client emitter: @typespec/http-client-python
Describe the bug
Generating our python SDK, we're running into a case where a docstring is generated with either a missing escape character, or an unnecessary one.
Our typespec contains the following sentence in a docstring for one of the properties of a model:
"Also note that the message content may be partially cut off if
finish_reason="length"
, which indicates the generation exceededmax_tokens
or the conversation exceeded the max context length."When generated, this shows up in two different places. The first is the docstring for the class the model is being generated into
Also note that the message content may be partially cut off if ``finish_reason="length"``\\ , which indicates the generation exceeded ``max_tokens`` or the conversation exceeded the max context length.
In this case, it has the double escape characters in the middle of the sentence, and then a space, before the comma. It's unclear to me why those are there, as the typespec docstring has no space, or new line or anything at that point in the docstring which would seemingly need to be escaped. But this doesn't actually cause any issues.The second place it shows up is as a comment under the actual property, within the generated class, and looks like
Also note that the message content may be partially cut off if ``finish_reason=\"length\"``\ , which indicates the generation exceeded ``max_tokens`` or the conversation exceeded the max context length.
In this case, it only generated a single escape character (and additional ones for the quotes around "length"), which is causing pylint to error out.Reproduction
I've created a branch where the generated code can be seen. This is the first location (which is fine, albeit odd), and this is the second (which breaks pylint). Here is a pointer to the typespec docstring.
Checklist
The text was updated successfully, but these errors were encountered: