@looker/sdk-codegen 21.1.1 → 21.3.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,51 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ### [21.3.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.3.0...sdk-codegen-v21.3.1) (2021-12-20)
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @looker/sdk-rtl bumped from ^21.3.0 to ^21.3.1
16
+
17
+ ## [21.3.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.2.1...sdk-codegen-v21.3.0) (2021-12-16)
18
+
19
+
20
+ ### Features
21
+
22
+ * add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @looker/sdk-rtl bumped from ^21.2.0 to ^21.3.0
30
+
31
+ ### [21.2.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.2.0...sdk-codegen-v21.2.1) (2021-12-06)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * enum naming and registration ([#918](https://www.github.com/looker-open-source/sdk-codegen/issues/918)) ([9d4a6cb](https://www.github.com/looker-open-source/sdk-codegen/commit/9d4a6cbfac5defad3a35389e2d46947d2135d349))
37
+
38
+ ## [21.2.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.1.1...sdk-codegen-v21.2.0) (2021-11-10)
39
+
40
+
41
+ ### Features
42
+
43
+ * create @looker/extension-utils ([#886](https://www.github.com/looker-open-source/sdk-codegen/issues/886)) ([9d1720d](https://www.github.com/looker-open-source/sdk-codegen/commit/9d1720d9a4cec00c45195dd9c716d9a2a929264f))
44
+ * Looker 21.20 bindings ([#899](https://www.github.com/looker-open-source/sdk-codegen/issues/899)) ([304d0d0](https://www.github.com/looker-open-source/sdk-codegen/commit/304d0d0688349efad0499d37609605e14df7e97d))
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * The following workspace dependencies were updated
50
+ * dependencies
51
+ * @looker/sdk-rtl bumped from ^21.1.1 to ^21.2.0
52
+
8
53
  ### [21.1.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.1.0...sdk-codegen-v21.1.1) (2021-10-27)
9
54
 
10
55
 
@@ -228,4 +273,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
228
273
 
229
274
  ### Added
230
275
 
231
- - [API spec diff utility](https://github.com/looker-open-source/sdk-codegen/pull/380)
276
+ - [API spec diff utility](https://github.com/looker-open-source/sdk-codegen/pull/380)
@@ -54,7 +54,7 @@ export class PythonGen extends CodeGen {
54
54
 
55
55
  _defineProperty(this, "pythonReservedKeywordClasses", new Set());
56
56
 
57
- _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\nfrom ").concat(this.packagePath, ".rtl import api_methods\nfrom ").concat(this.packagePath, ".rtl import transport\n\nclass ").concat(this.packageName, "(api_methods.APIMethods):\n"));
57
+ _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"));
58
58
 
59
59
  _defineProperty(this, "methodsEpilogue", _indent => this.apiVersion === '3.1' ? "LookerSDK = ".concat(this.packageName) : '');
60
60
 
@@ -382,7 +382,7 @@ export class PythonGen extends CodeGen {
382
382
  if (format === 'models') {
383
383
  name = forwardRef ? "\"".concat(name, "\"") : name;
384
384
  } else if (format === 'methods') {
385
- name = "models.".concat(name);
385
+ name = "mdls.".concat(name);
386
386
  }
387
387
 
388
388
  return name;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/python.gen.ts"],"names":["EnumType","strBody","CodeGen","trimInputs","PythonGen","indentStr","repeat","Set","_indent","warnEditing","packagePath","packageName","apiVersion","structureHookFR","apiRef","structureHookTK","hooks","join","prop","required","type","customType","includes","className","sdkFileName","baseFileName","fileName","argGroup","args","length","nullStr","hash","arg","push","dataStructureDelimiter","beginRegion","indent","description","endRegion","_description","declareProperty","property","annotations","mappedType","typeMapModels","propName","name","pythonKeywords","has","propType","propDef","annotation","isBareForwardRef","bumper","methodReturnType","method","typeMapMethods","returnType","responseIsBoth","responseIsBinary","methodSignature","bump","params","allParams","forEach","p","declareParameter","head","trim","httpMethod","endpoint","commentHeader","paramDelimiter","param","location","writeableType","mapped","paramType","default","makeTheCall","inputs","origDelim","argDelimiter","resp","assignParams","initArg","declareType","decl","invalid","typeProperties","Object","values","requiredProperties","concat","optionalProperties","construct","inits","declareConstructorArg","result","properties","some","argFill","current","delimiter","match","replace","httpArgs","callerIndent","currIndent","bodyArg","queryArgs","queryParams","test","httpCall","deprecation","callOpener","it","toLowerCase","callArgs","callCloser","returnStmt","encodePathParams","encodings","pathParams","doEncode","declareMethod","summary","typeSignature","b2","attrs","isEnum","baseClass","usesReservedPythonKeyword","attr","forwardRef","text","prefixModelsNamespace","format","typeMap","asString","_","v","pythonTypes","any","boolean","byte","datetime","double","float","int32","int64","integer","number","password","asVal","string","uri","void","elementType","map","typeName","defaultValue","Error","JSON","stringify","mt"],"mappings":";;AAkCA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,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amB,QAAb,cAAyBnB,CAAzB,CAAR;;AACA;;AACF;AACE,gBAAM,IAAIqB,KAAJ,qCAAuCC,IAAI,CAACC,SAAL,CAAehJ,IAAf,CAAvC,EAAN;AAxBJ;;AA0BA,UAAMiJ,EAAe,GAAG;AAAEvF,QAAAA,OAAO,EAAEmF,YAAX;AAAyBnH,QAAAA,IAAI,EAAEA;AAA/B,OAAxB;;AACA,UAAI4G,KAAJ,EAAW;AACTW,QAAAA,EAAE,CAACX,KAAH,GAAWA,KAAX;AACD;;AACD,aAAOW,EAAP;AACD;;AACD,QAAI,CAACjJ,IAAI,CAAC0B,IAAV,EAAgB;AACd,YAAM,IAAIoH,KAAJ,CAAU,gCAAV,CAAN;AACD;;AACD,QAAMpH,IAAI,GAAG,KAAK0F,qBAAL,CACXpH,IAAI,CAAC0B,IADM,EAEX2F,MAFW,EAGX,CAAC,CAACrH,IAAI,CAACC,UAHI,CAAb;AAKA,QAAM6E,MAAM,GAAG4C,WAAW,CAAC1H,IAAI,CAAC0B,IAAN,CAA1B;AACA,WAAOoD,MAAM,IAAI;AAAEpB,MAAAA,OAAO,EAAE,KAAKhD,OAAhB;AAAyBgB,MAAAA,IAAI,EAAEA;AAA/B,KAAjB;AACD;;AAEDU,EAAAA,cAAc,CAACpC,IAAD,EAAc;AAC1B,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,SAAnB,CAAP;AACD;;AAEDwB,EAAAA,aAAa,CAACxB,IAAD,EAAc;AACzB,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,QAAnB,CAAP;AACD;;AAjjBoC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type {\n Arg,\n ArgValues,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\nimport type { IMappedType, CodeAssignment } from './codeGen'\nimport { CodeGen, trimInputs } from './codeGen'\n\nexport class PythonGen extends CodeGen {\n codePath = './python/'\n packagePath = 'looker_sdk'\n itself = 'self'\n fileExtension = '.py'\n commentStr = '# '\n nullStr = 'None'\n\n indentStr = ' '\n argDelimiter = `,\\n${this.indentStr.repeat(3)}`\n argSetSep = '='\n paramDelimiter = ',\\n'\n propDelimiter = '\\n'\n dataStructureDelimiter = ', '\n enumDelimiter = '\\n'\n codeQuote = '\"'\n typeOpen = '('\n typeClose = ')'\n hashKeyQuote = '\"'\n useModelClassForTypes = true\n\n endTypeStr = ''\n\n // keyword.kwlist\n pythonKeywords = new Set<string>([\n 'False',\n 'None',\n 'True',\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'nonlocal',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield',\n ])\n\n // cattrs [un]structure hooks for model [de]serialization\n hooks: string[] = []\n structureHookFR = 'forward_ref_structure_hook'\n structureHookTK = 'translate_keys_structure_hook'\n pythonReservedKeywordClasses: Set<string> = new Set()\n\n methodsPrologue = (_indent: string) => `\n# ${this.warnEditing()}\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models\nfrom ${this.packagePath}.rtl import api_methods\nfrom ${this.packagePath}.rtl import transport\n\nclass ${this.packageName}(api_methods.APIMethods):\n`\n\n methodsEpilogue = (_indent: string) =>\n this.apiVersion === '3.1' ? `LookerSDK = ${this.packageName}` : ''\n\n modelsPrologue = (_indent: string) => `\n# ${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 ${this.packagePath}.rtl import model\nfrom ${this.packagePath}.rtl import serialize as sr\n\nEXPLICIT_NULL = model.EXPLICIT_NULL # type: ignore\nDelimSequence = model.DelimSequence\n`\n\n modelsEpilogue = (_indent: string) => `\n\n# The following cattrs structure hook registrations are a workaround\n# for https://github.com/Tinche/cattrs/pull/42 Once this issue is resolved\n# these calls will be removed.\n\nimport functools # noqa:E402\n\n${\n this.structureHookFR\n} = functools.partial(sr.forward_ref_structure_hook, globals(), sr.converter${\n this.apiRef\n })\n${\n this.structureHookTK\n} = functools.partial(sr.translate_keys_structure_hook, sr.converter${\n this.apiRef\n })\n${this.hooks.join('\\n')}\n`\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`sdk/api${this.apiRef}/${baseFileName}`)\n }\n\n argGroup(_indent: string, args: Arg[]) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n hash.push(`\"${arg}\": ${arg}`)\n }\n return `{${hash.join(this.dataStructureDelimiter)}}`\n }\n\n beginRegion(indent: string, description: string): string {\n // Sadly, Black reformats this to \"# region\" and IntelliJ doesn't recognize it either way\n return `${indent}#region ${description}`\n }\n\n endRegion(indent: string, _description: string): string {\n // Sadly, Black reformats this to \"# endregion\" and IntelliJ doesn't recognize it either way\n return `${indent}#endregion`\n }\n\n declareProperty(indent: string, property: IProperty, annotations = false) {\n const mappedType = this.typeMapModels(property.type)\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n let propType = mappedType.name\n if (!property.required) {\n propType = `Optional[${mappedType.name}]`\n }\n\n let propDef\n if (annotations) {\n let annotation = propType\n if (this.isBareForwardRef(property)) {\n annotation = `ForwardRef(${propType})`\n }\n propDef = `${this.bumper(indent)}\"${propName}\": ${annotation}`\n } else {\n if (!property.required) {\n propType += ` = ${this.nullStr}`\n }\n propDef = `${indent}${propName}: ${propType}`\n }\n return propDef\n }\n\n private methodReturnType(method: IMethod) {\n const type = this.typeMapMethods(method.type)\n let returnType = type.name\n if (method.responseIsBoth()) {\n returnType = `Union[${returnType}, bytes]`\n } else if (method.responseIsBinary()) {\n returnType = 'bytes'\n }\n return returnType\n }\n\n // because Python has named default parameters, Request types are not required like\n // they are for TypeScript\n methodSignature(indent: string, method: IMethod) {\n const returnType = this.methodReturnType(method)\n const bump = this.bumper(indent)\n const params: string[] = []\n const args = method.allParams\n if (args && args.length > 0) {\n method.allParams.forEach((p) =>\n params.push(this.declareParameter(bump, method, p))\n )\n }\n let head = method.description?.trim()\n head =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${returnType}`\n params.push(\n `${bump}transport_options: Optional[transport.TransportOptions] = None,`\n )\n return (\n this.commentHeader(indent, head) +\n `${indent}def ${method.name}(\\n` +\n `${bump}self${params.length > 0 ? ',\\n' : ''}` +\n `${params.join(this.paramDelimiter)}\\n` +\n `${indent}) -> ${returnType}:\\n`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n let type: IType\n if (param.location === strBody) {\n type = this.writeableType(param.type, method) || param.type\n } else {\n type = param.type\n }\n const mapped = this.typeMapMethods(type)\n const paramType = param.required ? mapped.name : `Optional[${mapped.name}]`\n return (\n this.commentHeader(indent, param.description) +\n `${indent}${param.name}: ${paramType}` +\n (param.required ? '' : ` = ${mapped.default}`)\n )\n }\n\n makeTheCall(method: IMethod, inputs: ArgValues): string {\n const origDelim = this.argDelimiter\n this.argDelimiter = `,\\n${this.indentStr}`\n inputs = trimInputs(inputs)\n const resp = `response = sdk.${method.name}(`\n const args = this.assignParams(method, inputs)\n this.argDelimiter = origDelim\n return `${resp}${args})`\n }\n\n initArg(indent: string, property: IProperty) {\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}self.${propName} = ${propName}`\n }\n\n declareType(indent: string, type: IType) {\n let decl = super.declareType(indent, type)\n if (type instanceof EnumType) {\n const invalid =\n 'invalid_api_enum_value = \"invalid_api_enum_value\"' +\n '\\n\\n\\n# https://github.com/python/mypy/issues/2427' +\n `\\n${type.name}.__new__ = model.safe_enum__new__ # type: ignore`\n decl += `\\n${this.bumper(indent)}${invalid}`\n }\n return decl\n }\n\n typeProperties(type: IType) {\n return Object.values(type.requiredProperties).concat(\n Object.values(type.optionalProperties)\n )\n }\n\n private isBareForwardRef = (prop: IProperty) => {\n // contains a \"bare\" forward reference e.g. `result_format: \"ResultFormat\"`\n // so we need to emit the `__annotations__` property\n return (\n prop.required &&\n (prop.type.customType || prop.type instanceof EnumType) &&\n !['ArrayType', 'HashType', 'DelimArrayType'].includes(prop.type.className)\n )\n }\n\n /**\n * Ideally we'd rely on @attr.s to generate the constructor for us\n * However, neither Jedi (https://github.com/davidhalter/jedi-vim/issues/816)\n * nor microsoft/python-language-server\n * (https://github.com/microsoft/python-language-server/issues/399)\n * display good tooltips for these auto-generated __init__ methods. So for\n * now we'll generate them ourselves following the functionality of\n * @attr.s(kw_only=True) we'll only allow kw_args.\n */\n construct(indent: string, type: IType) {\n if (type instanceof EnumType) return ''\n indent = this.bumper(indent)\n const bump = this.bumper(indent)\n const annotations: string[] = []\n const args: string[] = []\n const inits: string[] = []\n this.typeProperties(type).forEach((prop) => {\n annotations.push(this.declareProperty(indent, prop, true))\n args.push(this.declareConstructorArg('', prop))\n inits.push(this.initArg(bump, prop))\n })\n let result = ''\n if (Object.values(type.properties).some(this.isBareForwardRef)) {\n result =\n `\\n${indent}__annotations__ = {\\n` +\n `${annotations.join(',\\n')}` +\n `\\n${indent}}`\n }\n result +=\n `\\n\\n${indent}def __init__(self, *${this.argDelimiter}` +\n `${args.join(this.argDelimiter)}):\\n` +\n inits.join('\\n')\n return result\n }\n\n declareConstructorArg(indent: string, property: IProperty) {\n const mappedType = this.typeMapModels(property.type)\n let propType: string\n if (property.required) {\n propType = mappedType.name\n } else {\n propType = `Optional[${mappedType.name}] = ${this.nullStr}`\n }\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}${propName}: ${propType}`\n }\n\n // this is a builder function to produce arguments with optional null place holders but no extra required optional arguments\n argFill(current: string, args: string): string {\n if (!current && args.trim() === this.nullStr) {\n // Don't append trailing optional arguments if none have been set yet\n return ''\n }\n let delimiter = ',\\n'\n if (!current) {\n delimiter = ''\n // Caller manually inserted delimiter followed by inline comment\n } else if (args.match(/, {2}#/)) {\n delimiter = delimiter.replace(',', '')\n }\n return `${args}${delimiter}${current}`\n }\n\n httpArgs(callerIndent: string, method: IMethod): string {\n const currIndent = this.bumper(callerIndent)\n let args = ''\n args = this.argFill(\n args,\n `${currIndent}transport_options=transport_options`\n )\n if (method.bodyArg) {\n args = this.argFill(args, `${currIndent}body=${method.bodyArg}`)\n }\n if (method.queryArgs.length) {\n const queryParams = this.argGroup('', method.queryArgs)\n args = this.argFill(args, `${currIndent}query_params=${queryParams}`)\n }\n let returnType = this.methodReturnType(method)\n if (method.responseIsBoth()) {\n // cattrs needs the python object Union[<rt>, bytes] in order\n // to properly deserialize the response. However, this argument\n // is passed as a value so we get a mypy error that the argument\n // has type \"object\" instead of TStructure. Hence the # type: ignore\n returnType += ', # type: ignore'\n }\n args = this.argFill(args, `${currIndent}structure=${returnType}`)\n let endpoint = `\"${method.endpoint}\"`\n if (/\\{\\w+\\}/.test(endpoint)) {\n // avoid flake8: f-string is missing placeholders\n endpoint = `f${endpoint}`\n }\n args = this.argFill(args, `${currIndent}path=${endpoint}`)\n return args\n }\n\n httpCall(callerIndent: string, method: IMethod): string {\n // callOpener itself is nested inside a cast()\n const currIndent = this.bumper(callerIndent)\n let deprecation = ''\n if (method.name === 'login_user') {\n deprecation =\n `${callerIndent}warnings.warn(\"login_user behavior changed significantly ` +\n `in 21.4.0. See https://git.io/JOtH1\")\\n`\n }\n const callOpener =\n `${callerIndent}response = cast(\\n` +\n `${currIndent}${this.methodReturnType(method)},\\n` +\n `${currIndent}${this.it(method.httpMethod.toLowerCase())}(\\n`\n const callArgs = `${this.httpArgs(currIndent, method)}\\n`\n const callCloser = `${currIndent})\\n${callerIndent})\\n`\n const returnStmt = `${callerIndent}return response`\n return deprecation + callOpener + callArgs + callCloser + returnStmt\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n const pathParams = method.pathParams\n if (pathParams.length > 0) {\n for (const param of pathParams) {\n if (param.doEncode()) {\n encodings += `${indent}${param.name} = self.encode_path_param(${param.name})\\n`\n }\n }\n }\n return encodings\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n\n return (\n this.methodSignature(indent, method) +\n this.summary(bump, method.summary) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method)\n )\n }\n\n typeSignature(indent: string, type: IType) {\n const bump = this.bumper(indent)\n const b2 = this.bumper(bump)\n const attrs: string[] = []\n const isEnum = type instanceof EnumType\n const baseClass = isEnum ? 'enum.Enum' : 'model.Model'\n let usesReservedPythonKeyword = false\n\n if (!isEnum) {\n for (const prop of this.typeProperties(type)) {\n let propName = prop.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n usesReservedPythonKeyword = true\n }\n let attr = `${b2}${propName}:`\n if (prop.description) {\n attr += ` ${prop.description}`\n }\n attrs.push(attr)\n }\n }\n\n const forwardRef = `ForwardRef(\"${type.name}\")`\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${forwardRef}, # type: ignore\\n${bump}${this.structureHookFR} # type:ignore\\n)`\n )\n if (usesReservedPythonKeyword) {\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${type.name}, # type: ignore\\n${bump}${this.structureHookTK} # type:ignore\\n)`\n )\n }\n\n let result =\n `\\n` +\n (isEnum ? '' : `${indent}@attr.s(auto_attribs=True, init=False)\\n`) +\n `${indent}class ${type.name}(${baseClass}):\\n` +\n `${bump}\"\"\"\\n` +\n (type.description ? `${bump}${type.description}\\n\\n` : '')\n\n if (attrs.length > 0) {\n result += `${bump}Attributes:\\n` + `${attrs.join('\\n')}\\n`\n }\n\n return result + `${bump}\"\"\"\\n`\n }\n\n summary(indent: string, text: string | undefined) {\n return text ? `${indent}\"\"\"${text}\"\"\"\\n` : ''\n }\n\n // when format is \"methods\" that means we're in the methods.py module\n // and we need to reference the type by the `models.` package name\n prefixModelsNamespace(\n name: string,\n format: 'models' | 'methods',\n forwardRef = false\n ): string {\n if (format === 'models') {\n // need to quote this forwardRef\n name = forwardRef ? `\"${name}\"` : name\n } else if (format === 'methods') {\n name = `models.${name}`\n }\n return name\n }\n\n // hack default format to 'methods' so that argValue() calls the right thing\n typeMap(type: IType, format: 'models' | 'methods' = 'methods'): IMappedType {\n const asString: CodeAssignment = (_, v) => `\"${v}\"`\n const pythonTypes: Record<string, IMappedType> = {\n any: { default: this.nullStr, name: 'Any' },\n boolean: { default: this.nullStr, name: 'bool' },\n byte: { default: this.nullStr, name: 'bytes' },\n datetime: { default: this.nullStr, name: 'datetime.datetime' },\n double: { default: this.nullStr, name: 'float' },\n float: { default: this.nullStr, name: 'float' },\n int32: { default: this.nullStr, name: 'int' },\n int64: { default: this.nullStr, name: 'int' },\n integer: { default: this.nullStr, name: 'int' },\n number: { default: this.nullStr, name: 'float' },\n password: { default: this.nullStr, name: 'str', asVal: asString },\n string: { default: this.nullStr, name: 'str', asVal: asString },\n uri: { default: this.nullStr, name: 'str', asVal: asString },\n void: { default: this.nullStr, name: 'None' },\n }\n\n super.typeMap(type)\n if (type.elementType) {\n const map = this.typeMap(type.elementType, format)\n let typeName: string\n let name: string\n const defaultValue = this.nullStr\n let asVal: CodeAssignment | undefined\n switch (type.className) {\n case 'ArrayType':\n typeName = 'Sequence'\n name = `${typeName}[${map.name}]`\n break\n case 'HashType':\n typeName = 'MutableMapping'\n // TODO fix bad API spec, like MergeQuery vis_config\n name =\n typeName +\n '[str, ' +\n (type.elementType.name === 'string' ? 'Any' : map.name) +\n ']'\n break\n case 'DelimArrayType':\n typeName = this.prefixModelsNamespace('DelimSequence', format)\n name = `${typeName}[${map.name}]`\n asVal = (_, v) => `${typeName}([${v}])`\n break\n case 'EnumType':\n name = typeName = this.prefixModelsNamespace(type.name, format, true)\n asVal = (_, v) => `${typeName}.${v}`\n break\n default:\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n const mt: IMappedType = { default: defaultValue, name: name }\n if (asVal) {\n mt.asVal = asVal\n }\n return mt\n }\n if (!type.name) {\n throw new Error('Cannot output a nameless type.')\n }\n const name = this.prefixModelsNamespace(\n type.name,\n format,\n !!type.customType\n )\n const result = pythonTypes[type.name]\n return result || { default: this.nullStr, name: name }\n }\n\n typeMapMethods(type: IType) {\n return this.typeMap(type, 'methods')\n }\n\n typeMapModels(type: IType) {\n return this.typeMap(type, 'models')\n }\n}\n"],"file":"python.gen.js"}
1
+ {"version":3,"sources":["../../src/python.gen.ts"],"names":["EnumType","strBody","CodeGen","trimInputs","PythonGen","indentStr","repeat","Set","_indent","warnEditing","packagePath","packageName","apiVersion","structureHookFR","apiRef","structureHookTK","hooks","join","prop","required","type","customType","includes","className","sdkFileName","baseFileName","fileName","argGroup","args","length","nullStr","hash","arg","push","dataStructureDelimiter","beginRegion","indent","description","endRegion","_description","declareProperty","property","annotations","mappedType","typeMapModels","propName","name","pythonKeywords","has","propType","propDef","annotation","isBareForwardRef","bumper","methodReturnType","method","typeMapMethods","returnType","responseIsBoth","responseIsBinary","methodSignature","bump","params","allParams","forEach","p","declareParameter","head","trim","httpMethod","endpoint","commentHeader","paramDelimiter","param","location","writeableType","mapped","paramType","default","makeTheCall","inputs","origDelim","argDelimiter","resp","assignParams","initArg","declareType","decl","invalid","typeProperties","Object","values","requiredProperties","concat","optionalProperties","construct","inits","declareConstructorArg","result","properties","some","argFill","current","delimiter","match","replace","httpArgs","callerIndent","currIndent","bodyArg","queryArgs","queryParams","test","httpCall","deprecation","callOpener","it","toLowerCase","callArgs","callCloser","returnStmt","encodePathParams","encodings","pathParams","doEncode","declareMethod","summary","typeSignature","b2","attrs","isEnum","baseClass","usesReservedPythonKeyword","attr","forwardRef","text","prefixModelsNamespace","format","typeMap","asString","_","v","pythonTypes","any","boolean","byte","datetime","double","float","int32","int64","integer","number","password","asVal","string","uri","void","elementType","map","typeName","defaultValue","Error","JSON","stringify","mt"],"mappings":";;AAkCA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,aAAlC;AAEA,SAASC,OAAT,EAAkBC,UAAlB,QAAoC,WAApC;AAEA,OAAO,MAAMC,SAAN,SAAwBF,OAAxB,CAAgC;AAAA;AAAA;;AAAA,sCAC1B,WAD0B;;AAAA,yCAEvB,YAFuB;;AAAA,oCAG5B,MAH4B;;AAAA,2CAIrB,KAJqB;;AAAA,wCAKxB,IALwB;;AAAA,qCAM3B,MAN2B;;AAAA,uCAQzB,MARyB;;AAAA,uDAShB,KAAKG,SAAL,CAAeC,MAAf,CAAsB,CAAtB,CATgB;;AAAA,uCAUzB,GAVyB;;AAAA,4CAWpB,KAXoB;;AAAA,2CAYrB,IAZqB;;AAAA,oDAaZ,IAbY;;AAAA,2CAcrB,IAdqB;;AAAA,uCAezB,GAfyB;;AAAA,sCAgB1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BAAL,CACXpH,IAAI,CAAC0B,IADM,EAEX2F,MAFW,EAGX,CAAC,CAACrH,IAAI,CAACC,UAHI,CAAb;AAKA,QAAM6E,MAAM,GAAG4C,WAAW,CAAC1H,IAAI,CAAC0B,IAAN,CAA1B;AACA,WAAOoD,MAAM,IAAI;AAAEpB,MAAAA,OAAO,EAAE,KAAKhD,OAAhB;AAAyBgB,MAAAA,IAAI,EAAEA;AAA/B,KAAjB;AACD;;AAEDU,EAAAA,cAAc,CAACpC,IAAD,EAAc;AAC1B,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,SAAnB,CAAP;AACD;;AAEDwB,EAAAA,aAAa,CAACxB,IAAD,EAAc;AACzB,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,QAAnB,CAAP;AACD;;AAjjBoC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type {\n Arg,\n ArgValues,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\nimport type { IMappedType, CodeAssignment } from './codeGen'\nimport { CodeGen, trimInputs } from './codeGen'\n\nexport class PythonGen extends CodeGen {\n codePath = './python/'\n packagePath = 'looker_sdk'\n itself = 'self'\n fileExtension = '.py'\n commentStr = '# '\n nullStr = 'None'\n\n indentStr = ' '\n argDelimiter = `,\\n${this.indentStr.repeat(3)}`\n argSetSep = '='\n paramDelimiter = ',\\n'\n propDelimiter = '\\n'\n dataStructureDelimiter = ', '\n enumDelimiter = '\\n'\n codeQuote = '\"'\n typeOpen = '('\n typeClose = ')'\n hashKeyQuote = '\"'\n useModelClassForTypes = true\n\n endTypeStr = ''\n\n // keyword.kwlist\n pythonKeywords = new Set<string>([\n 'False',\n 'None',\n 'True',\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'nonlocal',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield',\n ])\n\n // cattrs [un]structure hooks for model [de]serialization\n hooks: string[] = []\n structureHookFR = 'forward_ref_structure_hook'\n structureHookTK = 'translate_keys_structure_hook'\n pythonReservedKeywordClasses: Set<string> = new Set()\n\n methodsPrologue = (_indent: string) => `\n# ${this.warnEditing()}\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models as mdls\nfrom ${this.packagePath}.rtl import api_methods\nfrom ${this.packagePath}.rtl import transport\n\nclass ${this.packageName}(api_methods.APIMethods):\n`\n\n methodsEpilogue = (_indent: string) =>\n this.apiVersion === '3.1' ? `LookerSDK = ${this.packageName}` : ''\n\n modelsPrologue = (_indent: string) => `\n# ${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 ${this.packagePath}.rtl import model\nfrom ${this.packagePath}.rtl import serialize as sr\n\nEXPLICIT_NULL = model.EXPLICIT_NULL # type: ignore\nDelimSequence = model.DelimSequence\n`\n\n modelsEpilogue = (_indent: string) => `\n\n# The following cattrs structure hook registrations are a workaround\n# for https://github.com/Tinche/cattrs/pull/42 Once this issue is resolved\n# these calls will be removed.\n\nimport functools # noqa:E402\n\n${\n this.structureHookFR\n} = functools.partial(sr.forward_ref_structure_hook, globals(), sr.converter${\n this.apiRef\n })\n${\n this.structureHookTK\n} = functools.partial(sr.translate_keys_structure_hook, sr.converter${\n this.apiRef\n })\n${this.hooks.join('\\n')}\n`\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`sdk/api${this.apiRef}/${baseFileName}`)\n }\n\n argGroup(_indent: string, args: Arg[]) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n hash.push(`\"${arg}\": ${arg}`)\n }\n return `{${hash.join(this.dataStructureDelimiter)}}`\n }\n\n beginRegion(indent: string, description: string): string {\n // Sadly, Black reformats this to \"# region\" and IntelliJ doesn't recognize it either way\n return `${indent}#region ${description}`\n }\n\n endRegion(indent: string, _description: string): string {\n // Sadly, Black reformats this to \"# endregion\" and IntelliJ doesn't recognize it either way\n return `${indent}#endregion`\n }\n\n declareProperty(indent: string, property: IProperty, annotations = false) {\n const mappedType = this.typeMapModels(property.type)\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n let propType = mappedType.name\n if (!property.required) {\n propType = `Optional[${mappedType.name}]`\n }\n\n let propDef\n if (annotations) {\n let annotation = propType\n if (this.isBareForwardRef(property)) {\n annotation = `ForwardRef(${propType})`\n }\n propDef = `${this.bumper(indent)}\"${propName}\": ${annotation}`\n } else {\n if (!property.required) {\n propType += ` = ${this.nullStr}`\n }\n propDef = `${indent}${propName}: ${propType}`\n }\n return propDef\n }\n\n private methodReturnType(method: IMethod) {\n const type = this.typeMapMethods(method.type)\n let returnType = type.name\n if (method.responseIsBoth()) {\n returnType = `Union[${returnType}, bytes]`\n } else if (method.responseIsBinary()) {\n returnType = 'bytes'\n }\n return returnType\n }\n\n // because Python has named default parameters, Request types are not required like\n // they are for TypeScript\n methodSignature(indent: string, method: IMethod) {\n const returnType = this.methodReturnType(method)\n const bump = this.bumper(indent)\n const params: string[] = []\n const args = method.allParams\n if (args && args.length > 0) {\n method.allParams.forEach((p) =>\n params.push(this.declareParameter(bump, method, p))\n )\n }\n let head = method.description?.trim()\n head =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${returnType}`\n params.push(\n `${bump}transport_options: Optional[transport.TransportOptions] = None,`\n )\n return (\n this.commentHeader(indent, head) +\n `${indent}def ${method.name}(\\n` +\n `${bump}self${params.length > 0 ? ',\\n' : ''}` +\n `${params.join(this.paramDelimiter)}\\n` +\n `${indent}) -> ${returnType}:\\n`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n let type: IType\n if (param.location === strBody) {\n type = this.writeableType(param.type, method) || param.type\n } else {\n type = param.type\n }\n const mapped = this.typeMapMethods(type)\n const paramType = param.required ? mapped.name : `Optional[${mapped.name}]`\n return (\n this.commentHeader(indent, param.description) +\n `${indent}${param.name}: ${paramType}` +\n (param.required ? '' : ` = ${mapped.default}`)\n )\n }\n\n makeTheCall(method: IMethod, inputs: ArgValues): string {\n const origDelim = this.argDelimiter\n this.argDelimiter = `,\\n${this.indentStr}`\n inputs = trimInputs(inputs)\n const resp = `response = sdk.${method.name}(`\n const args = this.assignParams(method, inputs)\n this.argDelimiter = origDelim\n return `${resp}${args})`\n }\n\n initArg(indent: string, property: IProperty) {\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}self.${propName} = ${propName}`\n }\n\n declareType(indent: string, type: IType) {\n let decl = super.declareType(indent, type)\n if (type instanceof EnumType) {\n const invalid =\n 'invalid_api_enum_value = \"invalid_api_enum_value\"' +\n '\\n\\n\\n# https://github.com/python/mypy/issues/2427' +\n `\\n${type.name}.__new__ = model.safe_enum__new__ # type: ignore`\n decl += `\\n${this.bumper(indent)}${invalid}`\n }\n return decl\n }\n\n typeProperties(type: IType) {\n return Object.values(type.requiredProperties).concat(\n Object.values(type.optionalProperties)\n )\n }\n\n private isBareForwardRef = (prop: IProperty) => {\n // contains a \"bare\" forward reference e.g. `result_format: \"ResultFormat\"`\n // so we need to emit the `__annotations__` property\n return (\n prop.required &&\n (prop.type.customType || prop.type instanceof EnumType) &&\n !['ArrayType', 'HashType', 'DelimArrayType'].includes(prop.type.className)\n )\n }\n\n /**\n * Ideally we'd rely on @attr.s to generate the constructor for us\n * However, neither Jedi (https://github.com/davidhalter/jedi-vim/issues/816)\n * nor microsoft/python-language-server\n * (https://github.com/microsoft/python-language-server/issues/399)\n * display good tooltips for these auto-generated __init__ methods. So for\n * now we'll generate them ourselves following the functionality of\n * @attr.s(kw_only=True) we'll only allow kw_args.\n */\n construct(indent: string, type: IType) {\n if (type instanceof EnumType) return ''\n indent = this.bumper(indent)\n const bump = this.bumper(indent)\n const annotations: string[] = []\n const args: string[] = []\n const inits: string[] = []\n this.typeProperties(type).forEach((prop) => {\n annotations.push(this.declareProperty(indent, prop, true))\n args.push(this.declareConstructorArg('', prop))\n inits.push(this.initArg(bump, prop))\n })\n let result = ''\n if (Object.values(type.properties).some(this.isBareForwardRef)) {\n result =\n `\\n${indent}__annotations__ = {\\n` +\n `${annotations.join(',\\n')}` +\n `\\n${indent}}`\n }\n result +=\n `\\n\\n${indent}def __init__(self, *${this.argDelimiter}` +\n `${args.join(this.argDelimiter)}):\\n` +\n inits.join('\\n')\n return result\n }\n\n declareConstructorArg(indent: string, property: IProperty) {\n const mappedType = this.typeMapModels(property.type)\n let propType: string\n if (property.required) {\n propType = mappedType.name\n } else {\n propType = `Optional[${mappedType.name}] = ${this.nullStr}`\n }\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}${propName}: ${propType}`\n }\n\n // this is a builder function to produce arguments with optional null place holders but no extra required optional arguments\n argFill(current: string, args: string): string {\n if (!current && args.trim() === this.nullStr) {\n // Don't append trailing optional arguments if none have been set yet\n return ''\n }\n let delimiter = ',\\n'\n if (!current) {\n delimiter = ''\n // Caller manually inserted delimiter followed by inline comment\n } else if (args.match(/, {2}#/)) {\n delimiter = delimiter.replace(',', '')\n }\n return `${args}${delimiter}${current}`\n }\n\n httpArgs(callerIndent: string, method: IMethod): string {\n const currIndent = this.bumper(callerIndent)\n let args = ''\n args = this.argFill(\n args,\n `${currIndent}transport_options=transport_options`\n )\n if (method.bodyArg) {\n args = this.argFill(args, `${currIndent}body=${method.bodyArg}`)\n }\n if (method.queryArgs.length) {\n const queryParams = this.argGroup('', method.queryArgs)\n args = this.argFill(args, `${currIndent}query_params=${queryParams}`)\n }\n let returnType = this.methodReturnType(method)\n if (method.responseIsBoth()) {\n // cattrs needs the python object Union[<rt>, bytes] in order\n // to properly deserialize the response. However, this argument\n // is passed as a value so we get a mypy error that the argument\n // has type \"object\" instead of TStructure. Hence the # type: ignore\n returnType += ', # type: ignore'\n }\n args = this.argFill(args, `${currIndent}structure=${returnType}`)\n let endpoint = `\"${method.endpoint}\"`\n if (/\\{\\w+\\}/.test(endpoint)) {\n // avoid flake8: f-string is missing placeholders\n endpoint = `f${endpoint}`\n }\n args = this.argFill(args, `${currIndent}path=${endpoint}`)\n return args\n }\n\n httpCall(callerIndent: string, method: IMethod): string {\n // callOpener itself is nested inside a cast()\n const currIndent = this.bumper(callerIndent)\n let deprecation = ''\n if (method.name === 'login_user') {\n deprecation =\n `${callerIndent}warnings.warn(\"login_user behavior changed significantly ` +\n `in 21.4.0. See https://git.io/JOtH1\")\\n`\n }\n const callOpener =\n `${callerIndent}response = cast(\\n` +\n `${currIndent}${this.methodReturnType(method)},\\n` +\n `${currIndent}${this.it(method.httpMethod.toLowerCase())}(\\n`\n const callArgs = `${this.httpArgs(currIndent, method)}\\n`\n const callCloser = `${currIndent})\\n${callerIndent})\\n`\n const returnStmt = `${callerIndent}return response`\n return deprecation + callOpener + callArgs + callCloser + returnStmt\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n const pathParams = method.pathParams\n if (pathParams.length > 0) {\n for (const param of pathParams) {\n if (param.doEncode()) {\n encodings += `${indent}${param.name} = self.encode_path_param(${param.name})\\n`\n }\n }\n }\n return encodings\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n\n return (\n this.methodSignature(indent, method) +\n this.summary(bump, method.summary) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method)\n )\n }\n\n typeSignature(indent: string, type: IType) {\n const bump = this.bumper(indent)\n const b2 = this.bumper(bump)\n const attrs: string[] = []\n const isEnum = type instanceof EnumType\n const baseClass = isEnum ? 'enum.Enum' : 'model.Model'\n let usesReservedPythonKeyword = false\n\n if (!isEnum) {\n for (const prop of this.typeProperties(type)) {\n let propName = prop.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n usesReservedPythonKeyword = true\n }\n let attr = `${b2}${propName}:`\n if (prop.description) {\n attr += ` ${prop.description}`\n }\n attrs.push(attr)\n }\n }\n\n const forwardRef = `ForwardRef(\"${type.name}\")`\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${forwardRef}, # type: ignore\\n${bump}${this.structureHookFR} # type:ignore\\n)`\n )\n if (usesReservedPythonKeyword) {\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${type.name}, # type: ignore\\n${bump}${this.structureHookTK} # type:ignore\\n)`\n )\n }\n\n let result =\n `\\n` +\n (isEnum ? '' : `${indent}@attr.s(auto_attribs=True, init=False)\\n`) +\n `${indent}class ${type.name}(${baseClass}):\\n` +\n `${bump}\"\"\"\\n` +\n (type.description ? `${bump}${type.description}\\n\\n` : '')\n\n if (attrs.length > 0) {\n result += `${bump}Attributes:\\n` + `${attrs.join('\\n')}\\n`\n }\n\n return result + `${bump}\"\"\"\\n`\n }\n\n summary(indent: string, text: string | undefined) {\n return text ? `${indent}\"\"\"${text}\"\"\"\\n` : ''\n }\n\n // when format is \"methods\" that means we're in the methods.py module\n // and we need to reference the type by the `mdls.` package name\n prefixModelsNamespace(\n name: string,\n format: 'models' | 'methods',\n forwardRef = false\n ): string {\n if (format === 'models') {\n // need to quote this forwardRef\n name = forwardRef ? `\"${name}\"` : name\n } else if (format === 'methods') {\n name = `mdls.${name}`\n }\n return name\n }\n\n // hack default format to 'methods' so that argValue() calls the right thing\n typeMap(type: IType, format: 'models' | 'methods' = 'methods'): IMappedType {\n const asString: CodeAssignment = (_, v) => `\"${v}\"`\n const pythonTypes: Record<string, IMappedType> = {\n any: { default: this.nullStr, name: 'Any' },\n boolean: { default: this.nullStr, name: 'bool' },\n byte: { default: this.nullStr, name: 'bytes' },\n datetime: { default: this.nullStr, name: 'datetime.datetime' },\n double: { default: this.nullStr, name: 'float' },\n float: { default: this.nullStr, name: 'float' },\n int32: { default: this.nullStr, name: 'int' },\n int64: { default: this.nullStr, name: 'int' },\n integer: { default: this.nullStr, name: 'int' },\n number: { default: this.nullStr, name: 'float' },\n password: { default: this.nullStr, name: 'str', asVal: asString },\n string: { default: this.nullStr, name: 'str', asVal: asString },\n uri: { default: this.nullStr, name: 'str', asVal: asString },\n void: { default: this.nullStr, name: 'None' },\n }\n\n super.typeMap(type)\n if (type.elementType) {\n const map = this.typeMap(type.elementType, format)\n let typeName: string\n let name: string\n const defaultValue = this.nullStr\n let asVal: CodeAssignment | undefined\n switch (type.className) {\n case 'ArrayType':\n typeName = 'Sequence'\n name = `${typeName}[${map.name}]`\n break\n case 'HashType':\n typeName = 'MutableMapping'\n // TODO fix bad API spec, like MergeQuery vis_config\n name =\n typeName +\n '[str, ' +\n (type.elementType.name === 'string' ? 'Any' : map.name) +\n ']'\n break\n case 'DelimArrayType':\n typeName = this.prefixModelsNamespace('DelimSequence', format)\n name = `${typeName}[${map.name}]`\n asVal = (_, v) => `${typeName}([${v}])`\n break\n case 'EnumType':\n name = typeName = this.prefixModelsNamespace(type.name, format, true)\n asVal = (_, v) => `${typeName}.${v}`\n break\n default:\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n const mt: IMappedType = { default: defaultValue, name: name }\n if (asVal) {\n mt.asVal = asVal\n }\n return mt\n }\n if (!type.name) {\n throw new Error('Cannot output a nameless type.')\n }\n const name = this.prefixModelsNamespace(\n type.name,\n format,\n !!type.customType\n )\n const result = pythonTypes[type.name]\n return result || { default: this.nullStr, name: name }\n }\n\n typeMapMethods(type: IType) {\n return this.typeMap(type, 'methods')\n }\n\n typeMapModels(type: IType) {\n return this.typeMap(type, 'models')\n }\n}\n"],"file":"python.gen.js"}
@@ -957,7 +957,7 @@ export class Type {
957
957
  load(api) {
958
958
  Object.entries(this.schema.properties || {}).forEach(_ref7 => {
959
959
  var [propName, propSchema] = _ref7;
960
- var propType = api.resolveType(propSchema, undefined, propName);
960
+ var propType = api.resolveType(propSchema, undefined, propName, this.name);
961
961
 
962
962
  if (propType.instanceOf('EnumType')) {
963
963
  api.registerEnum(propType, propName);
@@ -1069,7 +1069,7 @@ export class ArrayType extends Type {
1069
1069
 
1070
1070
  }
1071
1071
  export class EnumType extends Type {
1072
- constructor(elementType, schema, types, typeName, methodName) {
1072
+ constructor(elementType, schema, api, typeName, methodName) {
1073
1073
  super(schema, schema.name);
1074
1074
  this.elementType = elementType;
1075
1075
 
@@ -1086,27 +1086,36 @@ export class EnumType extends Type {
1086
1086
  }
1087
1087
 
1088
1088
  if (methodName) {
1089
- this.description = "Type defined in ".concat(methodName, "\n").concat(this.description);
1089
+ this.description = "".concat(this.description).concat(this.description ? ' ' : '', "(Enum defined in ").concat(methodName, ")");
1090
1090
  }
1091
1091
 
1092
- this.name = this.findName(types, typeName, methodName);
1092
+ this.name = this.findName(api, typeName, methodName);
1093
1093
  }
1094
1094
 
1095
- findName(types, typeName, methodName) {
1095
+ findName(api, typeName, methodName) {
1096
+ var hash = md5(this.asHashString());
1097
+ var enums = api.getEnumList();
1096
1098
  var name = titleCase(this.name || typeName || 'Enum');
1097
1099
 
1098
- if (name in types) {
1100
+ if (name in api.types) {
1101
+ var matched = enums[hash];
1102
+
1103
+ if ((matched === null || matched === void 0 ? void 0 : matched.name) === name) {
1104
+ return name;
1105
+ }
1106
+
1099
1107
  var baseName = methodName ? titleCase("".concat(methodName, "_").concat(name)) : name;
1100
1108
  var newName = baseName;
1101
1109
  var i = 0;
1102
1110
 
1103
- while (newName in types) {
1111
+ while (newName in api.types) {
1104
1112
  newName = "".concat(baseName).concat(++i);
1105
1113
  }
1106
1114
 
1107
1115
  name = newName;
1108
1116
  }
1109
1117
 
1118
+ enums[hash] = this;
1110
1119
  return name;
1111
1120
  }
1112
1121
 
@@ -1442,7 +1451,7 @@ export class ApiModel {
1442
1451
  }
1443
1452
 
1444
1453
  if (this.schemaHasEnums(schema)) {
1445
- var num = new EnumType(resolved, schema, this.types, typeName, methodName);
1454
+ var num = new EnumType(resolved, schema, this, typeName, methodName);
1446
1455
  this.registerEnum(num, methodName);
1447
1456
  var result = new ArrayType(num, schema);
1448
1457
  return result;
@@ -1452,7 +1461,9 @@ export class ApiModel {
1452
1461
  }
1453
1462
 
1454
1463
  if (this.schemaHasEnums(schema)) {
1455
- var _result = new EnumType(this.resolveType(schema.type), schema, this.types, typeName, methodName);
1464
+ var _resolved = this.resolveType(schema.type, style, typeName, methodName);
1465
+
1466
+ var _result = new EnumType(_resolved, schema, this, typeName, methodName);
1456
1467
 
1457
1468
  if (_result) {
1458
1469
  return this.registerEnum(_result, methodName);
@@ -1494,10 +1505,14 @@ export class ApiModel {
1494
1505
 
1495
1506
  registerEnum(type, methodName) {
1496
1507
  if (!(type instanceof EnumType)) return type;
1497
- var hash = md5(type.asHashString());
1498
1508
 
1499
- if (hash in this.enumTypes) {
1500
- return this.enumTypes[hash];
1509
+ if (type.name in this.types) {
1510
+ var hash = md5(type.asHashString());
1511
+ var matched = this.enumTypes[hash];
1512
+
1513
+ if ((matched === null || matched === void 0 ? void 0 : matched.name) === type.name) {
1514
+ return this.enumTypes[hash];
1515
+ }
1501
1516
  }
1502
1517
 
1503
1518
  if (methodName) {
@@ -1510,7 +1525,6 @@ export class ApiModel {
1510
1525
  }
1511
1526
  }
1512
1527
 
1513
- this.enumTypes[hash] = type;
1514
1528
  this.types[type.name] = type;
1515
1529
  return type;
1516
1530
  }
@@ -1532,6 +1546,10 @@ export class ApiModel {
1532
1546
  return result;
1533
1547
  }
1534
1548
 
1549
+ getEnumList() {
1550
+ return this.enumTypes;
1551
+ }
1552
+
1535
1553
  makeWriteableType(hash, type) {
1536
1554
  var writer = new WriteType(this, type);
1537
1555
  this.types[writer.name] = writer;