From d32707a29e07b47ad232560698158d525de67ea4 2024-02-08 09:47:42 From: Matthias Bussonnier Date: 2024-02-08 09:47:42 Subject: [PATCH] ignore some traitlets types --- diff --git a/IPython/core/historyapp.py b/IPython/core/historyapp.py index 01a5534..85dd9c5 100644 --- a/IPython/core/historyapp.py +++ b/IPython/core/historyapp.py @@ -32,25 +32,21 @@ This is an handy alias to `ipython history trim --keep=0` class HistoryTrim(BaseIPythonApplication): description = trim_hist_help - - backup = Bool(False, - help="Keep the old history file as history.sqlite." - ).tag(config=True) - - keep = Int(1000, - help="Number of recent lines to keep in the database." - ).tag(config=True) - - flags = Dict(dict( - backup = ({'HistoryTrim' : {'backup' : True}}, - backup.help - ) - )) - aliases=Dict(dict( - keep = 'HistoryTrim.keep' - )) - + backup = Bool(False, help="Keep the old history file as history.sqlite.").tag( + config=True + ) + + keep = Int(1000, help="Number of recent lines to keep in the database.").tag( + config=True + ) + + flags = Dict( # type: ignore + dict(backup=({"HistoryTrim": {"backup": True}}, backup.help)) + ) + + aliases = Dict(dict(keep="HistoryTrim.keep")) # type: ignore + def start(self): profile_dir = Path(self.profile_dir.location) hist_file = profile_dir / "history.sqlite" @@ -114,34 +110,33 @@ class HistoryTrim(BaseIPythonApplication): print("Backed up longer history file to", backup_hist_file) else: hist_file.unlink() - + new_hist_file.rename(hist_file) + class HistoryClear(HistoryTrim): description = clear_hist_help - keep = Int(0, - help="Number of recent lines to keep in the database.") - - force = Bool(False, - help="Don't prompt user for confirmation" - ).tag(config=True) - - flags = Dict(dict( - force = ({'HistoryClear' : {'force' : True}}, - force.help), - f = ({'HistoryTrim' : {'force' : True}}, - force.help + keep = Int(0, help="Number of recent lines to keep in the database.") + + force = Bool(False, help="Don't prompt user for confirmation").tag(config=True) + + flags = Dict( # type: ignore + dict( + force=({"HistoryClear": {"force": True}}, force.help), + f=({"HistoryTrim": {"force": True}}, force.help), ) - )) - aliases = Dict() + ) + aliases = Dict() # type: ignore def start(self): - if self.force or ask_yes_no("Really delete all ipython history? ", - default="no", interrupt="no"): + if self.force or ask_yes_no( + "Really delete all ipython history? ", default="no", interrupt="no" + ): HistoryTrim.start(self) + class HistoryApp(Application): - name = u'ipython-history' + name = "ipython-history" description = "Manage the IPython history database." subcommands = Dict(dict( diff --git a/pyproject.toml b/pyproject.toml index 15ea5c1..32ef454 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ exclude = [ 'IPython/core/application.py', 'IPython/core/completerlib.py', 'IPython/core/displaypub.py', - 'IPython/core/historyapp.py', #'IPython/core/interactiveshell.py', 'IPython/core/magic.py', 'IPython/core/profileapp.py', @@ -30,8 +29,6 @@ exclude = [ 'IPython/terminal/ipapp.py', 'IPython/utils/_process_win32.py', 'IPython/utils/path.py', - 'IPython/utils/timing.py', - 'IPython/utils/text.py' ] [tool.pytest.ini_options]