aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/lib/demo.py
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.ru>2022-05-18 00:43:36 +0300
committerrobot-contrib <robot-contrib@yandex-team.ru>2022-05-18 00:43:36 +0300
commit9e5f436a8b2a27bcc7802e443ea3ef3e41a82a75 (patch)
tree78b522cab9f76336e62064d4d8ff7c897659b20e /contrib/python/ipython/py3/IPython/lib/demo.py
parent8113a823ffca6451bb5ff8f0334560885a939a24 (diff)
downloadydb-9e5f436a8b2a27bcc7802e443ea3ef3e41a82a75.tar.gz
Update contrib/python/ipython/py3 to 8.3.0
ref:e84342d4d30476f9148137f37fd0c6405fd36f55
Diffstat (limited to 'contrib/python/ipython/py3/IPython/lib/demo.py')
-rw-r--r--contrib/python/ipython/py3/IPython/lib/demo.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/python/ipython/py3/IPython/lib/demo.py b/contrib/python/ipython/py3/IPython/lib/demo.py
index 0b19c413c3..8c9ae905d4 100644
--- a/contrib/python/ipython/py3/IPython/lib/demo.py
+++ b/contrib/python/ipython/py3/IPython/lib/demo.py
@@ -184,6 +184,7 @@ import re
import shlex
import sys
import pygments
+from pathlib import Path
from IPython.utils.text import marquee
from IPython.utils import openpy
@@ -238,7 +239,7 @@ class Demo(object):
terminal16m
- style('default'): a string of pygments style name to be used.
- """
+ """
if hasattr(src, "read"):
# It seems to be a file or a file-like object
self.fname = "from a file-like object"
@@ -403,8 +404,8 @@ class Demo(object):
index -= 1
filename = self.shell.mktempfile(self.src_blocks[index])
- self.shell.hooks.editor(filename,1)
- with open(filename, 'r') as f:
+ self.shell.hooks.editor(filename, 1)
+ with open(Path(filename), "r", encoding="utf-8") as f:
new_block = f.read()
# update the source and colored block
self.src_blocks[index] = new_block
@@ -531,7 +532,7 @@ class Demo(object):
elif token[0] == Token.Comment.Single:
toks.append((Token.Comment.Single, token[1][0]))
# parse comment content by rst lexer
- # remove the extrat newline added by rst lexer
+ # remove the extra newline added by rst lexer
toks += list(pygments.lex(token[1][1:], self.rst_lexer))[:-1]
else:
toks.append(token)