Show More
@@ -1,3929 +1,3950 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 |
|
|
3 | 3 | |
|
4 | 4 |
|
|
5 | 5 |
|
|
6 | 6 |
|
|
7 | 7 |
|
|
8 | 8 |
|
|
9 | 9 |
|
|
10 | 10 |
|
|
11 | 11 |
|
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 |
|
|
15 | 15 |
|
|
16 | 16 |
|
|
17 | 17 |
|
|
18 | 18 |
|
|
19 | 19 |
|
|
20 | 20 |
|
|
21 | 21 |
|
|
22 | 22 |
|
|
23 | 23 |
|
|
24 | 24 |
|
|
25 | 25 |
|
|
26 | 26 |
|
|
27 | 27 |
|
|
28 | 28 |
|
|
29 | 29 |
|
|
30 | 30 |
|
|
31 | 31 |
|
|
32 | 32 |
|
|
33 | 33 |
|
|
34 | 34 |
|
|
35 | 35 |
|
|
36 | 36 |
|
|
37 | 37 |
|
|
38 | 38 |
|
|
39 | 39 | |
|
40 | from pickleshare import PickleShareDB | |
|
40 | try: | |
|
41 | from pickleshare import PickleShareDB | |
|
42 | except ModuleNotFoundError: | |
|
43 | ||
|
44 | class PickleShareDB: # type: ignore [no-redef] | |
|
45 | def __init__(self, path): | |
|
46 | pass | |
|
47 | ||
|
48 | def get(self, key, default): | |
|
49 | warn( | |
|
50 | f"using {key} requires you to install the `pickleshare` library.", | |
|
51 | stacklevel=2, | |
|
52 | ) | |
|
53 | return default | |
|
54 | ||
|
55 | def __setitem__(self, key, value): | |
|
56 | warn( | |
|
57 | f"using {key} requires you to install the `pickleshare` library.", | |
|
58 | stacklevel=2, | |
|
59 | ) | |
|
60 | ||
|
61 | ||
|
41 | 62 |
|
|
42 | 63 |
|
|
43 | 64 |
|
|
44 | 65 |
|
|
45 | 66 |
|
|
46 | 67 |
|
|
47 | 68 |
|
|
48 | 69 |
|
|
49 | 70 |
|
|
50 | 71 |
|
|
51 | 72 |
|
|
52 | 73 |
|
|
53 | 74 |
|
|
54 | 75 |
|
|
55 | 76 |
|
|
56 | 77 |
|
|
57 | 78 |
|
|
58 | 79 |
|
|
59 | 80 | |
|
60 | 81 |
|
|
61 | 82 |
|
|
62 | 83 |
|
|
63 | 84 |
|
|
64 | 85 |
|
|
65 | 86 |
|
|
66 | 87 |
|
|
67 | 88 |
|
|
68 | 89 |
|
|
69 | 90 |
|
|
70 | 91 |
|
|
71 | 92 |
|
|
72 | 93 |
|
|
73 | 94 |
|
|
74 | 95 |
|
|
75 | 96 |
|
|
76 | 97 |
|
|
77 | 98 |
|
|
78 | 99 |
|
|
79 | 100 |
|
|
80 | 101 |
|
|
81 | 102 |
|
|
82 | 103 |
|
|
83 | 104 |
|
|
84 | 105 |
|
|
85 | 106 |
|
|
86 | 107 |
|
|
87 | 108 |
|
|
88 | 109 |
|
|
89 | 110 |
|
|
90 | 111 |
|
|
91 | 112 |
|
|
92 | 113 |
|
|
93 | 114 |
|
|
94 | 115 |
|
|
95 | 116 | |
|
96 | 117 | |
|
97 | 118 |
|
|
98 | 119 | |
|
99 | 120 |
|
|
100 | 121 |
|
|
101 | 122 | |
|
102 | 123 |
|
|
103 | 124 |
|
|
104 | 125 | |
|
105 | 126 |
|
|
106 | 127 |
|
|
107 | 128 |
|
|
108 | 129 |
|
|
109 | 130 |
|
|
110 | 131 |
|
|
111 | 132 | |
|
112 | 133 |
|
|
113 | 134 |
|
|
114 | 135 |
|
|
115 | 136 | |
|
116 | 137 |
|
|
117 | 138 |
|
|
118 | 139 | |
|
119 | 140 |
|
|
120 | 141 |
|
|
121 | 142 | Warning class for unstable features |
|
122 | 143 | """ |
|
123 | 144 |
|
|
124 | 145 | |
|
125 | 146 |
|
|
126 | 147 | |
|
127 | 148 |
|
|
128 | 149 |
|
|
129 | 150 | |
|
130 | 151 |
|
|
131 | 152 |
|
|
132 | 153 |
|
|
133 | 154 | |
|
134 | 155 |
|
|
135 | 156 |
|
|
136 | 157 |
|
|
137 | 158 |
|
|
138 | 159 |
|
|
139 | 160 |
|
|
140 | 161 |
|
|
141 | 162 |
|
|
142 | 163 |
|
|
143 | 164 | |
|
144 | 165 |
|
|
145 | 166 |
|
|
146 | 167 |
|
|
147 | 168 | |
|
148 | 169 |
|
|
149 | 170 |
|
|
150 | 171 | |
|
151 | 172 |
|
|
152 | 173 |
|
|
153 | 174 |
|
|
154 | 175 | |
|
155 | 176 | |
|
156 | 177 |
|
|
157 | 178 |
|
|
158 | 179 | Variant of "str.isnumeric()" that allow negative values and other ints. |
|
159 | 180 | """ |
|
160 | 181 |
|
|
161 | 182 |
|
|
162 | 183 |
|
|
163 | 184 |
|
|
164 | 185 |
|
|
165 | 186 |
|
|
166 | 187 | |
|
167 | 188 | |
|
168 | 189 |
|
|
169 | 190 |
|
|
170 | 191 |
|
|
171 | 192 | |
|
172 | 193 |
|
|
173 | 194 |
|
|
174 | 195 |
|
|
175 | 196 |
|
|
176 | 197 |
|
|
177 | 198 |
|
|
178 | 199 |
|
|
179 | 200 |
|
|
180 | 201 |
|
|
181 | 202 |
|
|
182 | 203 |
|
|
183 | 204 | |
|
184 | 205 |
|
|
185 | 206 |
|
|
186 | 207 |
|
|
187 | 208 | |
|
188 | 209 | |
|
189 | 210 |
|
|
190 | 211 | |
|
191 | 212 | |
|
192 | 213 |
|
|
193 | 214 |
|
|
194 | 215 | |
|
195 | 216 | This is a Unicode based trait that converts '0'->'' and ``'\\n'->'\n'``. |
|
196 | 217 | """ |
|
197 | 218 | |
|
198 | 219 |
|
|
199 | 220 |
|
|
200 | 221 |
|
|
201 | 222 |
|
|
202 | 223 | |
|
203 | 224 | |
|
204 | 225 |
|
|
205 | 226 |
|
|
206 | 227 |
|
|
207 | 228 | a namespace must be assigned to the module's __dict__.""" |
|
208 | 229 |
|
|
209 | 230 | |
|
210 | 231 | |
|
211 | 232 |
|
|
212 | 233 |
|
|
213 | 234 | |
|
214 | 235 | Stores information about what is going to happen. |
|
215 | 236 | """ |
|
216 | 237 |
|
|
217 | 238 |
|
|
218 | 239 |
|
|
219 | 240 |
|
|
220 | 241 |
|
|
221 | 242 | |
|
222 | 243 |
|
|
223 | 244 |
|
|
224 | 245 |
|
|
225 | 246 |
|
|
226 | 247 |
|
|
227 | 248 |
|
|
228 | 249 | |
|
229 | 250 |
|
|
230 | 251 |
|
|
231 | 252 |
|
|
232 | 253 |
|
|
233 | 254 |
|
|
234 | 255 |
|
|
235 | 256 |
|
|
236 | 257 |
|
|
237 | 258 |
|
|
238 | 259 |
|
|
239 | 260 |
|
|
240 | 261 |
|
|
241 | 262 |
|
|
242 | 263 |
|
|
243 | 264 |
|
|
244 | 265 |
|
|
245 | 266 |
|
|
246 | 267 | |
|
247 | 268 | |
|
248 | 269 |
|
|
249 | 270 |
|
|
250 | 271 | |
|
251 | 272 | Stores information about what took place. |
|
252 | 273 | """ |
|
253 | 274 |
|
|
254 | 275 |
|
|
255 | 276 |
|
|
256 | 277 |
|
|
257 | 278 |
|
|
258 | 279 | |
|
259 | 280 |
|
|
260 | 281 |
|
|
261 | 282 | |
|
262 | 283 |
|
|
263 | 284 |
|
|
264 | 285 |
|
|
265 | 286 | |
|
266 | 287 |
|
|
267 | 288 |
|
|
268 | 289 |
|
|
269 | 290 |
|
|
270 | 291 |
|
|
271 | 292 |
|
|
272 | 293 | |
|
273 | 294 |
|
|
274 | 295 |
|
|
275 | 296 |
|
|
276 | 297 |
|
|
277 | 298 | |
|
278 | 299 |
|
|
279 | 300 |
|
|
280 | 301 |
|
|
281 | 302 |
|
|
282 | 303 |
|
|
283 | 304 |
|
|
284 | 305 |
|
|
285 | 306 |
|
|
286 | 307 | |
|
287 | 308 |
|
|
288 | 309 | |
|
289 | 310 |
|
|
290 | 311 |
|
|
291 | 312 | |
|
292 | 313 |
|
|
293 | 314 | |
|
294 | 315 |
|
|
295 | 316 |
|
|
296 | 317 | A list of ast.NodeTransformer subclass instances, which will be applied |
|
297 | 318 | to user input before code is run. |
|
298 | 319 | """ |
|
299 | 320 |
|
|
300 | 321 | |
|
301 | 322 |
|
|
302 | 323 |
|
|
303 | 324 | Make IPython automatically call any callable object even if you didn't |
|
304 | 325 | type explicit parentheses. For example, 'str 43' becomes 'str(43)' |
|
305 | 326 | automatically. The value can be '0' to disable the feature, '1' for |
|
306 | 327 | 'smart' autocall, where it is not applied if there are no more |
|
307 | 328 | arguments on the line, and '2' for 'full' autocall, where all callable |
|
308 | 329 | objects are automatically called (even if no arguments are present). |
|
309 | 330 | """ |
|
310 | 331 |
|
|
311 | 332 | |
|
312 | 333 |
|
|
313 | 334 |
|
|
314 | 335 | Autoindent IPython code entered interactively. |
|
315 | 336 | """ |
|
316 | 337 |
|
|
317 | 338 | |
|
318 | 339 |
|
|
319 | 340 |
|
|
320 | 341 | Automatically run await statement in the top level repl. |
|
321 | 342 | """ |
|
322 | 343 |
|
|
323 | 344 | |
|
324 | 345 |
|
|
325 | 346 |
|
|
326 | 347 |
|
|
327 | 348 |
|
|
328 | 349 |
|
|
329 | 350 |
|
|
330 | 351 | |
|
331 | 352 |
|
|
332 | 353 |
|
|
333 | 354 |
|
|
334 | 355 |
|
|
335 | 356 | |
|
336 | 357 |
|
|
337 | 358 |
|
|
338 | 359 |
|
|
339 | 360 | |
|
340 | 361 |
|
|
341 | 362 |
|
|
342 | 363 |
|
|
343 | 364 |
|
|
344 | 365 |
|
|
345 | 366 |
|
|
346 | 367 |
|
|
347 | 368 |
|
|
348 | 369 |
|
|
349 | 370 |
|
|
350 | 371 |
|
|
351 | 372 |
|
|
352 | 373 |
|
|
353 | 374 |
|
|
354 | 375 | |
|
355 | 376 |
|
|
356 | 377 |
|
|
357 | 378 | Enable magic commands to be called without the leading %. |
|
358 | 379 | """ |
|
359 | 380 |
|
|
360 | 381 | |
|
361 | 382 |
|
|
362 | 383 |
|
|
363 | 384 |
|
|
364 | 385 |
|
|
365 | 386 |
|
|
366 | 387 |
|
|
367 | 388 | |
|
368 | 389 |
|
|
369 | 390 |
|
|
370 | 391 | Set the size of the output cache. The default is 1000, you can |
|
371 | 392 | change it permanently in your config file. Setting it to 0 completely |
|
372 | 393 | disables the caching system, and the minimum value accepted is 3 (if |
|
373 | 394 | you provide a value less than 3, it is reset to 0 and a warning is |
|
374 | 395 | issued). This limit is defined because otherwise you'll spend more |
|
375 | 396 | time re-flushing a too small cache than working |
|
376 | 397 | """ |
|
377 | 398 |
|
|
378 | 399 |
|
|
379 | 400 |
|
|
380 | 401 | Use colors for displaying information about objects. Because this |
|
381 | 402 | information is passed through a pager (like 'less'), and some pagers |
|
382 | 403 | get confused with color codes, this capability can be turned off. |
|
383 | 404 | """ |
|
384 | 405 |
|
|
385 | 406 |
|
|
386 | 407 |
|
|
387 | 408 |
|
|
388 | 409 |
|
|
389 | 410 |
|
|
390 | 411 |
|
|
391 | 412 |
|
|
392 | 413 |
|
|
393 | 414 |
|
|
394 | 415 |
|
|
395 | 416 |
|
|
396 | 417 |
|
|
397 | 418 |
|
|
398 | 419 |
|
|
399 | 420 |
|
|
400 | 421 | |
|
401 | 422 |
|
|
402 | 423 |
|
|
403 | 424 | Enables rich html representation of docstrings. (This requires the |
|
404 | 425 | docrepr module). |
|
405 | 426 | """).tag(config=True) |
|
406 | 427 | |
|
407 | 428 |
|
|
408 | 429 |
|
|
409 | 430 |
|
|
410 | 431 |
|
|
411 | 432 | |
|
412 | 433 |
|
|
413 | 434 |
|
|
414 | 435 | (Provisional API) enables html representation in mime bundles sent |
|
415 | 436 | to pagers. |
|
416 | 437 | """).tag(config=True) |
|
417 | 438 | |
|
418 | 439 |
|
|
419 | 440 |
|
|
420 | 441 |
|
|
421 | 442 |
|
|
422 | 443 | |
|
423 | 444 |
|
|
424 | 445 | |
|
425 | 446 |
|
|
426 | 447 |
|
|
427 | 448 |
|
|
428 | 449 |
|
|
429 | 450 |
|
|
430 | 451 |
|
|
431 | 452 |
|
|
432 | 453 |
|
|
433 | 454 |
|
|
434 | 455 | |
|
435 | 456 |
|
|
436 | 457 |
|
|
437 | 458 |
|
|
438 | 459 | |
|
439 | 460 |
|
|
440 | 461 |
|
|
441 | 462 |
|
|
442 | 463 | |
|
443 | 464 |
|
|
444 | 465 |
|
|
445 | 466 |
|
|
446 | 467 |
|
|
447 | 468 | |
|
448 | 469 |
|
|
449 | 470 |
|
|
450 | 471 |
|
|
451 | 472 | |
|
452 | 473 | For example, ipykernel ipykernel currently uses |
|
453 | 474 | `shell.input_splitter.check_complete` |
|
454 | 475 | """ |
|
455 | 476 |
|
|
456 | 477 |
|
|
457 | 478 |
|
|
458 | 479 |
|
|
459 | 480 |
|
|
460 | 481 | |
|
461 | 482 |
|
|
462 | 483 |
|
|
463 | 484 | Start logging to the default log file in overwrite mode. |
|
464 | 485 | Use `logappend` to specify a log file to **append** logs to. |
|
465 | 486 | """ |
|
466 | 487 |
|
|
467 | 488 |
|
|
468 | 489 |
|
|
469 | 490 | The name of the logfile to use. |
|
470 | 491 | """ |
|
471 | 492 |
|
|
472 | 493 |
|
|
473 | 494 |
|
|
474 | 495 | Start logging to the given file in append mode. |
|
475 | 496 | Use `logfile` to specify a log file to **overwrite** logs to. |
|
476 | 497 | """ |
|
477 | 498 |
|
|
478 | 499 |
|
|
479 | 500 |
|
|
480 | 501 |
|
|
481 | 502 |
|
|
482 | 503 | Automatically call the pdb debugger after every exception. |
|
483 | 504 | """ |
|
484 | 505 |
|
|
485 | 506 |
|
|
486 | 507 |
|
|
487 | 508 | will be displayed as regular output instead.""" |
|
488 | 509 |
|
|
489 | 510 | |
|
490 | 511 | |
|
491 | 512 |
|
|
492 | 513 |
|
|
493 | 514 |
|
|
494 | 515 | |
|
495 | 516 |
|
|
496 | 517 | |
|
497 | 518 |
|
|
498 | 519 |
|
|
499 | 520 |
|
|
500 | 521 | |
|
501 | 522 |
|
|
502 | 523 |
|
|
503 | 524 | The number of saved history entries to be loaded |
|
504 | 525 | into the history buffer at startup. |
|
505 | 526 | """ |
|
506 | 527 |
|
|
507 | 528 | |
|
508 | 529 |
|
|
509 | 530 |
|
|
510 | 531 |
|
|
511 | 532 |
|
|
512 | 533 | which nodes should be run interactively (displaying output from expressions). |
|
513 | 534 |
|
|
514 | 535 |
|
|
515 | 536 | |
|
516 | 537 |
|
|
517 | 538 |
|
|
518 | 539 |
|
|
519 | 540 |
|
|
520 | 541 | |
|
521 | 542 |
|
|
522 | 543 |
|
|
523 | 544 |
|
|
524 | 545 |
|
|
525 | 546 |
|
|
526 | 547 |
|
|
527 | 548 |
|
|
528 | 549 |
|
|
529 | 550 |
|
|
530 | 551 |
|
|
531 | 552 | |
|
532 | 553 |
|
|
533 | 554 |
|
|
534 | 555 |
|
|
535 | 556 |
|
|
536 | 557 |
|
|
537 | 558 |
|
|
538 | 559 |
|
|
539 | 560 |
|
|
540 | 561 |
|
|
541 | 562 | |
|
542 | 563 |
|
|
543 | 564 |
|
|
544 | 565 |
|
|
545 | 566 |
|
|
546 | 567 |
|
|
547 | 568 |
|
|
548 | 569 | |
|
549 | 570 | |
|
550 | 571 |
|
|
551 | 572 |
|
|
552 | 573 | |
|
553 | 574 |
|
|
554 | 575 |
|
|
555 | 576 | |
|
556 | 577 |
|
|
557 | 578 | |
|
558 | 579 |
|
|
559 | 580 | |
|
560 | 581 |
|
|
561 | 582 |
|
|
562 | 583 |
|
|
563 | 584 |
|
|
564 | 585 |
|
|
565 | 586 |
|
|
566 | 587 |
|
|
567 | 588 |
|
|
568 | 589 |
|
|
569 | 590 |
|
|
570 | 591 | |
|
571 | 592 |
|
|
572 | 593 |
|
|
573 | 594 |
|
|
574 | 595 |
|
|
575 | 596 |
|
|
576 | 597 | |
|
577 | 598 |
|
|
578 | 599 |
|
|
579 | 600 | |
|
580 | 601 |
|
|
581 | 602 |
|
|
582 | 603 |
|
|
583 | 604 |
|
|
584 | 605 |
|
|
585 | 606 |
|
|
586 | 607 |
|
|
587 | 608 |
|
|
588 | 609 |
|
|
589 | 610 |
|
|
590 | 611 | |
|
591 | 612 |
|
|
592 | 613 |
|
|
593 | 614 |
|
|
594 | 615 |
|
|
595 | 616 | |
|
596 | 617 |
|
|
597 | 618 |
|
|
598 | 619 |
|
|
599 | 620 | |
|
600 | 621 |
|
|
601 | 622 |
|
|
602 | 623 |
|
|
603 | 624 |
|
|
604 | 625 |
|
|
605 | 626 |
|
|
606 | 627 |
|
|
607 | 628 | |
|
608 | 629 |
|
|
609 | 630 |
|
|
610 | 631 |
|
|
611 | 632 |
|
|
612 | 633 |
|
|
613 | 634 |
|
|
614 | 635 |
|
|
615 | 636 |
|
|
616 | 637 |
|
|
617 | 638 |
|
|
618 | 639 |
|
|
619 | 640 |
|
|
620 | 641 |
|
|
621 | 642 |
|
|
622 | 643 |
|
|
623 | 644 |
|
|
624 | 645 |
|
|
625 | 646 |
|
|
626 | 647 |
|
|
627 | 648 |
|
|
628 | 649 |
|
|
629 | 650 |
|
|
630 | 651 | |
|
631 | 652 |
|
|
632 | 653 |
|
|
633 | 654 |
|
|
634 | 655 |
|
|
635 | 656 |
|
|
636 | 657 |
|
|
637 | 658 | |
|
638 | 659 |
|
|
639 | 660 |
|
|
640 | 661 |
|
|
641 | 662 | |
|
642 | 663 |
|
|
643 | 664 |
|
|
644 | 665 |
|
|
645 | 666 |
|
|
646 | 667 |
|
|
647 | 668 |
|
|
648 | 669 | |
|
649 | 670 |
|
|
650 | 671 |
|
|
651 | 672 | |
|
652 | 673 | If called with no arguments, it acts as a toggle.""" |
|
653 | 674 |
|
|
654 | 675 |
|
|
655 | 676 |
|
|
656 | 677 |
|
|
657 | 678 | |
|
658 | 679 |
|
|
659 | 680 |
|
|
660 | 681 | |
|
661 | 682 |
|
|
662 | 683 |
|
|
663 | 684 |
|
|
664 | 685 | |
|
665 | 686 |
|
|
666 | 687 |
|
|
667 | 688 |
|
|
668 | 689 |
|
|
669 | 690 | |
|
670 | 691 |
|
|
671 | 692 | |
|
672 | 693 |
|
|
673 | 694 |
|
|
674 | 695 |
|
|
675 | 696 |
|
|
676 | 697 |
|
|
677 | 698 |
|
|
678 | 699 |
|
|
679 | 700 | |
|
680 | 701 |
|
|
681 | 702 |
|
|
682 | 703 | |
|
683 | 704 |
|
|
684 | 705 |
|
|
685 | 706 | |
|
686 | 707 |
|
|
687 | 708 |
|
|
688 | 709 |
|
|
689 | 710 |
|
|
690 | 711 |
|
|
691 | 712 |
|
|
692 | 713 | |
|
693 | 714 |
|
|
694 | 715 |
|
|
695 | 716 |
|
|
696 | 717 |
|
|
697 | 718 | |
|
698 | 719 |
|
|
699 | 720 |
|
|
700 | 721 |
|
|
701 | 722 | |
|
702 | 723 |
|
|
703 | 724 |
|
|
704 | 725 | |
|
705 | 726 |
|
|
706 | 727 |
|
|
707 | 728 | |
|
708 | 729 |
|
|
709 | 730 |
|
|
710 | 731 |
|
|
711 | 732 | |
|
712 | 733 |
|
|
713 | 734 |
|
|
714 | 735 |
|
|
715 | 736 |
|
|
716 | 737 |
|
|
717 | 738 |
|
|
718 | 739 |
|
|
719 | 740 |
|
|
720 | 741 | |
|
721 | 742 | |
|
722 | 743 |
|
|
723 | 744 |
|
|
724 | 745 |
|
|
725 | 746 |
|
|
726 | 747 |
|
|
727 | 748 | |
|
728 | 749 |
|
|
729 | 750 |
|
|
730 | 751 |
|
|
731 | 752 | |
|
732 | 753 |
|
|
733 | 754 |
|
|
734 | 755 |
|
|
735 | 756 | |
|
736 | 757 |
|
|
737 | 758 | |
|
738 | 759 |
|
|
739 | 760 |
|
|
740 | 761 |
|
|
741 | 762 | |
|
742 | 763 |
|
|
743 | 764 |
|
|
744 | 765 | """ |
|
745 | 766 |
|
|
746 | 767 |
|
|
747 | 768 |
|
|
748 | 769 |
|
|
749 | 770 |
|
|
750 | 771 |
|
|
751 | 772 | |
|
752 | 773 | |
|
753 | 774 |
|
|
754 | 775 |
|
|
755 | 776 |
|
|
756 | 777 |
|
|
757 | 778 |
|
|
758 | 779 |
|
|
759 | 780 |
|
|
760 | 781 | |
|
761 | 782 |
|
|
762 | 783 | |
|
763 | 784 |
|
|
764 | 785 |
|
|
765 | 786 |
|
|
766 | 787 |
|
|
767 | 788 |
|
|
768 | 789 |
|
|
769 | 790 |
|
|
770 | 791 |
|
|
771 | 792 |
|
|
772 | 793 | |
|
773 | 794 |
|
|
774 | 795 |
|
|
775 | 796 |
|
|
776 | 797 |
|
|
777 | 798 | |
|
778 | 799 |
|
|
779 | 800 |
|
|
780 | 801 |
|
|
781 | 802 |
|
|
782 | 803 |
|
|
783 | 804 |
|
|
784 | 805 | |
|
785 | 806 |
|
|
786 | 807 |
|
|
787 | 808 |
|
|
788 | 809 | |
|
789 | 810 |
|
|
790 | 811 |
|
|
791 | 812 |
|
|
792 | 813 | |
|
793 | 814 |
|
|
794 | 815 |
|
|
795 | 816 |
|
|
796 | 817 |
|
|
797 | 818 |
|
|
798 | 819 |
|
|
799 | 820 | |
|
800 | 821 |
|
|
801 | 822 |
|
|
802 | 823 |
|
|
803 | 824 |
|
|
804 | 825 |
|
|
805 | 826 |
|
|
806 | 827 |
|
|
807 | 828 |
|
|
808 | 829 |
|
|
809 | 830 |
|
|
810 | 831 |
|
|
811 | 832 | |
|
812 | 833 |
|
|
813 | 834 |
|
|
814 | 835 |
|
|
815 | 836 | |
|
816 | 837 | Examples |
|
817 | 838 | -------- |
|
818 | 839 | In [1]: from IPython.core.interactiveshell import InteractiveShell |
|
819 | 840 | |
|
820 | 841 | In [2]: import sys, pathlib |
|
821 | 842 | |
|
822 | 843 | In [3]: paths = InteractiveShell.get_path_links(pathlib.Path(sys.executable)) |
|
823 | 844 | |
|
824 | 845 | In [4]: len(paths) == len(set(paths)) |
|
825 | 846 | Out[4]: True |
|
826 | 847 | |
|
827 | 848 | In [5]: bool(paths) |
|
828 | 849 | Out[5]: True |
|
829 | 850 | """ |
|
830 | 851 |
|
|
831 | 852 |
|
|
832 | 853 |
|
|
833 | 854 |
|
|
834 | 855 |
|
|
835 | 856 |
|
|
836 | 857 |
|
|
837 | 858 |
|
|
838 | 859 | |
|
839 | 860 |
|
|
840 | 861 |
|
|
841 | 862 | This isn't perfect: it doesn't use the Python interpreter with which the |
|
842 | 863 | virtualenv was built, and it ignores the --no-site-packages option. A |
|
843 | 864 | warning will appear suggesting the user installs IPython in the |
|
844 | 865 | virtualenv, but for many cases, it probably works well enough. |
|
845 | 866 | |
|
846 | 867 | Adapted from code snippets online. |
|
847 | 868 | |
|
848 | 869 | http://blog.ufsoft.org/2009/1/29/ipython-and-virtualenv |
|
849 | 870 | """ |
|
850 | 871 |
|
|
851 | 872 |
|
|
852 | 873 |
|
|
853 | 874 |
|
|
854 | 875 |
|
|
855 | 876 |
|
|
856 | 877 | |
|
857 | 878 |
|
|
858 | 879 |
|
|
859 | 880 | |
|
860 | 881 |
|
|
861 | 882 |
|
|
862 | 883 |
|
|
863 | 884 |
|
|
864 | 885 |
|
|
865 | 886 | |
|
866 | 887 |
|
|
867 | 888 |
|
|
868 | 889 |
|
|
869 | 890 |
|
|
870 | 891 | |
|
871 | 892 |
|
|
872 | 893 |
|
|
873 | 894 |
|
|
874 | 895 | |
|
875 | 896 |
|
|
876 | 897 |
|
|
877 | 898 |
|
|
878 | 899 |
|
|
879 | 900 |
|
|
880 | 901 |
|
|
881 | 902 |
|
|
882 | 903 | |
|
883 | 904 |
|
|
884 | 905 |
|
|
885 | 906 |
|
|
886 | 907 |
|
|
887 | 908 |
|
|
888 | 909 |
|
|
889 | 910 | |
|
890 | 911 |
|
|
891 | 912 |
|
|
892 | 913 |
|
|
893 | 914 |
|
|
894 | 915 |
|
|
895 | 916 |
|
|
896 | 917 |
|
|
897 | 918 |
|
|
898 | 919 |
|
|
899 | 920 | |
|
900 | 921 |
|
|
901 | 922 |
|
|
902 | 923 |
|
|
903 | 924 | |
|
904 | 925 |
|
|
905 | 926 |
|
|
906 | 927 | |
|
907 | 928 | This has to be called after self.user_module is created. |
|
908 | 929 | """ |
|
909 | 930 |
|
|
910 | 931 |
|
|
911 | 932 |
|
|
912 | 933 |
|
|
913 | 934 |
|
|
914 | 935 |
|
|
915 | 936 | |
|
916 | 937 |
|
|
917 | 938 |
|
|
918 | 939 |
|
|
919 | 940 |
|
|
920 | 941 |
|
|
921 | 942 |
|
|
922 | 943 |
|
|
923 | 944 |
|
|
924 | 945 |
|
|
925 | 946 |
|
|
926 | 947 | |
|
927 | 948 |
|
|
928 | 949 |
|
|
929 | 950 |
|
|
930 | 951 | |
|
931 | 952 |
|
|
932 | 953 |
|
|
933 | 954 |
|
|
934 | 955 |
|
|
935 | 956 |
|
|
936 | 957 |
|
|
937 | 958 |
|
|
938 | 959 |
|
|
939 | 960 | |
|
940 | 961 |
|
|
941 | 962 |
|
|
942 | 963 |
|
|
943 | 964 |
|
|
944 | 965 | |
|
945 | 966 |
|
|
946 | 967 |
|
|
947 | 968 |
|
|
948 | 969 | |
|
949 | 970 |
|
|
950 | 971 |
|
|
951 | 972 |
|
|
952 | 973 | |
|
953 | 974 |
|
|
954 | 975 | |
|
955 | 976 |
|
|
956 | 977 |
|
|
957 | 978 |
|
|
958 | 979 |
|
|
959 | 980 |
|
|
960 | 981 |
|
|
961 | 982 | |
|
962 | 983 |
|
|
963 | 984 |
|
|
964 | 985 | |
|
965 | 986 |
|
|
966 | 987 |
|
|
967 | 988 | |
|
968 | 989 | IPython exposes some of its internal API as user-modifiable hooks. By |
|
969 | 990 | adding your function to one of these hooks, you can modify IPython's |
|
970 | 991 | behavior to call at runtime your own routines.""" |
|
971 | 992 | |
|
972 | 993 |
|
|
973 | 994 |
|
|
974 | 995 |
|
|
975 | 996 | |
|
976 | 997 |
|
|
977 | 998 | |
|
978 | 999 |
|
|
979 | 1000 |
|
|
980 | 1001 |
|
|
981 | 1002 |
|
|
982 | 1003 |
|
|
983 | 1004 |
|
|
984 | 1005 |
|
|
985 | 1006 |
|
|
986 | 1007 |
|
|
987 | 1008 |
|
|
988 | 1009 |
|
|
989 | 1010 | |
|
990 | 1011 |
|
|
991 | 1012 |
|
|
992 | 1013 |
|
|
993 | 1014 |
|
|
994 | 1015 | |
|
995 | 1016 |
|
|
996 | 1017 |
|
|
997 | 1018 |
|
|
998 | 1019 |
|
|
999 | 1020 |
|
|
1000 | 1021 |
|
|
1001 | 1022 |
|
|
1002 | 1023 | |
|
1003 | 1024 |
|
|
1004 | 1025 |
|
|
1005 | 1026 | |
|
1006 | 1027 |
|
|
1007 | 1028 |
|
|
1008 | 1029 |
|
|
1009 | 1030 |
|
|
1010 | 1031 |
|
|
1011 | 1032 | |
|
1012 | 1033 |
|
|
1013 | 1034 | |
|
1014 | 1035 |
|
|
1015 | 1036 |
|
|
1016 | 1037 |
|
|
1017 | 1038 | |
|
1018 | 1039 |
|
|
1019 | 1040 |
|
|
1020 | 1041 | |
|
1021 | 1042 |
|
|
1022 | 1043 | |
|
1023 | 1044 |
|
|
1024 | 1045 |
|
|
1025 | 1046 | |
|
1026 | 1047 | Register a function for calling after code execution. |
|
1027 | 1048 | """ |
|
1028 | 1049 |
|
|
1029 | 1050 |
|
|
1030 | 1051 |
|
|
1031 | 1052 |
|
|
1032 | 1053 | |
|
1033 | 1054 |
|
|
1034 | 1055 |
|
|
1035 | 1056 |
|
|
1036 | 1057 |
|
|
1037 | 1058 |
|
|
1038 | 1059 |
|
|
1039 | 1060 | |
|
1040 | 1061 |
|
|
1041 | 1062 |
|
|
1042 | 1063 |
|
|
1043 | 1064 | |
|
1044 | 1065 |
|
|
1045 | 1066 |
|
|
1046 | 1067 | |
|
1047 | 1068 | ``filename`` should be the path of the script which will be run in the |
|
1048 | 1069 | module. Requests with the same filename will get the same module, with |
|
1049 | 1070 | its namespace cleared. |
|
1050 | 1071 | |
|
1051 | 1072 | ``modname`` should be the module name - normally either '__main__' or |
|
1052 | 1073 | the basename of the file without the extension. |
|
1053 | 1074 | |
|
1054 | 1075 | When scripts are executed via %run, we must keep a reference to their |
|
1055 | 1076 | __main__ module around so that Python doesn't |
|
1056 | 1077 | clear it, rendering references to module globals useless. |
|
1057 | 1078 | |
|
1058 | 1079 | This method keeps said reference in a private dict, keyed by the |
|
1059 | 1080 | absolute path of the script. This way, for multiple executions of the |
|
1060 | 1081 | same script we only keep one copy of the namespace (the last one), |
|
1061 | 1082 | thus preventing memory leaks from old references while allowing the |
|
1062 | 1083 | objects from the last execution to be accessible. |
|
1063 | 1084 | """ |
|
1064 | 1085 |
|
|
1065 | 1086 |
|
|
1066 | 1087 |
|
|
1067 | 1088 |
|
|
1068 | 1089 |
|
|
1069 | 1090 |
|
|
1070 | 1091 |
|
|
1071 | 1092 |
|
|
1072 | 1093 |
|
|
1073 | 1094 |
|
|
1074 | 1095 | |
|
1075 | 1096 |
|
|
1076 | 1097 |
|
|
1077 | 1098 |
|
|
1078 | 1099 |
|
|
1079 | 1100 | |
|
1080 | 1101 |
|
|
1081 | 1102 | |
|
1082 | 1103 |
|
|
1083 | 1104 |
|
|
1084 | 1105 | |
|
1085 | 1106 | Mainly for use by utilities like %reset. |
|
1086 | 1107 | |
|
1087 | 1108 | Examples |
|
1088 | 1109 | -------- |
|
1089 | 1110 | In [15]: import IPython |
|
1090 | 1111 | |
|
1091 | 1112 | In [16]: m = _ip.new_main_mod(IPython.__file__, 'IPython') |
|
1092 | 1113 | |
|
1093 | 1114 | In [17]: len(_ip._main_mod_cache) > 0 |
|
1094 | 1115 | Out[17]: True |
|
1095 | 1116 | |
|
1096 | 1117 | In [18]: _ip.clear_main_mod_cache() |
|
1097 | 1118 | |
|
1098 | 1119 | In [19]: len(_ip._main_mod_cache) == 0 |
|
1099 | 1120 | Out[19]: True |
|
1100 | 1121 | """ |
|
1101 | 1122 |
|
|
1102 | 1123 | |
|
1103 | 1124 |
|
|
1104 | 1125 |
|
|
1105 | 1126 |
|
|
1106 | 1127 | |
|
1107 | 1128 |
|
|
1108 | 1129 |
|
|
1109 | 1130 |
|
|
1110 | 1131 |
|
|
1111 | 1132 | |
|
1112 | 1133 |
|
|
1113 | 1134 |
|
|
1114 | 1135 | |
|
1115 | 1136 |
|
|
1116 | 1137 | |
|
1117 | 1138 |
|
|
1118 | 1139 |
|
|
1119 | 1140 | |
|
1120 | 1141 |
|
|
1121 | 1142 |
|
|
1122 | 1143 | |
|
1123 | 1144 |
|
|
1124 | 1145 |
|
|
1125 | 1146 | |
|
1126 | 1147 |
|
|
1127 | 1148 |
|
|
1128 | 1149 | |
|
1129 | 1150 |
|
|
1130 | 1151 |
|
|
1131 | 1152 | |
|
1132 | 1153 | Keywords: |
|
1133 | 1154 | |
|
1134 | 1155 | - force(False): by default, this routine checks the instance call_pdb |
|
1135 | 1156 | flag and does not actually invoke the debugger if the flag is false. |
|
1136 | 1157 | The 'force' option forces the debugger to activate even if the flag |
|
1137 | 1158 | is false. |
|
1138 | 1159 | """ |
|
1139 | 1160 | |
|
1140 | 1161 |
|
|
1141 | 1162 |
|
|
1142 | 1163 | |
|
1143 | 1164 |
|
|
1144 | 1165 |
|
|
1145 | 1166 |
|
|
1146 | 1167 | |
|
1147 | 1168 |
|
|
1148 | 1169 | |
|
1149 | 1170 |
|
|
1150 | 1171 |
|
|
1151 | 1172 |
|
|
1152 | 1173 |
|
|
1153 | 1174 | |
|
1154 | 1175 |
|
|
1155 | 1176 |
|
|
1156 | 1177 |
|
|
1157 | 1178 |
|
|
1158 | 1179 |
|
|
1159 | 1180 |
|
|
1160 | 1181 |
|
|
1161 | 1182 |
|
|
1162 | 1183 | |
|
1163 | 1184 |
|
|
1164 | 1185 |
|
|
1165 | 1186 |
|
|
1166 | 1187 |
|
|
1167 | 1188 | |
|
1168 | 1189 |
|
|
1169 | 1190 |
|
|
1170 | 1191 |
|
|
1171 | 1192 |
|
|
1172 | 1193 |
|
|
1173 | 1194 | |
|
1174 | 1195 |
|
|
1175 | 1196 |
|
|
1176 | 1197 |
|
|
1177 | 1198 |
|
|
1178 | 1199 |
|
|
1179 | 1200 |
|
|
1180 | 1201 | |
|
1181 | 1202 |
|
|
1182 | 1203 |
|
|
1183 | 1204 |
|
|
1184 | 1205 |
|
|
1185 | 1206 |
|
|
1186 | 1207 |
|
|
1187 | 1208 | |
|
1188 | 1209 |
|
|
1189 | 1210 |
|
|
1190 | 1211 |
|
|
1191 | 1212 |
|
|
1192 | 1213 |
|
|
1193 | 1214 |
|
|
1194 | 1215 | |
|
1195 | 1216 |
|
|
1196 | 1217 |
|
|
1197 | 1218 |
|
|
1198 | 1219 | |
|
1199 | 1220 |
|
|
1200 | 1221 |
|
|
1201 | 1222 |
|
|
1202 | 1223 |
|
|
1203 | 1224 |
|
|
1204 | 1225 |
|
|
1205 | 1226 |
|
|
1206 | 1227 |
|
|
1207 | 1228 |
|
|
1208 | 1229 |
|
|
1209 | 1230 |
|
|
1210 | 1231 |
|
|
1211 | 1232 |
|
|
1212 | 1233 |
|
|
1213 | 1234 |
|
|
1214 | 1235 |
|
|
1215 | 1236 |
|
|
1216 | 1237 |
|
|
1217 | 1238 |
|
|
1218 | 1239 |
|
|
1219 | 1240 |
|
|
1220 | 1241 |
|
|
1221 | 1242 | |
|
1222 | 1243 |
|
|
1223 | 1244 |
|
|
1224 | 1245 | |
|
1225 | 1246 |
|
|
1226 | 1247 |
|
|
1227 | 1248 |
|
|
1228 | 1249 |
|
|
1229 | 1250 |
|
|
1230 | 1251 |
|
|
1231 | 1252 | |
|
1232 | 1253 |
|
|
1233 | 1254 |
|
|
1234 | 1255 |
|
|
1235 | 1256 | |
|
1236 | 1257 |
|
|
1237 | 1258 |
|
|
1238 | 1259 | |
|
1239 | 1260 | When IPython is started normally, both parameters are None: a new module |
|
1240 | 1261 | is created automatically, and its __dict__ used as the namespace. |
|
1241 | 1262 | |
|
1242 | 1263 | If only user_module is provided, its __dict__ is used as the namespace. |
|
1243 | 1264 | If only user_ns is provided, a dummy module is created, and user_ns |
|
1244 | 1265 | becomes the global namespace. If both are provided (as they may be |
|
1245 | 1266 | when embedding), user_ns is the local namespace, and user_module |
|
1246 | 1267 | provides the global namespace. |
|
1247 | 1268 | |
|
1248 | 1269 | Parameters |
|
1249 | 1270 | ---------- |
|
1250 | 1271 | user_module : module, optional |
|
1251 | 1272 | The current user module in which IPython is being run. If None, |
|
1252 | 1273 | a clean module will be created. |
|
1253 | 1274 | user_ns : dict, optional |
|
1254 | 1275 | A namespace in which to run interactive commands. |
|
1255 | 1276 | |
|
1256 | 1277 | Returns |
|
1257 | 1278 | ------- |
|
1258 | 1279 | A tuple of user_module and user_ns, each properly initialised. |
|
1259 | 1280 | """ |
|
1260 | 1281 |
|
|
1261 | 1282 |
|
|
1262 | 1283 |
|
|
1263 | 1284 |
|
|
1264 | 1285 | |
|
1265 | 1286 |
|
|
1266 | 1287 |
|
|
1267 | 1288 |
|
|
1268 | 1289 | |
|
1269 | 1290 |
|
|
1270 | 1291 |
|
|
1271 | 1292 |
|
|
1272 | 1293 |
|
|
1273 | 1294 |
|
|
1274 | 1295 | |
|
1275 | 1296 |
|
|
1276 | 1297 |
|
|
1277 | 1298 | |
|
1278 | 1299 |
|
|
1279 | 1300 | |
|
1280 | 1301 |
|
|
1281 | 1302 |
|
|
1282 | 1303 |
|
|
1283 | 1304 |
|
|
1284 | 1305 |
|
|
1285 | 1306 |
|
|
1286 | 1307 |
|
|
1287 | 1308 | |
|
1288 | 1309 |
|
|
1289 | 1310 |
|
|
1290 | 1311 |
|
|
1291 | 1312 |
|
|
1292 | 1313 |
|
|
1293 | 1314 |
|
|
1294 | 1315 |
|
|
1295 | 1316 | |
|
1296 | 1317 |
|
|
1297 | 1318 |
|
|
1298 | 1319 |
|
|
1299 | 1320 | |
|
1300 | 1321 |
|
|
1301 | 1322 |
|
|
1302 | 1323 | |
|
1303 | 1324 | Certain history lists are also initialized here, as they effectively |
|
1304 | 1325 | act as user namespaces. |
|
1305 | 1326 | |
|
1306 | 1327 | Notes |
|
1307 | 1328 | ----- |
|
1308 | 1329 | All data structures here are only filled in, they are NOT reset by this |
|
1309 | 1330 | method. If they were not empty before, data will simply be added to |
|
1310 | 1331 | them. |
|
1311 | 1332 | """ |
|
1312 | 1333 |
|
|
1313 | 1334 |
|
|
1314 | 1335 |
|
|
1315 | 1336 |
|
|
1316 | 1337 |
|
|
1317 | 1338 | |
|
1318 | 1339 |
|
|
1319 | 1340 |
|
|
1320 | 1341 |
|
|
1321 | 1342 |
|
|
1322 | 1343 |
|
|
1323 | 1344 |
|
|
1324 | 1345 |
|
|
1325 | 1346 |
|
|
1326 | 1347 | |
|
1327 | 1348 |
|
|
1328 | 1349 |
|
|
1329 | 1350 |
|
|
1330 | 1351 | |
|
1331 | 1352 |
|
|
1332 | 1353 |
|
|
1333 | 1354 |
|
|
1334 | 1355 |
|
|
1335 | 1356 | |
|
1336 | 1357 |
|
|
1337 | 1358 |
|
|
1338 | 1359 |
|
|
1339 | 1360 |
|
|
1340 | 1361 | |
|
1341 | 1362 |
|
|
1342 | 1363 |
|
|
1343 | 1364 | |
|
1344 | 1365 |
|
|
1345 | 1366 |
|
|
1346 | 1367 |
|
|
1347 | 1368 | |
|
1348 | 1369 |
|
|
1349 | 1370 |
|
|
1350 | 1371 |
|
|
1351 | 1372 | |
|
1352 | 1373 |
|
|
1353 | 1374 |
|
|
1354 | 1375 |
|
|
1355 | 1376 | |
|
1356 | 1377 |
|
|
1357 | 1378 |
|
|
1358 | 1379 | |
|
1359 | 1380 |
|
|
1360 | 1381 |
|
|
1361 | 1382 |
|
|
1362 | 1383 | IPython might store a user-created object. |
|
1363 | 1384 | |
|
1364 | 1385 | Note that this does not include the displayhook, which also caches |
|
1365 | 1386 | objects from the output.""" |
|
1366 | 1387 |
|
|
1367 | 1388 |
|
|
1368 | 1389 | |
|
1369 | 1390 |
|
|
1370 | 1391 |
|
|
1371 | 1392 | user objects. |
|
1372 | 1393 | |
|
1373 | 1394 | If new_session is True, a new history session will be opened. |
|
1374 | 1395 | """ |
|
1375 | 1396 |
|
|
1376 | 1397 |
|
|
1377 | 1398 |
|
|
1378 | 1399 |
|
|
1379 | 1400 |
|
|
1380 | 1401 | |
|
1381 | 1402 |
|
|
1382 | 1403 |
|
|
1383 | 1404 |
|
|
1384 | 1405 | |
|
1385 | 1406 |
|
|
1386 | 1407 |
|
|
1387 | 1408 |
|
|
1388 | 1409 | |
|
1389 | 1410 |
|
|
1390 | 1411 |
|
|
1391 | 1412 |
|
|
1392 | 1413 |
|
|
1393 | 1414 |
|
|
1394 | 1415 |
|
|
1395 | 1416 |
|
|
1396 | 1417 |
|
|
1397 | 1418 |
|
|
1398 | 1419 |
|
|
1399 | 1420 |
|
|
1400 | 1421 |
|
|
1401 | 1422 | |
|
1402 | 1423 |
|
|
1403 | 1424 | |
|
1404 | 1425 |
|
|
1405 | 1426 |
|
|
1406 | 1427 |
|
|
1407 | 1428 |
|
|
1408 | 1429 |
|
|
1409 | 1430 |
|
|
1410 | 1431 |
|
|
1411 | 1432 |
|
|
1412 | 1433 |
|
|
1413 | 1434 |
|
|
1414 | 1435 |
|
|
1415 | 1436 | |
|
1416 | 1437 |
|
|
1417 | 1438 |
|
|
1418 | 1439 |
|
|
1419 | 1440 | |
|
1420 | 1441 |
|
|
1421 | 1442 |
|
|
1422 | 1443 |
|
|
1423 | 1444 |
|
|
1424 | 1445 |
|
|
1425 | 1446 |
|
|
1426 | 1447 |
|
|
1427 | 1448 | |
|
1428 | 1449 |
|
|
1429 | 1450 |
|
|
1430 | 1451 |
|
|
1431 | 1452 | |
|
1432 | 1453 |
|
|
1433 | 1454 |
|
|
1434 | 1455 | far as possible, we're not keeping any hidden references to it. |
|
1435 | 1456 | |
|
1436 | 1457 | Parameters |
|
1437 | 1458 | ---------- |
|
1438 | 1459 | varname : str |
|
1439 | 1460 | The name of the variable to delete. |
|
1440 | 1461 | by_name : bool |
|
1441 | 1462 | If True, delete variables with the given name in each |
|
1442 | 1463 | namespace. If False (default), find the variable in the user |
|
1443 | 1464 | namespace, and delete references to it. |
|
1444 | 1465 | """ |
|
1445 | 1466 |
|
|
1446 | 1467 |
|
|
1447 | 1468 | |
|
1448 | 1469 |
|
|
1449 | 1470 | |
|
1450 | 1471 |
|
|
1451 | 1472 |
|
|
1452 | 1473 |
|
|
1453 | 1474 |
|
|
1454 | 1475 |
|
|
1455 | 1476 |
|
|
1456 | 1477 |
|
|
1457 | 1478 |
|
|
1458 | 1479 |
|
|
1459 | 1480 |
|
|
1460 | 1481 |
|
|
1461 | 1482 |
|
|
1462 | 1483 |
|
|
1463 | 1484 |
|
|
1464 | 1485 |
|
|
1465 | 1486 |
|
|
1466 | 1487 |
|
|
1467 | 1488 | |
|
1468 | 1489 |
|
|
1469 | 1490 |
|
|
1470 | 1491 |
|
|
1471 | 1492 | |
|
1472 | 1493 |
|
|
1473 | 1494 |
|
|
1474 | 1495 |
|
|
1475 | 1496 |
|
|
1476 | 1497 | |
|
1477 | 1498 |
|
|
1478 | 1499 |
|
|
1479 | 1500 | specified regular expression. |
|
1480 | 1501 | |
|
1481 | 1502 | Parameters |
|
1482 | 1503 | ---------- |
|
1483 | 1504 | regex : string or compiled pattern, optional |
|
1484 | 1505 | A regular expression pattern that will be used in searching |
|
1485 | 1506 | variable names in the users namespaces. |
|
1486 | 1507 | """ |
|
1487 | 1508 |
|
|
1488 | 1509 |
|
|
1489 | 1510 |
|
|
1490 | 1511 |
|
|
1491 | 1512 |
|
|
1492 | 1513 |
|
|
1493 | 1514 |
|
|
1494 | 1515 |
|
|
1495 | 1516 |
|
|
1496 | 1517 |
|
|
1497 | 1518 |
|
|
1498 | 1519 | |
|
1499 | 1520 |
|
|
1500 | 1521 |
|
|
1501 | 1522 | |
|
1502 | 1523 | Parameters |
|
1503 | 1524 | ---------- |
|
1504 | 1525 | variables : dict, str or list/tuple of str |
|
1505 | 1526 | The variables to inject into the user's namespace. If a dict, a |
|
1506 | 1527 | simple update is done. If a str, the string is assumed to have |
|
1507 | 1528 | variable names separated by spaces. A list/tuple of str can also |
|
1508 | 1529 | be used to give the variable names. If just the variable names are |
|
1509 | 1530 | give (list/tuple/str) then the variable values looked up in the |
|
1510 | 1531 | callers frame. |
|
1511 | 1532 | interactive : bool |
|
1512 | 1533 | If True (default), the variables will be listed with the ``who`` |
|
1513 | 1534 | magic. |
|
1514 | 1535 | """ |
|
1515 | 1536 |
|
|
1516 | 1537 | |
|
1517 | 1538 |
|
|
1518 | 1539 |
|
|
1519 | 1540 |
|
|
1520 | 1541 |
|
|
1521 | 1542 |
|
|
1522 | 1543 |
|
|
1523 | 1544 |
|
|
1524 | 1545 |
|
|
1525 | 1546 |
|
|
1526 | 1547 |
|
|
1527 | 1548 |
|
|
1528 | 1549 |
|
|
1529 | 1550 |
|
|
1530 | 1551 |
|
|
1531 | 1552 |
|
|
1532 | 1553 |
|
|
1533 | 1554 |
|
|
1534 | 1555 |
|
|
1535 | 1556 | |
|
1536 | 1557 |
|
|
1537 | 1558 |
|
|
1538 | 1559 | |
|
1539 | 1560 |
|
|
1540 | 1561 |
|
|
1541 | 1562 |
|
|
1542 | 1563 |
|
|
1543 | 1564 |
|
|
1544 | 1565 |
|
|
1545 | 1566 |
|
|
1546 | 1567 | |
|
1547 | 1568 |
|
|
1548 | 1569 |
|
|
1549 | 1570 | same as the values in the dictionary. |
|
1550 | 1571 | |
|
1551 | 1572 | This is intended for use by extensions: variables that they've added can |
|
1552 | 1573 | be taken back out if they are unloaded, without removing any that the |
|
1553 | 1574 | user has overwritten. |
|
1554 | 1575 | |
|
1555 | 1576 | Parameters |
|
1556 | 1577 | ---------- |
|
1557 | 1578 | variables : dict |
|
1558 | 1579 | A dictionary mapping object names (as strings) to the objects. |
|
1559 | 1580 | """ |
|
1560 | 1581 |
|
|
1561 | 1582 |
|
|
1562 | 1583 |
|
|
1563 | 1584 |
|
|
1564 | 1585 | |
|
1565 | 1586 |
|
|
1566 | 1587 |
|
|
1567 | 1588 |
|
|
1568 | 1589 |
|
|
1569 | 1590 |
|
|
1570 | 1591 |
|
|
1571 | 1592 | Given an object name, return a list of parts of this object name. |
|
1572 | 1593 | |
|
1573 | 1594 | Basically split on docs when using attribute access, |
|
1574 | 1595 | and extract the value when using square bracket. |
|
1575 | 1596 | |
|
1576 | 1597 | |
|
1577 | 1598 | For example foo.bar[3].baz[x] -> foo, bar, 3, baz, x |
|
1578 | 1599 | |
|
1579 | 1600 | |
|
1580 | 1601 | Returns |
|
1581 | 1602 | ------- |
|
1582 | 1603 | parts_ok: bool |
|
1583 | 1604 | wether we were properly able to parse parts. |
|
1584 | 1605 | parts: list of str |
|
1585 | 1606 | extracted parts |
|
1586 | 1607 | |
|
1587 | 1608 | |
|
1588 | 1609 | |
|
1589 | 1610 | """ |
|
1590 | 1611 |
|
|
1591 | 1612 |
|
|
1592 | 1613 |
|
|
1593 | 1614 |
|
|
1594 | 1615 |
|
|
1595 | 1616 |
|
|
1596 | 1617 |
|
|
1597 | 1618 |
|
|
1598 | 1619 |
|
|
1599 | 1620 |
|
|
1600 | 1621 |
|
|
1601 | 1622 |
|
|
1602 | 1623 |
|
|
1603 | 1624 |
|
|
1604 | 1625 |
|
|
1605 | 1626 |
|
|
1606 | 1627 | |
|
1607 | 1628 |
|
|
1608 | 1629 |
|
|
1609 | 1630 |
|
|
1610 | 1631 | |
|
1611 | 1632 |
|
|
1612 | 1633 | |
|
1613 | 1634 |
|
|
1614 | 1635 |
|
|
1615 | 1636 |
|
|
1616 | 1637 |
|
|
1617 | 1638 | |
|
1618 | 1639 | |
|
1619 | 1640 | Returns |
|
1620 | 1641 | ------- |
|
1621 | 1642 | OInfo with fields: |
|
1622 | 1643 | - ismagic |
|
1623 | 1644 | - isalias |
|
1624 | 1645 | - found |
|
1625 | 1646 | - obj |
|
1626 | 1647 | - namespac |
|
1627 | 1648 | - parent |
|
1628 | 1649 | |
|
1629 | 1650 | Has special code to detect magic functions. |
|
1630 | 1651 | """ |
|
1631 | 1652 |
|
|
1632 | 1653 |
|
|
1633 | 1654 | |
|
1634 | 1655 |
|
|
1635 | 1656 |
|
|
1636 | 1657 |
|
|
1637 | 1658 |
|
|
1638 | 1659 |
|
|
1639 | 1660 |
|
|
1640 | 1661 |
|
|
1641 | 1662 |
|
|
1642 | 1663 |
|
|
1643 | 1664 |
|
|
1644 | 1665 |
|
|
1645 | 1666 |
|
|
1646 | 1667 |
|
|
1647 | 1668 | |
|
1648 | 1669 |
|
|
1649 | 1670 |
|
|
1650 | 1671 |
|
|
1651 | 1672 |
|
|
1652 | 1673 |
|
|
1653 | 1674 |
|
|
1654 | 1675 |
|
|
1655 | 1676 |
|
|
1656 | 1677 | |
|
1657 | 1678 |
|
|
1658 | 1679 |
|
|
1659 | 1680 |
|
|
1660 | 1681 |
|
|
1661 | 1682 |
|
|
1662 | 1683 |
|
|
1663 | 1684 | |
|
1664 | 1685 | |
|
1665 | 1686 |
|
|
1666 | 1687 |
|
|
1667 | 1688 |
|
|
1668 | 1689 |
|
|
1669 | 1690 |
|
|
1670 | 1691 |
|
|
1671 | 1692 |
|
|
1672 | 1693 |
|
|
1673 | 1694 |
|
|
1674 | 1695 |
|
|
1675 | 1696 |
|
|
1676 | 1697 |
|
|
1677 | 1698 |
|
|
1678 | 1699 |
|
|
1679 | 1700 |
|
|
1680 | 1701 |
|
|
1681 | 1702 |
|
|
1682 | 1703 |
|
|
1683 | 1704 |
|
|
1684 | 1705 |
|
|
1685 | 1706 |
|
|
1686 | 1707 |
|
|
1687 | 1708 |
|
|
1688 | 1709 |
|
|
1689 | 1710 |
|
|
1690 | 1711 |
|
|
1691 | 1712 |
|
|
1692 | 1713 |
|
|
1693 | 1714 |
|
|
1694 | 1715 |
|
|
1695 | 1716 |
|
|
1696 | 1717 |
|
|
1697 | 1718 |
|
|
1698 | 1719 |
|
|
1699 | 1720 | |
|
1700 | 1721 |
|
|
1701 | 1722 |
|
|
1702 | 1723 |
|
|
1703 | 1724 |
|
|
1704 | 1725 |
|
|
1705 | 1726 |
|
|
1706 | 1727 |
|
|
1707 | 1728 |
|
|
1708 | 1729 |
|
|
1709 | 1730 |
|
|
1710 | 1731 |
|
|
1711 | 1732 |
|
|
1712 | 1733 |
|
|
1713 | 1734 |
|
|
1714 | 1735 |
|
|
1715 | 1736 |
|
|
1716 | 1737 |
|
|
1717 | 1738 |
|
|
1718 | 1739 |
|
|
1719 | 1740 | |
|
1720 | 1741 |
|
|
1721 | 1742 |
|
|
1722 | 1743 |
|
|
1723 | 1744 |
|
|
1724 | 1745 |
|
|
1725 | 1746 | |
|
1726 | 1747 |
|
|
1727 | 1748 |
|
|
1728 | 1749 |
|
|
1729 | 1750 |
|
|
1730 | 1751 |
|
|
1731 | 1752 |
|
|
1732 | 1753 |
|
|
1733 | 1754 |
|
|
1734 | 1755 | |
|
1735 | 1756 |
|
|
1736 | 1757 |
|
|
1737 | 1758 |
|
|
1738 | 1759 | |
|
1739 | 1760 | If attrname represents a property, return it unevaluated (in case it has |
|
1740 | 1761 | side effects or raises an error. |
|
1741 | 1762 | |
|
1742 | 1763 | """ |
|
1743 | 1764 |
|
|
1744 | 1765 |
|
|
1745 | 1766 |
|
|
1746 | 1767 |
|
|
1747 | 1768 |
|
|
1748 | 1769 |
|
|
1749 | 1770 |
|
|
1750 | 1771 |
|
|
1751 | 1772 |
|
|
1752 | 1773 |
|
|
1753 | 1774 |
|
|
1754 | 1775 |
|
|
1755 | 1776 |
|
|
1756 | 1777 |
|
|
1757 | 1778 |
|
|
1758 | 1779 |
|
|
1759 | 1780 |
|
|
1760 | 1781 |
|
|
1761 | 1782 |
|
|
1762 | 1783 |
|
|
1763 | 1784 |
|
|
1764 | 1785 |
|
|
1765 | 1786 |
|
|
1766 | 1787 |
|
|
1767 | 1788 |
|
|
1768 | 1789 |
|
|
1769 | 1790 |
|
|
1770 | 1791 |
|
|
1771 | 1792 |
|
|
1772 | 1793 |
|
|
1773 | 1794 | |
|
1774 | 1795 |
|
|
1775 | 1796 |
|
|
1776 | 1797 | |
|
1777 | 1798 |
|
|
1778 | 1799 |
|
|
1779 | 1800 |
|
|
1780 | 1801 | |
|
1781 | 1802 |
|
|
1782 | 1803 |
|
|
1783 | 1804 | |
|
1784 | 1805 | This function is meant to be called by pdef, pdoc & friends. |
|
1785 | 1806 | """ |
|
1786 | 1807 |
|
|
1787 | 1808 |
|
|
1788 | 1809 |
|
|
1789 | 1810 |
|
|
1790 | 1811 |
|
|
1791 | 1812 |
|
|
1792 | 1813 |
|
|
1793 | 1814 |
|
|
1794 | 1815 |
|
|
1795 | 1816 |
|
|
1796 | 1817 |
|
|
1797 | 1818 |
|
|
1798 | 1819 |
|
|
1799 | 1820 |
|
|
1800 | 1821 |
|
|
1801 | 1822 |
|
|
1802 | 1823 |
|
|
1803 | 1824 |
|
|
1804 | 1825 |
|
|
1805 | 1826 |
|
|
1806 | 1827 |
|
|
1807 | 1828 |
|
|
1808 | 1829 |
|
|
1809 | 1830 |
|
|
1810 | 1831 |
|
|
1811 | 1832 |
|
|
1812 | 1833 |
|
|
1813 | 1834 |
|
|
1814 | 1835 | |
|
1815 | 1836 |
|
|
1816 | 1837 |
|
|
1817 | 1838 |
|
|
1818 | 1839 |
|
|
1819 | 1840 |
|
|
1820 | 1841 |
|
|
1821 | 1842 |
|
|
1822 | 1843 |
|
|
1823 | 1844 |
|
|
1824 | 1845 |
|
|
1825 | 1846 | |
|
1826 | 1847 |
|
|
1827 | 1848 |
|
|
1828 | 1849 |
|
|
1829 | 1850 | |
|
1830 | 1851 |
|
|
1831 | 1852 |
|
|
1832 | 1853 | |
|
1833 | 1854 | A mimebundle is a dictionary, keyed by mime-type. |
|
1834 | 1855 | It must always have the key `'text/plain'`. |
|
1835 | 1856 | """ |
|
1836 | 1857 |
|
|
1837 | 1858 |
|
|
1838 | 1859 |
|
|
1839 | 1860 |
|
|
1840 | 1861 |
|
|
1841 | 1862 |
|
|
1842 | 1863 |
|
|
1843 | 1864 |
|
|
1844 | 1865 |
|
|
1845 | 1866 |
|
|
1846 | 1867 |
|
|
1847 | 1868 |
|
|
1848 | 1869 |
|
|
1849 | 1870 |
|
|
1850 | 1871 |
|
|
1851 | 1872 |
|
|
1852 | 1873 |
|
|
1853 | 1874 |
|
|
1854 | 1875 | |
|
1855 | 1876 |
|
|
1856 | 1877 |
|
|
1857 | 1878 |
|
|
1858 | 1879 | |
|
1859 | 1880 |
|
|
1860 | 1881 |
|
|
1861 | 1882 |
|
|
1862 | 1883 |
|
|
1863 | 1884 | |
|
1864 | 1885 |
|
|
1865 | 1886 |
|
|
1866 | 1887 |
|
|
1867 | 1888 | |
|
1868 | 1889 |
|
|
1869 | 1890 | |
|
1870 | 1891 |
|
|
1871 | 1892 |
|
|
1872 | 1893 |
|
|
1873 | 1894 | |
|
1874 | 1895 |
|
|
1875 | 1896 |
|
|
1876 | 1897 |
|
|
1877 | 1898 |
|
|
1878 | 1899 |
|
|
1879 | 1900 |
|
|
1880 | 1901 |
|
|
1881 | 1902 | |
|
1882 | 1903 |
|
|
1883 | 1904 |
|
|
1884 | 1905 |
|
|
1885 | 1906 |
|
|
1886 | 1907 | |
|
1887 | 1908 |
|
|
1888 | 1909 |
|
|
1889 | 1910 | |
|
1890 | 1911 |
|
|
1891 | 1912 |
|
|
1892 | 1913 | |
|
1893 | 1914 |
|
|
1894 | 1915 |
|
|
1895 | 1916 | |
|
1896 | 1917 | Set a custom exception handler, which will be called if any of the |
|
1897 | 1918 | exceptions in exc_tuple occur in the mainloop (specifically, in the |
|
1898 | 1919 | run_code() method). |
|
1899 | 1920 | |
|
1900 | 1921 | Parameters |
|
1901 | 1922 | ---------- |
|
1902 | 1923 | exc_tuple : tuple of exception classes |
|
1903 | 1924 | A *tuple* of exception classes, for which to call the defined |
|
1904 | 1925 | handler. It is very important that you use a tuple, and NOT A |
|
1905 | 1926 | LIST here, because of the way Python's except statement works. If |
|
1906 | 1927 | you only want to trap a single exception, use a singleton tuple:: |
|
1907 | 1928 | |
|
1908 | 1929 | exc_tuple == (MyCustomException,) |
|
1909 | 1930 | |
|
1910 | 1931 | handler : callable |
|
1911 | 1932 | handler must have the following signature:: |
|
1912 | 1933 | |
|
1913 | 1934 | def my_handler(self, etype, value, tb, tb_offset=None): |
|
1914 | 1935 | ... |
|
1915 | 1936 | return structured_traceback |
|
1916 | 1937 | |
|
1917 | 1938 | Your handler must return a structured traceback (a list of strings), |
|
1918 | 1939 | or None. |
|
1919 | 1940 | |
|
1920 | 1941 | This will be made into an instance method (via types.MethodType) |
|
1921 | 1942 | of IPython itself, and it will be called if any of the exceptions |
|
1922 | 1943 | listed in the exc_tuple are caught. If the handler is None, an |
|
1923 | 1944 | internal basic one is used, which just prints basic info. |
|
1924 | 1945 | |
|
1925 | 1946 | To protect IPython from crashes, if your handler ever raises an |
|
1926 | 1947 | exception or returns an invalid result, it will be immediately |
|
1927 | 1948 | disabled. |
|
1928 | 1949 | |
|
1929 | 1950 | Notes |
|
1930 | 1951 | ----- |
|
1931 | 1952 | WARNING: by putting in your own exception handler into IPython's main |
|
1932 | 1953 | execution loop, you run a very good chance of nasty crashes. This |
|
1933 | 1954 | facility should only be used if you really know what you are doing. |
|
1934 | 1955 | """ |
|
1935 | 1956 | |
|
1936 | 1957 |
|
|
1937 | 1958 |
|
|
1938 | 1959 | |
|
1939 | 1960 |
|
|
1940 | 1961 |
|
|
1941 | 1962 |
|
|
1942 | 1963 |
|
|
1943 | 1964 |
|
|
1944 | 1965 | |
|
1945 | 1966 |
|
|
1946 | 1967 |
|
|
1947 | 1968 | |
|
1948 | 1969 | return type of CustomTB *should* be a list of strings, but allow |
|
1949 | 1970 | single strings or None, which are harmless. |
|
1950 | 1971 | |
|
1951 | 1972 | This function will *always* return a list of strings, |
|
1952 | 1973 | and will raise a TypeError if stb is inappropriate. |
|
1953 | 1974 | """ |
|
1954 | 1975 |
|
|
1955 | 1976 |
|
|
1956 | 1977 |
|
|
1957 | 1978 |
|
|
1958 | 1979 |
|
|
1959 | 1980 |
|
|
1960 | 1981 |
|
|
1961 | 1982 |
|
|
1962 | 1983 |
|
|
1963 | 1984 |
|
|
1964 | 1985 |
|
|
1965 | 1986 |
|
|
1966 | 1987 |
|
|
1967 | 1988 | |
|
1968 | 1989 |
|
|
1969 | 1990 |
|
|
1970 | 1991 |
|
|
1971 | 1992 |
|
|
1972 | 1993 |
|
|
1973 | 1994 | |
|
1974 | 1995 | This makes it harder (but not impossible) for custom exception |
|
1975 | 1996 | handlers to crash IPython. |
|
1976 | 1997 | """ |
|
1977 | 1998 |
|
|
1978 | 1999 |
|
|
1979 | 2000 |
|
|
1980 | 2001 |
|
|
1981 | 2002 |
|
|
1982 | 2003 |
|
|
1983 | 2004 |
|
|
1984 | 2005 |
|
|
1985 | 2006 |
|
|
1986 | 2007 |
|
|
1987 | 2008 |
|
|
1988 | 2009 |
|
|
1989 | 2010 |
|
|
1990 | 2011 |
|
|
1991 | 2012 |
|
|
1992 | 2013 | |
|
1993 | 2014 |
|
|
1994 | 2015 |
|
|
1995 | 2016 | |
|
1996 | 2017 |
|
|
1997 | 2018 |
|
|
1998 | 2019 | |
|
1999 | 2020 | GUI frameworks like wxPython trap exceptions and call |
|
2000 | 2021 | sys.excepthook themselves. I guess this is a feature that |
|
2001 | 2022 | enables them to keep running after exceptions that would |
|
2002 | 2023 | otherwise kill their mainloop. This is a bother for IPython |
|
2003 | 2024 | which expects to catch all of the program exceptions with a try: |
|
2004 | 2025 | except: statement. |
|
2005 | 2026 | |
|
2006 | 2027 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if |
|
2007 | 2028 | any app directly invokes sys.excepthook, it will look to the user like |
|
2008 | 2029 | IPython crashed. In order to work around this, we can disable the |
|
2009 | 2030 | CrashHandler and replace it with this excepthook instead, which prints a |
|
2010 | 2031 | regular traceback using our InteractiveTB. In this fashion, apps which |
|
2011 | 2032 | call sys.excepthook will generate a regular-looking exception from |
|
2012 | 2033 | IPython, and the CrashHandler will only be triggered by real IPython |
|
2013 | 2034 | crashes. |
|
2014 | 2035 | |
|
2015 | 2036 | This hook should be used sparingly, only in places which are not likely |
|
2016 | 2037 | to be true IPython errors. |
|
2017 | 2038 | """ |
|
2018 | 2039 |
|
|
2019 | 2040 | |
|
2020 | 2041 |
|
|
2021 | 2042 |
|
|
2022 | 2043 | |
|
2023 | 2044 | Ensures sys.last_type,value,traceback hold the exc_info we found, |
|
2024 | 2045 | from whichever source. |
|
2025 | 2046 | |
|
2026 | 2047 | raises ValueError if none of these contain any information |
|
2027 | 2048 | """ |
|
2028 | 2049 |
|
|
2029 | 2050 |
|
|
2030 | 2051 |
|
|
2031 | 2052 |
|
|
2032 | 2053 | |
|
2033 | 2054 |
|
|
2034 | 2055 |
|
|
2035 | 2056 |
|
|
2036 | 2057 |
|
|
2037 | 2058 | |
|
2038 | 2059 |
|
|
2039 | 2060 |
|
|
2040 | 2061 | |
|
2041 | 2062 |
|
|
2042 | 2063 |
|
|
2043 | 2064 |
|
|
2044 | 2065 |
|
|
2045 | 2066 |
|
|
2046 | 2067 |
|
|
2047 | 2068 |
|
|
2048 | 2069 |
|
|
2049 | 2070 | |
|
2050 | 2071 |
|
|
2051 | 2072 | |
|
2052 | 2073 |
|
|
2053 | 2074 |
|
|
2054 | 2075 | |
|
2055 | 2076 | These are special exceptions that shouldn't show a traceback. |
|
2056 | 2077 | """ |
|
2057 | 2078 |
|
|
2058 | 2079 | |
|
2059 | 2080 |
|
|
2060 | 2081 |
|
|
2061 | 2082 | Return as a string (ending with a newline) the exception that |
|
2062 | 2083 | just occurred, without any traceback. |
|
2063 | 2084 | """ |
|
2064 | 2085 |
|
|
2065 | 2086 |
|
|
2066 | 2087 |
|
|
2067 | 2088 | |
|
2068 | 2089 |
|
|
2069 | 2090 |
|
|
2070 | 2091 |
|
|
2071 | 2092 | |
|
2072 | 2093 | If nothing is known about the exception, this is the method which |
|
2073 | 2094 | should be used throughout the code for presenting user tracebacks, |
|
2074 | 2095 | rather than directly invoking the InteractiveTB object. |
|
2075 | 2096 | |
|
2076 | 2097 | A specific showsyntaxerror() also exists, but this method can take |
|
2077 | 2098 | care of calling it if needed, so unless you are explicitly catching a |
|
2078 | 2099 | SyntaxError exception, don't try to analyze the stack manually and |
|
2079 | 2100 | simply call this method.""" |
|
2080 | 2101 | |
|
2081 | 2102 |
|
|
2082 | 2103 |
|
|
2083 | 2104 |
|
|
2084 | 2105 |
|
|
2085 | 2106 |
|
|
2086 | 2107 |
|
|
2087 | 2108 | |
|
2088 | 2109 |
|
|
2089 | 2110 |
|
|
2090 | 2111 |
|
|
2091 | 2112 |
|
|
2092 | 2113 |
|
|
2093 | 2114 |
|
|
2094 | 2115 |
|
|
2095 | 2116 |
|
|
2096 | 2117 |
|
|
2097 | 2118 |
|
|
2098 | 2119 |
|
|
2099 | 2120 |
|
|
2100 | 2121 |
|
|
2101 | 2122 | |
|
2102 | 2123 |
|
|
2103 | 2124 |
|
|
2104 | 2125 |
|
|
2105 | 2126 |
|
|
2106 | 2127 |
|
|
2107 | 2128 |
|
|
2108 | 2129 | |
|
2109 | 2130 |
|
|
2110 | 2131 |
|
|
2111 | 2132 |
|
|
2112 | 2133 |
|
|
2113 | 2134 |
|
|
2114 | 2135 |
|
|
2115 | 2136 |
|
|
2116 | 2137 |
|
|
2117 | 2138 |
|
|
2118 | 2139 |
|
|
2119 | 2140 |
|
|
2120 | 2141 |
|
|
2121 | 2142 |
|
|
2122 | 2143 |
|
|
2123 | 2144 |
|
|
2124 | 2145 | |
|
2125 | 2146 |
|
|
2126 | 2147 |
|
|
2127 | 2148 |
|
|
2128 | 2149 |
|
|
2129 | 2150 |
|
|
2130 | 2151 |
|
|
2131 | 2152 | |
|
2132 | 2153 |
|
|
2133 | 2154 |
|
|
2134 | 2155 |
|
|
2135 | 2156 |
|
|
2136 | 2157 |
|
|
2137 | 2158 | |
|
2138 | 2159 |
|
|
2139 | 2160 |
|
|
2140 | 2161 | |
|
2141 | 2162 |
|
|
2142 | 2163 |
|
|
2143 | 2164 | |
|
2144 | 2165 |
|
|
2145 | 2166 |
|
|
2146 | 2167 | |
|
2147 | 2168 | Subclasses may override this method to put the traceback on a different |
|
2148 | 2169 | place, like a side channel. |
|
2149 | 2170 | """ |
|
2150 | 2171 |
|
|
2151 | 2172 |
|
|
2152 | 2173 |
|
|
2153 | 2174 |
|
|
2154 | 2175 |
|
|
2155 | 2176 | |
|
2156 | 2177 |
|
|
2157 | 2178 |
|
|
2158 | 2179 | |
|
2159 | 2180 | This doesn't display a stack trace because there isn't one. |
|
2160 | 2181 | |
|
2161 | 2182 | If a filename is given, it is stuffed in the exception instead |
|
2162 | 2183 | of what was there before (because Python's parser always uses |
|
2163 | 2184 | "<string>" when reading from a string). |
|
2164 | 2185 | |
|
2165 | 2186 | If the syntax error occurred when running a compiled code (i.e. running_compile_code=True), |
|
2166 | 2187 | longer stack trace will be displayed. |
|
2167 | 2188 | """ |
|
2168 | 2189 |
|
|
2169 | 2190 | |
|
2170 | 2191 |
|
|
2171 | 2192 |
|
|
2172 | 2193 |
|
|
2173 | 2194 |
|
|
2174 | 2195 |
|
|
2175 | 2196 |
|
|
2176 | 2197 | |
|
2177 | 2198 |
|
|
2178 | 2199 |
|
|
2179 | 2200 |
|
|
2180 | 2201 |
|
|
2181 | 2202 | |
|
2182 | 2203 |
|
|
2183 | 2204 |
|
|
2184 | 2205 |
|
|
2185 | 2206 |
|
|
2186 | 2207 | at the prompt. |
|
2187 | 2208 | |
|
2188 | 2209 | This is overridden in TerminalInteractiveShell to show a message about |
|
2189 | 2210 | the %paste magic.""" |
|
2190 | 2211 |
|
|
2191 | 2212 | |
|
2192 | 2213 |
|
|
2193 | 2214 |
|
|
2194 | 2215 |
|
|
2195 | 2216 | |
|
2196 | 2217 | Example:: |
|
2197 | 2218 | |
|
2198 | 2219 | In [1]: _ip.set_next_input("Hello Word") |
|
2199 | 2220 | In [2]: Hello Word_ # cursor is here |
|
2200 | 2221 | """ |
|
2201 | 2222 |
|
|
2202 | 2223 | |
|
2203 | 2224 |
|
|
2204 | 2225 |
|
|
2205 | 2226 |
|
|
2206 | 2227 | |
|
2207 | 2228 |
|
|
2208 | 2229 |
|
|
2209 | 2230 |
|
|
2210 | 2231 | |
|
2211 | 2232 |
|
|
2212 | 2233 |
|
|
2213 | 2234 | |
|
2214 | 2235 | This creates completion machinery that can be used by client code, |
|
2215 | 2236 | either interactively in-process (typically triggered by the readline |
|
2216 | 2237 | library), programmatically (such as in test suites) or out-of-process |
|
2217 | 2238 | (typically over the network by remote frontends). |
|
2218 | 2239 | """ |
|
2219 | 2240 |
|
|
2220 | 2241 |
|
|
2221 | 2242 |
|
|
2222 | 2243 |
|
|
2223 | 2244 |
|
|
2224 | 2245 |
|
|
2225 | 2246 |
|
|
2226 | 2247 | |
|
2227 | 2248 |
|
|
2228 | 2249 |
|
|
2229 | 2250 |
|
|
2230 | 2251 |
|
|
2231 | 2252 |
|
|
2232 | 2253 |
|
|
2233 | 2254 | |
|
2234 | 2255 |
|
|
2235 | 2256 |
|
|
2236 | 2257 |
|
|
2237 | 2258 |
|
|
2238 | 2259 | |
|
2239 | 2260 |
|
|
2240 | 2261 |
|
|
2241 | 2262 |
|
|
2242 | 2263 |
|
|
2243 | 2264 |
|
|
2244 | 2265 |
|
|
2245 | 2266 | |
|
2246 | 2267 |
|
|
2247 | 2268 |
|
|
2248 | 2269 |
|
|
2249 | 2270 | |
|
2250 | 2271 | Parameters |
|
2251 | 2272 | ---------- |
|
2252 | 2273 | text : string |
|
2253 | 2274 | A string of text to be completed on. It can be given as empty and |
|
2254 | 2275 | instead a line/position pair are given. In this case, the |
|
2255 | 2276 | completer itself will split the line like readline does. |
|
2256 | 2277 | line : string, optional |
|
2257 | 2278 | The complete line that text is part of. |
|
2258 | 2279 | cursor_pos : int, optional |
|
2259 | 2280 | The position of the cursor on the input line. |
|
2260 | 2281 | |
|
2261 | 2282 | Returns |
|
2262 | 2283 | ------- |
|
2263 | 2284 | text : string |
|
2264 | 2285 | The actual text that was completed. |
|
2265 | 2286 | matches : list |
|
2266 | 2287 | A sorted list with all possible completions. |
|
2267 | 2288 | |
|
2268 | 2289 | Notes |
|
2269 | 2290 | ----- |
|
2270 | 2291 | The optional arguments allow the completion to take more context into |
|
2271 | 2292 | account, and are part of the low-level completion API. |
|
2272 | 2293 | |
|
2273 | 2294 | This is a wrapper around the completion mechanism, similar to what |
|
2274 | 2295 | readline does at the command line when the TAB key is hit. By |
|
2275 | 2296 | exposing it as a method, it can be used by other non-readline |
|
2276 | 2297 | environments (such as GUIs) for text completion. |
|
2277 | 2298 | |
|
2278 | 2299 | Examples |
|
2279 | 2300 | -------- |
|
2280 | 2301 | In [1]: x = 'hello' |
|
2281 | 2302 | |
|
2282 | 2303 | In [2]: _ip.complete('x.l') |
|
2283 | 2304 | Out[2]: ('x.l', ['x.ljust', 'x.lower', 'x.lstrip']) |
|
2284 | 2305 | """ |
|
2285 | 2306 | |
|
2286 | 2307 |
|
|
2287 | 2308 |
|
|
2288 | 2309 |
|
|
2289 | 2310 | |
|
2290 | 2311 |
|
|
2291 | 2312 |
|
|
2292 | 2313 | |
|
2293 | 2314 | The position argument (defaults to 0) is the index in the completers |
|
2294 | 2315 | list where you want the completer to be inserted. |
|
2295 | 2316 | |
|
2296 | 2317 | `completer` should have the following signature:: |
|
2297 | 2318 | |
|
2298 | 2319 | def completion(self: Completer, text: string) -> List[str]: |
|
2299 | 2320 | raise NotImplementedError |
|
2300 | 2321 | |
|
2301 | 2322 | It will be bound to the current Completer instance and pass some text |
|
2302 | 2323 | and return a list with current completions to suggest to the user. |
|
2303 | 2324 | """ |
|
2304 | 2325 | |
|
2305 | 2326 |
|
|
2306 | 2327 |
|
|
2307 | 2328 | |
|
2308 | 2329 |
|
|
2309 | 2330 |
|
|
2310 | 2331 |
|
|
2311 | 2332 |
|
|
2312 | 2333 |
|
|
2313 | 2334 |
|
|
2314 | 2335 |
|
|
2315 | 2336 |
|
|
2316 | 2337 | |
|
2317 | 2338 |
|
|
2318 | 2339 |
|
|
2319 | 2340 |
|
|
2320 | 2341 | |
|
2321 | 2342 |
|
|
2322 | 2343 |
|
|
2323 | 2344 |
|
|
2324 | 2345 |
|
|
2325 | 2346 |
|
|
2326 | 2347 |
|
|
2327 | 2348 | |
|
2328 | 2349 |
|
|
2329 | 2350 |
|
|
2330 | 2351 | |
|
2331 | 2352 |
|
|
2332 | 2353 |
|
|
2333 | 2354 |
|
|
2334 | 2355 |
|
|
2335 | 2356 |
|
|
2336 | 2357 |
|
|
2337 | 2358 |
|
|
2338 | 2359 | |
|
2339 | 2360 |
|
|
2340 | 2361 |
|
|
2341 | 2362 |
|
|
2342 | 2363 |
|
|
2343 | 2364 |
|
|
2344 | 2365 |
|
|
2345 | 2366 |
|
|
2346 | 2367 |
|
|
2347 | 2368 |
|
|
2348 | 2369 |
|
|
2349 | 2370 | |
|
2350 | 2371 |
|
|
2351 | 2372 |
|
|
2352 | 2373 |
|
|
2353 | 2374 |
|
|
2354 | 2375 | |
|
2355 | 2376 |
|
|
2356 | 2377 |
|
|
2357 | 2378 |
|
|
2358 | 2379 |
|
|
2359 | 2380 |
|
|
2360 | 2381 |
|
|
2361 | 2382 | |
|
2362 | 2383 |
|
|
2363 | 2384 |
|
|
2364 | 2385 | Try to find a magic potentially lazy-loading it. |
|
2365 | 2386 | |
|
2366 | 2387 | Parameters |
|
2367 | 2388 | ---------- |
|
2368 | 2389 | |
|
2369 | 2390 | type_: "line"|"cell" |
|
2370 | 2391 | the type of magics we are trying to find/lazy load. |
|
2371 | 2392 | magic_name: str |
|
2372 | 2393 | The name of the magic we are trying to find/lazy load |
|
2373 | 2394 | |
|
2374 | 2395 | |
|
2375 | 2396 | Note that this may have any side effects |
|
2376 | 2397 | """ |
|
2377 | 2398 |
|
|
2378 | 2399 |
|
|
2379 | 2400 |
|
|
2380 | 2401 |
|
|
2381 | 2402 |
|
|
2382 | 2403 |
|
|
2383 | 2404 |
|
|
2384 | 2405 | |
|
2385 | 2406 |
|
|
2386 | 2407 |
|
|
2387 | 2408 |
|
|
2388 | 2409 | |
|
2389 | 2410 |
|
|
2390 | 2411 |
|
|
2391 | 2412 | |
|
2392 | 2413 | Parameters |
|
2393 | 2414 | ---------- |
|
2394 | 2415 | magic_name : str |
|
2395 | 2416 | Name of the desired magic function, without '%' prefix. |
|
2396 | 2417 | line : str |
|
2397 | 2418 | The rest of the input line as a single string. |
|
2398 | 2419 | _stack_depth : int |
|
2399 | 2420 | If run_line_magic() is called from magic() then _stack_depth=2. |
|
2400 | 2421 | This is added to ensure backward compatibility for use of 'get_ipython().magic()' |
|
2401 | 2422 | """ |
|
2402 | 2423 |
|
|
2403 | 2424 |
|
|
2404 | 2425 |
|
|
2405 | 2426 |
|
|
2406 | 2427 |
|
|
2407 | 2428 |
|
|
2408 | 2429 |
|
|
2409 | 2430 |
|
|
2410 | 2431 |
|
|
2411 | 2432 |
|
|
2412 | 2433 |
|
|
2413 | 2434 |
|
|
2414 | 2435 |
|
|
2415 | 2436 |
|
|
2416 | 2437 |
|
|
2417 | 2438 |
|
|
2418 | 2439 | |
|
2419 | 2440 |
|
|
2420 | 2441 |
|
|
2421 | 2442 |
|
|
2422 | 2443 |
|
|
2423 | 2444 |
|
|
2424 | 2445 |
|
|
2425 | 2446 |
|
|
2426 | 2447 |
|
|
2427 | 2448 |
|
|
2428 | 2449 |
|
|
2429 | 2450 |
|
|
2430 | 2451 |
|
|
2431 | 2452 |
|
|
2432 | 2453 |
|
|
2433 | 2454 |
|
|
2434 | 2455 | |
|
2435 | 2456 |
|
|
2436 | 2457 |
|
|
2437 | 2458 |
|
|
2438 | 2459 |
|
|
2439 | 2460 |
|
|
2440 | 2461 |
|
|
2441 | 2462 | |
|
2442 | 2463 |
|
|
2443 | 2464 | |
|
2444 | 2465 |
|
|
2445 | 2466 |
|
|
2446 | 2467 | |
|
2447 | 2468 | Parameters |
|
2448 | 2469 | ---------- |
|
2449 | 2470 | stack_depth : int |
|
2450 | 2471 | Depth relative to calling frame |
|
2451 | 2472 | """ |
|
2452 | 2473 |
|
|
2453 | 2474 | |
|
2454 | 2475 |
|
|
2455 | 2476 |
|
|
2456 | 2477 | |
|
2457 | 2478 | Parameters |
|
2458 | 2479 | ---------- |
|
2459 | 2480 | magic_name : str |
|
2460 | 2481 | Name of the desired magic function, without '%' prefix. |
|
2461 | 2482 | line : str |
|
2462 | 2483 | The rest of the first input line as a single string. |
|
2463 | 2484 | cell : str |
|
2464 | 2485 | The body of the cell as a (possibly multiline) string. |
|
2465 | 2486 | """ |
|
2466 | 2487 |
|
|
2467 | 2488 |
|
|
2468 | 2489 |
|
|
2469 | 2490 |
|
|
2470 | 2491 |
|
|
2471 | 2492 |
|
|
2472 | 2493 |
|
|
2473 | 2494 |
|
|
2474 | 2495 |
|
|
2475 | 2496 |
|
|
2476 | 2497 |
|
|
2477 | 2498 |
|
|
2478 | 2499 |
|
|
2479 | 2500 |
|
|
2480 | 2501 |
|
|
2481 | 2502 |
|
|
2482 | 2503 |
|
|
2483 | 2504 |
|
|
2484 | 2505 |
|
|
2485 | 2506 |
|
|
2486 | 2507 |
|
|
2487 | 2508 |
|
|
2488 | 2509 |
|
|
2489 | 2510 |
|
|
2490 | 2511 |
|
|
2491 | 2512 | |
|
2492 | 2513 |
|
|
2493 | 2514 |
|
|
2494 | 2515 |
|
|
2495 | 2516 | |
|
2496 | 2517 |
|
|
2497 | 2518 |
|
|
2498 | 2519 |
|
|
2499 | 2520 |
|
|
2500 | 2521 |
|
|
2501 | 2522 |
|
|
2502 | 2523 | |
|
2503 | 2524 |
|
|
2504 | 2525 | |
|
2505 | 2526 |
|
|
2506 | 2527 |
|
|
2507 | 2528 | |
|
2508 | 2529 | Returns None if the magic isn't found.""" |
|
2509 | 2530 |
|
|
2510 | 2531 | |
|
2511 | 2532 |
|
|
2512 | 2533 |
|
|
2513 | 2534 | |
|
2514 | 2535 | Returns None if the magic isn't found.""" |
|
2515 | 2536 |
|
|
2516 | 2537 | |
|
2517 | 2538 |
|
|
2518 | 2539 |
|
|
2519 | 2540 | |
|
2520 | 2541 | Returns None if the magic isn't found.""" |
|
2521 | 2542 |
|
|
2522 | 2543 | |
|
2523 | 2544 |
|
|
2524 | 2545 |
|
|
2525 | 2546 | DEPRECATED |
|
2526 | 2547 | |
|
2527 | 2548 | Deprecated since IPython 0.13 (warning added in |
|
2528 | 2549 | 8.1), use run_line_magic(magic_name, parameter_s). |
|
2529 | 2550 | |
|
2530 | 2551 | Call a magic function by name. |
|
2531 | 2552 | |
|
2532 | 2553 | Input: a string containing the name of the magic function to call and |
|
2533 | 2554 | any additional arguments to be passed to the magic. |
|
2534 | 2555 | |
|
2535 | 2556 | magic('name -opt foo bar') is equivalent to typing at the ipython |
|
2536 | 2557 | prompt: |
|
2537 | 2558 | |
|
2538 | 2559 | In[1]: %name -opt foo bar |
|
2539 | 2560 | |
|
2540 | 2561 | To call a magic without arguments, simply use magic('name'). |
|
2541 | 2562 | |
|
2542 | 2563 | This provides a proper Python function to call IPython's magics in any |
|
2543 | 2564 | valid Python code you can type at the interpreter, including loops and |
|
2544 | 2565 | compound statements. |
|
2545 | 2566 | """ |
|
2546 | 2567 |
|
|
2547 | 2568 |
|
|
2548 | 2569 |
|
|
2549 | 2570 |
|
|
2550 | 2571 |
|
|
2551 | 2572 |
|
|
2552 | 2573 |
|
|
2553 | 2574 |
|
|
2554 | 2575 |
|
|
2555 | 2576 |
|
|
2556 | 2577 | |
|
2557 | 2578 |
|
|
2558 | 2579 |
|
|
2559 | 2580 |
|
|
2560 | 2581 | |
|
2561 | 2582 |
|
|
2562 | 2583 |
|
|
2563 | 2584 | |
|
2564 | 2585 | Parameters |
|
2565 | 2586 | ---------- |
|
2566 | 2587 | name : str |
|
2567 | 2588 | The name of the macro. |
|
2568 | 2589 | themacro : str or Macro |
|
2569 | 2590 | The action to do upon invoking the macro. If a string, a new |
|
2570 | 2591 | Macro object is created by passing the string to it. |
|
2571 | 2592 | """ |
|
2572 | 2593 | |
|
2573 | 2594 |
|
|
2574 | 2595 | |
|
2575 | 2596 |
|
|
2576 | 2597 |
|
|
2577 | 2598 |
|
|
2578 | 2599 |
|
|
2579 | 2600 |
|
|
2580 | 2601 | |
|
2581 | 2602 |
|
|
2582 | 2603 |
|
|
2583 | 2604 |
|
|
2584 | 2605 | |
|
2585 | 2606 |
|
|
2586 | 2607 |
|
|
2587 | 2608 | |
|
2588 | 2609 | Parameters |
|
2589 | 2610 | ---------- |
|
2590 | 2611 | cmd : str |
|
2591 | 2612 | Command to execute (can not end in '&', as background processes are |
|
2592 | 2613 | not supported. Should not be a command that expects input |
|
2593 | 2614 | other than simple text. |
|
2594 | 2615 | """ |
|
2595 | 2616 |
|
|
2596 | 2617 |
|
|
2597 | 2618 |
|
|
2598 | 2619 |
|
|
2599 | 2620 |
|
|
2600 | 2621 |
|
|
2601 | 2622 |
|
|
2602 | 2623 | |
|
2603 | 2624 |
|
|
2604 | 2625 |
|
|
2605 | 2626 |
|
|
2606 | 2627 |
|
|
2607 | 2628 | |
|
2608 | 2629 |
|
|
2609 | 2630 |
|
|
2610 | 2631 | subprocess.call using the system shell on other platforms. |
|
2611 | 2632 | |
|
2612 | 2633 | Parameters |
|
2613 | 2634 | ---------- |
|
2614 | 2635 | cmd : str |
|
2615 | 2636 | Command to execute. |
|
2616 | 2637 | """ |
|
2617 | 2638 |
|
|
2618 | 2639 |
|
|
2619 | 2640 |
|
|
2620 | 2641 |
|
|
2621 | 2642 | |
|
2622 | 2643 |
|
|
2623 | 2644 |
|
|
2624 | 2645 |
|
|
2625 | 2646 |
|
|
2626 | 2647 |
|
|
2627 | 2648 |
|
|
2628 | 2649 |
|
|
2629 | 2650 | |
|
2630 | 2651 |
|
|
2631 | 2652 |
|
|
2632 | 2653 |
|
|
2633 | 2654 |
|
|
2634 | 2655 |
|
|
2635 | 2656 |
|
|
2636 | 2657 |
|
|
2637 | 2658 |
|
|
2638 | 2659 |
|
|
2639 | 2660 |
|
|
2640 | 2661 |
|
|
2641 | 2662 |
|
|
2642 | 2663 |
|
|
2643 | 2664 |
|
|
2644 | 2665 |
|
|
2645 | 2666 |
|
|
2646 | 2667 |
|
|
2647 | 2668 |
|
|
2648 | 2669 |
|
|
2649 | 2670 |
|
|
2650 | 2671 |
|
|
2651 | 2672 |
|
|
2652 | 2673 |
|
|
2653 | 2674 |
|
|
2654 | 2675 |
|
|
2655 | 2676 |
|
|
2656 | 2677 |
|
|
2657 | 2678 |
|
|
2658 | 2679 |
|
|
2659 | 2680 |
|
|
2660 | 2681 |
|
|
2661 | 2682 | |
|
2662 | 2683 |
|
|
2663 | 2684 |
|
|
2664 | 2685 |
|
|
2665 | 2686 |
|
|
2666 | 2687 |
|
|
2667 | 2688 |
|
|
2668 | 2689 | |
|
2669 | 2690 |
|
|
2670 | 2691 |
|
|
2671 | 2692 | |
|
2672 | 2693 |
|
|
2673 | 2694 |
|
|
2674 | 2695 | |
|
2675 | 2696 | Parameters |
|
2676 | 2697 | ---------- |
|
2677 | 2698 | cmd : str |
|
2678 | 2699 | Command to execute (can not end in '&', as background processes are |
|
2679 | 2700 | not supported. |
|
2680 | 2701 | split : bool, optional |
|
2681 | 2702 | If True, split the output into an IPython SList. Otherwise, an |
|
2682 | 2703 | IPython LSString is returned. These are objects similar to normal |
|
2683 | 2704 | lists and strings, with a few convenience attributes for easier |
|
2684 | 2705 | manipulation of line-based output. You can use '?' on them for |
|
2685 | 2706 | details. |
|
2686 | 2707 | depth : int, optional |
|
2687 | 2708 | How many frames above the caller are the local variables which should |
|
2688 | 2709 | be expanded in the command string? The default (0) assumes that the |
|
2689 | 2710 | expansion variables are in the stack frame calling this function. |
|
2690 | 2711 | """ |
|
2691 | 2712 |
|
|
2692 | 2713 |
|
|
2693 | 2714 |
|
|
2694 | 2715 |
|
|
2695 | 2716 |
|
|
2696 | 2717 |
|
|
2697 | 2718 |
|
|
2698 | 2719 |
|
|
2699 | 2720 |
|
|
2700 | 2721 | |
|
2701 | 2722 |
|
|
2702 | 2723 |
|
|
2703 | 2724 |
|
|
2704 | 2725 | |
|
2705 | 2726 |
|
|
2706 | 2727 |
|
|
2707 | 2728 |
|
|
2708 | 2729 | |
|
2709 | 2730 |
|
|
2710 | 2731 |
|
|
2711 | 2732 |
|
|
2712 | 2733 | |
|
2713 | 2734 |
|
|
2714 | 2735 |
|
|
2715 | 2736 |
|
|
2716 | 2737 | |
|
2717 | 2738 |
|
|
2718 | 2739 |
|
|
2719 | 2740 |
|
|
2720 | 2741 | |
|
2721 | 2742 |
|
|
2722 | 2743 |
|
|
2723 | 2744 |
|
|
2724 | 2745 | |
|
2725 | 2746 |
|
|
2726 | 2747 |
|
|
2727 | 2748 |
|
|
2728 | 2749 | |
|
2729 | 2750 |
|
|
2730 | 2751 |
|
|
2731 | 2752 |
|
|
2732 | 2753 |
|
|
2733 | 2754 |
|
|
2734 | 2755 |
|
|
2735 | 2756 |
|
|
2736 | 2757 | |
|
2737 | 2758 |
|
|
2738 | 2759 |
|
|
2739 | 2760 | |
|
2740 | 2761 | This shows visual feedback by rewriting input lines that cause |
|
2741 | 2762 | automatic calling to kick in, like:: |
|
2742 | 2763 | |
|
2743 | 2764 | /f x |
|
2744 | 2765 | |
|
2745 | 2766 | into:: |
|
2746 | 2767 | |
|
2747 | 2768 | ------> f(x) |
|
2748 | 2769 | |
|
2749 | 2770 | after the user's input prompt. This helps the user understand that the |
|
2750 | 2771 | input line was transformed automatically by IPython. |
|
2751 | 2772 | """ |
|
2752 | 2773 |
|
|
2753 | 2774 |
|
|
2754 | 2775 | |
|
2755 | 2776 |
|
|
2756 | 2777 |
|
|
2757 | 2778 | |
|
2758 | 2779 |
|
|
2759 | 2780 |
|
|
2760 | 2781 |
|
|
2761 | 2782 | |
|
2762 | 2783 |
|
|
2763 | 2784 |
|
|
2764 | 2785 | |
|
2765 | 2786 | for use in user_expressions |
|
2766 | 2787 | """ |
|
2767 | 2788 | |
|
2768 | 2789 |
|
|
2769 | 2790 |
|
|
2770 | 2791 | |
|
2771 | 2792 |
|
|
2772 | 2793 |
|
|
2773 | 2794 |
|
|
2774 | 2795 |
|
|
2775 | 2796 |
|
|
2776 | 2797 |
|
|
2777 | 2798 | |
|
2778 | 2799 |
|
|
2779 | 2800 | |
|
2780 | 2801 |
|
|
2781 | 2802 |
|
|
2782 | 2803 | |
|
2783 | 2804 | for use in user_expressions |
|
2784 | 2805 | """ |
|
2785 | 2806 | |
|
2786 | 2807 |
|
|
2787 | 2808 |
|
|
2788 | 2809 |
|
|
2789 | 2810 |
|
|
2790 | 2811 |
|
|
2791 | 2812 |
|
|
2792 | 2813 |
|
|
2793 | 2814 | |
|
2794 | 2815 |
|
|
2795 | 2816 |
|
|
2796 | 2817 | |
|
2797 | 2818 | Parameters |
|
2798 | 2819 | ---------- |
|
2799 | 2820 | expressions : dict |
|
2800 | 2821 | A dict with string keys and string values. The expression values |
|
2801 | 2822 | should be valid Python expressions, each of which will be evaluated |
|
2802 | 2823 | in the user namespace. |
|
2803 | 2824 | |
|
2804 | 2825 | Returns |
|
2805 | 2826 | ------- |
|
2806 | 2827 | A dict, keyed like the input expressions dict, with the rich mime-typed |
|
2807 | 2828 | display_data of each value. |
|
2808 | 2829 | """ |
|
2809 | 2830 |
|
|
2810 | 2831 |
|
|
2811 | 2832 |
|
|
2812 | 2833 | |
|
2813 | 2834 |
|
|
2814 | 2835 |
|
|
2815 | 2836 |
|
|
2816 | 2837 |
|
|
2817 | 2838 |
|
|
2818 | 2839 |
|
|
2819 | 2840 |
|
|
2820 | 2841 | |
|
2821 | 2842 |
|
|
2822 | 2843 |
|
|
2823 | 2844 |
|
|
2824 | 2845 | |
|
2825 | 2846 |
|
|
2826 | 2847 |
|
|
2827 | 2848 |
|
|
2828 | 2849 |
|
|
2829 | 2850 | |
|
2830 | 2851 |
|
|
2831 | 2852 |
|
|
2832 | 2853 | |
|
2833 | 2854 | Returns the result of evaluation |
|
2834 | 2855 | """ |
|
2835 | 2856 |
|
|
2836 | 2857 |
|
|
2837 | 2858 | |
|
2838 | 2859 |
|
|
2839 | 2860 |
|
|
2840 | 2861 | |
|
2841 | 2862 | This version will never throw an exception, but instead print |
|
2842 | 2863 | helpful error messages to the screen. This only works on pure |
|
2843 | 2864 | Python files with the .py extension. |
|
2844 | 2865 | |
|
2845 | 2866 | Parameters |
|
2846 | 2867 | ---------- |
|
2847 | 2868 | fname : string |
|
2848 | 2869 | The name of the file to be executed. |
|
2849 | 2870 | *where : tuple |
|
2850 | 2871 | One or two namespaces, passed to execfile() as (globals,locals). |
|
2851 | 2872 | If only one is given, it is passed as both. |
|
2852 | 2873 | exit_ignore : bool (False) |
|
2853 | 2874 | If True, then silence SystemExit for non-zero status (it is always |
|
2854 | 2875 | silenced for zero status, as it is so common). |
|
2855 | 2876 | raise_exceptions : bool (False) |
|
2856 | 2877 | If True raise exceptions everywhere. Meant for testing. |
|
2857 | 2878 | shell_futures : bool (False) |
|
2858 | 2879 | If True, the code will share future statements with the interactive |
|
2859 | 2880 | shell. It will both be affected by previous __future__ imports, and |
|
2860 | 2881 | any __future__ imports in the code will affect the shell. If False, |
|
2861 | 2882 | __future__ imports are not shared in either direction. |
|
2862 | 2883 | |
|
2863 | 2884 | """ |
|
2864 | 2885 |
|
|
2865 | 2886 | |
|
2866 | 2887 |
|
|
2867 | 2888 |
|
|
2868 | 2889 |
|
|
2869 | 2890 |
|
|
2870 | 2891 |
|
|
2871 | 2892 |
|
|
2872 | 2893 |
|
|
2873 | 2894 | |
|
2874 | 2895 |
|
|
2875 | 2896 |
|
|
2876 | 2897 |
|
|
2877 | 2898 |
|
|
2878 | 2899 | |
|
2879 | 2900 |
|
|
2880 | 2901 |
|
|
2881 | 2902 |
|
|
2882 | 2903 |
|
|
2883 | 2904 |
|
|
2884 | 2905 |
|
|
2885 | 2906 |
|
|
2886 | 2907 |
|
|
2887 | 2908 |
|
|
2888 | 2909 |
|
|
2889 | 2910 |
|
|
2890 | 2911 |
|
|
2891 | 2912 |
|
|
2892 | 2913 |
|
|
2893 | 2914 |
|
|
2894 | 2915 |
|
|
2895 | 2916 |
|
|
2896 | 2917 |
|
|
2897 | 2918 |
|
|
2898 | 2919 |
|
|
2899 | 2920 |
|
|
2900 | 2921 |
|
|
2901 | 2922 |
|
|
2902 | 2923 |
|
|
2903 | 2924 |
|
|
2904 | 2925 |
|
|
2905 | 2926 | |
|
2906 | 2927 |
|
|
2907 | 2928 |
|
|
2908 | 2929 | |
|
2909 | 2930 | Parameters |
|
2910 | 2931 | ---------- |
|
2911 | 2932 | fname : str |
|
2912 | 2933 | The name of the file to execute. The filename must have a |
|
2913 | 2934 | .ipy or .ipynb extension. |
|
2914 | 2935 | shell_futures : bool (False) |
|
2915 | 2936 | If True, the code will share future statements with the interactive |
|
2916 | 2937 | shell. It will both be affected by previous __future__ imports, and |
|
2917 | 2938 | any __future__ imports in the code will affect the shell. If False, |
|
2918 | 2939 | __future__ imports are not shared in either direction. |
|
2919 | 2940 | raise_exceptions : bool (False) |
|
2920 | 2941 | If True raise exceptions everywhere. Meant for testing. |
|
2921 | 2942 | """ |
|
2922 | 2943 |
|
|
2923 | 2944 | |
|
2924 | 2945 |
|
|
2925 | 2946 |
|
|
2926 | 2947 |
|
|
2927 | 2948 |
|
|
2928 | 2949 |
|
|
2929 | 2950 |
|
|
2930 | 2951 |
|
|
2931 | 2952 | |
|
2932 | 2953 |
|
|
2933 | 2954 |
|
|
2934 | 2955 |
|
|
2935 | 2956 |
|
|
2936 | 2957 | |
|
2937 | 2958 |
|
|
2938 | 2959 |
|
|
2939 | 2960 |
|
|
2940 | 2961 |
|
|
2941 | 2962 |
|
|
2942 | 2963 |
|
|
2943 | 2964 |
|
|
2944 | 2965 |
|
|
2945 | 2966 |
|
|
2946 | 2967 |
|
|
2947 | 2968 |
|
|
2948 | 2969 |
|
|
2949 | 2970 | |
|
2950 | 2971 |
|
|
2951 | 2972 |
|
|
2952 | 2973 |
|
|
2953 | 2974 |
|
|
2954 | 2975 |
|
|
2955 | 2976 |
|
|
2956 | 2977 |
|
|
2957 | 2978 |
|
|
2958 | 2979 |
|
|
2959 | 2980 |
|
|
2960 | 2981 |
|
|
2961 | 2982 |
|
|
2962 | 2983 |
|
|
2963 | 2984 | |
|
2964 | 2985 |
|
|
2965 | 2986 |
|
|
2966 | 2987 | |
|
2967 | 2988 | This version will never throw an exception, but instead print |
|
2968 | 2989 | helpful error messages to the screen. |
|
2969 | 2990 | |
|
2970 | 2991 | `SystemExit` exceptions with status code 0 or None are ignored. |
|
2971 | 2992 | |
|
2972 | 2993 | Parameters |
|
2973 | 2994 | ---------- |
|
2974 | 2995 | mod_name : string |
|
2975 | 2996 | The name of the module to be executed. |
|
2976 | 2997 | where : dict |
|
2977 | 2998 | The globals namespace. |
|
2978 | 2999 | """ |
|
2979 | 3000 |
|
|
2980 | 3001 |
|
|
2981 | 3002 |
|
|
2982 | 3003 |
|
|
2983 | 3004 |
|
|
2984 | 3005 |
|
|
2985 | 3006 |
|
|
2986 | 3007 |
|
|
2987 | 3008 |
|
|
2988 | 3009 |
|
|
2989 | 3010 |
|
|
2990 | 3011 |
|
|
2991 | 3012 | |
|
2992 | 3013 |
|
|
2993 | 3014 |
|
|
2994 | 3015 |
|
|
2995 | 3016 |
|
|
2996 | 3017 |
|
|
2997 | 3018 |
|
|
2998 | 3019 |
|
|
2999 | 3020 |
|
|
3000 | 3021 |
|
|
3001 | 3022 | |
|
3002 | 3023 | Parameters |
|
3003 | 3024 | ---------- |
|
3004 | 3025 | raw_cell : str |
|
3005 | 3026 | The code (including IPython code such as %magic functions) to run. |
|
3006 | 3027 | store_history : bool |
|
3007 | 3028 | If True, the raw and translated cell will be stored in IPython's |
|
3008 | 3029 | history. For user code calling back into IPython's machinery, this |
|
3009 | 3030 | should be set to False. |
|
3010 | 3031 | silent : bool |
|
3011 | 3032 | If True, avoid side-effects, such as implicit displayhooks and |
|
3012 | 3033 | and logging. silent=True forces store_history=False. |
|
3013 | 3034 | shell_futures : bool |
|
3014 | 3035 | If True, the code will share future statements with the interactive |
|
3015 | 3036 | shell. It will both be affected by previous __future__ imports, and |
|
3016 | 3037 | any __future__ imports in the code will affect the shell. If False, |
|
3017 | 3038 | __future__ imports are not shared in either direction. |
|
3018 | 3039 | |
|
3019 | 3040 | Returns |
|
3020 | 3041 | ------- |
|
3021 | 3042 | result : :class:`ExecutionResult` |
|
3022 | 3043 | """ |
|
3023 | 3044 |
|
|
3024 | 3045 |
|
|
3025 | 3046 |
|
|
3026 | 3047 |
|
|
3027 | 3048 |
|
|
3028 | 3049 |
|
|
3029 | 3050 |
|
|
3030 | 3051 |
|
|
3031 | 3052 |
|
|
3032 | 3053 |
|
|
3033 | 3054 | |
|
3034 | 3055 |
|
|
3035 | 3056 |
|
|
3036 | 3057 |
|
|
3037 | 3058 |
|
|
3038 | 3059 |
|
|
3039 | 3060 |
|
|
3040 | 3061 |
|
|
3041 | 3062 |
|
|
3042 | 3063 |
|
|
3043 | 3064 | |
|
3044 | 3065 |
|
|
3045 | 3066 |
|
|
3046 | 3067 |
|
|
3047 | 3068 |
|
|
3048 | 3069 |
|
|
3049 | 3070 |
|
|
3050 | 3071 |
|
|
3051 | 3072 |
|
|
3052 | 3073 | |
|
3053 | 3074 |
|
|
3054 | 3075 |
|
|
3055 | 3076 |
|
|
3056 | 3077 |
|
|
3057 | 3078 |
|
|
3058 | 3079 |
|
|
3059 | 3080 |
|
|
3060 | 3081 |
|
|
3061 | 3082 |
|
|
3062 | 3083 |
|
|
3063 | 3084 | |
|
3064 | 3085 |
|
|
3065 | 3086 |
|
|
3066 | 3087 |
|
|
3067 | 3088 |
|
|
3068 | 3089 |
|
|
3069 | 3090 |
|
|
3070 | 3091 |
|
|
3071 | 3092 |
|
|
3072 | 3093 |
|
|
3073 | 3094 |
|
|
3074 | 3095 |
|
|
3075 | 3096 |
|
|
3076 | 3097 |
|
|
3077 | 3098 |
|
|
3078 | 3099 | |
|
3079 | 3100 |
|
|
3080 | 3101 |
|
|
3081 | 3102 |
|
|
3082 | 3103 |
|
|
3083 | 3104 |
|
|
3084 | 3105 |
|
|
3085 | 3106 |
|
|
3086 | 3107 |
|
|
3087 | 3108 |
|
|
3088 | 3109 |
|
|
3089 | 3110 |
|
|
3090 | 3111 | |
|
3091 | 3112 |
|
|
3092 | 3113 |
|
|
3093 | 3114 |
|
|
3094 | 3115 |
|
|
3095 | 3116 | |
|
3096 | 3117 | Parameters |
|
3097 | 3118 | ---------- |
|
3098 | 3119 | raw_cell : str |
|
3099 | 3120 | The code to be executed |
|
3100 | 3121 | |
|
3101 | 3122 | Returns |
|
3102 | 3123 | ------- |
|
3103 | 3124 | result: bool |
|
3104 | 3125 | Whether the code needs to be run with a coroutine runner or not |
|
3105 | 3126 | .. versionadded:: 7.0 |
|
3106 | 3127 | """ |
|
3107 | 3128 |
|
|
3108 | 3129 |
|
|
3109 | 3130 |
|
|
3110 | 3131 |
|
|
3111 | 3132 |
|
|
3112 | 3133 |
|
|
3113 | 3134 |
|
|
3114 | 3135 |
|
|
3115 | 3136 |
|
|
3116 | 3137 |
|
|
3117 | 3138 |
|
|
3118 | 3139 |
|
|
3119 | 3140 |
|
|
3120 | 3141 |
|
|
3121 | 3142 |
|
|
3122 | 3143 |
|
|
3123 | 3144 |
|
|
3124 | 3145 |
|
|
3125 | 3146 |
|
|
3126 | 3147 |
|
|
3127 | 3148 |
|
|
3128 | 3149 |
|
|
3129 | 3150 |
|
|
3130 | 3151 |
|
|
3131 | 3152 |
|
|
3132 | 3153 | |
|
3133 | 3154 |
|
|
3134 | 3155 |
|
|
3135 | 3156 |
|
|
3136 | 3157 |
|
|
3137 | 3158 |
|
|
3138 | 3159 |
|
|
3139 | 3160 |
|
|
3140 | 3161 |
|
|
3141 | 3162 |
|
|
3142 | 3163 |
|
|
3143 | 3164 |
|
|
3144 | 3165 |
|
|
3145 | 3166 | |
|
3146 | 3167 | Parameters |
|
3147 | 3168 | ---------- |
|
3148 | 3169 | raw_cell : str |
|
3149 | 3170 | The code (including IPython code such as %magic functions) to run. |
|
3150 | 3171 | store_history : bool |
|
3151 | 3172 | If True, the raw and translated cell will be stored in IPython's |
|
3152 | 3173 | history. For user code calling back into IPython's machinery, this |
|
3153 | 3174 | should be set to False. |
|
3154 | 3175 | silent : bool |
|
3155 | 3176 | If True, avoid side-effects, such as implicit displayhooks and |
|
3156 | 3177 | and logging. silent=True forces store_history=False. |
|
3157 | 3178 | shell_futures : bool |
|
3158 | 3179 | If True, the code will share future statements with the interactive |
|
3159 | 3180 | shell. It will both be affected by previous __future__ imports, and |
|
3160 | 3181 | any __future__ imports in the code will affect the shell. If False, |
|
3161 | 3182 | __future__ imports are not shared in either direction. |
|
3162 | 3183 | transformed_cell: str |
|
3163 | 3184 | cell that was passed through transformers |
|
3164 | 3185 | preprocessing_exc_tuple: |
|
3165 | 3186 | trace if the transformation failed. |
|
3166 | 3187 | |
|
3167 | 3188 | Returns |
|
3168 | 3189 | ------- |
|
3169 | 3190 | result : :class:`ExecutionResult` |
|
3170 | 3191 | |
|
3171 | 3192 | .. versionadded:: 7.0 |
|
3172 | 3193 | """ |
|
3173 | 3194 |
|
|
3174 | 3195 |
|
|
3175 | 3196 | |
|
3176 | 3197 |
|
|
3177 | 3198 |
|
|
3178 | 3199 |
|
|
3179 | 3200 |
|
|
3180 | 3201 | |
|
3181 | 3202 |
|
|
3182 | 3203 |
|
|
3183 | 3204 | |
|
3184 | 3205 |
|
|
3185 | 3206 |
|
|
3186 | 3207 | |
|
3187 | 3208 |
|
|
3188 | 3209 |
|
|
3189 | 3210 |
|
|
3190 | 3211 |
|
|
3191 | 3212 |
|
|
3192 | 3213 |
|
|
3193 | 3214 |
|
|
3194 | 3215 | |
|
3195 | 3216 |
|
|
3196 | 3217 |
|
|
3197 | 3218 |
|
|
3198 | 3219 | |
|
3199 | 3220 |
|
|
3200 | 3221 |
|
|
3201 | 3222 |
|
|
3202 | 3223 |
|
|
3203 | 3224 |
|
|
3204 | 3225 |
|
|
3205 | 3226 |
|
|
3206 | 3227 |
|
|
3207 | 3228 |
|
|
3208 | 3229 |
|
|
3209 | 3230 |
|
|
3210 | 3231 |
|
|
3211 | 3232 |
|
|
3212 | 3233 |
|
|
3213 | 3234 |
|
|
3214 | 3235 |
|
|
3215 | 3236 |
|
|
3216 | 3237 |
|
|
3217 | 3238 |
|
|
3218 | 3239 |
|
|
3219 | 3240 |
|
|
3220 | 3241 |
|
|
3221 | 3242 |
|
|
3222 | 3243 |
|
|
3223 | 3244 |
|
|
3224 | 3245 |
|
|
3225 | 3246 |
|
|
3226 | 3247 | |
|
3227 | 3248 |
|
|
3228 | 3249 |
|
|
3229 | 3250 |
|
|
3230 | 3251 | |
|
3231 | 3252 |
|
|
3232 | 3253 |
|
|
3233 | 3254 |
|
|
3234 | 3255 |
|
|
3235 | 3256 |
|
|
3236 | 3257 | |
|
3237 | 3258 |
|
|
3238 | 3259 |
|
|
3239 | 3260 |
|
|
3240 | 3261 |
|
|
3241 | 3262 |
|
|
3242 | 3263 |
|
|
3243 | 3264 | |
|
3244 | 3265 |
|
|
3245 | 3266 |
|
|
3246 | 3267 |
|
|
3247 | 3268 |
|
|
3248 | 3269 | |
|
3249 | 3270 |
|
|
3250 | 3271 | |
|
3251 | 3272 |
|
|
3252 | 3273 |
|
|
3253 | 3274 | |
|
3254 | 3275 |
|
|
3255 | 3276 |
|
|
3256 | 3277 |
|
|
3257 | 3278 |
|
|
3258 | 3279 |
|
|
3259 | 3280 |
|
|
3260 | 3281 |
|
|
3261 | 3282 |
|
|
3262 | 3283 |
|
|
3263 | 3284 |
|
|
3264 | 3285 |
|
|
3265 | 3286 |
|
|
3266 | 3287 |
|
|
3267 | 3288 |
|
|
3268 | 3289 |
|
|
3269 | 3290 | |
|
3270 | 3291 |
|
|
3271 | 3292 |
|
|
3272 | 3293 |
|
|
3273 | 3294 |
|
|
3274 | 3295 |
|
|
3275 | 3296 |
|
|
3276 | 3297 | |
|
3277 | 3298 |
|
|
3278 | 3299 |
|
|
3279 | 3300 |
|
|
3280 | 3301 | |
|
3281 | 3302 |
|
|
3282 | 3303 |
|
|
3283 | 3304 | |
|
3284 | 3305 | |
|
3285 | 3306 |
|
|
3286 | 3307 |
|
|
3287 | 3308 | |
|
3288 | 3309 |
|
|
3289 | 3310 |
|
|
3290 | 3311 | |
|
3291 | 3312 |
|
|
3292 | 3313 |
|
|
3293 | 3314 |
|
|
3294 | 3315 | |
|
3295 | 3316 |
|
|
3296 | 3317 |
|
|
3297 | 3318 |
|
|
3298 | 3319 |
|
|
3299 | 3320 |
|
|
3300 | 3321 |
|
|
3301 | 3322 | |
|
3302 | 3323 |
|
|
3303 | 3324 | |
|
3304 | 3325 |
|
|
3305 | 3326 |
|
|
3306 | 3327 | |
|
3307 | 3328 | Static transformations, implemented in IPython.core.inputtransformer2, |
|
3308 | 3329 | deal with things like ``%magic`` and ``!system`` commands. |
|
3309 | 3330 | These run on all input. |
|
3310 | 3331 | Dynamic transformations, for things like unescaped magics and the exit |
|
3311 | 3332 | autocall, depend on the state of the interpreter. |
|
3312 | 3333 | These only apply to single line inputs. |
|
3313 | 3334 | |
|
3314 | 3335 | These string-based transformations are followed by AST transformations; |
|
3315 | 3336 | see :meth:`transform_ast`. |
|
3316 | 3337 | """ |
|
3317 | 3338 |
|
|
3318 | 3339 |
|
|
3319 | 3340 | |
|
3320 | 3341 |
|
|
3321 | 3342 |
|
|
3322 | 3343 |
|
|
3323 | 3344 |
|
|
3324 | 3345 |
|
|
3325 | 3346 |
|
|
3326 | 3347 | |
|
3327 | 3348 |
|
|
3328 | 3349 |
|
|
3329 | 3350 |
|
|
3330 | 3351 |
|
|
3331 | 3352 | |
|
3332 | 3353 |
|
|
3333 | 3354 | |
|
3334 | 3355 |
|
|
3335 | 3356 |
|
|
3336 | 3357 | |
|
3337 | 3358 | Parameters |
|
3338 | 3359 | ---------- |
|
3339 | 3360 | node : ast.Node |
|
3340 | 3361 | The root node to be transformed. Typically called with the ast.Module |
|
3341 | 3362 | produced by parsing user input. |
|
3342 | 3363 | |
|
3343 | 3364 | Returns |
|
3344 | 3365 | ------- |
|
3345 | 3366 | An ast.Node corresponding to the node it was called with. Note that it |
|
3346 | 3367 | may also modify the passed object, so don't rely on references to the |
|
3347 | 3368 | original AST. |
|
3348 | 3369 | """ |
|
3349 | 3370 |
|
|
3350 | 3371 |
|
|
3351 | 3372 |
|
|
3352 | 3373 |
|
|
3353 | 3374 |
|
|
3354 | 3375 |
|
|
3355 | 3376 |
|
|
3356 | 3377 |
|
|
3357 | 3378 |
|
|
3358 | 3379 |
|
|
3359 | 3380 |
|
|
3360 | 3381 |
|
|
3361 | 3382 |
|
|
3362 | 3383 |
|
|
3363 | 3384 | |
|
3364 | 3385 |
|
|
3365 | 3386 |
|
|
3366 | 3387 |
|
|
3367 | 3388 | |
|
3368 | 3389 |
|
|
3369 | 3390 |
|
|
3370 | 3391 |
|
|
3371 | 3392 |
|
|
3372 | 3393 |
|
|
3373 | 3394 |
|
|
3374 | 3395 |
|
|
3375 | 3396 |
|
|
3376 | 3397 |
|
|
3377 | 3398 | interactivity parameter. |
|
3378 | 3399 | |
|
3379 | 3400 | Parameters |
|
3380 | 3401 | ---------- |
|
3381 | 3402 | nodelist : list |
|
3382 | 3403 | A sequence of AST nodes to run. |
|
3383 | 3404 | cell_name : str |
|
3384 | 3405 | Will be passed to the compiler as the filename of the cell. Typically |
|
3385 | 3406 | the value returned by ip.compile.cache(cell). |
|
3386 | 3407 | interactivity : str |
|
3387 | 3408 | 'all', 'last', 'last_expr' , 'last_expr_or_assign' or 'none', |
|
3388 | 3409 | specifying which nodes should be run interactively (displaying output |
|
3389 | 3410 | from expressions). 'last_expr' will run the last node interactively |
|
3390 | 3411 | only if it is an expression (i.e. expressions in loops or other blocks |
|
3391 | 3412 | are not displayed) 'last_expr_or_assign' will run the last expression |
|
3392 | 3413 | or the last assignment. Other values for this parameter will raise a |
|
3393 | 3414 | ValueError. |
|
3394 | 3415 | |
|
3395 | 3416 | compiler : callable |
|
3396 | 3417 | A function with the same interface as the built-in compile(), to turn |
|
3397 | 3418 | the AST nodes into code objects. Default is the built-in compile(). |
|
3398 | 3419 | result : ExecutionResult, optional |
|
3399 | 3420 | An object to store exceptions that occur during execution. |
|
3400 | 3421 | |
|
3401 | 3422 | Returns |
|
3402 | 3423 | ------- |
|
3403 | 3424 | True if an exception occurred while running code, False if it finished |
|
3404 | 3425 | running. |
|
3405 | 3426 | """ |
|
3406 | 3427 |
|
|
3407 | 3428 |
|
|
3408 | 3429 | |
|
3409 | 3430 | |
|
3410 | 3431 |
|
|
3411 | 3432 |
|
|
3412 | 3433 |
|
|
3413 | 3434 |
|
|
3414 | 3435 |
|
|
3415 | 3436 |
|
|
3416 | 3437 |
|
|
3417 | 3438 |
|
|
3418 | 3439 |
|
|
3419 | 3440 |
|
|
3420 | 3441 |
|
|
3421 | 3442 |
|
|
3422 | 3443 |
|
|
3423 | 3444 |
|
|
3424 | 3445 | |
|
3425 | 3446 |
|
|
3426 | 3447 |
|
|
3427 | 3448 |
|
|
3428 | 3449 |
|
|
3429 | 3450 |
|
|
3430 | 3451 |
|
|
3431 | 3452 | |
|
3432 | 3453 |
|
|
3433 | 3454 |
|
|
3434 | 3455 |
|
|
3435 | 3456 |
|
|
3436 | 3457 |
|
|
3437 | 3458 |
|
|
3438 | 3459 |
|
|
3439 | 3460 |
|
|
3440 | 3461 | |
|
3441 | 3462 |
|
|
3442 | 3463 | |
|
3443 | 3464 |
|
|
3444 | 3465 |
|
|
3445 | 3466 |
|
|
3446 | 3467 | |
|
3447 | 3468 |
|
|
3448 | 3469 |
|
|
3449 | 3470 |
|
|
3450 | 3471 |
|
|
3451 | 3472 | |
|
3452 | 3473 |
|
|
3453 | 3474 |
|
|
3454 | 3475 | |
|
3455 | 3476 |
|
|
3456 | 3477 |
|
|
3457 | 3478 |
|
|
3458 | 3479 |
|
|
3459 | 3480 |
|
|
3460 | 3481 |
|
|
3461 | 3482 |
|
|
3462 | 3483 |
|
|
3463 | 3484 |
|
|
3464 | 3485 |
|
|
3465 | 3486 |
|
|
3466 | 3487 |
|
|
3467 | 3488 |
|
|
3468 | 3489 |
|
|
3469 | 3490 | |
|
3470 | 3491 |
|
|
3471 | 3492 |
|
|
3472 | 3493 |
|
|
3473 | 3494 | |
|
3474 | 3495 |
|
|
3475 | 3496 |
|
|
3476 | 3497 |
|
|
3477 | 3498 |
|
|
3478 | 3499 |
|
|
3479 | 3500 |
|
|
3480 | 3501 | |
|
3481 | 3502 |
|
|
3482 | 3503 |
|
|
3483 | 3504 |
|
|
3484 | 3505 |
|
|
3485 | 3506 |
|
|
3486 | 3507 |
|
|
3487 | 3508 |
|
|
3488 | 3509 | |
|
3489 | 3510 |
|
|
3490 | 3511 | |
|
3491 | 3512 |
|
|
3492 | 3513 |
|
|
3493 | 3514 | |
|
3494 | 3515 | When an exception occurs, self.showtraceback() is called to display a |
|
3495 | 3516 | traceback. |
|
3496 | 3517 | |
|
3497 | 3518 | Parameters |
|
3498 | 3519 | ---------- |
|
3499 | 3520 | code_obj : code object |
|
3500 | 3521 | A compiled code object, to be executed |
|
3501 | 3522 | result : ExecutionResult, optional |
|
3502 | 3523 | An object to store exceptions that occur during execution. |
|
3503 | 3524 | async_ : Bool (Experimental) |
|
3504 | 3525 | Attempt to run top-level asynchronous code in a default loop. |
|
3505 | 3526 | |
|
3506 | 3527 | Returns |
|
3507 | 3528 | ------- |
|
3508 | 3529 | False : successful execution. |
|
3509 | 3530 | True : an error occurred. |
|
3510 | 3531 | """ |
|
3511 | 3532 |
|
|
3512 | 3533 |
|
|
3513 | 3534 |
|
|
3514 | 3535 |
|
|
3515 | 3536 |
|
|
3516 | 3537 |
|
|
3517 | 3538 | |
|
3518 | 3539 |
|
|
3519 | 3540 |
|
|
3520 | 3541 |
|
|
3521 | 3542 |
|
|
3522 | 3543 |
|
|
3523 | 3544 |
|
|
3524 | 3545 |
|
|
3525 | 3546 |
|
|
3526 | 3547 |
|
|
3527 | 3548 |
|
|
3528 | 3549 |
|
|
3529 | 3550 |
|
|
3530 | 3551 |
|
|
3531 | 3552 |
|
|
3532 | 3553 |
|
|
3533 | 3554 |
|
|
3534 | 3555 |
|
|
3535 | 3556 |
|
|
3536 | 3557 |
|
|
3537 | 3558 |
|
|
3538 | 3559 |
|
|
3539 | 3560 |
|
|
3540 | 3561 |
|
|
3541 | 3562 |
|
|
3542 | 3563 |
|
|
3543 | 3564 |
|
|
3544 | 3565 |
|
|
3545 | 3566 |
|
|
3546 | 3567 |
|
|
3547 | 3568 |
|
|
3548 | 3569 |
|
|
3549 | 3570 |
|
|
3550 | 3571 |
|
|
3551 | 3572 |
|
|
3552 | 3573 |
|
|
3553 | 3574 | |
|
3554 | 3575 |
|
|
3555 | 3576 |
|
|
3556 | 3577 | |
|
3557 | 3578 |
|
|
3558 | 3579 |
|
|
3559 | 3580 | |
|
3560 | 3581 | Parameters |
|
3561 | 3582 | ---------- |
|
3562 | 3583 | code : string |
|
3563 | 3584 | Python input code, which can be multiline. |
|
3564 | 3585 | |
|
3565 | 3586 | Returns |
|
3566 | 3587 | ------- |
|
3567 | 3588 | status : str |
|
3568 | 3589 | One of 'complete', 'incomplete', or 'invalid' if source is not a |
|
3569 | 3590 | prefix of valid code. |
|
3570 | 3591 | indent : str |
|
3571 | 3592 | When status is 'incomplete', this is some whitespace to insert on |
|
3572 | 3593 | the next line of the prompt. |
|
3573 | 3594 | """ |
|
3574 | 3595 |
|
|
3575 | 3596 |
|
|
3576 | 3597 | |
|
3577 | 3598 |
|
|
3578 | 3599 |
|
|
3579 | 3600 |
|
|
3580 | 3601 | |
|
3581 | 3602 |
|
|
3582 | 3603 | |
|
3583 | 3604 |
|
|
3584 | 3605 |
|
|
3585 | 3606 | |
|
3586 | 3607 |
|
|
3587 | 3608 |
|
|
3588 | 3609 | |
|
3589 | 3610 | This takes the following steps: |
|
3590 | 3611 | |
|
3591 | 3612 | 1. select the appropriate eventloop and matplotlib backend |
|
3592 | 3613 | 2. set up matplotlib for interactive use with that backend |
|
3593 | 3614 | 3. configure formatters for inline figure display |
|
3594 | 3615 | 4. enable the selected gui eventloop |
|
3595 | 3616 | |
|
3596 | 3617 | Parameters |
|
3597 | 3618 | ---------- |
|
3598 | 3619 | gui : optional, string |
|
3599 | 3620 | If given, dictates the choice of matplotlib GUI backend to use |
|
3600 | 3621 | (should be one of IPython's supported backends, 'qt', 'osx', 'tk', |
|
3601 | 3622 | 'gtk', 'wx' or 'inline'), otherwise we use the default chosen by |
|
3602 | 3623 | matplotlib (as dictated by the matplotlib build-time options plus the |
|
3603 | 3624 | user's matplotlibrc configuration file). Note that not all backends |
|
3604 | 3625 | make sense in all contexts, for example a terminal ipython can't |
|
3605 | 3626 | display figures inline. |
|
3606 | 3627 | """ |
|
3607 | 3628 |
|
|
3608 | 3629 | |
|
3609 | 3630 |
|
|
3610 | 3631 |
|
|
3611 | 3632 | |
|
3612 | 3633 |
|
|
3613 | 3634 |
|
|
3614 | 3635 |
|
|
3615 | 3636 |
|
|
3616 | 3637 |
|
|
3617 | 3638 |
|
|
3618 | 3639 |
|
|
3619 | 3640 |
|
|
3620 | 3641 |
|
|
3621 | 3642 | |
|
3622 | 3643 |
|
|
3623 | 3644 |
|
|
3624 | 3645 | |
|
3625 | 3646 |
|
|
3626 | 3647 |
|
|
3627 | 3648 |
|
|
3628 | 3649 |
|
|
3629 | 3650 |
|
|
3630 | 3651 | |
|
3631 | 3652 |
|
|
3632 | 3653 | |
|
3633 | 3654 |
|
|
3634 | 3655 |
|
|
3635 | 3656 | |
|
3636 | 3657 | This turns on support for matplotlib, preloads into the interactive |
|
3637 | 3658 | namespace all of numpy and pylab, and configures IPython to correctly |
|
3638 | 3659 | interact with the GUI event loop. The GUI backend to be used can be |
|
3639 | 3660 | optionally selected with the optional ``gui`` argument. |
|
3640 | 3661 | |
|
3641 | 3662 | This method only adds preloading the namespace to InteractiveShell.enable_matplotlib. |
|
3642 | 3663 | |
|
3643 | 3664 | Parameters |
|
3644 | 3665 | ---------- |
|
3645 | 3666 | gui : optional, string |
|
3646 | 3667 | If given, dictates the choice of matplotlib GUI backend to use |
|
3647 | 3668 | (should be one of IPython's supported backends, 'qt', 'osx', 'tk', |
|
3648 | 3669 | 'gtk', 'wx' or 'inline'), otherwise we use the default chosen by |
|
3649 | 3670 | matplotlib (as dictated by the matplotlib build-time options plus the |
|
3650 | 3671 | user's matplotlibrc configuration file). Note that not all backends |
|
3651 | 3672 | make sense in all contexts, for example a terminal ipython can't |
|
3652 | 3673 | display figures inline. |
|
3653 | 3674 | import_all : optional, bool, default: True |
|
3654 | 3675 | Whether to do `from numpy import *` and `from pylab import *` |
|
3655 | 3676 | in addition to module imports. |
|
3656 | 3677 | welcome_message : deprecated |
|
3657 | 3678 | This argument is ignored, no welcome message will be displayed. |
|
3658 | 3679 | """ |
|
3659 | 3680 |
|
|
3660 | 3681 | |
|
3661 | 3682 |
|
|
3662 | 3683 | |
|
3663 | 3684 |
|
|
3664 | 3685 |
|
|
3665 | 3686 |
|
|
3666 | 3687 |
|
|
3667 | 3688 |
|
|
3668 | 3689 |
|
|
3669 | 3690 |
|
|
3670 | 3691 |
|
|
3671 | 3692 |
|
|
3672 | 3693 |
|
|
3673 | 3694 |
|
|
3674 | 3695 |
|
|
3675 | 3696 |
|
|
3676 | 3697 | |
|
3677 | 3698 |
|
|
3678 | 3699 |
|
|
3679 | 3700 |
|
|
3680 | 3701 | |
|
3681 | 3702 |
|
|
3682 | 3703 |
|
|
3683 | 3704 | |
|
3684 | 3705 | The depth argument indicates how many frames above the caller should |
|
3685 | 3706 | be walked to look for the local namespace where to expand variables. |
|
3686 | 3707 | |
|
3687 | 3708 | The global namespace for expansion is always the user's interactive |
|
3688 | 3709 | namespace. |
|
3689 | 3710 | """ |
|
3690 | 3711 |
|
|
3691 | 3712 |
|
|
3692 | 3713 |
|
|
3693 | 3714 |
|
|
3694 | 3715 |
|
|
3695 | 3716 |
|
|
3696 | 3717 |
|
|
3697 | 3718 |
|
|
3698 | 3719 |
|
|
3699 | 3720 | |
|
3700 | 3721 |
|
|
3701 | 3722 |
|
|
3702 | 3723 |
|
|
3703 | 3724 |
|
|
3704 | 3725 |
|
|
3705 | 3726 |
|
|
3706 | 3727 |
|
|
3707 | 3728 |
|
|
3708 | 3729 |
|
|
3709 | 3730 | |
|
3710 | 3731 |
|
|
3711 | 3732 |
|
|
3712 | 3733 | |
|
3713 | 3734 | This makes a call to tempfile.mkstemp (created in a tempfile.mkdtemp), |
|
3714 | 3735 | but it registers the created filename internally so ipython cleans it up |
|
3715 | 3736 | at exit time. |
|
3716 | 3737 | |
|
3717 | 3738 | Optional inputs: |
|
3718 | 3739 | |
|
3719 | 3740 | - data(None): if data is given, it gets written out to the temp file |
|
3720 | 3741 | immediately, and the file is closed again.""" |
|
3721 | 3742 | |
|
3722 | 3743 |
|
|
3723 | 3744 |
|
|
3724 | 3745 | |
|
3725 | 3746 |
|
|
3726 | 3747 |
|
|
3727 | 3748 | |
|
3728 | 3749 |
|
|
3729 | 3750 |
|
|
3730 | 3751 | |
|
3731 | 3752 |
|
|
3732 | 3753 |
|
|
3733 | 3754 |
|
|
3734 | 3755 | |
|
3735 | 3756 |
|
|
3736 | 3757 |
|
|
3737 | 3758 |
|
|
3738 | 3759 |
|
|
3739 | 3760 | |
|
3740 | 3761 |
|
|
3741 | 3762 |
|
|
3742 | 3763 |
|
|
3743 | 3764 | |
|
3744 | 3765 |
|
|
3745 | 3766 |
|
|
3746 | 3767 | |
|
3747 | 3768 | Parameters |
|
3748 | 3769 | ---------- |
|
3749 | 3770 | range_str : str |
|
3750 | 3771 | The set of slices is given as a string, like "~5/6-~4/2 4:8 9", |
|
3751 | 3772 | since this function is for use by magic functions which get their |
|
3752 | 3773 | arguments as strings. The number before the / is the session |
|
3753 | 3774 | number: ~n goes n back from the current session. |
|
3754 | 3775 | |
|
3755 | 3776 | If empty string is given, returns history of current session |
|
3756 | 3777 | without the last input. |
|
3757 | 3778 | |
|
3758 | 3779 | raw : bool, optional |
|
3759 | 3780 | By default, the processed input is used. If this is true, the raw |
|
3760 | 3781 | input history is used instead. |
|
3761 | 3782 | |
|
3762 | 3783 | Notes |
|
3763 | 3784 | ----- |
|
3764 | 3785 | Slices can be described with two notations: |
|
3765 | 3786 | |
|
3766 | 3787 | * ``N:M`` -> standard python form, means including items N...(M-1). |
|
3767 | 3788 | * ``N-M`` -> include items N..M (closed endpoint). |
|
3768 | 3789 | """ |
|
3769 | 3790 |
|
|
3770 | 3791 |
|
|
3771 | 3792 | |
|
3772 | 3793 |
|
|
3773 | 3794 |
|
|
3774 | 3795 |
|
|
3775 | 3796 |
|
|
3776 | 3797 |
|
|
3777 | 3798 |
|
|
3778 | 3799 | |
|
3779 | 3800 |
|
|
3780 | 3801 | |
|
3781 | 3802 |
|
|
3782 | 3803 |
|
|
3783 | 3804 | |
|
3784 | 3805 | This is mainly used by magic functions. |
|
3785 | 3806 | |
|
3786 | 3807 | Parameters |
|
3787 | 3808 | ---------- |
|
3788 | 3809 | target : str |
|
3789 | 3810 | A string specifying code to retrieve. This will be tried respectively |
|
3790 | 3811 | as: ranges of input history (see %history for syntax), url, |
|
3791 | 3812 | corresponding .py file, filename, or an expression evaluating to a |
|
3792 | 3813 | string or Macro in the user namespace. |
|
3793 | 3814 | |
|
3794 | 3815 | If empty string is given, returns complete history of current |
|
3795 | 3816 | session, without the last line. |
|
3796 | 3817 | |
|
3797 | 3818 | raw : bool |
|
3798 | 3819 | If true (default), retrieve raw history. Has no effect on the other |
|
3799 | 3820 | retrieval mechanisms. |
|
3800 | 3821 | |
|
3801 | 3822 | py_only : bool (default False) |
|
3802 | 3823 | Only try to fetch python code, do not try alternative methods to decode file |
|
3803 | 3824 | if unicode fails. |
|
3804 | 3825 | |
|
3805 | 3826 | Returns |
|
3806 | 3827 | ------- |
|
3807 | 3828 | A string of code. |
|
3808 | 3829 | ValueError is raised if nothing is found, and TypeError if it evaluates |
|
3809 | 3830 | to an object of another type. In each case, .args[0] is a printable |
|
3810 | 3831 | message. |
|
3811 | 3832 | """ |
|
3812 | 3833 |
|
|
3813 | 3834 |
|
|
3814 | 3835 |
|
|
3815 | 3836 |
|
|
3816 | 3837 |
|
|
3817 | 3838 |
|
|
3818 | 3839 |
|
|
3819 | 3840 |
|
|
3820 | 3841 |
|
|
3821 | 3842 |
|
|
3822 | 3843 |
|
|
3823 | 3844 |
|
|
3824 | 3845 |
|
|
3825 | 3846 | |
|
3826 | 3847 |
|
|
3827 | 3848 |
|
|
3828 | 3849 |
|
|
3829 | 3850 |
|
|
3830 | 3851 |
|
|
3831 | 3852 | |
|
3832 | 3853 |
|
|
3833 | 3854 |
|
|
3834 | 3855 |
|
|
3835 | 3856 |
|
|
3836 | 3857 |
|
|
3837 | 3858 |
|
|
3838 | 3859 |
|
|
3839 | 3860 |
|
|
3840 | 3861 |
|
|
3841 | 3862 |
|
|
3842 | 3863 |
|
|
3843 | 3864 | |
|
3844 | 3865 |
|
|
3845 | 3866 |
|
|
3846 | 3867 |
|
|
3847 | 3868 |
|
|
3848 | 3869 |
|
|
3849 | 3870 | |
|
3850 | 3871 |
|
|
3851 | 3872 |
|
|
3852 | 3873 |
|
|
3853 | 3874 |
|
|
3854 | 3875 |
|
|
3855 | 3876 | |
|
3856 | 3877 |
|
|
3857 | 3878 |
|
|
3858 | 3879 |
|
|
3859 | 3880 |
|
|
3860 | 3881 | |
|
3861 | 3882 |
|
|
3862 | 3883 |
|
|
3863 | 3884 | |
|
3864 | 3885 |
|
|
3865 | 3886 |
|
|
3866 | 3887 | At exist operation that need to be called at most once. |
|
3867 | 3888 | Second call to this function per instance will do nothing. |
|
3868 | 3889 | """ |
|
3869 | 3890 | |
|
3870 | 3891 |
|
|
3871 | 3892 |
|
|
3872 | 3893 |
|
|
3873 | 3894 |
|
|
3874 | 3895 |
|
|
3875 | 3896 |
|
|
3876 | 3897 |
|
|
3877 | 3898 |
|
|
3878 | 3899 |
|
|
3879 | 3900 | |
|
3880 | 3901 |
|
|
3881 | 3902 |
|
|
3882 | 3903 |
|
|
3883 | 3904 |
|
|
3884 | 3905 |
|
|
3885 | 3906 | |
|
3886 | 3907 | Cleanup operations and saving of persistent data that is done |
|
3887 | 3908 | unconditionally by IPython should be performed here. |
|
3888 | 3909 | |
|
3889 | 3910 | For things that may depend on startup flags or platform specifics (such |
|
3890 | 3911 | as having readline or not), register a separate atexit function in the |
|
3891 | 3912 | code that has the appropriate information, rather than trying to |
|
3892 | 3913 | clutter |
|
3893 | 3914 | """ |
|
3894 | 3915 |
|
|
3895 | 3916 | |
|
3896 | 3917 |
|
|
3897 | 3918 |
|
|
3898 | 3919 |
|
|
3899 | 3920 |
|
|
3900 | 3921 |
|
|
3901 | 3922 |
|
|
3902 | 3923 |
|
|
3903 | 3924 |
|
|
3904 | 3925 |
|
|
3905 | 3926 |
|
|
3906 | 3927 |
|
|
3907 | 3928 |
|
|
3908 | 3929 |
|
|
3909 | 3930 |
|
|
3910 | 3931 |
|
|
3911 | 3932 | |
|
3912 | 3933 |
|
|
3913 | 3934 |
|
|
3914 | 3935 |
|
|
3915 | 3936 |
|
|
3916 | 3937 | |
|
3917 | 3938 |
|
|
3918 | 3939 |
|
|
3919 | 3940 | |
|
3920 | 3941 | |
|
3921 | 3942 |
|
|
3922 | 3943 |
|
|
3923 | 3944 |
|
|
3924 | 3945 | |
|
3925 | 3946 | |
|
3926 | 3947 |
|
|
3927 | 3948 |
|
|
3928 | 3949 | |
|
3929 | 3950 |
|
@@ -1,117 +1,117 b'' | |||
|
1 | 1 | [metadata] |
|
2 | 2 | name = ipython |
|
3 | 3 | version = attr: IPython.core.release.__version__ |
|
4 | 4 | url = https://ipython.org |
|
5 | 5 | description = IPython: Productive Interactive Computing |
|
6 | 6 | long_description_content_type = text/x-rst |
|
7 | 7 | long_description = file: long_description.rst |
|
8 | 8 | license_file = LICENSE |
|
9 | 9 | project_urls = |
|
10 | 10 | Documentation = https://ipython.readthedocs.io/ |
|
11 | 11 | Funding = https://numfocus.org/ |
|
12 | 12 | Source = https://github.com/ipython/ipython |
|
13 | 13 | Tracker = https://github.com/ipython/ipython/issues |
|
14 | 14 | keywords = Interactive, Interpreter, Shell, Embedding |
|
15 | 15 | platforms = Linux, Mac OSX, Windows |
|
16 | 16 | classifiers = |
|
17 | 17 | Framework :: IPython |
|
18 | 18 | Framework :: Jupyter |
|
19 | 19 | Intended Audience :: Developers |
|
20 | 20 | Intended Audience :: Science/Research |
|
21 | 21 | License :: OSI Approved :: BSD License |
|
22 | 22 | Programming Language :: Python |
|
23 | 23 | Programming Language :: Python :: 3 |
|
24 | 24 | Programming Language :: Python :: 3 :: Only |
|
25 | 25 | Topic :: System :: Shells |
|
26 | 26 | |
|
27 | 27 | [options] |
|
28 | 28 | packages = find: |
|
29 | 29 | python_requires = >=3.9 |
|
30 | 30 | zip_safe = False |
|
31 | 31 | install_requires = |
|
32 | 32 | appnope; sys_platform == "darwin" |
|
33 | 33 | colorama; sys_platform == "win32" |
|
34 | 34 | decorator |
|
35 | 35 | exceptiongroup; python_version<'3.11' |
|
36 | 36 | jedi>=0.16 |
|
37 | 37 | matplotlib-inline |
|
38 | 38 | pexpect>4.3; sys_platform != "win32" |
|
39 | pickleshare | |
|
40 | 39 | prompt_toolkit>=3.0.30,<3.1.0,!=3.0.37 |
|
41 | 40 | pygments>=2.4.0 |
|
42 | 41 | stack_data |
|
43 | 42 | traitlets>=5 |
|
44 | 43 | typing_extensions ; python_version<'3.10' |
|
45 | 44 | |
|
46 | 45 | [options.extras_require] |
|
47 | 46 | black = |
|
48 | 47 | black |
|
49 | 48 | doc = |
|
50 | 49 | ipykernel |
|
51 | 50 | setuptools>=18.5 |
|
52 | 51 | sphinx>=1.3 |
|
53 | 52 | sphinx-rtd-theme |
|
54 | 53 | docrepr |
|
55 | 54 | matplotlib |
|
56 | 55 | stack_data |
|
57 | 56 | pytest<7 |
|
58 | 57 | typing_extensions |
|
59 | 58 | exceptiongroup |
|
60 | 59 | %(test)s |
|
61 | 60 | kernel = |
|
62 | 61 | ipykernel |
|
63 | 62 | nbconvert = |
|
64 | 63 | nbconvert |
|
65 | 64 | nbformat = |
|
66 | 65 | nbformat |
|
67 | 66 | notebook = |
|
68 | 67 | ipywidgets |
|
69 | 68 | notebook |
|
70 | 69 | parallel = |
|
71 | 70 | ipyparallel |
|
72 | 71 | qtconsole = |
|
73 | 72 | qtconsole |
|
74 | 73 | terminal = |
|
75 | 74 | test = |
|
76 | 75 | pytest<7.1 |
|
77 | 76 | pytest-asyncio |
|
78 | 77 | testpath |
|
78 | pickleshare | |
|
79 | 79 | test_extra = |
|
80 | 80 | %(test)s |
|
81 | 81 | curio |
|
82 | 82 | matplotlib!=3.2.0 |
|
83 | 83 | nbformat |
|
84 | 84 | numpy>=1.22 |
|
85 | 85 | pandas |
|
86 | 86 | trio |
|
87 | 87 | all = |
|
88 | 88 | %(black)s |
|
89 | 89 | %(doc)s |
|
90 | 90 | %(kernel)s |
|
91 | 91 | %(nbconvert)s |
|
92 | 92 | %(nbformat)s |
|
93 | 93 | %(notebook)s |
|
94 | 94 | %(parallel)s |
|
95 | 95 | %(qtconsole)s |
|
96 | 96 | %(terminal)s |
|
97 | 97 | %(test_extra)s |
|
98 | 98 | %(test)s |
|
99 | 99 | |
|
100 | 100 | [options.packages.find] |
|
101 | 101 | exclude = |
|
102 | 102 | setupext |
|
103 | 103 | |
|
104 | 104 | [options.package_data] |
|
105 | 105 | IPython = py.typed |
|
106 | 106 | IPython.core = profile/README* |
|
107 | 107 | IPython.core.tests = *.png, *.jpg, daft_extension/*.py |
|
108 | 108 | IPython.lib.tests = *.wav |
|
109 | 109 | IPython.testing.plugin = *.txt |
|
110 | 110 | |
|
111 | 111 | [velin] |
|
112 | 112 | ignore_patterns = |
|
113 | 113 | IPython/core/tests |
|
114 | 114 | IPython/testing |
|
115 | 115 | |
|
116 | 116 | [tool.black] |
|
117 | 117 | exclude = 'timing\.py' |
General Comments 0
You need to be logged in to leave comments.
Login now