(typeNames: Iterable<string>, comment: string)
| 3084 | actualTypeNames.get(name.toLowerCase()) ?? definitionAliases.get(name.toLowerCase()) ?? name; |
| 3085 | |
| 3086 | const annotatePythonTypes = (typeNames: Iterable<string>, comment: string): void => { |
| 3087 | const annotated = new Set<string>(); |
| 3088 | for (const typeName of typeNames) { |
| 3089 | const actualName = resolveType(typeName); |
| 3090 | if (annotated.has(actualName)) continue; |
| 3091 | let replaced = false; |
| 3092 | typesCode = typesCode.replace( |
| 3093 | new RegExp(`^(@dataclass\\n)?class ${actualName}[:(]`, "m"), |
| 3094 | (match) => { |
| 3095 | replaced = true; |
| 3096 | return `${comment}\n${match}`; |
| 3097 | } |
| 3098 | ); |
| 3099 | if (replaced) { |
| 3100 | annotated.add(actualName); |
| 3101 | } |
| 3102 | } |
| 3103 | }; |
| 3104 | |
| 3105 | annotatePythonTypes(experimentalTypeNames, pyExperimentalComment("type")); |
| 3106 | annotatePythonTypes(deprecatedTypeNames, "# Deprecated: this type is part of a deprecated API and will be removed in a future version."); |
no test coverage detected
searching dependent graphs…