Skip to content

Commit

Permalink
add typing informations
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Nov 6, 2023
1 parent a07edac commit 8c9dd9d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jupyter_client/manager.py
Expand Up @@ -19,6 +19,7 @@
from traitlets import (
Any,
Bool,
Dict,
DottedObjectName,
Float,
Instance,
Expand Down Expand Up @@ -206,7 +207,7 @@ def ipykernel(self) -> bool:
return self.kernel_name in {"python", "python2", "python3"}

# Protected traits
_launch_args: Any = Any()
_launch_args: t.Optional[Dict] = Dict(allow_none=True)
_control_socket: Any = Any()

_restarter: Any = Any()
Expand Down Expand Up @@ -319,7 +320,7 @@ def format_kernel_cmd(self, extra_arguments: t.Optional[t.List[str]] = None) ->

if self.kernel_spec: # type:ignore[truthy-bool]
ns["resource_dir"] = self.kernel_spec.resource_dir

assert self._launch_args is not None
ns.update(self._launch_args)

pat = re.compile(r"\{([A-Za-z0-9_]+)\}")
Expand Down Expand Up @@ -376,7 +377,8 @@ async def _async_pre_start_kernel(
self.shutting_down = False
self.kernel_id = self.kernel_id or kw.pop("kernel_id", str(uuid.uuid4()))
# save kwargs for use in restart
self._launch_args = kw.copy()
# assigning Traitlets Dicts to Dict make mypy unhappy but is ok
self._launch_args = kw.copy() # type:ignore [assignment]
if self.provisioner is None: # will not be None on restarts
self.provisioner = KPF.instance(parent=self.parent).create_provisioner_instance(
self.kernel_id,
Expand Down

0 comments on commit 8c9dd9d

Please sign in to comment.