Skip to content

Commit bc475a1

Browse files
committed
Add typing for shell attribute of SpyderPdb
Also, fix imports ordering and code style in the module that contains that class.
1 parent c6682d2 commit bc475a1

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

spyder_kernels/customize/spyderpdb.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77

88
"""Spyder debugger."""
99

10+
from __future__ import annotations
11+
1012
import ast
1113
import bdb
1214
import builtins
1315
from contextlib import contextmanager
16+
from collections import namedtuple
17+
from functools import lru_cache
1418
import logging
1519
import os
1620
import sys
1721
import traceback
1822
import threading
19-
from collections import namedtuple
20-
from functools import lru_cache
23+
import typing
2124

2225
from IPython.core.autocall import ZMQExitAutocall
2326
from IPython.core.debugger import Pdb as ipyPdb
@@ -27,10 +30,16 @@
2730
from spyder_kernels.comms.commbase import stacksummary_to_json
2831
from spyder_kernels.comms.frontendcomm import CommError, frontend_request
2932
from spyder_kernels.customize.utils import (
30-
path_is_library, capture_last_Expr, exec_encapsulate_locals
33+
path_is_library,
34+
capture_last_Expr,
35+
exec_encapsulate_locals,
3136
)
3237

3338

39+
if typing.TYPE_CHECKING:
40+
from spyder_kernels.console.shell import SpyderShell
41+
42+
3443
logger = logging.getLogger(__name__)
3544

3645

@@ -85,7 +94,9 @@ def __init__(self, completekey='tab', stdin=None, stdout=None,
8594
self._exclamation_warning_printed = False
8695
self.pdb_stop_first_line = True
8796
self._disable_next_stack_entry = False
88-
super(SpyderPdb, self).__init__()
97+
self.shell: SpyderShell | None = None
98+
99+
super().__init__()
89100

90101
# content of tuple: (filename, line number)
91102
self._previous_step = None

0 commit comments

Comments
 (0)