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

Function EnvironmentUsage

packages/editor/src/components/config_panel.tsx:30–102  ·  view source on GitHub ↗
(props: {
  startDrag: (fragment: RenderedFragment, offsetX: number, offsetY: number) => any
  envVars: Map<string, [string, boolean]>
})

Source from the content-addressed store, hash-verified

28}
29
30function EnvironmentUsage(props: {
31 startDrag: (fragment: RenderedFragment, offsetX: number, offsetY: number) => any
32 envVars: Map<string, [string, boolean]>
33}) {
34 const { startDrag, envVars } = props
35 const serializedNodes: SerializedNode[] = [
36 {
37 type: 'PYTHON_IMPORT',
38 properties: {},
39 childSets: { modules: [{ type: 'PYTHON_MODULE_IDENTIFIER', properties: { identifier: 'os' }, childSets: {} }] },
40 },
41 ]
42
43 for (const [name] of envVars) {
44 serializedNodes.push({
45 type: 'PYTHON_ASSIGNMENT',
46 properties: {},
47 childSets: {
48 left: [{ type: 'PY_IDENTIFIER', properties: { identifier: name }, childSets: {} }],
49 right: [
50 {
51 type: 'PYTHON_EXPRESSION',
52 properties: {},
53 childSets: {
54 tokens: [
55 {
56 type: 'PYTHON_SUBSCRIPT',
57 properties: {},
58 childSets: {
59 target: [
60 {
61 type: 'PYTHON_MEMBER',
62 properties: {
63 member: 'environ',
64 },
65 childSets: {
66 object: [{ type: 'PY_IDENTIFIER', properties: { identifier: 'os' }, childSets: {} }],
67 },
68 },
69 ],
70 key: [
71 {
72 type: 'PYTHON_EXPRESSION',
73 properties: {},
74 childSets: { tokens: [{ type: 'STRING_LITERAL', properties: { value: name }, childSets: {} }] },
75 },
76 ],
77 },
78 },
79 ],
80 },
81 },
82 ],
83 },
84 })
85 }
86
87 const nodes = serializedNodes.map((node) =>

Callers

nothing calls this directly

Calls 1

deserializeNodeFunction · 0.90

Tested by

no test coverage detected