22==========
33"""
44
5- from typing import Any , Callable
5+ from collections .abc import Callable
6+ from typing import Any
67
78from IPython .terminal .interactiveshell import TerminalInteractiveShell
89from IPython .terminal .prompts import ClassicPrompts , Prompts
@@ -16,7 +17,7 @@ def get_new_prompts_class(
1617 prompts_class : type ,
1718 hook : Callable = wakatime_hook ,
1819 args : tuple = (),
19- kwargs : dict [str , Any ] = {} ,
20+ kwargs : dict [str , Any ] | None = None ,
2021) -> type :
2122 """Get new prompts class.
2223
@@ -27,9 +28,11 @@ def get_new_prompts_class(
2728 :param args:
2829 :type args: tuple
2930 :param kwargs:
30- :type kwargs: dict[str, Any]
31+ :type kwargs: dict[str, Any] | None
3132 :rtype: type
3233 """
34+ if kwargs is None :
35+ kwargs = {}
3336 if isinstance (prompts_class , LazyConfigValue ):
3437 prompts_class = ClassicPrompts
3538 shell = TerminalInteractiveShell ()
@@ -77,7 +80,7 @@ def install_hook(
7780 c : Config ,
7881 hook : Callable = wakatime_hook ,
7982 args : tuple = (),
80- kwargs : dict [str , Any ] = { "plugin" : "repl-ipython-wakatime" } ,
83+ kwargs : dict [str , Any ] | None = None ,
8184) -> Config :
8285 """Install hook.
8386
@@ -88,10 +91,15 @@ def install_hook(
8891 :param args:
8992 :type args: tuple
9093 :param kwargs:
91- :type kwargs: dict[str, Any]
94+ :type kwargs: dict[str, Any] | None
9295 :rtype: Config
9396 """
97+ if kwargs is None :
98+ kwargs = {"plugin" : "repl-ipython-wakatime" }
9499 c .TerminalInteractiveShell .prompts_class = get_new_prompts_class ( # type: ignore
95- c .TerminalInteractiveShell .prompts_class , hook , args , kwargs # type: ignore
100+ c .TerminalInteractiveShell .prompts_class ,
101+ hook ,
102+ args ,
103+ kwargs , # type: ignore
96104 )
97105 return c
0 commit comments