Skip to content

Commit

Permalink
[Python] Fix incorrect code escape in M2R (#2973)
Browse files Browse the repository at this point in the history
* Update dependencies (2024-12-17 05:43:36)

* Regenerate for typespec-python (2024-12-17 05:48:10)

* Regenerate for autorest.python (2024-12-17 06:02:54)

* update package.json

* update changelog

---------

Co-authored-by: AutoPrFromHttpClientPython <AutoPrFromHttpClientPython>
  • Loading branch information
msyyc authored Dec 17, 2024
1 parent 2fb7a1f commit 2ca8468
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 79 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/auto-m2r_code_fix-2024-11-17-17-55-36.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

`:code:` in docstring should always be preceded by `\`
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.4.3",
"@typespec/http-client-python": "~0.4.4",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ async def put_mbcs(self, **kwargs: Any) -> None:

@distributed_trace_async
async def get_whitespace(self, **kwargs: Any) -> str:
"""Get string value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Get string value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: str or the result of cls(response)
:rtype: str
Expand Down Expand Up @@ -406,9 +406,9 @@ async def get_whitespace(self, **kwargs: Any) -> str:

@distributed_trace_async
async def put_whitespace(self, **kwargs: Any) -> None:
"""Set String value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Set String value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: None or the result of cls(response)
:rtype: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur

@distributed_trace
def get_whitespace(self, **kwargs: Any) -> str:
"""Get string value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Get string value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: str or the result of cls(response)
:rtype: str
Expand Down Expand Up @@ -604,9 +604,9 @@ def get_whitespace(self, **kwargs: Any) -> str:

@distributed_trace
def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
"""Set String value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Set String value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: None or the result of cls(response)
:rtype: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ async def put_mbcs(self, **kwargs: Any) -> None:

@distributed_trace_async
async def get_whitespace(self, **kwargs: Any) -> str:
"""Get string value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Get string value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: str
:rtype: str
Expand Down Expand Up @@ -417,9 +417,9 @@ async def get_whitespace(self, **kwargs: Any) -> str:

@distributed_trace_async
async def put_whitespace(self, **kwargs: Any) -> None:
"""Set String value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Set String value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: None
:rtype: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@ def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur

@distributed_trace
def get_whitespace(self, **kwargs: Any) -> str:
"""Get string value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Get string value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: str
:rtype: str
Expand Down Expand Up @@ -704,9 +704,9 @@ def get_whitespace(self, **kwargs: Any) -> str:

@distributed_trace
def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
"""Set String value with leading and trailing whitespace
':code:`<tab>`:code:`<space>`:code:`<space>`Now is the time for all good men to come to the aid
of their country:code:`<tab>`:code:`<space>`:code:`<space>`'.
"""Set String value with leading and trailing whitespace '\\ :code:`<tab>`\\ :code:`<space>`\\
:code:`<space>`Now is the time for all good men to come to the aid of their country\\
:code:`<tab>`\\ :code:`<space>`\\ :code:`<space>`'.
:return: None
:rtype: None
Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "~0.4.3",
"@typespec/http-client-python": "~0.4.4",
"fs-extra": "~11.2.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class DifferentSpreadFloatRecord(_model_base.Model):
"""The model spread Record:code:`<float32>` with the different known property type.
"""The model spread Record\\ :code:`<float32>` with the different known property type.
:ivar name: The id property. Required.
Expand Down Expand Up @@ -48,7 +48,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class DifferentSpreadFloatDerived(DifferentSpreadFloatRecord):
"""The model extends from a model that spread Record:code:`<float32>` with the different known
"""The model extends from a model that spread Record\\ :code:`<float32>` with the different known
property type.
Expand Down Expand Up @@ -143,7 +143,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class DifferentSpreadModelRecord(_model_base.Model):
"""The model spread Record:code:`<ModelForRecord>` with the different known property type.
"""The model spread Record\\ :code:`<ModelForRecord>` with the different known property type.
:ivar known_prop: Required.
Expand Down Expand Up @@ -172,7 +172,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class DifferentSpreadModelDerived(DifferentSpreadModelRecord):
"""The model extends from a model that spread Record:code:`<ModelForRecord>` with the different
"""The model extends from a model that spread Record\\ :code:`<ModelForRecord>` with the different
known property type.
Expand Down Expand Up @@ -205,7 +205,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class DifferentSpreadStringRecord(_model_base.Model):
"""The model spread Record:code:`<string>` with the different known property type.
"""The model spread Record\\ :code:`<string>` with the different known property type.
:ivar id: The name property. Required.
Expand Down Expand Up @@ -234,7 +234,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class DifferentSpreadStringDerived(DifferentSpreadStringRecord):
"""The model extends from a model that spread Record:code:`<string>` with the different known
"""The model extends from a model that spread Record\\ :code:`<string>` with the different known
property type.
Expand Down Expand Up @@ -267,7 +267,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class ExtendsFloatAdditionalProperties(_model_base.Model):
"""The model extends from Record:code:`<float32>` type.
"""The model extends from Record\\ :code:`<float32>` type.
:ivar id: The id property. Required.
Expand Down Expand Up @@ -296,7 +296,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class ExtendsModelAdditionalProperties(_model_base.Model):
"""The model extends from Record:code:`<ModelForRecord>` type.
"""The model extends from Record\\ :code:`<ModelForRecord>` type.
:ivar known_prop: Required.
Expand Down Expand Up @@ -354,7 +354,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class ExtendsStringAdditionalProperties(_model_base.Model):
"""The model extends from Record:code:`<string>` type.
"""The model extends from Record\\ :code:`<string>` type.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -383,7 +383,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class ExtendsUnknownAdditionalProperties(_model_base.Model):
"""The model extends from Record:code:`<unknown>` type.
"""The model extends from Record\\ :code:`<unknown>` type.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -412,7 +412,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class ExtendsUnknownAdditionalPropertiesDerived(ExtendsUnknownAdditionalProperties): # pylint: disable=name-too-long
"""The model extends from a type that extends from Record:code:`<unknown>`.
"""The model extends from a type that extends from Record\\ :code:`<unknown>`.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -449,7 +449,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class ExtendsUnknownAdditionalPropertiesDiscriminated(_model_base.Model): # pylint: disable=name-too-long
"""The model extends from Record:code:`<unknown>` with a discriminator.
"""The model extends from Record\\ :code:`<unknown>` with a discriminator.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
ExtendsUnknownAdditionalPropertiesDiscriminatedDerived
Expand Down Expand Up @@ -530,7 +530,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class IsFloatAdditionalProperties(_model_base.Model):
"""The model is from Record:code:`<float32>` type.
"""The model is from Record\\ :code:`<float32>` type.
:ivar id: The id property. Required.
Expand Down Expand Up @@ -559,7 +559,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class IsModelAdditionalProperties(_model_base.Model):
"""The model is from Record:code:`<ModelForRecord>` type.
"""The model is from Record\\ :code:`<ModelForRecord>` type.
:ivar known_prop: Required.
Expand Down Expand Up @@ -617,7 +617,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class IsStringAdditionalProperties(_model_base.Model):
"""The model is from Record:code:`<string>` type.
"""The model is from Record\\ :code:`<string>` type.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -646,7 +646,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class IsUnknownAdditionalProperties(_model_base.Model):
"""The model is from Record:code:`<unknown>` type.
"""The model is from Record\\ :code:`<unknown>` type.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -675,7 +675,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class IsUnknownAdditionalPropertiesDerived(IsUnknownAdditionalProperties):
"""The model extends from a type that is Record:code:`<unknown>` type.
"""The model extends from a type that is Record\\ :code:`<unknown>` type.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -712,7 +712,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class IsUnknownAdditionalPropertiesDiscriminated(_model_base.Model): # pylint: disable=name-too-long
"""The model is Record:code:`<unknown>` with a discriminator.
"""The model is Record\\ :code:`<unknown>` with a discriminator.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
IsUnknownAdditionalPropertiesDiscriminatedDerived
Expand Down Expand Up @@ -822,7 +822,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class MultipleSpreadRecord(_model_base.Model):
"""The model spread Record:code:`<string>` and Record:code:`<float32>`.
"""The model spread Record\\ :code:`<string>` and Record\\ :code:`<float32>`.
:ivar flag: The name property. Required.
Expand Down Expand Up @@ -851,7 +851,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class SpreadFloatRecord(_model_base.Model):
"""The model spread Record:code:`<float32>` with the same known property type.
"""The model spread Record\\ :code:`<float32>` with the same known property type.
:ivar id: The id property. Required.
Expand Down Expand Up @@ -909,7 +909,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class SpreadModelRecord(_model_base.Model):
"""The model spread Record:code:`<ModelForRecord>` with the same known property type.
"""The model spread Record\\ :code:`<ModelForRecord>` with the same known property type.
:ivar known_prop: Required.
Expand Down Expand Up @@ -938,7 +938,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class SpreadRecordForDiscriminatedUnion(_model_base.Model):
"""The model spread Record:code:`<WidgetData>`.
"""The model spread Record\\ :code:`<WidgetData>`.
:ivar name: The name property. Required.
Expand Down Expand Up @@ -1083,7 +1083,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class SpreadStringRecord(_model_base.Model):
"""The model spread Record:code:`<string>` with the same known property type.
"""The model spread Record\\ :code:`<string>` with the same known property type.
:ivar name: The name property. Required.
Expand Down
Loading

0 comments on commit 2ca8468

Please sign in to comment.