@autorest/python 6.35.3 → 6.35.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generator/build/lib/pygen/codegen/models/property.py +6 -0
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +31 -0
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/property.py +6 -0
- package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +31 -0
- package/package.json +2 -2
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
|
@@ -87,11 +87,17 @@ class Property(BaseModel): # pylint: disable=too-many-instance-attributes
|
|
|
87
87
|
def is_enum_discriminator(self) -> bool:
|
|
88
88
|
return self.is_discriminator and self.type.type == "enum"
|
|
89
89
|
|
|
90
|
+
@property
|
|
91
|
+
def is_combined_discriminator(self) -> bool:
|
|
92
|
+
return self.is_discriminator and self.type.type == "combined"
|
|
93
|
+
|
|
90
94
|
@property
|
|
91
95
|
def is_base_discriminator(self) -> bool:
|
|
92
96
|
"""If this discriminator is on the base model for polymorphic inheritance"""
|
|
93
97
|
if self.is_enum_discriminator:
|
|
94
98
|
return self.is_polymorphic and self.client_default_value is None
|
|
99
|
+
if self.is_combined_discriminator:
|
|
100
|
+
return True
|
|
95
101
|
return self.is_discriminator and self.is_polymorphic and cast(ConstantType, self.type).value is None
|
|
96
102
|
|
|
97
103
|
@property
|
|
@@ -104,4 +104,35 @@ additional questions or comments.
|
|
|
104
104
|
[pip]: https://pypi.org/project/pip/
|
|
105
105
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
106
106
|
{% endif %}
|
|
107
|
+
{% else %}
|
|
108
|
+
# Overview
|
|
109
|
+
|
|
110
|
+
This package is generated by `@typespec/http-client-python` with Typespec.
|
|
111
|
+
|
|
112
|
+
## Getting started
|
|
113
|
+
|
|
114
|
+
### Prequisites
|
|
115
|
+
|
|
116
|
+
- Python 3.9 or later is required to use this package.
|
|
117
|
+
|
|
118
|
+
### Install the package
|
|
119
|
+
|
|
120
|
+
Step into folder where setup.py is then run:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pip install -e .
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Examples
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
>>> from {{ code_model.namespace }} import {{ client_name }}
|
|
130
|
+
>>> from {{ code_model.core_library }}.exceptions import HttpResponseError
|
|
131
|
+
|
|
132
|
+
>>> client = {{ client_name }}(endpoint='<endpoint>')
|
|
133
|
+
>>> try:
|
|
134
|
+
<!-- write code here -->
|
|
135
|
+
except HttpResponseError as e:
|
|
136
|
+
print('service responds error: {}'.format(e.response.json()))
|
|
137
|
+
```
|
|
107
138
|
{% endif %}
|
|
Binary file
|
|
@@ -87,11 +87,17 @@ class Property(BaseModel): # pylint: disable=too-many-instance-attributes
|
|
|
87
87
|
def is_enum_discriminator(self) -> bool:
|
|
88
88
|
return self.is_discriminator and self.type.type == "enum"
|
|
89
89
|
|
|
90
|
+
@property
|
|
91
|
+
def is_combined_discriminator(self) -> bool:
|
|
92
|
+
return self.is_discriminator and self.type.type == "combined"
|
|
93
|
+
|
|
90
94
|
@property
|
|
91
95
|
def is_base_discriminator(self) -> bool:
|
|
92
96
|
"""If this discriminator is on the base model for polymorphic inheritance"""
|
|
93
97
|
if self.is_enum_discriminator:
|
|
94
98
|
return self.is_polymorphic and self.client_default_value is None
|
|
99
|
+
if self.is_combined_discriminator:
|
|
100
|
+
return True
|
|
95
101
|
return self.is_discriminator and self.is_polymorphic and cast(ConstantType, self.type).value is None
|
|
96
102
|
|
|
97
103
|
@property
|
|
@@ -104,4 +104,35 @@ additional questions or comments.
|
|
|
104
104
|
[pip]: https://pypi.org/project/pip/
|
|
105
105
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
106
106
|
{% endif %}
|
|
107
|
+
{% else %}
|
|
108
|
+
# Overview
|
|
109
|
+
|
|
110
|
+
This package is generated by `@typespec/http-client-python` with Typespec.
|
|
111
|
+
|
|
112
|
+
## Getting started
|
|
113
|
+
|
|
114
|
+
### Prequisites
|
|
115
|
+
|
|
116
|
+
- Python 3.9 or later is required to use this package.
|
|
117
|
+
|
|
118
|
+
### Install the package
|
|
119
|
+
|
|
120
|
+
Step into folder where setup.py is then run:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pip install -e .
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Examples
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
>>> from {{ code_model.namespace }} import {{ client_name }}
|
|
130
|
+
>>> from {{ code_model.core_library }}.exceptions import HttpResponseError
|
|
131
|
+
|
|
132
|
+
>>> client = {{ client_name }}(endpoint='<endpoint>')
|
|
133
|
+
>>> try:
|
|
134
|
+
<!-- write code here -->
|
|
135
|
+
except HttpResponseError as e:
|
|
136
|
+
print('service responds error: {}'.format(e.response.json()))
|
|
137
|
+
```
|
|
107
138
|
{% endif %}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "6.35.
|
|
3
|
+
"version": "6.35.5",
|
|
4
4
|
"description": "The Python extension for generators in AutoRest.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@typespec/http-client-python": "~0.12.
|
|
22
|
+
"@typespec/http-client-python": "~0.12.5",
|
|
23
23
|
"@autorest/system-requirements": "~1.0.2",
|
|
24
24
|
"fs-extra": "~11.2.0",
|
|
25
25
|
"tsx": "~4.19.1"
|
|
Binary file
|