MCPcopy Create free account
hub / github.com/SplootCode/splootcode / formatPythonData

Function formatPythonData

packages/language-python/src/nodes/utils.ts:16–32  ·  view source on GitHub ↗
(value: string, type: string)

Source from the content-addressed store, hash-verified

14import { PythonNode } from './python_node'
15
16export function formatPythonData(value: string, type: string): string {
17 switch (type) {
18 case 'str':
19 if (value.length > 30) {
20 return `"${value.substring(0, 27)}..." (str)`
21 }
22 return `"${value}" (str)`
23 case 'bool':
24 case 'NoneType':
25 return value
26 default:
27 if (value.length > 50) {
28 return `(${type})`
29 }
30 return `${value} (${type})`
31 }
32}
33
34export function formatPythonReturnValue(value: ReturnValueAnnotation): string {
35 return `→ ${formatPythonData(value.value, value.type)}`

Callers 2

formatPythonReturnValueFunction · 0.85
formatPythonAssingmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected