Skip to content

Commit c776168

Browse files
committed
Tweak %delimiter output; fix CI errors
1 parent 8ff2203 commit c776168

File tree

6 files changed

+45
-53
lines changed

6 files changed

+45
-53
lines changed

manual_test_nbs/delimit tests.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"name": "stdout",
101101
"output_type": "stream",
102102
"text": [
103-
"Stata command delimiter: ;\n"
103+
"Current Stata command delimiter: ;\n"
104104
]
105105
}
106106
],

manual_test_nbs/stata_kernel example.ipynb

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@
148148
"cell_type": "code",
149149
"execution_count": 4,
150150
"metadata": {
151-
"collapsed": true,
152151
"jupyter": {
153-
"outputs_hidden": true,
154152
"source_hidden": true
155153
},
156154
"tags": []
@@ -178,7 +176,7 @@
178176
"name": "stdout",
179177
"output_type": "stream",
180178
"text": [
181-
"(highschool and beyond (200 cases))\n"
179+
" (highschool and beyond (200 cases))"
182180
]
183181
},
184182
{
@@ -264,15 +262,7 @@
264262
"cell_type": "code",
265263
"execution_count": 8,
266264
"metadata": {},
267-
"outputs": [
268-
{
269-
"name": "stdout",
270-
"output_type": "stream",
271-
"text": [
272-
"\n"
273-
]
274-
}
275-
],
265+
"outputs": [],
276266
"source": [
277267
"display \"$S\""
278268
]
@@ -437,7 +427,7 @@
437427
{
438428
"data": {
439429
"application/vnd.jupyter.widget-view+json": {
440-
"model_id": "b31927a674394df3b93aad51956aa952",
430+
"model_id": "47aaaecae10f48ccbe6bac04cb13be7d",
441431
"version_major": 2,
442432
"version_minor": 0
443433
},
@@ -797,7 +787,7 @@
797787
"name": "stdout",
798788
"output_type": "stream",
799789
"text": [
800-
"Stata command delimiter: ;\n"
790+
"Current Stata command delimiter: ;\n"
801791
]
802792
}
803793
],
@@ -830,7 +820,7 @@
830820
"name": "stdout",
831821
"output_type": "stream",
832822
"text": [
833-
"Stata command delimiter: cr\n"
823+
"Current Stata command delimiter: cr\n"
834824
]
835825
}
836826
],

nbs/02_stata.ipynb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
{
8080
"cell_type": "code",
8181
"execution_count": null,
82-
"id": "7a4433a6",
82+
"id": "56f636bc",
8383
"metadata": {},
8484
"outputs": [],
8585
"source": [
@@ -90,7 +90,7 @@
9090
},
9191
{
9292
"cell_type": "markdown",
93-
"id": "39a30389",
93+
"id": "f24dac9d",
9494
"metadata": {},
9595
"source": [
9696
"## Simple wrappers"
@@ -162,7 +162,7 @@
162162
{
163163
"cell_type": "code",
164164
"execution_count": null,
165-
"id": "a6db616b",
165+
"id": "3b2c0c93",
166166
"metadata": {},
167167
"outputs": [],
168168
"source": [
@@ -174,7 +174,7 @@
174174
},
175175
{
176176
"cell_type": "markdown",
177-
"id": "eceb995b",
177+
"id": "5e6e3219",
178178
"metadata": {},
179179
"source": [
180180
"[https://www.stata.com/python/api17/Scalar.html?highlight=scalar#sfi.Scalar.getValue](https://www.stata.com/python/api17/Scalar.html?highlight=scalar#sfi.Scalar.getValue)"
@@ -225,7 +225,7 @@
225225
{
226226
"cell_type": "code",
227227
"execution_count": null,
228-
"id": "a3867502",
228+
"id": "88740d45",
229229
"metadata": {},
230230
"outputs": [],
231231
"source": [
@@ -390,7 +390,7 @@
390390
},
391391
{
392392
"cell_type": "markdown",
393-
"id": "e31c7524",
393+
"id": "08449ea8",
394394
"metadata": {},
395395
"source": [
396396
"## Running arbitrary Stata code"
@@ -420,7 +420,7 @@
420420
{
421421
"cell_type": "code",
422422
"execution_count": null,
423-
"id": "405879dd",
423+
"id": "e4a17042",
424424
"metadata": {},
425425
"outputs": [
426426
{
@@ -447,7 +447,7 @@
447447
},
448448
{
449449
"cell_type": "markdown",
450-
"id": "1048c596",
450+
"id": "bef9908c",
451451
"metadata": {},
452452
"source": [
453453
"#| hide\n",
@@ -457,7 +457,7 @@
457457
{
458458
"cell_type": "code",
459459
"execution_count": null,
460-
"id": "c2040883",
460+
"id": "f7dd200c",
461461
"metadata": {},
462462
"outputs": [
463463
{
@@ -483,7 +483,7 @@
483483
{
484484
"cell_type": "code",
485485
"execution_count": null,
486-
"id": "7bd2a424",
486+
"id": "7e5c7ae4",
487487
"metadata": {},
488488
"outputs": [
489489
{
@@ -592,7 +592,7 @@
592592
{
593593
"cell_type": "code",
594594
"execution_count": null,
595-
"id": "3226d719",
595+
"id": "586a6f43",
596596
"metadata": {},
597597
"outputs": [],
598598
"source": [
@@ -611,13 +611,14 @@
611611
"output_type": "stream",
612612
"text": [
613613
"0\n",
614-
"Elapsed time: 0.0001 seconds\n",
614+
"Elapsed time: 0.0002 seconds\n",
615615
"0\n",
616-
"Elapsed time: 0.0542 seconds\n"
616+
"Elapsed time: 0.0508 seconds\n"
617617
]
618618
}
619619
],
620620
"source": [
621+
"#| eval: False\n",
621622
"with Timer():\n",
622623
" sfi.SFIToolkit.stata(\"disp 0\")\n",
623624
"with Timer():\n",

nbs/03_stata_more.ipynb

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@
7474
{
7575
"cell_type": "code",
7676
"execution_count": null,
77-
"id": "b334caf2",
77+
"id": "fc8944c8",
7878
"metadata": {},
7979
"outputs": [],
8080
"source": [
8181
"#| hide\n",
82+
"#| eval: false\n",
8283
"launch_stata(splash=False)"
8384
]
8485
},
@@ -131,7 +132,7 @@
131132
},
132133
{
133134
"cell_type": "markdown",
134-
"id": "3f8d9b03",
135+
"id": "517eb526",
135136
"metadata": {},
136137
"source": [
137138
"When given multi-line Stata code, `run_direct` outputs an extra blank line at the start and two extra lines at the end:"
@@ -140,7 +141,7 @@
140141
{
141142
"cell_type": "code",
142143
"execution_count": null,
143-
"id": "c6c4ea9d",
144+
"id": "77268cd8",
144145
"metadata": {},
145146
"outputs": [
146147
{
@@ -161,7 +162,7 @@
161162
{
162163
"cell_type": "code",
163164
"execution_count": null,
164-
"id": "155d2ca1",
165+
"id": "d1a2c35b",
165166
"metadata": {},
166167
"outputs": [
167168
{
@@ -188,7 +189,7 @@
188189
},
189190
{
190191
"cell_type": "markdown",
191-
"id": "38bb82ed",
192+
"id": "23f3c302",
192193
"metadata": {},
193194
"source": [
194195
"We can clean it up like this:"
@@ -197,7 +198,7 @@
197198
{
198199
"cell_type": "code",
199200
"execution_count": null,
200-
"id": "b4c4e593",
201+
"id": "7f87219b",
201202
"metadata": {},
202203
"outputs": [
203204
{
@@ -225,7 +226,7 @@
225226
{
226227
"cell_type": "code",
227228
"execution_count": null,
228-
"id": "d804ecbc",
229+
"id": "e2260b0f",
229230
"metadata": {},
230231
"outputs": [
231232
{
@@ -250,7 +251,7 @@
250251
{
251252
"cell_type": "code",
252253
"execution_count": null,
253-
"id": "d781c72d",
254+
"id": "4ad19471",
254255
"metadata": {},
255256
"outputs": [
256257
{
@@ -276,7 +277,7 @@
276277
{
277278
"cell_type": "code",
278279
"execution_count": null,
279-
"id": "02ce82dd",
280+
"id": "ae387622",
280281
"metadata": {},
281282
"outputs": [
282283
{
@@ -299,7 +300,7 @@
299300
{
300301
"cell_type": "code",
301302
"execution_count": null,
302-
"id": "bda8ab3c",
303+
"id": "7b375dbe",
303304
"metadata": {},
304305
"outputs": [
305306
{
@@ -327,7 +328,7 @@
327328
},
328329
{
329330
"cell_type": "markdown",
330-
"id": "63341d17",
331+
"id": "3257de50",
331332
"metadata": {},
332333
"source": [
333334
"`run_direct_cleaned` also removes the blank line output by `run_direct` with `quietly=True`"
@@ -384,7 +385,7 @@
384385
},
385386
{
386387
"cell_type": "markdown",
387-
"id": "751c8512",
388+
"id": "66e02d03",
388389
"metadata": {},
389390
"source": [
390391
"#| hide\n",
@@ -418,7 +419,7 @@
418419
},
419420
{
420421
"cell_type": "markdown",
421-
"id": "06251617",
422+
"id": "5824a58d",
422423
"metadata": {},
423424
"source": [
424425
"Note however that `run_direct_cleaned` delays text output until the code finishes running:"
@@ -427,7 +428,7 @@
427428
{
428429
"cell_type": "code",
429430
"execution_count": null,
430-
"id": "b565bd11",
431+
"id": "c8ac57b9",
431432
"metadata": {},
432433
"outputs": [
433434
{
@@ -458,7 +459,7 @@
458459
},
459460
{
460461
"cell_type": "markdown",
461-
"id": "beb13406",
462+
"id": "8dc90cca",
462463
"metadata": {},
463464
"source": [
464465
"`run_direct_cleaned` may also misalign text output relative to graph output:"
@@ -467,7 +468,7 @@
467468
{
468469
"cell_type": "code",
469470
"execution_count": null,
470-
"id": "cd6d40b0",
471+
"id": "1ede5ddb",
471472
"metadata": {},
472473
"outputs": [
473474
{
@@ -797,7 +798,7 @@
797798
"text": [
798799
"var1 __000001\n",
799800
"var1\n",
800-
"Elapsed time: 0.0009 seconds\n"
801+
"Elapsed time: 0.0005 seconds\n"
801802
]
802803
}
803804
],
@@ -1317,8 +1318,8 @@
13171318
"name": "stdout",
13181319
"output_type": "stream",
13191320
"text": [
1320-
"Elapsed time: 0.1911 seconds\n",
1321-
"Elapsed time: 0.0929 seconds\n"
1321+
"Elapsed time: 0.2083 seconds\n",
1322+
"Elapsed time: 0.0912 seconds\n"
13221323
]
13231324
}
13241325
],
@@ -1341,7 +1342,7 @@
13411342
"name": "stdout",
13421343
"output_type": "stream",
13431344
"text": [
1344-
"Elapsed time: 0.2876 seconds\n"
1345+
"Elapsed time: 0.3145 seconds\n"
13451346
]
13461347
}
13471348
],
@@ -1650,8 +1651,8 @@
16501651
"name": "stdout",
16511652
"output_type": "stream",
16521653
"text": [
1653-
"Elapsed time: 0.0012 seconds\n",
1654-
"Elapsed time: 0.2409 seconds\n"
1654+
"Elapsed time: 0.0011 seconds\n",
1655+
"Elapsed time: 0.2424 seconds\n"
16551656
]
16561657
}
16571658
],

nbs/09_magics.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
" \n",
114114
" def magic_delimit(self, code, kernel, cell):\n",
115115
" delim = ';' if kernel.stata_session.sc_delimiter else 'cr'\n",
116-
" print_kernel(f'Stata command delimiter: {delim}', kernel)\n",
116+
" print_kernel(f'Current Stata command delimiter: {delim}', kernel)\n",
117117
" return ''"
118118
]
119119
},

nbstata/magics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def magic_echo(self, code, kernel, cell):
6565

6666
def magic_delimit(self, code, kernel, cell):
6767
delim = ';' if kernel.stata_session.sc_delimiter else 'cr'
68-
print_kernel(f'Stata command delimiter: {delim}', kernel)
68+
print_kernel(f'Current Stata command delimiter: {delim}', kernel)
6969
return ''
7070

7171
# %% ../nbs/09_magics.ipynb 6

0 commit comments

Comments
 (0)