@looker/sdk-codegen 21.7.4 → 21.8.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/codeGen.d.ts +1 -1
  3. package/lib/codeGen.js +28 -154
  4. package/lib/codeGen.js.map +1 -1
  5. package/lib/codeGenerators.js +0 -16
  6. package/lib/codeGenerators.js.map +1 -1
  7. package/lib/csharp.gen.js +3 -71
  8. package/lib/csharp.gen.js.map +1 -1
  9. package/lib/declarationInfo.js +0 -7
  10. package/lib/declarationInfo.js.map +1 -1
  11. package/lib/esm/codeGen.js +48 -157
  12. package/lib/esm/codeGen.js.map +1 -1
  13. package/lib/esm/codeGenerators.js +28 -20
  14. package/lib/esm/codeGenerators.js.map +1 -1
  15. package/lib/esm/csharp.gen.js +19 -75
  16. package/lib/esm/csharp.gen.js.map +1 -1
  17. package/lib/esm/declarationInfo.js +10 -7
  18. package/lib/esm/declarationInfo.js.map +1 -1
  19. package/lib/esm/exampleInfo.js +24 -23
  20. package/lib/esm/exampleInfo.js.map +1 -1
  21. package/lib/esm/go.gen.js +18 -92
  22. package/lib/esm/go.gen.js.map +1 -1
  23. package/lib/esm/index.js +148 -13
  24. package/lib/esm/index.js.map +1 -1
  25. package/lib/esm/kotlin.gen.js +23 -118
  26. package/lib/esm/kotlin.gen.js.map +1 -1
  27. package/lib/esm/pseudo.gen.js +14 -24
  28. package/lib/esm/pseudo.gen.js.map +1 -1
  29. package/lib/esm/python.gen.js +19 -138
  30. package/lib/esm/python.gen.js.map +1 -1
  31. package/lib/esm/sdkModels.js +100 -432
  32. package/lib/esm/sdkModels.js.map +1 -1
  33. package/lib/esm/specConverter.js +58 -88
  34. package/lib/esm/specConverter.js.map +1 -1
  35. package/lib/esm/specDiff.js +36 -51
  36. package/lib/esm/specDiff.js.map +1 -1
  37. package/lib/esm/swift.gen.js +25 -137
  38. package/lib/esm/swift.gen.js.map +1 -1
  39. package/lib/esm/testUtils/index.js +17 -0
  40. package/lib/esm/testUtils/index.js.map +1 -0
  41. package/lib/esm/testUtils/testUtils.js +66 -0
  42. package/lib/esm/testUtils/testUtils.js.map +1 -0
  43. package/lib/esm/typescript.gen.js +24 -125
  44. package/lib/esm/typescript.gen.js.map +1 -1
  45. package/lib/exampleInfo.js +1 -31
  46. package/lib/exampleInfo.js.map +1 -1
  47. package/lib/go.gen.js +3 -87
  48. package/lib/go.gen.js.map +1 -1
  49. package/lib/index.js +0 -26
  50. package/lib/index.js.map +1 -1
  51. package/lib/kotlin.gen.js +7 -113
  52. package/lib/kotlin.gen.js.map +1 -1
  53. package/lib/pseudo.gen.js +3 -24
  54. package/lib/pseudo.gen.js.map +1 -1
  55. package/lib/python.gen.js +3 -133
  56. package/lib/python.gen.js.map +1 -1
  57. package/lib/sdkModels.js +8 -438
  58. package/lib/sdkModels.js.map +1 -1
  59. package/lib/specConverter.js +6 -106
  60. package/lib/specConverter.js.map +1 -1
  61. package/lib/specDiff.js +1 -56
  62. package/lib/specDiff.js.map +1 -1
  63. package/lib/swift.gen.js +3 -128
  64. package/lib/swift.gen.js.map +1 -1
  65. package/lib/testUtils/index.js +0 -2
  66. package/lib/testUtils/index.js.map +1 -1
  67. package/lib/testUtils/testUtils.js +1 -17
  68. package/lib/testUtils/testUtils.js.map +1 -1
  69. package/lib/typescript.gen.js +5 -117
  70. package/lib/typescript.gen.js.map +1 -1
  71. package/package.json +3 -3
package/lib/python.gen.js CHANGED
@@ -4,215 +4,149 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PythonGen = void 0;
7
-
8
7
  var _sdkModels = require("./sdkModels");
9
-
10
8
  var _codeGen = require("./codeGen");
11
-
12
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
-
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
12
  class PythonGen extends _codeGen.CodeGen {
15
13
  constructor() {
16
14
  super(...arguments);
17
-
18
15
  _defineProperty(this, "codePath", './python/');
19
-
20
16
  _defineProperty(this, "packagePath", 'looker_sdk');
21
-
22
17
  _defineProperty(this, "itself", 'self');
23
-
24
18
  _defineProperty(this, "fileExtension", '.py');
25
-
26
19
  _defineProperty(this, "commentStr", '# ');
27
-
28
20
  _defineProperty(this, "nullStr", 'None');
29
-
30
21
  _defineProperty(this, "indentStr", ' ');
31
-
32
22
  _defineProperty(this, "argDelimiter", ",\n".concat(this.indentStr.repeat(3)));
33
-
34
23
  _defineProperty(this, "argSetSep", '=');
35
-
36
24
  _defineProperty(this, "paramDelimiter", ',\n');
37
-
38
25
  _defineProperty(this, "propDelimiter", '\n');
39
-
40
26
  _defineProperty(this, "dataStructureDelimiter", ', ');
41
-
42
27
  _defineProperty(this, "enumDelimiter", '\n');
43
-
44
28
  _defineProperty(this, "codeQuote", '"');
45
-
46
29
  _defineProperty(this, "typeOpen", '(');
47
-
48
30
  _defineProperty(this, "typeClose", ')');
49
-
50
31
  _defineProperty(this, "hashKeyQuote", '"');
51
-
52
32
  _defineProperty(this, "useModelClassForTypes", true);
53
-
54
33
  _defineProperty(this, "endTypeStr", '');
55
-
56
34
  _defineProperty(this, "pythonKeywords", new Set(['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']));
57
-
58
35
  _defineProperty(this, "hooks", []);
59
-
60
36
  _defineProperty(this, "structureHookTK", 'translate_keys_structure_hook');
61
-
62
37
  _defineProperty(this, "pythonReservedKeywordClasses", new Set());
63
-
64
38
  _defineProperty(this, "methodsPrologue", _indent => "\n# ".concat(this.warnEditing(), "\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models as mdls\nfrom ").concat(this.packagePath, ".rtl import api_methods\nfrom ").concat(this.packagePath, ".rtl import transport\n\nclass ").concat(this.packageName, "(api_methods.APIMethods):\n"));
65
-
66
39
  _defineProperty(this, "methodsEpilogue", _indent => this.apiVersion === '3.1' ? "LookerSDK = ".concat(this.packageName) : '');
67
-
68
40
  _defineProperty(this, "modelsPrologue", _indent => "\n# ".concat(this.warnEditing(), "\nimport datetime\nimport enum\nfrom typing import Any, MutableMapping, Optional, Sequence\n\ntry:\n from typing import ForwardRef # type: ignore\nexcept ImportError:\n from typing import _ForwardRef as ForwardRef # type: ignore\n\nimport attr\n\nfrom ").concat(this.packagePath, ".rtl import model\nfrom ").concat(this.packagePath, ".rtl import serialize as sr\n\nEXPLICIT_NULL = model.EXPLICIT_NULL # type: ignore\nDelimSequence = model.DelimSequence\n"));
69
-
70
41
  _defineProperty(this, "modelsEpilogue", _indent => "\nimport functools # noqa:E402\n\nforward_ref_structure_hook = functools.partial(\n sr.forward_ref_structure_hook, globals(), sr.converter".concat(this.apiRef, "\n)\nsr.converter").concat(this.apiRef, ".register_structure_hook_func(\n lambda t: t.__class__ is ForwardRef, forward_ref_structure_hook\n)\n").concat(this.structureHookTK, " = functools.partial(sr.translate_keys_structure_hook, sr.converter").concat(this.apiRef, ")\n").concat(this.hooks.join('\n'), "\n"));
71
-
72
42
  _defineProperty(this, "isBareForwardRef", prop => {
73
43
  return prop.required && (prop.type.customType || prop.type instanceof _sdkModels.EnumType) && !['ArrayType', 'HashType', 'DelimArrayType'].includes(prop.type.className);
74
44
  });
75
45
  }
76
-
77
46
  sdkFileName(baseFileName) {
78
47
  return this.fileName("sdk/api".concat(this.apiRef, "/").concat(baseFileName));
79
48
  }
80
-
81
49
  argGroup(_indent, args) {
82
50
  if (!args || args.length === 0) return this.nullStr;
83
51
  var hash = [];
84
-
85
52
  for (var arg of args) {
86
53
  hash.push("\"".concat(arg, "\": ").concat(arg));
87
54
  }
88
-
89
55
  return "{".concat(hash.join(this.dataStructureDelimiter), "}");
90
56
  }
91
-
92
57
  beginRegion(indent, description) {
93
58
  return "".concat(indent, "#region ").concat(description);
94
59
  }
95
-
96
60
  endRegion(indent, _description) {
97
61
  return "".concat(indent, "#endregion");
98
62
  }
99
-
100
63
  declareProperty(indent, property) {
101
64
  var annotations = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
102
65
  var mappedType = this.typeMapModels(property.type);
103
66
  var propName = property.name;
104
-
105
67
  if (this.pythonKeywords.has(propName)) {
106
68
  propName = propName + '_';
107
69
  }
108
-
109
70
  var propType = mappedType.name;
110
-
111
71
  if (!property.required) {
112
72
  propType = "Optional[".concat(mappedType.name, "]");
113
73
  }
114
-
115
74
  var propDef;
116
-
117
75
  if (annotations) {
118
76
  var annotation = propType;
119
-
120
77
  if (this.isBareForwardRef(property)) {
121
78
  annotation = "ForwardRef(".concat(propType, ")");
122
79
  }
123
-
124
80
  propDef = "".concat(this.bumper(indent), "\"").concat(propName, "\": ").concat(annotation);
125
81
  } else {
126
82
  if (!property.required) {
127
83
  propType += " = ".concat(this.nullStr);
128
84
  }
129
-
130
85
  propDef = "".concat(indent).concat(propName, ": ").concat(propType);
131
86
  }
132
-
133
87
  return propDef;
134
88
  }
135
-
136
89
  methodReturnType(method) {
137
90
  var type = this.typeMapMethods(method.type);
138
91
  var returnType = type.name;
139
-
140
92
  if (method.responseIsBoth()) {
141
93
  returnType = "Union[".concat(returnType, ", bytes]");
142
94
  } else if (method.responseIsBinary()) {
143
95
  returnType = 'bytes';
144
96
  }
145
-
146
97
  return returnType;
147
98
  }
148
-
149
99
  methodSignature(indent, method) {
150
100
  var _method$description;
151
-
152
101
  var returnType = this.methodReturnType(method);
153
102
  var bump = this.bumper(indent);
154
103
  var params = [];
155
104
  var args = method.allParams;
156
-
157
105
  if (args && args.length > 0) {
158
106
  method.allParams.forEach(p => params.push(this.declareParameter(bump, method, p)));
159
107
  }
160
-
161
108
  var head = (_method$description = method.description) === null || _method$description === void 0 ? void 0 : _method$description.trim();
162
109
  head = (head ? "".concat(head, "\n\n") : '') + "".concat(method.httpMethod, " ").concat(method.endpoint, " -> ").concat(returnType);
163
110
  params.push("".concat(bump, "transport_options: Optional[transport.TransportOptions] = None,"));
164
111
  return this.commentHeader(indent, head) + "".concat(indent, "def ").concat(method.name, "(\n") + "".concat(bump, "self").concat(params.length > 0 ? ',\n' : '') + "".concat(params.join(this.paramDelimiter), "\n") + "".concat(indent, ") -> ").concat(returnType, ":\n");
165
112
  }
166
-
167
113
  declareParameter(indent, method, param) {
168
114
  var type;
169
-
170
115
  if (param.location === _sdkModels.strBody) {
171
116
  type = this.writeableType(param.type, method) || param.type;
172
117
  } else {
173
118
  type = param.type;
174
119
  }
175
-
176
120
  var mapped = this.typeMapMethods(type);
177
121
  var paramType = param.required ? mapped.name : "Optional[".concat(mapped.name, "]");
178
122
  return this.commentHeader(indent, (0, _sdkModels.describeParam)(param)) + "".concat(indent).concat(param.name, ": ").concat(paramType) + (param.required ? '' : " = ".concat(mapped.default));
179
123
  }
180
-
181
124
  makeTheCall(method, inputs) {
182
125
  var origDelim = this.argDelimiter;
183
126
  this.argDelimiter = ",\n".concat(this.indentStr);
184
- inputs = (0, _codeGen.trimInputs)(inputs);
185
127
  var resp = "response = sdk.".concat(method.name, "(");
186
128
  var args = this.assignParams(method, inputs);
187
129
  this.argDelimiter = origDelim;
188
130
  return "".concat(resp).concat(args, ")");
189
131
  }
190
-
191
132
  initArg(indent, property) {
192
133
  var propName = property.name;
193
-
194
134
  if (this.pythonKeywords.has(propName)) {
195
135
  propName = propName + '_';
196
136
  }
197
-
198
137
  return "".concat(indent, "self.").concat(propName, " = ").concat(propName);
199
138
  }
200
-
201
139
  declareType(indent, type) {
202
140
  var decl = super.declareType(indent, type);
203
-
204
141
  if (type instanceof _sdkModels.EnumType) {
205
142
  var invalid = 'invalid_api_enum_value = "invalid_api_enum_value"' + '\n\n\n# https://github.com/python/mypy/issues/2427' + "\n".concat(type.name, ".__new__ = model.safe_enum__new__ # type: ignore");
206
143
  decl += "\n".concat(this.bumper(indent)).concat(invalid);
207
144
  }
208
-
209
145
  return decl;
210
146
  }
211
-
212
147
  typeProperties(type) {
213
148
  return Object.values(type.requiredProperties).concat(Object.values(type.optionalProperties));
214
149
  }
215
-
216
150
  construct(indent, type) {
217
151
  if (type instanceof _sdkModels.EnumType) return '';
218
152
  indent = this.bumper(indent);
@@ -226,100 +160,76 @@ class PythonGen extends _codeGen.CodeGen {
226
160
  inits.push(this.initArg(bump, prop));
227
161
  });
228
162
  var result = '';
229
-
230
163
  if (Object.values(type.properties).some(this.isBareForwardRef)) {
231
164
  result = "\n".concat(indent, "__annotations__ = {\n") + "".concat(annotations.join(',\n')) + "\n".concat(indent, "}");
232
165
  }
233
-
234
166
  result += "\n\n".concat(indent, "def __init__(self, *").concat(this.argDelimiter) + "".concat(args.join(this.argDelimiter), "):\n") + inits.join('\n');
235
167
  return result;
236
168
  }
237
-
238
169
  declareConstructorArg(indent, property) {
239
170
  var mappedType = this.typeMapModels(property.type);
240
171
  var propType;
241
-
242
172
  if (property.required) {
243
173
  propType = mappedType.name;
244
174
  } else {
245
175
  propType = "Optional[".concat(mappedType.name, "] = ").concat(this.nullStr);
246
176
  }
247
-
248
177
  var propName = property.name;
249
-
250
178
  if (this.pythonKeywords.has(propName)) {
251
179
  propName = propName + '_';
252
180
  }
253
-
254
181
  return "".concat(indent).concat(propName, ": ").concat(propType);
255
182
  }
256
-
257
183
  argFill(current, args) {
258
184
  if (!current && args.trim() === this.nullStr) {
259
185
  return '';
260
186
  }
261
-
262
187
  var delimiter = ',\n';
263
-
264
188
  if (!current) {
265
189
  delimiter = '';
266
190
  } else if (args.match(/, {2}#/)) {
267
191
  delimiter = delimiter.replace(',', '');
268
192
  }
269
-
270
193
  return "".concat(args).concat(delimiter).concat(current);
271
194
  }
272
-
273
195
  httpArgs(callerIndent, method) {
274
196
  var currIndent = this.bumper(callerIndent);
275
197
  var args = '';
276
198
  args = this.argFill(args, "".concat(currIndent, "transport_options=transport_options"));
277
-
278
199
  if (method.bodyArg) {
279
200
  args = this.argFill(args, "".concat(currIndent, "body=").concat(method.bodyArg));
280
201
  }
281
-
282
202
  if (method.queryArgs.length) {
283
203
  var queryParams = this.argGroup('', method.queryArgs);
284
204
  args = this.argFill(args, "".concat(currIndent, "query_params=").concat(queryParams));
285
205
  }
286
-
287
206
  var returnType = this.methodReturnType(method);
288
-
289
207
  if (method.responseIsBoth()) {
290
208
  returnType += ', # type: ignore';
291
209
  }
292
-
293
210
  args = this.argFill(args, "".concat(currIndent, "structure=").concat(returnType));
294
211
  var endpoint = "\"".concat(method.endpoint, "\"");
295
-
296
212
  if (/\{\w+\}/.test(endpoint)) {
297
213
  endpoint = "f".concat(endpoint);
298
214
  }
299
-
300
215
  args = this.argFill(args, "".concat(currIndent, "path=").concat(endpoint));
301
216
  return args;
302
217
  }
303
-
304
218
  httpCall(callerIndent, method) {
305
219
  var currIndent = this.bumper(callerIndent);
306
220
  var deprecation = '';
307
-
308
221
  if (method.name === 'login_user') {
309
222
  deprecation = "".concat(callerIndent, "warnings.warn(\"login_user behavior changed significantly ") + "in 21.4.0. See https://git.io/JOtH1\")\n";
310
223
  }
311
-
312
224
  var callOpener = "".concat(callerIndent, "response = cast(\n") + "".concat(currIndent).concat(this.methodReturnType(method), ",\n") + "".concat(currIndent).concat(this.it(method.httpMethod.toLowerCase()), "(\n");
313
225
  var callArgs = "".concat(this.httpArgs(currIndent, method), "\n");
314
226
  var callCloser = "".concat(currIndent, ")\n").concat(callerIndent, ")\n");
315
227
  var returnStmt = "".concat(callerIndent, "return response");
316
228
  return deprecation + callOpener + callArgs + callCloser + returnStmt;
317
229
  }
318
-
319
230
  encodePathParams(indent, method) {
320
231
  var encodings = '';
321
232
  var pathParams = method.pathParams;
322
-
323
233
  if (pathParams.length > 0) {
324
234
  for (var param of pathParams) {
325
235
  if (param.doEncode()) {
@@ -327,15 +237,12 @@ class PythonGen extends _codeGen.CodeGen {
327
237
  }
328
238
  }
329
239
  }
330
-
331
240
  return encodings;
332
241
  }
333
-
334
242
  declareMethod(indent, method) {
335
243
  var bump = this.bumper(indent);
336
244
  return this.methodSignature(indent, method) + this.summary(bump, method.summary) + this.encodePathParams(bump, method) + this.httpCall(bump, method);
337
245
  }
338
-
339
246
  typeSignature(indent, type) {
340
247
  var bump = this.bumper(indent);
341
248
  var b2 = this.bumper(bump);
@@ -343,60 +250,44 @@ class PythonGen extends _codeGen.CodeGen {
343
250
  var isEnum = type instanceof _sdkModels.EnumType;
344
251
  var baseClass = isEnum ? 'enum.Enum' : 'model.Model';
345
252
  var usesReservedPythonKeyword = false;
346
-
347
253
  if (!isEnum) {
348
254
  for (var prop of this.typeProperties(type)) {
349
255
  var propName = prop.name;
350
-
351
256
  if (this.pythonKeywords.has(propName)) {
352
257
  propName = propName + '_';
353
258
  usesReservedPythonKeyword = true;
354
259
  }
355
-
356
260
  var attr = "".concat(b2).concat(propName, ":");
357
-
358
261
  if (prop.description) {
359
262
  attr += " ".concat(prop.description);
360
263
  }
361
-
362
264
  attrs.push(attr);
363
265
  }
364
266
  }
365
-
366
267
  if (usesReservedPythonKeyword) {
367
268
  this.hooks.push("sr.converter".concat(this.apiRef, ".register_structure_hook(\n").concat(bump).concat(type.name, ", # type: ignore\n").concat(bump).concat(this.structureHookTK, " # type:ignore\n)"));
368
269
  }
369
-
370
270
  var result = "\n" + (isEnum ? '' : "".concat(indent, "@attr.s(auto_attribs=True, init=False)\n")) + "".concat(indent, "class ").concat(type.name, "(").concat(baseClass, "):\n") + "".concat(bump, "\"\"\"\n") + (type.description ? "".concat(bump).concat(type.description, "\n\n") : '');
371
-
372
271
  if (attrs.length > 0) {
373
272
  result += "".concat(bump, "Attributes:\n") + "".concat(attrs.join('\n'), "\n");
374
273
  }
375
-
376
274
  return result + "".concat(bump, "\"\"\"\n");
377
275
  }
378
-
379
276
  summary(indent, text) {
380
277
  return text ? "".concat(indent, "\"\"\"").concat(text, "\"\"\"\n") : '';
381
278
  }
382
-
383
279
  prefixModelsNamespace(name, format) {
384
280
  var forwardRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
385
-
386
281
  if (format === 'models') {
387
282
  name = forwardRef ? "\"".concat(name, "\"") : name;
388
283
  } else if (format === 'methods') {
389
284
  name = "mdls.".concat(name);
390
285
  }
391
-
392
286
  return name;
393
287
  }
394
-
395
288
  typeMap(type) {
396
289
  var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'methods';
397
-
398
290
  var asString = (_, v) => "\"".concat(v, "\"");
399
-
400
291
  var pythonTypes = {
401
292
  any: {
402
293
  default: this.nullStr,
@@ -464,62 +355,45 @@ class PythonGen extends _codeGen.CodeGen {
464
355
  }
465
356
  };
466
357
  super.typeMap(type);
467
-
468
358
  if (type.elementType) {
469
359
  var map = this.typeMap(type.elementType, format);
470
360
  var typeName;
471
-
472
361
  var _name;
473
-
474
362
  var defaultValue = this.nullStr;
475
363
  var asVal;
476
-
477
364
  switch (type.className) {
478
365
  case 'ArrayType':
479
366
  typeName = 'Sequence';
480
367
  _name = "".concat(typeName, "[").concat(map.name, "]");
481
368
  break;
482
-
483
369
  case 'HashType':
484
370
  typeName = 'MutableMapping';
485
371
  _name = typeName + '[str, ' + (type.elementType.name === 'string' ? 'Any' : map.name) + ']';
486
372
  break;
487
-
488
373
  case 'DelimArrayType':
489
374
  typeName = this.prefixModelsNamespace('DelimSequence', format);
490
375
  _name = "".concat(typeName, "[").concat(map.name, "]");
491
-
492
376
  asVal = (_, v) => "".concat(typeName, "([").concat(v, "])");
493
-
494
377
  break;
495
-
496
378
  case 'EnumType':
497
379
  _name = typeName = this.prefixModelsNamespace(type.name, format, true);
498
-
499
380
  asVal = (_, v) => "".concat(typeName, ".").concat(v);
500
-
501
381
  break;
502
-
503
382
  default:
504
383
  throw new Error("Don't know how to handle: ".concat(JSON.stringify(type)));
505
384
  }
506
-
507
385
  var mt = {
508
386
  default: defaultValue,
509
387
  name: _name
510
388
  };
511
-
512
389
  if (asVal) {
513
390
  mt.asVal = asVal;
514
391
  }
515
-
516
392
  return mt;
517
393
  }
518
-
519
394
  if (!type.name) {
520
395
  throw new Error('Cannot output a nameless type.');
521
396
  }
522
-
523
397
  var name = this.prefixModelsNamespace(type.name, format, !!type.customType);
524
398
  var result = pythonTypes[type.name];
525
399
  return result || {
@@ -527,16 +401,12 @@ class PythonGen extends _codeGen.CodeGen {
527
401
  name: name
528
402
  };
529
403
  }
530
-
531
404
  typeMapMethods(type) {
532
405
  return this.typeMap(type, 'methods');
533
406
  }
534
-
535
407
  typeMapModels(type) {
536
408
  return this.typeMap(type, 'models');
537
409
  }
538
-
539
410
  }
540
-
541
411
  exports.PythonGen = PythonGen;
542
412
  //# sourceMappingURL=python.gen.js.map