()
| 17 | |
| 18 | # after: https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook |
| 19 | def _in_notebook(): |
| 20 | try: |
| 21 | from IPython import get_ipython # noqa |
| 22 | |
| 23 | if "IPKernelApp" not in get_ipython().config: # noqa |
| 24 | return False |
| 25 | except ImportError: |
| 26 | return False |
| 27 | except AttributeError: |
| 28 | return False |
| 29 | return True |
| 30 | |
| 31 | |
| 32 | @check_arg_types |