Skip to content

Commit 1451544

Browse files
authored
more types (ipython#14549)
2 parents 0e33642 + 3254296 commit 1451544

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

IPython/core/page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _detect_screen_size(screen_lines_def):
125125
# print('***Screen size:',screen_lines_real,'lines x',
126126
# screen_cols,'columns.') # dbg
127127

128-
def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):
128+
def pager_page(strng, start=0, screen_lines=0, pager_cmd=None) -> None:
129129
"""Display a string, piping through a pager after a certain length.
130130
131131
strng can be a mime-bundle dict, supplying multiple representations,
@@ -239,7 +239,7 @@ def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):
239239
page_dumb(strng,screen_lines=screen_lines)
240240

241241

242-
def page(data, start=0, screen_lines=0, pager_cmd=None):
242+
def page(data, start: int = 0, screen_lines: int = 0, pager_cmd=None):
243243
"""Display content in a pager, piping through a pager after a certain length.
244244
245245
data can be a mime-bundle dict, supplying multiple representations,

IPython/utils/frame.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#-----------------------------------------------------------------------------
1616

1717
import sys
18+
from typing import Any
1819

1920
#-----------------------------------------------------------------------------
2021
# Code
@@ -51,7 +52,7 @@ def extract_vars(*names,**kw):
5152
return dict((k,callerNS[k]) for k in names)
5253

5354

54-
def extract_vars_above(*names):
55+
def extract_vars_above(*names: list[str]):
5556
"""Extract a set of variables by name from another frame.
5657
5758
Similar to extractVars(), but with a specified depth of 1, so that names
@@ -65,7 +66,7 @@ def extract_vars_above(*names):
6566
return dict((k,callerNS[k]) for k in names)
6667

6768

68-
def debugx(expr,pre_msg=''):
69+
def debugx(expr: str, pre_msg: str = ""):
6970
"""Print the value of an expression from the caller's frame.
7071
7172
Takes an expression, evaluates it in the caller's frame and prints both
@@ -84,7 +85,8 @@ def debugx(expr,pre_msg=''):
8485
# deactivate it by uncommenting the following line, which makes it a no-op
8586
#def debugx(expr,pre_msg=''): pass
8687

87-
def extract_module_locals(depth=0):
88+
89+
def extract_module_locals(depth: int = 0) -> tuple[Any, Any]:
8890
"""Returns (module, locals) of the function `depth` frames away from the caller"""
8991
f = sys._getframe(depth + 1)
9092
global_ns = f.f_globals

0 commit comments

Comments
 (0)