Skip to content

Commit 6097a33

Browse files
solve conflicts
1 parent 2b8cac8 commit 6097a33

46 files changed

Lines changed: 2321 additions & 230 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/typespec-python/scripts/eng/regenerate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ const AZURE_EMITTER_OPTIONS: Record<string, Record<string, string> | Record<stri
9797
"namespace": "client.structure.twooperationgroup",
9898
},
9999
"client/naming": {
100-
namespace: "client.naming",
100+
namespace: "client.naming.main",
101+
},
102+
"client/naming/enum-conflict": {
103+
namespace: "client.naming.enumconflict",
101104
},
102105
"client/overload": {
103106
namespace: "client.overload",

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/apiview-properties.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"CrossLanguagePackageId": "Client.Naming.EnumConflict",
33
"CrossLanguageDefinitionId": {
4-
"client.naming.enumconflict.firstnamespace.models.FirstModel": "Client.Naming.EnumConflict.FirstNamespace.FirstModel",
5-
"client.naming.enumconflict.secondnamespace.models.SecondModel": "Client.Naming.EnumConflict.SecondNamespace.SecondModel",
4+
"client.naming.enumconflict.models.FirstModel": "Client.Naming.EnumConflict.FirstNamespace.FirstModel",
5+
"client.naming.enumconflict.models.SecondModel": "Client.Naming.EnumConflict.SecondNamespace.SecondModel",
66
"client.naming.enumconflict.models.Status": "Client.Naming.EnumConflict.FirstNamespace.Status",
77
"client.naming.enumconflict.models.SecondStatus": "Client.Naming.EnumConflict.SecondNamespace.Status",
88
"client.naming.enumconflict.operations.FirstOperationsOperations.first": "Client.Naming.EnumConflict.FirstOperations.first",

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pylint: disable=too-many-lines
1+
# pylint: disable=line-too-long,useless-suppression,too-many-lines
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_operations.py

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=line-too-long,useless-suppression
12
# coding=utf-8
23
# --------------------------------------------------------------------------
34
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26,11 +27,10 @@
2627
from azure.core.tracing.decorator_async import distributed_trace_async
2728
from azure.core.utils import case_insensitive_dict
2829

30+
from ... import models as _models
2931
from ..._utils.model_base import SdkJSONEncoder, _deserialize
3032
from ..._utils.serialization import Deserializer, Serializer
31-
from ...firstnamespace import models as _firstnamespace_models3
3233
from ...operations._operations import build_first_operations_first_request, build_second_operations_second_request
33-
from ...secondnamespace import models as _secondnamespace_models3
3434
from .._configuration import EnumConflictClientConfiguration
3535

3636
JSON = MutableMapping[str, Any]
@@ -57,24 +57,22 @@ def __init__(self, *args, **kwargs) -> None:
5757

5858
@overload
5959
async def first(
60-
self, body: _firstnamespace_models3.FirstModel, *, content_type: str = "application/json", **kwargs: Any
61-
) -> _firstnamespace_models3.FirstModel:
60+
self, body: _models.FirstModel, *, content_type: str = "application/json", **kwargs: Any
61+
) -> _models.FirstModel:
6262
"""Operation using first namespace Status enum.
6363
6464
:param body: Required.
65-
:type body: ~client.naming.enumconflict.firstnamespace.models.FirstModel
65+
:type body: ~client.naming.enumconflict.models.FirstModel
6666
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
6767
Default value is "application/json".
6868
:paramtype content_type: str
6969
:return: FirstModel. The FirstModel is compatible with MutableMapping
70-
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
70+
:rtype: ~client.naming.enumconflict.models.FirstModel
7171
:raises ~azure.core.exceptions.HttpResponseError:
7272
"""
7373

7474
@overload
75-
async def first(
76-
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
77-
) -> _firstnamespace_models3.FirstModel:
75+
async def first(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.FirstModel:
7876
"""Operation using first namespace Status enum.
7977
8078
:param body: Required.
@@ -83,14 +81,14 @@ async def first(
8381
Default value is "application/json".
8482
:paramtype content_type: str
8583
:return: FirstModel. The FirstModel is compatible with MutableMapping
86-
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
84+
:rtype: ~client.naming.enumconflict.models.FirstModel
8785
:raises ~azure.core.exceptions.HttpResponseError:
8886
"""
8987

9088
@overload
9189
async def first(
9290
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
93-
) -> _firstnamespace_models3.FirstModel:
91+
) -> _models.FirstModel:
9492
"""Operation using first namespace Status enum.
9593
9694
:param body: Required.
@@ -99,20 +97,18 @@ async def first(
9997
Default value is "application/json".
10098
:paramtype content_type: str
10199
:return: FirstModel. The FirstModel is compatible with MutableMapping
102-
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
100+
:rtype: ~client.naming.enumconflict.models.FirstModel
103101
:raises ~azure.core.exceptions.HttpResponseError:
104102
"""
105103

106104
@distributed_trace_async
107-
async def first(
108-
self, body: Union[_firstnamespace_models3.FirstModel, JSON, IO[bytes]], **kwargs: Any
109-
) -> _firstnamespace_models3.FirstModel:
105+
async def first(self, body: Union[_models.FirstModel, JSON, IO[bytes]], **kwargs: Any) -> _models.FirstModel:
110106
"""Operation using first namespace Status enum.
111107
112108
:param body: Is one of the following types: FirstModel, JSON, IO[bytes] Required.
113-
:type body: ~client.naming.enumconflict.firstnamespace.models.FirstModel or JSON or IO[bytes]
109+
:type body: ~client.naming.enumconflict.models.FirstModel or JSON or IO[bytes]
114110
:return: FirstModel. The FirstModel is compatible with MutableMapping
115-
:rtype: ~client.naming.enumconflict.firstnamespace.models.FirstModel
111+
:rtype: ~client.naming.enumconflict.models.FirstModel
116112
:raises ~azure.core.exceptions.HttpResponseError:
117113
"""
118114
error_map: MutableMapping = {
@@ -127,7 +123,7 @@ async def first(
127123
_params = kwargs.pop("params", {}) or {}
128124

129125
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
130-
cls: ClsType[_firstnamespace_models3.FirstModel] = kwargs.pop("cls", None)
126+
cls: ClsType[_models.FirstModel] = kwargs.pop("cls", None)
131127

132128
content_type = content_type or "application/json"
133129
_content = None
@@ -166,7 +162,7 @@ async def first(
166162
if _stream:
167163
deserialized = response.iter_bytes()
168164
else:
169-
deserialized = _deserialize(_firstnamespace_models3.FirstModel, response.json())
165+
deserialized = _deserialize(_models.FirstModel, response.json())
170166

171167
if cls:
172168
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -193,24 +189,22 @@ def __init__(self, *args, **kwargs) -> None:
193189

194190
@overload
195191
async def second(
196-
self, body: _secondnamespace_models3.SecondModel, *, content_type: str = "application/json", **kwargs: Any
197-
) -> _secondnamespace_models3.SecondModel:
192+
self, body: _models.SecondModel, *, content_type: str = "application/json", **kwargs: Any
193+
) -> _models.SecondModel:
198194
"""Operation using second namespace Status enum.
199195
200196
:param body: Required.
201-
:type body: ~client.naming.enumconflict.secondnamespace.models.SecondModel
197+
:type body: ~client.naming.enumconflict.models.SecondModel
202198
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
203199
Default value is "application/json".
204200
:paramtype content_type: str
205201
:return: SecondModel. The SecondModel is compatible with MutableMapping
206-
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
202+
:rtype: ~client.naming.enumconflict.models.SecondModel
207203
:raises ~azure.core.exceptions.HttpResponseError:
208204
"""
209205

210206
@overload
211-
async def second(
212-
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
213-
) -> _secondnamespace_models3.SecondModel:
207+
async def second(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.SecondModel:
214208
"""Operation using second namespace Status enum.
215209
216210
:param body: Required.
@@ -219,14 +213,14 @@ async def second(
219213
Default value is "application/json".
220214
:paramtype content_type: str
221215
:return: SecondModel. The SecondModel is compatible with MutableMapping
222-
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
216+
:rtype: ~client.naming.enumconflict.models.SecondModel
223217
:raises ~azure.core.exceptions.HttpResponseError:
224218
"""
225219

226220
@overload
227221
async def second(
228222
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
229-
) -> _secondnamespace_models3.SecondModel:
223+
) -> _models.SecondModel:
230224
"""Operation using second namespace Status enum.
231225
232226
:param body: Required.
@@ -235,20 +229,18 @@ async def second(
235229
Default value is "application/json".
236230
:paramtype content_type: str
237231
:return: SecondModel. The SecondModel is compatible with MutableMapping
238-
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
232+
:rtype: ~client.naming.enumconflict.models.SecondModel
239233
:raises ~azure.core.exceptions.HttpResponseError:
240234
"""
241235

242236
@distributed_trace_async
243-
async def second(
244-
self, body: Union[_secondnamespace_models3.SecondModel, JSON, IO[bytes]], **kwargs: Any
245-
) -> _secondnamespace_models3.SecondModel:
237+
async def second(self, body: Union[_models.SecondModel, JSON, IO[bytes]], **kwargs: Any) -> _models.SecondModel:
246238
"""Operation using second namespace Status enum.
247239
248240
:param body: Is one of the following types: SecondModel, JSON, IO[bytes] Required.
249-
:type body: ~client.naming.enumconflict.secondnamespace.models.SecondModel or JSON or IO[bytes]
241+
:type body: ~client.naming.enumconflict.models.SecondModel or JSON or IO[bytes]
250242
:return: SecondModel. The SecondModel is compatible with MutableMapping
251-
:rtype: ~client.naming.enumconflict.secondnamespace.models.SecondModel
243+
:rtype: ~client.naming.enumconflict.models.SecondModel
252244
:raises ~azure.core.exceptions.HttpResponseError:
253245
"""
254246
error_map: MutableMapping = {
@@ -263,7 +255,7 @@ async def second(
263255
_params = kwargs.pop("params", {}) or {}
264256

265257
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
266-
cls: ClsType[_secondnamespace_models3.SecondModel] = kwargs.pop("cls", None)
258+
cls: ClsType[_models.SecondModel] = kwargs.pop("cls", None)
267259

268260
content_type = content_type or "application/json"
269261
_content = None
@@ -302,7 +294,7 @@ async def second(
302294
if _stream:
303295
deserialized = response.iter_bytes()
304296
else:
305-
deserialized = _deserialize(_secondnamespace_models3.SecondModel, response.json())
297+
deserialized = _deserialize(_models.SecondModel, response.json())
306298

307299
if cls:
308300
return cls(pipeline_response, deserialized, {}) # type: ignore

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_enums.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_models.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/__init__.py renamed to packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@
1414

1515

1616
from ._models import ( # type: ignore
17+
FirstModel,
1718
SecondModel,
1819
)
1920

2021
from ._enums import ( # type: ignore
2122
SecondStatus,
23+
Status,
2224
)
2325
from ._patch import __all__ as _patch_all
2426
from ._patch import *
2527
from ._patch import patch_sdk as _patch_sdk
2628

2729
__all__ = [
30+
"FirstModel",
2831
"SecondModel",
2932
"SecondStatus",
33+
"Status",
3034
]
3135
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
3236
_patch_sdk()

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_enums.py renamed to packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/models/_enums.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ class SecondStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1717
"""Running status"""
1818
STOPPED = "stopped"
1919
"""Stopped status"""
20+
21+
22+
class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta):
23+
"""Status enum in first namespace."""
24+
25+
ACTIVE = "active"
26+
"""Active status"""
27+
INACTIVE = "inactive"
28+
"""Inactive status"""

packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_models.py renamed to packages/typespec-python/test/azure/generated/client-naming-enum-conflict/client/naming/enumconflict/models/_models.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,51 @@
99

1010
from typing import Any, Mapping, TYPE_CHECKING, Union, overload
1111

12-
from ..._utils.model_base import Model as _Model, rest_field
12+
from .._utils.model_base import Model as _Model, rest_field
1313

1414
if TYPE_CHECKING:
1515
from .. import models as _models
1616

1717

18+
class FirstModel(_Model):
19+
"""FirstModel.
20+
21+
:ivar status: Status from first namespace. Required. Known values are: "active" and "inactive".
22+
:vartype status: str or ~client.naming.enumconflict.models.Status
23+
:ivar name: Name of the item. Required.
24+
:vartype name: str
25+
"""
26+
27+
status: Union[str, "_models.Status"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
28+
"""Status from first namespace. Required. Known values are: \"active\" and \"inactive\"."""
29+
name: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
30+
"""Name of the item. Required."""
31+
32+
@overload
33+
def __init__(
34+
self,
35+
*,
36+
status: Union[str, "_models.Status"],
37+
name: str,
38+
) -> None: ...
39+
40+
@overload
41+
def __init__(self, mapping: Mapping[str, Any]) -> None:
42+
"""
43+
:param mapping: raw JSON to initialize the model.
44+
:type mapping: Mapping[str, Any]
45+
"""
46+
47+
def __init__(self, *args: Any, **kwargs: Any) -> None:
48+
super().__init__(*args, **kwargs)
49+
50+
1851
class SecondModel(_Model):
1952
"""SecondModel.
2053
2154
:ivar status: Status from second namespace. Required. Known values are: "running" and
2255
"stopped".
23-
:vartype status: str or ~client.naming.enumconflict.secondnamespace.models.SecondStatus
56+
:vartype status: str or ~client.naming.enumconflict.models.SecondStatus
2457
:ivar description: Description of the item. Required.
2558
:vartype description: str
2659
"""

0 commit comments

Comments
 (0)