This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
#### to reset the logging basicConfig, you need to reload the module | |
# from importlib import reload | |
# reload(logging) | |
logging.basicConfig(filename='debugging.log', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Jupyter notebook configurations and interactive examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plotting does actually currently work on my end. You just have to add plt.show() after the plot command. | |
``` | |
plt.matshow(df) | |
plt.show() | |
``` | |
This pops up an external plot window. The debug console is then blocked and will complain that plt.show() did not finish after 3 seconds, but the plot is there and fully functional. | |
Then when i am done analyzing the figure, I click on close, or press q (the shortcut for closing a matplotlib window) and that unblocks the debugger. The plot window though doesn't disappear, but freezes. But it's still possible to do additional plots like that, which will then use the same window. It's also possible to prepare several figure objects in one or several debugging commands, and plt.show() will show all of them. In addition if you show the plot with plt.pause(0.001) instead of plt.show(), then you return immediately back to the debug terminal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import numba | |
# @numba.jit | |
@numba.vectorize(([numba.float64(numba.float64)])) | |
def count_triples(limit): | |
result = 0 | |
for a in range(1, limit+1): | |
for b in range(a+1, limit+1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect, re | |
def varname(p): | |
for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]: | |
m = re.search(r'\bvarname\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)', line) | |
if m: | |
return m.group(1) | |
print(varname(df_stimulus)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import TYPE_CHECKING | |
from typing import List | |
# l: List[int] = [1, 2, 3] | |
l = [1, 2, 3] | |
if TYPE_CHECKING: | |
reveal_type(l) # pylint: disable=undefined-variable | |
print(TYPE_CHECKING) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[pytest] | |
junit_family=xunit1 | |
addopts= --cov=src/primitive_types --cov-report=xml # needs pip install pytest-cov |
NewerOlder