diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index e0a481c..03b58c6 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -26,20 +26,9 @@ jobs: pip install mypy pyflakes flake8 - name: Lint with mypy run: | - mypy IPython/terminal/ptutils.py - mypy IPython/core/magics/*.py - mypy IPython/terminal/__init__.py - mypy IPython/terminal/console.py - #mypy IPython/terminal/debugger.py - #mypy IPython/terminal/embed.py - mypy IPython/terminal/interactiveshell.py - mypy IPython/terminal/ipapp.py - mypy IPython/terminal/magics.py - mypy IPython/terminal/prompts.py - mypy IPython/terminal/ptshell.py - mypy IPython/terminal/ptutils.py - mypy IPython/terminal/shortcuts.py - mypy IPython/core/c*.py + mypy -p IPython.terminal + mypy -p IPython.core.magics - name: Lint with pyflakes run: | flake8 IPython/core/magics/script.py + flake8 IPython/core/magics/packaging.py diff --git a/IPython/terminal/debugger.py b/IPython/terminal/debugger.py index 1ea1a86..57aa5dd 100644 --- a/IPython/terminal/debugger.py +++ b/IPython/terminal/debugger.py @@ -161,6 +161,6 @@ if __name__ == '__main__': # happened after hitting "c", this is needed in order to # be able to quit the debugging session (see #9950). old_trace_dispatch = pdb.Pdb.trace_dispatch - pdb.Pdb = TerminalPdb - pdb.Pdb.trace_dispatch = old_trace_dispatch + pdb.Pdb = TerminalPdb # type: ignore + pdb.Pdb.trace_dispatch = old_trace_dispatch # type: ignore pdb.main() diff --git a/IPython/terminal/embed.py b/IPython/terminal/embed.py index 188844f..b5ceeec 100644 --- a/IPython/terminal/embed.py +++ b/IPython/terminal/embed.py @@ -19,6 +19,8 @@ from IPython.terminal.ipapp import load_default_config from traitlets import Bool, CBool, Unicode from IPython.utils.io import ask_yes_no +from typing import Set + class KillEmbedded(Exception):pass # kept for backward compatibility as IPython 6 was released with @@ -123,17 +125,17 @@ class InteractiveShellEmbed(TerminalInteractiveShell): help="Automatically set the terminal title" ).tag(config=True) - _inactive_locations = set() + _inactive_locations: Set[str] = set() + + def _disable_init_location(self): + """Disable the current Instance creation location""" + InteractiveShellEmbed._inactive_locations.add(self._init_location_id) @property def embedded_active(self): return (self._call_location_id not in InteractiveShellEmbed._inactive_locations)\ and (self._init_location_id not in InteractiveShellEmbed._inactive_locations) - def _disable_init_location(self): - """Disable the current Instance creation location""" - InteractiveShellEmbed._inactive_locations.add(self._init_location_id) - @embedded_active.setter def embedded_active(self, value): if value: diff --git a/IPython/terminal/pt_inputhooks/osx.py b/IPython/terminal/pt_inputhooks/osx.py index 8044019..2754820 100644 --- a/IPython/terminal/pt_inputhooks/osx.py +++ b/IPython/terminal/pt_inputhooks/osx.py @@ -9,7 +9,7 @@ import ctypes import ctypes.util from threading import Event -objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('objc')) +objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("objc")) # type: ignore void_p = ctypes.c_void_p @@ -37,7 +37,7 @@ def C(classname): # end obj-c boilerplate from appnope # CoreFoundation C-API calls we will use: -CoreFoundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation')) +CoreFoundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library("CoreFoundation")) # type: ignore CFFileDescriptorCreate = CoreFoundation.CFFileDescriptorCreate CFFileDescriptorCreate.restype = void_p