ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / test / prompts / newNotebookCell.stest.ts 182 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import assert from 'assert' ;
import { newNotebookCodeCell } from '../../src/extension/intents/node/newNotebookIntent' ;
import { IChatMLFetcher } from '../../src/platform/chat/common/chatMLFetcher' ;
import { IEndpointProvider } from '../../src/platform/endpoint/common/endpointProvider' ;
import { ITestingServicesAccessor } from '../../src/platform/test/node/services' ;
import { INotebookSection } from '../../src/util/common/notebooks' ;
import { CancellationToken } from '../../src/util/vs/base/common/cancellation' ;
import { URI }
IInstantiationService
ssuite stest
fetchConversationOptions
isValidPythonFile
title subtitle location
description language testingServiceCollection
accessor testingServiceCollection
endpoint accessor IEndpointProvider
topic
sections INotebookSection
cells
firstCell accessor IInstantiationService accessor IChatMLFetcher endpoint topic sections CancellationToken None
assert firstCell
assert firstCell
firstCellIsValid accessor firstCell
assert firstCellIsValid
cells firstCell
secondCell accessor IInstantiationService accessor IChatMLFetcher endpoint topic sections cells CancellationToken None
assert secondCell
assert secondCell
description language testingServiceCollection
accessor testingServiceCollection
endpoint accessor IEndpointProvider
topic
sections INotebookSection
title content
title content
title content
title content
cells
firstCell accessor IInstantiationService accessor IChatMLFetcher endpoint topic sections CancellationToken None
assert firstCell
assert firstCell
firstCellIsValid accessor firstCell
assert firstCellIsValid
cells firstCell
i i sections length i
cell accessor IInstantiationService accessor IChatMLFetcher endpoint topic sections i cells CancellationToken None
assert cell
assert cell
cellIsValid accessor cell
assert cellIsValid
cells cell
description language testingServiceCollection
accessor testingServiceCollection
endpoint accessor IEndpointProvider
topic
sections INotebookSection
title content
title content
title content
title content
title content
cells
firstCell accessor IInstantiationService accessor IChatMLFetcher endpoint topic sections CancellationToken None
assert firstCell
assert firstCell
assert firstCell
firstCellIsValid accessor firstCell
assert firstCellIsValid
cells firstCell
i i sections length i
cell accessor IInstantiationService accessor IChatMLFetcher endpoint topic sections i cells CancellationToken None
assert cell
assert cell
assert cell
cellIsValid accessor cell
assert cellIsValid
cells cell
accessor ITestingServicesAccessor pythonCode
escapedPythonCode pythonCode
validateCode
accessor validateCode
from
'../../src/util/vs/base/common/uri'
;
import
{
}
from
'../../src/util/vs/platform/instantiation/common/instantiation'
;
import
{
,
}
from
'../base/stest'
;
import
{
}
from
'../e2e/scenarioTest'
;
import
{
}
from
'../simulation/diagnosticProviders/python'
;
ssuite
(
{
:
'newNotebook'
,
:
'prompt'
,
:
'panel'
}
,
(
)
=>
{
stest
(
{
:
'generate code cell'
,
:
'python'
}
,
async
(
)
=>
{
const
=
.
createTestingAccessor
(
)
;
const
=
await
.
get
(
)
.
getChatEndpoint
(
'copilot-utility'
)
;
const
=
'Creating Random Arrays with Numpy'
;
const
:
[
]
=
[
{
'title'
:
'Import Required Libraries'
,
'content'
:
'Import the necessary libraries, including NumPy.'
}
,
{
'title'
:
'Create Random Arrays'
,
'content'
:
'Use NumPy to create random arrays of various shapes and sizes, including 1D, 2D, and 3D arrays.'
}
,
{
'title'
:
'Seed the Random Number Generator'
,
'content'
:
'Use the seed() function to seed the random number generator for reproducibility.'
}
,
{
'title'
:
'Generate Random Integers'
,
'content'
:
'Use the randint() function to generate random integers within a specified range.'
}
]
;
const
:
string
[
]
=
[
]
;
const
=
await
newNotebookCodeCell
(
.
get
(
)
,
.
get
(
)
,
,
fetchConversationOptions
(
)
,
undefined
,
,
[
0
]
,
''
,
'python'
,
URI
.
file
(
'sample.ipynb'
)
,
.
)
;
.
ok
(
!==
undefined
,
'code should not be empty'
)
;
.
ok
(
.
includes
(
'import numpy as np'
)
,
'code should include import numpy as np'
)
;
const
=
await
validatePythonCode
(
,
!
)
;
.
ok
(
,
'first cell code should be valid python code'
)
;
.
push
(
!
)
;
const
=
await
newNotebookCodeCell
(
.
get
(
)
,
.
get
(
)
,
,
fetchConversationOptions
(
)
,
undefined
,
,
[
1
]
,
.
join
(
'\n'
)
,
'python'
,
URI
.
file
(
'sample.ipynb'
)
,
.
)
;
.
ok
(
!==
undefined
,
'code should not be empty'
)
;
.
ok
(
!
.
includes
(
'import numpy'
)
,
'code should not include import numpy again'
)
;
}
)
;
stest
(
{
:
'Generate code cell (numpy)'
,
:
'python'
}
,
async
(
)
=>
{
const
=
.
createTestingAccessor
(
)
;
const
=
await
.
get
(
)
.
getChatEndpoint
(
'copilot-utility'
)
;
const
=
'A Jupyter notebook that creates a structured array with NumPy.'
;
const
:
[
]
=
[
{
:
'Import Required Libraries'
,
:
'Import the necessary libraries, including NumPy.'
}
,
{
:
'Create Structured Array'
,
:
'Use NumPy to create a structured array with named fields and data types.'
}
,
{
:
'Accessing Structured Array Elements'
,
:
'Access individual elements of the structured array using the field names.'
}
,
{
:
'Iterating over Structured Arrays'
,
:
'Iterate over the structured array using a fo…nd access the field values for each element.'
}
]
;
const
:
string
[
]
=
[
]
;
const
=
await
newNotebookCodeCell
(
.
get
(
)
,
.
get
(
)
,
,
fetchConversationOptions
(
)
,
undefined
,
,
[
0
]
,
''
,
'python'
,
URI
.
file
(
'sample.ipynb'
)
,
.
)
;
.
ok
(
!==
undefined
,
'code should not be empty'
)
;
.
ok
(
.
includes
(
'import numpy as np'
)
,
'code should include import numpy as np'
)
;
const
=
await
validatePythonCode
(
,
!
)
;
.
ok
(
,
'code should be valid python code'
)
;
.
push
(
!
)
;
for
(
let
=
1
;
<
.
;
++
)
{
const
=
await
newNotebookCodeCell
(
.
get
(
)
,
.
get
(
)
,
,
fetchConversationOptions
(
)
,
undefined
,
,
[
]
,
.
join
(
'\n'
)
,
'python'
,
URI
.
file
(
'sample.ipynb'
)
,
.
)
;
.
ok
(
!==
undefined
,
'code should not be empty'
)
;
.
ok
(
!
.
includes
(
'import numpy'
)
,
'code should not include import numpy again'
)
;
const
=
await
validatePythonCode
(
,
!
)
;
.
ok
(
,
'code should be valid python code'
)
;
.
push
(
!
)
;
}
}
)
;
stest
(
{
:
'Generate code cell (seaborn + pandas)'
,
:
'python'
}
,
async
(
)
=>
{
const
=
.
createTestingAccessor
(
)
;
const
=
await
.
get
(
)
.
getChatEndpoint
(
'copilot-utility'
)
;
const
=
'A Jupyter notebook that loads planets data from Seaborn and performs aggregation in Pandas.'
;
const
:
[
]
=
[
{
:
'Import Required Libraries'
,
:
'Import the necessary libraries, including Pandas and Seaborn.'
}
,
{
:
'Load Planets Data'
,
:
'Load the planets data from Seaborn into a Pandas DataFrame.'
}
,
{
:
'Data Cleaning'
,
:
'Clean the data by removing missing values and converting data types if necessary.'
}
,
{
:
'Aggregation with GroupBy'
,
:
'Use the groupby() function to group the data…erform aggregation operations on the groups.'
}
,
{
:
'Aggregation with Pivot Tables'
,
:
'Use the pivot_table() function to create a p… summarizes the data by one or more columns.'
}
,
]
;
const
:
string
[
]
=
[
]
;
const
=
await
newNotebookCodeCell
(
.
get
(
)
,
.
get
(
)
,
,
fetchConversationOptions
(
)
,
undefined
,
,
[
0
]
,
''
,
'python'
,
URI
.
file
(
'sample.ipynb'
)
,
.
)
;
.
ok
(
!==
undefined
,
'code should not be empty'
)
;
.
ok
(
.
includes
(
'import seaborn'
)
,
'code should include import seaborn'
)
;
.
ok
(
.
includes
(
'import pandas'
)
,
'code should include import pandas'
)
;
const
=
await
validatePythonCode
(
,
!
)
;
.
ok
(
,
'code should be valid python code'
)
;
.
push
(
!
)
;
for
(
let
=
1
;
<
.
;
++
)
{
const
=
await
newNotebookCodeCell
(
.
get
(
)
,
.
get
(
)
,
,
fetchConversationOptions
(
)
,
undefined
,
,
[
]
,
.
join
(
'\n'
)
,
'python'
,
URI
.
file
(
'sample.ipynb'
)
,
.
)
;
.
ok
(
!==
undefined
,
'code should not be empty'
)
;
.
ok
(
!
.
includes
(
'import seaborn'
)
,
'code should not include import seaborn again'
)
;
.
ok
(
!
.
includes
(
'import pandas'
)
,
'code should not include import pandas again'
)
;
const
=
await
validatePythonCode
(
,
!
)
;
.
ok
(
,
'code should be valid python code'
)
;
.
push
(
!
)
;
}
}
)
;
}
)
;
async
function
validatePythonCode
(
:
,
:
string
)
:
Promise
<
boolean
>
{
const
=
.
replace
(
/ ` / g
,
'BACKTICK_PLACEHOLDER'
)
;
const
=
`
import codeop
import re
def validate_python_code(code):
# Replace placeholder string with actual backtick
code = code.replace('BACKTICK_PLACEHOLDER', chr(96))
# Split the code into separate statements
statements = re.split(r"\\n(?=\\w)", code)
for statement in statements:
codeop.compile_command(statement)
validate_python_code(""" ${ escapedPythonCode} """)
`
;
return
isValidPythonFile
(
,
)
;
}