@azure-tools/typespec-python 0.31.1 → 0.32.0
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/pygen/codegen/serializers/builder_serializer.py +2 -2
- package/generator/pygen/codegen/serializers/model_serializer.py +2 -1
- package/generator/pygen/codegen/templates/operation_tools.jinja2 +9 -2
- package/package.json +22 -22
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
|
@@ -284,8 +284,8 @@ class _BuilderBaseSerializer(Generic[BuilderType]):
|
|
|
284
284
|
return description_list
|
|
285
285
|
|
|
286
286
|
@staticmethod
|
|
287
|
-
def line_too_long(docs: List[str]) -> bool:
|
|
288
|
-
return any(len(line) > 120 for line in docs)
|
|
287
|
+
def line_too_long(docs: List[str], indentation: int = 0) -> bool:
|
|
288
|
+
return any(len(line) > (120 - indentation) for line in docs)
|
|
289
289
|
|
|
290
290
|
def example_template(self, builder: BuilderType) -> List[str]:
|
|
291
291
|
template = []
|
|
@@ -261,9 +261,10 @@ class DpgModelSerializer(_ModelSerializer):
|
|
|
261
261
|
else ""
|
|
262
262
|
)
|
|
263
263
|
generated_code = f'{prop.client_name}: {prop.type_annotation()} = {field}({", ".join(args)})'
|
|
264
|
+
# there is 4 spaces indentation so original line length limit 120 - 4 = 116
|
|
264
265
|
pylint_disable = (
|
|
265
266
|
" # pylint: disable=line-too-long"
|
|
266
|
-
if len(generated_code) <=
|
|
267
|
+
if len(generated_code) <= 116 < (len(generated_code) + len(type_ignore))
|
|
267
268
|
else ""
|
|
268
269
|
)
|
|
269
270
|
return f"{generated_code}{type_ignore}{pylint_disable}"
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
{% macro description(builder, serializer) %}
|
|
4
4
|
{% set example_template = serializer.example_template(builder) %}
|
|
5
|
+
{% set param_description_and_response_docstring = serializer.param_description_and_response_docstring(builder) %}
|
|
6
|
+
{% set ns = namespace(line_too_long=false) %}
|
|
7
|
+
{% for item in param_description_and_response_docstring %}
|
|
8
|
+
{% if item and serializer.line_too_long(wrap_string(item, wrapstring='\n ').split('\n'), 8) %}
|
|
9
|
+
{% set ns.line_too_long = true %}
|
|
10
|
+
{% endif %}
|
|
11
|
+
{% endfor %}
|
|
5
12
|
{% for description in serializer.description_and_summary(builder) %}
|
|
6
13
|
{% if description %}
|
|
7
14
|
{% set description = wrap_string(description, wrapstring='\n') %}
|
|
8
|
-
{% if serializer.line_too_long(example_template) and loop.first %}
|
|
15
|
+
{% if (serializer.line_too_long(example_template) or ns.line_too_long) and loop.first %}
|
|
9
16
|
# pylint: disable=line-too-long
|
|
10
17
|
{% endif %}
|
|
11
18
|
{{ '"""' + description if loop.first else description }}
|
|
@@ -13,7 +20,7 @@
|
|
|
13
20
|
|
|
14
21
|
{% endif %}
|
|
15
22
|
{% endfor %}
|
|
16
|
-
{% for description in
|
|
23
|
+
{% for description in param_description_and_response_docstring %}
|
|
17
24
|
{% if description %}
|
|
18
25
|
{{ wrap_string(description, wrapstring='\n ') }}
|
|
19
26
|
{% else %}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-python",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Python SDKs",
|
|
6
6
|
"homepage": "https://github.com/Azure/autorest.python",
|
|
@@ -33,26 +33,26 @@
|
|
|
33
33
|
"scripts/**"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@azure-tools/typespec-azure-core": ">=0.
|
|
37
|
-
"@azure-tools/typespec-azure-resource-manager": ">=0.
|
|
38
|
-
"@azure-tools/typespec-autorest": ">=0.
|
|
39
|
-
"@azure-tools/typespec-client-generator-core": ">=0.
|
|
40
|
-
"@azure-tools/typespec-azure-rulesets": ">=0.
|
|
41
|
-
"@typespec/compiler": ">=0.
|
|
42
|
-
"@typespec/http": ">=0.
|
|
43
|
-
"@typespec/rest": ">=0.
|
|
44
|
-
"@typespec/versioning": ">=0.
|
|
45
|
-
"@typespec/openapi": ">=0.
|
|
36
|
+
"@azure-tools/typespec-azure-core": ">=0.46.0 <1.0.0",
|
|
37
|
+
"@azure-tools/typespec-azure-resource-manager": ">=0.46.0 <1.0.0",
|
|
38
|
+
"@azure-tools/typespec-autorest": ">=0.46.0 <1.0.0",
|
|
39
|
+
"@azure-tools/typespec-client-generator-core": ">=0.46.0 <1.0.0",
|
|
40
|
+
"@azure-tools/typespec-azure-rulesets": ">=0.46.0 <3.0.0",
|
|
41
|
+
"@typespec/compiler": ">=0.60.0 <1.0.0",
|
|
42
|
+
"@typespec/http": ">=0.60.0 <1.0.0",
|
|
43
|
+
"@typespec/rest": ">=0.60.0 <1.0.0",
|
|
44
|
+
"@typespec/versioning": ">=0.60.0 <1.0.0",
|
|
45
|
+
"@typespec/openapi": ">=0.60.0 <1.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"js-yaml": "~4.1.0",
|
|
49
|
-
"@typespec/openapi3": "~0.
|
|
49
|
+
"@typespec/openapi3": "~0.60.0",
|
|
50
50
|
"semver": "~7.6.2",
|
|
51
51
|
"tsx": "4.17.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@azure-tools/typespec-azure-resource-manager": "~0.
|
|
55
|
-
"@azure-tools/typespec-autorest": "~0.
|
|
54
|
+
"@azure-tools/typespec-azure-resource-manager": "~0.46.0",
|
|
55
|
+
"@azure-tools/typespec-autorest": "~0.46.0",
|
|
56
56
|
"@azure-tools/cadl-ranch-expect": "~0.15.3",
|
|
57
57
|
"@azure-tools/cadl-ranch-specs": "~0.37.1",
|
|
58
58
|
"@types/js-yaml": "~4.0.5",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"@types/yargs": "17.0.32",
|
|
61
61
|
"@types/semver": "7.5.8",
|
|
62
62
|
"@typespec/eslint-config-typespec": "~0.55.0",
|
|
63
|
-
"@typespec/openapi": "~0.
|
|
63
|
+
"@typespec/openapi": "~0.60.0",
|
|
64
64
|
"c8": "~7.13.0",
|
|
65
65
|
"vitest": "^2.0.4",
|
|
66
66
|
"rimraf": "~5.0.0",
|
|
67
67
|
"typescript": "~5.5.4",
|
|
68
|
-
"@azure-tools/typespec-azure-core": "~0.
|
|
69
|
-
"@azure-tools/typespec-client-generator-core": "0.
|
|
70
|
-
"@typespec/compiler": "~0.
|
|
71
|
-
"@typespec/http": "~0.
|
|
72
|
-
"@typespec/rest": "~0.
|
|
73
|
-
"@typespec/versioning": "~0.
|
|
74
|
-
"@azure-tools/typespec-azure-rulesets": "0.
|
|
68
|
+
"@azure-tools/typespec-azure-core": "~0.46.0",
|
|
69
|
+
"@azure-tools/typespec-client-generator-core": "0.46.0",
|
|
70
|
+
"@typespec/compiler": "~0.60.0",
|
|
71
|
+
"@typespec/http": "~0.60.0",
|
|
72
|
+
"@typespec/rest": "~0.60.0",
|
|
73
|
+
"@typespec/versioning": "~0.60.0",
|
|
74
|
+
"@azure-tools/typespec-azure-rulesets": "0.46.0",
|
|
75
75
|
"yargs": "~17.2.1",
|
|
76
76
|
"chalk": "5.3.0"
|
|
77
77
|
},
|
|
Binary file
|