Skip to content

Commit df2a9b5

Browse files
committed
Remove reliance on IPython's coloransi
I'm nuking it in IPython 9.0 in favor of a lit of list of pairs of token and text, and having pygments/prompt_toolkit use formatting. In the and this module will likely not exists in IPython 9.0
1 parent 46172fe commit df2a9b5

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

ipyparallel/client/client.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from IPython.core.profiledir import ProfileDir, ProfileDirError
2727
from IPython.paths import get_ipython_dir
2828
from IPython.utils.capture import RichOutput
29-
from IPython.utils.coloransi import TermColors
3029
from IPython.utils.path import compress_user
3130
from jupyter_client.localinterfaces import is_local_ip, localhost
3231
from jupyter_client.session import Session
@@ -155,36 +154,19 @@ def __repr__(self):
155154

156155
return f"<ExecuteReply[{self.execution_count}]: {text_out}>"
157156

158-
def _plaintext(self):
157+
def _plaintext(self) -> str:
159158
execute_result = self.metadata['execute_result'] or {'data': {}}
160159
text_out = execute_result['data'].get('text/plain', '')
161160

162161
if not text_out:
163162
return ''
164163

165-
ip = get_ipython()
166-
if ip is None:
167-
colors = "NoColor"
168-
else:
169-
colors = ip.colors
170-
171-
if colors == "NoColor":
172-
out = normal = ""
173-
else:
174-
out = TermColors.Red
175-
normal = TermColors.Normal
176-
177164
if '\n' in text_out and not text_out.startswith('\n'):
178165
# add newline for multiline reprs
179166
text_out = '\n' + text_out
180167

181-
return ''.join(
182-
[
183-
out,
184-
f"Out[{self.metadata['engine_id']}:{self.execution_count}]: ",
185-
normal,
186-
text_out,
187-
]
168+
return (
169+
f"Out[{self.metadata['engine_id']}:{self.execution_count}]: {text_out}",
188170
)
189171

190172
def _repr_pretty_(self, p, cycle):

0 commit comments

Comments
 (0)