MCPcopy Index your code
hub / github.com/github/copilot-sdk / annotatePythonTypes

Function annotatePythonTypes

scripts/codegen/python.ts:3086–3103  ·  view source on GitHub ↗
(typeNames: Iterable<string>, comment: string)

Source from the content-addressed store, hash-verified

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.");

Callers 1

generateRpcFunction · 0.85

Calls 2

resolveTypeFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…