Show More
@@ -25,6 +25,7 b' import tempfile' | |||||
25 | import traceback |
|
25 | import traceback | |
26 | import types |
|
26 | import types | |
27 | import subprocess |
|
27 | import subprocess | |
|
28 | import warnings | |||
28 | from io import open as io_open |
|
29 | from io import open as io_open | |
29 |
|
30 | |||
30 | from pickleshare import PickleShareDB |
|
31 | from pickleshare import PickleShareDB | |
@@ -547,6 +548,7 b' class InteractiveShell(SingletonConfigurable):' | |||||
547 | self.init_pdb() |
|
548 | self.init_pdb() | |
548 | self.init_extension_manager() |
|
549 | self.init_extension_manager() | |
549 | self.init_payload() |
|
550 | self.init_payload() | |
|
551 | self.init_deprecation_warnings() | |||
550 | self.hooks.late_startup_hook() |
|
552 | self.hooks.late_startup_hook() | |
551 | self.events.trigger('shell_initialized', self) |
|
553 | self.events.trigger('shell_initialized', self) | |
552 | atexit.register(self.atexit_operations) |
|
554 | atexit.register(self.atexit_operations) | |
@@ -663,6 +665,18 b' class InteractiveShell(SingletonConfigurable):' | |||||
663 | elif self.logstart: |
|
665 | elif self.logstart: | |
664 | self.magic('logstart') |
|
666 | self.magic('logstart') | |
665 |
|
667 | |||
|
668 | @staticmethod | |||
|
669 | def init_deprecation_warnings(): | |||
|
670 | """ | |||
|
671 | register default filter for (pending) deprecation warning. | |||
|
672 | ||||
|
673 | This will allow deprecation warning of function used interactively to show | |||
|
674 | warning to users, and still hide deprecation warning from libraries import. | |||
|
675 | """ | |||
|
676 | warnings.filterwarnings("default", category=DeprecationWarning, module="__main__") | |||
|
677 | warnings.filterwarnings("default", category=PendingDeprecationWarning, module="__main__") | |||
|
678 | ||||
|
679 | ||||
666 | def init_builtins(self): |
|
680 | def init_builtins(self): | |
667 | # A single, static flag that we set to True. Its presence indicates |
|
681 | # A single, static flag that we set to True. Its presence indicates | |
668 | # that an IPython shell has been created, and we make no attempts at |
|
682 | # that an IPython shell has been created, and we make no attempts at |
General Comments 0
You need to be logged in to leave comments.
Login now