Commit 8faa766
committed
Rolled back changes, moved code to Cython level
line_profiler/_line_profiler.pyx
LineProfiler
- Added:
- Private class attribute `._active_instances_getter`
- Private property `._active_instances`
- Refactored `.enable()` and `.disable()` so that multiple
instances of `LineProfiler` are supported
python_trace_callback()
- Updated call signature; instead of taking a `LineProfiler`
`PyObject`, now it takes an iterable thereof
- Refactored implementation to work with all profiler instances
in said iterable
line_profiler/line_profiler.py[i]
<General>
Rolled back most of the code changes (e.g. now a
`line_profiler._line_profiler.LineProfiler` subclass again)
LineProfiler.add_callable()
- Added check for if the callable is a wrapper created by
another profiler, in which case the wrapped function's
`add_callable()` should be called instead
- Fixed erroneous stub-file return annotation (`None` ->
`Literal[0, 1]`)
LineProfiler._already_a_wrapper(), ._mark_wrapper()
Renamed and updated implementations
line_profiler/profiler_mixin.py::ByCountProfilerMixin
<General>
Rolled back most of the code changes (e.g. removed the new
private `._get_toggle_callbacks()` method)
_already_a_wrapper() (<- `_already_wrapped()`)
_mark_wrapper() (<- `_mark_wrapped()`)
Renamed methods for clarity
tests/test_line_profiler.py
test_multiple_profilers_metadata()
Removed test because `line_profiler.LineProfiler` no longer
wraps around `line_profiler._line_profiler.LineProfiler`
test_multiple_profilers_usage()
Updated to reflect the new, improved implementation: profiler
instances and created wrappers are now separate, so profiling is
granular and only happens e.g. when the appropriate wrapper is
called1 parent d9f20cc commit 8faa766
5 files changed
Lines changed: 100 additions & 517 deletions
File tree
- line_profiler
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
245 | 248 | | |
246 | 249 | | |
247 | 250 | | |
| |||
308 | 311 | | |
309 | 312 | | |
310 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
311 | 319 | | |
312 | 320 | | |
313 | 321 | | |
| |||
334 | 342 | | |
335 | 343 | | |
336 | 344 | | |
337 | | - | |
338 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
339 | 350 | | |
340 | 351 | | |
341 | 352 | | |
| |||
386 | 397 | | |
387 | 398 | | |
388 | 399 | | |
| 400 | + | |
389 | 401 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
395 | 409 | | |
396 | 410 | | |
397 | 411 | | |
| |||
432 | 446 | | |
433 | 447 | | |
434 | 448 | | |
435 | | - | |
| 449 | + | |
| 450 | + | |
436 | 451 | | |
437 | 452 | | |
438 | 453 | | |
439 | 454 | | |
440 | 455 | | |
441 | 456 | | |
442 | 457 | | |
443 | | - | |
| 458 | + | |
| 459 | + | |
444 | 460 | | |
445 | 461 | | |
446 | 462 | | |
| |||
451 | 467 | | |
452 | 468 | | |
453 | 469 | | |
454 | | - | |
455 | | - | |
456 | 470 | | |
457 | 471 | | |
458 | 472 | | |
459 | 473 | | |
460 | 474 | | |
461 | 475 | | |
462 | 476 | | |
463 | | - | |
464 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
465 | 482 | | |
466 | | - | |
467 | | - | |
468 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
469 | 486 | | |
470 | 487 | | |
471 | | - | |
472 | | - | |
473 | | - | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
474 | 491 | | |
475 | 492 | | |
476 | 493 | | |
477 | | - | |
478 | | - | |
| 494 | + | |
| 495 | + | |
479 | 496 | | |
480 | 497 | | |
481 | 498 | | |
482 | | - | |
| 499 | + | |
483 | 500 | | |
484 | 501 | | |
0 commit comments