Skip to content

Commit 7d05cfb

Browse files
committed
Correct Any type annotations.
1 parent e526895 commit 7d05cfb

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

jupyter_client/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,19 @@ def __del__(self):
137137
# Channel proxy methods
138138
# --------------------------------------------------------------------------
139139

140-
async def _async_get_shell_msg(self, *args: Any, **kwargs: Any) -> t.Dict[str, t.Any]:
140+
async def _async_get_shell_msg(self, *args: t.Any, **kwargs: t.Any) -> t.Dict[str, t.Any]:
141141
"""Get a message from the shell channel"""
142142
return await self.shell_channel.get_msg(*args, **kwargs)
143143

144-
async def _async_get_iopub_msg(self, *args: Any, **kwargs: Any) -> t.Dict[str, t.Any]:
144+
async def _async_get_iopub_msg(self, *args: t.Any, **kwargs: t.Any) -> t.Dict[str, t.Any]:
145145
"""Get a message from the iopub channel"""
146146
return await self.iopub_channel.get_msg(*args, **kwargs)
147147

148-
async def _async_get_stdin_msg(self, *args: Any, **kwargs: Any) -> t.Dict[str, t.Any]:
148+
async def _async_get_stdin_msg(self, *args: t.Any, **kwargs: t.Any) -> t.Dict[str, t.Any]:
149149
"""Get a message from the stdin channel"""
150150
return await self.stdin_channel.get_msg(*args, **kwargs)
151151

152-
async def _async_get_control_msg(self, *args: Any, **kwargs: Any) -> t.Dict[str, t.Any]:
152+
async def _async_get_control_msg(self, *args: t.Any, **kwargs: t.Any) -> t.Dict[str, t.Any]:
153153
"""Get a message from the control channel"""
154154
return await self.control_channel.get_msg(*args, **kwargs)
155155

@@ -270,7 +270,7 @@ def _output_hook_kernel(
270270
self,
271271
session: Session,
272272
socket: zmq.sugar.socket.Socket,
273-
parent_header: Any,
273+
parent_header: t.Any,
274274
msg: t.Dict[str, t.Any],
275275
) -> None:
276276
"""Output hook when running inside an IPython kernel
@@ -687,7 +687,7 @@ def history(
687687
raw: bool = True,
688688
output: bool = False,
689689
hist_access_type: str = "range",
690-
**kwargs: Any,
690+
**kwargs: t.Any,
691691
) -> str:
692692
"""Get entries from the kernel's history list.
693693

jupyter_client/manager.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def remove_restart_callback(self, callback: t.Callable, event: str = "restart")
235235
# create a Client connected to our Kernel
236236
# --------------------------------------------------------------------------
237237

238-
def client(self, **kwargs: Any) -> KernelClient:
238+
def client(self, **kwargs: t.Any) -> KernelClient:
239239
"""Create a client configured to connect to our kernel"""
240240
kw = {}
241241
kw.update(self.get_connection_info(session=True))
@@ -296,7 +296,7 @@ def from_ns(match):
296296

297297
return [pat.sub(from_ns, arg) for arg in cmd]
298298

299-
async def _async_launch_kernel(self, kernel_cmd: t.List[str], **kw: Any) -> None:
299+
async def _async_launch_kernel(self, kernel_cmd: t.List[str], **kw: t.Any) -> None:
300300
"""actually launch the kernel
301301
302302
override in a subclass to launch kernel subprocesses differently
@@ -324,7 +324,7 @@ def _close_control_socket(self) -> None:
324324
self._control_socket.close()
325325
self._control_socket = None
326326

327-
async def _async_pre_start_kernel(self, **kw: Any) -> t.Tuple[t.List[str], t.Dict[str, t.Any]]:
327+
async def _async_pre_start_kernel(self, **kw: t.Any) -> t.Tuple[t.List[str], t.Dict[str, t.Any]]:
328328
"""Prepares a kernel for startup in a separate process.
329329
330330
If random ports (port=0) are being used, this method must be called
@@ -352,7 +352,7 @@ async def _async_pre_start_kernel(self, **kw: Any) -> t.Tuple[t.List[str], t.Dic
352352

353353
pre_start_kernel = run_sync(_async_pre_start_kernel)
354354

355-
async def _async_post_start_kernel(self, **kw: Any) -> None:
355+
async def _async_post_start_kernel(self, **kw: t.Any) -> None:
356356
"""Performs any post startup tasks relative to the kernel.
357357
358358
Parameters
@@ -368,7 +368,7 @@ async def _async_post_start_kernel(self, **kw: Any) -> None:
368368
post_start_kernel = run_sync(_async_post_start_kernel)
369369

370370
@in_pending_state
371-
async def _async_start_kernel(self, **kw: Any) -> None:
371+
async def _async_start_kernel(self, **kw: t.Any) -> None:
372372
"""Starts a kernel on this host in a separate process.
373373
374374
If random ports (port=0) are being used, this method must be called
@@ -500,7 +500,7 @@ async def _async_shutdown_kernel(self, now: bool = False, restart: bool = False)
500500
shutdown_kernel = run_sync(_async_shutdown_kernel)
501501

502502
async def _async_restart_kernel(
503-
self, now: bool = False, newports: bool = False, **kw: Any
503+
self, now: bool = False, newports: bool = False, **kw: t.Any
504504
) -> None:
505505
"""Restarts a kernel with the arguments that were used to launch it.
506506
@@ -661,7 +661,7 @@ class AsyncKernelManager(KernelManager):
661661

662662

663663
def start_new_kernel(
664-
startup_timeout: float = 60, kernel_name: str = "python", **kwargs: Any
664+
startup_timeout: float = 60, kernel_name: str = "python", **kwargs: t.Any
665665
) -> t.Tuple[KernelManager, KernelClient]:
666666
"""Start a new kernel, and return its Manager and Client"""
667667
km = KernelManager(kernel_name=kernel_name)
@@ -679,7 +679,7 @@ def start_new_kernel(
679679

680680

681681
async def start_new_async_kernel(
682-
startup_timeout: float = 60, kernel_name: str = "python", **kwargs: Any
682+
startup_timeout: float = 60, kernel_name: str = "python", **kwargs: t.Any
683683
) -> t.Tuple[AsyncKernelManager, KernelClient]:
684684
"""Start a new kernel, and return its Manager and Client"""
685685
km = AsyncKernelManager(kernel_name=kernel_name)
@@ -697,7 +697,7 @@ async def start_new_async_kernel(
697697

698698

699699
@contextmanager
700-
def run_kernel(**kwargs: Any) -> t.Iterator[KernelClient]:
700+
def run_kernel(**kwargs: t.Any) -> t.Iterator[KernelClient]:
701701
"""Context manager to create a kernel in a subprocess.
702702
703703
The kernel is shut down when the context exits.

jupyter_client/multikernelmanager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def kernel_method(f: t.Callable) -> t.Callable:
3434
"""decorator for proxying MKM.method(kernel_id) to individual KMs by ID"""
3535

3636
def wrapped(
37-
self: Any, kernel_id: str, *args: Any, **kwargs: Any
37+
self: t.Any, kernel_id: str, *args: t.Any, **kwargs: t.Any
3838
) -> t.Union[t.Callable, t.Awaitable]:
3939
# get the kernel
4040
km = self.get_kernel(kernel_id)
@@ -79,7 +79,7 @@ def _kernel_manager_factory_default(self):
7979
def _create_kernel_manager_factory(self) -> t.Callable:
8080
kernel_manager_ctor = import_item(self.kernel_manager_class)
8181

82-
def create_kernel_manager(*args: Any, **kwargs: Any) -> KernelManager:
82+
def create_kernel_manager(*args: t.Any, **kwargs: t.Any) -> KernelManager:
8383
if self.shared_context:
8484
if self.context.closed:
8585
# recreate context if closed
@@ -142,7 +142,7 @@ def __contains__(self, kernel_id: str) -> bool:
142142
return kernel_id in self._kernels
143143

144144
def pre_start_kernel(
145-
self, kernel_name: t.Optional[str], kwargs: Any
145+
self, kernel_name: t.Optional[str], kwargs: t.Any
146146
) -> t.Tuple[KernelManager, str, str]:
147147
# kwargs should be mutable, passing it as a dict argument.
148148
kernel_id = kwargs.pop("kernel_id", self.new_kernel_id(**kwargs))
@@ -192,7 +192,7 @@ def _using_pending_kernels(self):
192192
"""
193193
return getattr(self, 'use_pending_kernels', False)
194194

195-
async def _async_start_kernel(self, kernel_name: t.Optional[str] = None, **kwargs: Any) -> str:
195+
async def _async_start_kernel(self, kernel_name: t.Optional[str] = None, **kwargs: t.Any) -> str:
196196
"""Start a new kernel.
197197
198198
The caller can pick a kernel_id by passing one in as a keyword arg,
@@ -517,7 +517,7 @@ def connect_hb(self, kernel_id: str, identity: t.Optional[bytes] = None) -> sock
517517
stream : zmq Socket or ZMQStream
518518
"""
519519

520-
def new_kernel_id(self, **kwargs: Any) -> str:
520+
def new_kernel_id(self, **kwargs: t.Any) -> str:
521521
"""
522522
Returns the id to associate with the kernel for this request. Subclasses may override
523523
this method to substitute other sources of kernel ids.

jupyter_client/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class SessionFactory(LoggingConfigurable):
216216
logname = Unicode("")
217217

218218
@observe("logname") # type:ignore[misc]
219-
def _logname_changed(self, change: Any) -> None:
219+
def _logname_changed(self, change: t.Any) -> None:
220220
self.log = logging.getLogger(change["new"])
221221

222222
# not configurable:
@@ -1077,7 +1077,7 @@ def deserialize(
10771077
# adapt to the current version
10781078
return adapt(message)
10791079

1080-
def unserialize(self, *args: Any, **kwargs: Any) -> t.Dict[str, t.Any]:
1080+
def unserialize(self, *args: t.Any, **kwargs: t.Any) -> t.Dict[str, t.Any]:
10811081
warnings.warn(
10821082
"Session.unserialize is deprecated. Use Session.deserialize.",
10831083
DeprecationWarning,

0 commit comments

Comments
 (0)