File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33matplotlib
44ipywidgets
55ipykernel
6- ansicolors
Original file line number Diff line number Diff line change 1- from colors import strip_color
1+ import re
22
33
44class AwsError (Exception ):
@@ -59,6 +59,23 @@ class PapermillParameterOverwriteWarning(PapermillWarning):
5959 """Callee overwrites caller argument to pass down the stream."""
6060
6161
62+ def strip_color (text ):
63+ """Remove most ANSI color and style sequences from a string
64+
65+ Based on https://pypi.org/project/ansicolors/."""
66+
67+ # The regular expression is copied from:
68+ # https://github.com/jonathaneunice/colors/blob/
69+ # c965f5b9103c5bd32a1572adb8024ebe83278fb0/colors/colors.py#L122-L131
70+ #
71+ # The original docstring notes that this does not strip all possible ANSI
72+ # escape sequences related to color and style, but it attempts to cover the
73+ # most common ones and a few known oddities produced by actual
74+ # colorization libraries, including \x1b[K (EL, erase to end of line) and
75+ # \x1b[m (more commonly expressed as \x1b[0m).
76+ return re .sub ("\x1b \\ [(K|.*?m)" , "" , text )
77+
78+
6279def missing_dependency_generator (package , dep ):
6380 def missing_dep ():
6481 raise PapermillOptionalDependencyException (
Original file line number Diff line number Diff line change 88from unittest .mock import ANY , patch
99
1010import nbformat
11- from colors import strip_color
1211from nbformat import validate
1312
1413from .. import engines , translators
15- from ..exceptions import PapermillExecutionError
14+ from ..exceptions import PapermillExecutionError , strip_color
1615from ..execute import execute_notebook
1716from ..iorw import load_notebook_node
1817from ..log import logger
Original file line number Diff line number Diff line change 77entrypoints
88tenacity >= 5.0.2
99aiohttp >= 3.9.0 ; python_version == "3.12"
10- ansicolors
You can’t perform that action at this time.
0 commit comments