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

Function pushPyRpcMethodDocstring

scripts/codegen/python.ts:775–806  ·  view source on GitHub ↗
(
    lines: string[],
    indent: string,
    method: RpcMethod,
    options: {
        paramsName?: string;
        paramsDescription?: string;
        resultDescription?: string;
        deprecated?: boolean;
        experimental?: boolean;
        internal?: boolean;
    } = {}
)

Source from the content-addressed store, hash-verified

773}
774
775function pushPyRpcMethodDocstring(
776 lines: string[],
777 indent: string,
778 method: RpcMethod,
779 options: {
780 paramsName?: string;
781 paramsDescription?: string;
782 resultDescription?: string;
783 deprecated?: boolean;
784 experimental?: boolean;
785 internal?: boolean;
786 } = {}
787): void {
788 const sections: string[] = [method.description ?? `Calls ${method.rpcMethod}.`];
789 if (options.paramsName && options.paramsDescription) {
790 sections.push(`Args:\n ${options.paramsName}: ${options.paramsDescription}`);
791 }
792 if (options.resultDescription) {
793 sections.push(`Returns:\n ${options.resultDescription}`);
794 }
795 if (options.deprecated) {
796 sections.push(".. deprecated:: This API is deprecated and will be removed in a future version.");
797 }
798 if (options.experimental) {
799 sections.push(".. warning:: This API is experimental and may change or be removed in future versions.");
800 }
801 if (options.internal) {
802 sections.push(":meta private:\n\nInternal SDK API; not part of the public surface.");
803 }
804
805 lines.push(`${indent}${pyDocstringLiteral(sections.join("\n\n"))}`);
806}
807
808function modernizePython(code: string): string {
809 // Replace Optional[X] with X | None (handles arbitrarily nested brackets)

Callers 2

emitMethodFunction · 0.85

Calls 3

pyDocstringLiteralFunction · 0.85
joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…