@autorest/python 6.12.0 → 6.12.1

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.
@@ -304,6 +304,11 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]):
304
304
  """Whether there is abstract operation in any operation group."""
305
305
  return any(og.has_abstract_operations for og in self.operation_groups)
306
306
 
307
+ @property
308
+ def has_non_abstract_operations(self) -> bool:
309
+ """Whether there is non-abstract operation in any operation group."""
310
+ return any(og.has_non_abstract_operations for og in self.operation_groups)
311
+
307
312
  def imports(self, async_mode: bool) -> FileImport:
308
313
  file_import = self._imports_shared(async_mode)
309
314
  if async_mode:
@@ -79,12 +79,11 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
79
79
 
80
80
  @property
81
81
  def has_form_data(self) -> bool:
82
- for client in self.clients:
83
- for operation_group in client.operation_groups:
84
- for operation in operation_group.operations:
85
- if operation.has_form_data_body:
86
- return True
87
- return False
82
+ return any(
83
+ og.has_form_data_body
84
+ for client in self.clients
85
+ for og in client.operation_groups
86
+ )
88
87
 
89
88
  @property
90
89
  def has_etag(self) -> bool:
@@ -103,18 +102,12 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
103
102
 
104
103
  @property
105
104
  def has_non_abstract_operations(self) -> bool:
106
- for client in self.clients:
107
- for operation_group in client.operation_groups:
108
- for operation in operation_group.operations:
109
- if not operation.abstract:
110
- return True
111
- for clients in self.subnamespace_to_clients.values():
112
- for client in clients:
113
- for operation_group in client.operation_groups:
114
- for operation in operation_group.operations:
115
- if not operation.abstract:
116
- return True
117
- return False
105
+ return any(c for c in self.clients if c.has_non_abstract_operations) or any(
106
+ c
107
+ for cs in self.subnamespace_to_clients.values()
108
+ for c in cs
109
+ if c.has_non_abstract_operations
110
+ )
118
111
 
119
112
  def lookup_request_builder(
120
113
  self, request_builder_id: int
@@ -48,7 +48,17 @@ class OperationGroup(BaseModel):
48
48
 
49
49
  @property
50
50
  def has_abstract_operations(self) -> bool:
51
- return any(o for o in self.operations if o.abstract)
51
+ return any(o for o in self.operations if o.abstract) or any(
52
+ operation_group.has_abstract_operations
53
+ for operation_group in self.operation_groups
54
+ )
55
+
56
+ @property
57
+ def has_non_abstract_operations(self) -> bool:
58
+ return any(o for o in self.operations if not o.abstract) or any(
59
+ operation_group.has_non_abstract_operations
60
+ for operation_group in self.operation_groups
61
+ )
52
62
 
53
63
  @property
54
64
  def base_class(self) -> str:
@@ -183,6 +193,13 @@ class OperationGroup(BaseModel):
183
193
  operation_group.has_operations for operation_group in self.operation_groups
184
194
  ) or bool(self.operations)
185
195
 
196
+ @property
197
+ def has_form_data_body(self) -> bool:
198
+ operations = self.operations + [
199
+ o for og in self.operation_groups for o in og.operations
200
+ ]
201
+ return any(operation.has_form_data_body for operation in operations)
202
+
186
203
  @classmethod
187
204
  def from_yaml(
188
205
  cls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.12.0",
3
+ "version": "6.12.1",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "main": "index.js",
6
6
  "repository": {