Skip to content

Commit e81d602

Browse files
committed
fix py37 syntax
1 parent b51eb00 commit e81d602

File tree

9 files changed

+18
-15
lines changed

9 files changed

+18
-15
lines changed

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import os
1616
import shutil
17-
from typing import Any
17+
from typing import Dict, Any, List
1818

1919
# If extensions (or modules to document with autodoc) are in another directory,
2020
# add these directories to sys.path here. If the directory is relative to the
@@ -62,7 +62,7 @@
6262
# built documents.
6363
#
6464

65-
version_ns: dict[str, Any] = {}
65+
version_ns: Dict[str, Any] = {}
6666
here = os.path.dirname(__file__)
6767
version_py = os.path.join(here, os.pardir, "ipykernel", "_version.py")
6868
with open(version_py) as f:
@@ -151,7 +151,7 @@
151151
# Add any paths that contain custom static files (such as style sheets) here,
152152
# relative to this directory. They are copied after the builtin static files,
153153
# so a file named "default.css" will overwrite the builtin "default.css".
154-
html_static_path: list[str] = []
154+
html_static_path: List[str] = []
155155

156156
# Add any extra paths that contain custom files (such as robots.txt or
157157
# .htaccess) here, relative to this directory. These files are copied
@@ -218,7 +218,7 @@
218218

219219
# -- Options for LaTeX output ---------------------------------------------
220220

221-
latex_elements: dict[str, object] = {}
221+
latex_elements: Dict[str, object] = {}
222222

223223
# Grouping the document tree into LaTeX files. List of tuples
224224
# (source start file, target name, title,

ipykernel/_version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
store the current version info of the server.
33
"""
44
import re
5+
from typing import List
56

67
# Version string must appear intact for tbump versioning
78
__version__ = "6.12.1"
@@ -10,7 +11,7 @@
1011
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
1112
match = re.match(pattern, __version__)
1213
assert match is not None
13-
parts: list[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
14+
parts: List[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
1415
if match["rest"]:
1516
parts.append(match["rest"])
1617
version_info = tuple(parts)

ipykernel/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import json
77
import sys
88
from subprocess import PIPE, Popen
9-
from typing import Any
9+
from typing import Any, Dict
1010

1111
import jupyter_client
1212
from jupyter_client import write_connection_file
@@ -108,7 +108,7 @@ def connect_qtconsole(connection_file=None, argv=None):
108108

109109
cmd = ";".join(["from IPython.qt.console import qtconsoleapp", "qtconsoleapp.main()"])
110110

111-
kwargs: dict[str, Any] = {}
111+
kwargs: Dict[str, Any] = {}
112112
# Launch the Qt console in a separate session & process group, so
113113
# interrupting the kernel doesn't kill it.
114114
kwargs["start_new_session"] = True

ipykernel/debugger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _reset_tcp_pos(self):
101101

102102
def _put_message(self, raw_msg):
103103
self.log.debug("QUEUE - _put_message:")
104-
msg = t.cast(dict[str, t.Any], jsonapi.loads(raw_msg))
104+
msg = t.cast(t.Dict[str, t.Any], jsonapi.loads(raw_msg))
105105
if msg["type"] == "event":
106106
self.log.debug("QUEUE - received event:")
107107
self.log.debug(msg)

ipykernel/inprocess/channels.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Distributed under the terms of the Modified BSD License.
55

66
from jupyter_client.channelsabc import HBChannelABC
7+
from typing import List
78

89
# -----------------------------------------------------------------------------
910
# Channel classes
@@ -13,7 +14,7 @@
1314
class InProcessChannel:
1415
"""Base class for in-process channels."""
1516

16-
proxy_methods: list[object] = []
17+
proxy_methods: List[object] = []
1718

1819
def __init__(self, client=None):
1920
super().__init__()

ipykernel/ipkernel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ async def do_execute(
311311

312312
self._forward_input(allow_stdin)
313313

314-
reply_content: dict[str, t.Any] = {}
314+
reply_content: t.Dict[str, t.Any] = {}
315315
if hasattr(shell, "run_cell_async") and hasattr(shell, "should_run_async"):
316316
run_cell = shell.run_cell_async
317317
should_run_async = shell.should_run_async
@@ -507,7 +507,7 @@ def _experimental_do_complete(self, code, cursor_pos):
507507
def do_inspect(self, code, cursor_pos, detail_level=0, omit_sections=()):
508508
name = token_at_cursor(code, cursor_pos)
509509

510-
reply_content: dict[str, t.Any] = {"status": "ok"}
510+
reply_content: t.Dict[str, t.Any] = {"status": "ok"}
511511
reply_content["data"] = {}
512512
reply_content["metadata"] = {}
513513
try:

ipykernel/kernelbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _default_ident(self):
143143

144144
# This should be overridden by wrapper kernels that implement any real
145145
# language.
146-
language_info: dict[str, object] = {}
146+
language_info: t.Dict[str, object] = {}
147147

148148
# any links that should go in the help menu
149149
help_links = List()

ipykernel/pickleutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class CannedFunction(CannedObject):
195195
def __init__(self, f):
196196
self._check_type(f)
197197
self.code = f.__code__
198-
self.defaults: typing.Optional[list[typing.Any]]
198+
self.defaults: typing.Optional[typing.List[typing.Any]]
199199
if f.__defaults__:
200200
self.defaults = [can(fd) for fd in f.__defaults__]
201201
else:
@@ -461,7 +461,7 @@ def uncan_sequence(obj, g=None):
461461
if buffer is not memoryview:
462462
can_map[buffer] = CannedBuffer
463463

464-
uncan_map: dict[type, typing.Any] = {
464+
uncan_map: typing.Dict[type, typing.Any] = {
465465
CannedObject: lambda obj, g: obj.get_object(g),
466466
dict: uncan_dict,
467467
}

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import shutil
88
import sys
99
from glob import glob
10+
from typing import Dict
1011

1112
from setuptools import setup
1213
from setuptools.command.bdist_egg import bdist_egg
@@ -42,7 +43,7 @@ def run(self):
4243
with open(pjoin(here, "README.md")) as fid:
4344
LONG_DESCRIPTION = fid.read()
4445

45-
setup_args: dict[str, object] = dict(
46+
setup_args: Dict[str, object] = dict(
4647
name=name,
4748
cmdclass={
4849
"bdist_egg": bdist_egg if "bdist_egg" in sys.argv else bdist_egg_disabled,

0 commit comments

Comments
 (0)