Skip to content

Commit e4d929b

Browse files
committed
More MyPy mollification.
1 parent b6ddfb8 commit e4d929b

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

scalene/scalene_magics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from scalene.scalene_parseargs import ScaleneParseArgs
1818

1919
@magics_class
20-
class ScaleneMagics(Magics): # type: ignore[no-any-unimported]
20+
class ScaleneMagics(Magics): # type: ignore[no-any-unimported,unused-ignore]
2121
"""IPython (Jupyter) support for magics for Scalene (%scrun and %%scalene)."""
2222

2323
def run_code(self, args: ScaleneArguments, code: str) -> None:
@@ -26,7 +26,7 @@ def run_code(self, args: ScaleneArguments, code: str) -> None:
2626
# Create a file to hold the supplied code.
2727
# We encode the cell number in the string for later recovery.
2828
# The length of the history buffer lets us find the most recent string (this one).
29-
filename = f"_ipython-input-{len(IPython.get_ipython().history_manager.input_hist_raw)-1}-profile"
29+
filename = f"_ipython-input-{len(IPython.get_ipython().history_manager.input_hist_raw)-1}-profile" # type: ignore[no-untyped-call]
3030
with open(filename, "w+") as tmpfile:
3131
tmpfile.write(code)
3232
args.memory = False # full Scalene is not yet working, force to not profile memory

scalene/scalene_parseargs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def parse_args() -> Tuple[argparse.Namespace, List[str]]:
4343
with contextlib.suppress(BaseException):
4444
from IPython import get_ipython
4545

46-
if get_ipython():
46+
if get_ipython(): # type: ignore[no-untyped-call]
4747
sys.exit = ScaleneParseArgs.clean_exit
4848
sys._exit = ScaleneParseArgs.clean_exit # type: ignore
4949
defaults = ScaleneArguments()

scalene/scalene_preload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def setup_preload(args: argparse.Namespace) -> bool:
112112
with contextlib.suppress(Exception):
113113
from IPython import get_ipython
114114

115-
if get_ipython():
115+
if get_ipython(): # type: ignore[no-untyped-call]
116116
sys.exit = scalene.Scalene.clean_exit # type: ignore
117117
sys._exit = scalene.Scalene.clean_exit # type: ignore
118118

scalene/scalene_profiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ def _handle_jupyter_cell(filename: Filename) -> bool:
11761176
import IPython
11771177

11781178
if result := re.match(r"_ipython-input-([0-9]+)-.*", filename):
1179-
cell_contents = IPython.get_ipython().history_manager.input_hist_raw[
1179+
cell_contents = IPython.get_ipython().history_manager.input_hist_raw[ # type: ignore[no-untyped-call]
11801180
int(result[1])
11811181
]
11821182
with open(filename, "w+") as f:

0 commit comments

Comments
 (0)