##// END OF EJS Templates
Prepare removal of unnecessary options of ColorSchemeTable.
Matthias Bussonnier -
Show More
@@ -15,6 +15,8 b' from IPython.utils.ipstruct import Struct'
15 15
16 16 __all__ = ["TermColors", "InputTermColors", "ColorScheme", "ColorSchemeTable"]
17 17
18 _sentinel = object()
19
18 20 color_templates = (
19 21 # Dark colors
20 22 ("Black" , "0;30"),
@@ -159,18 +161,35 b' class ColorSchemeTable(dict):'
159 161 """Return full copy of object"""
160 162 return ColorSchemeTable(self.values(),self.active_scheme_name)
161 163
164 def __setitem__(self, key: str, value: ColorScheme):
165 assert isinstance(key, str)
166 assert isinstance(value, ColorScheme)
167 super().__setitem__(key, value)
168
162 169 def add_scheme(self,new_scheme):
163 170 """Add a new color scheme to the table."""
164 171 if not isinstance(new_scheme,ColorScheme):
165 172 raise ValueError('ColorSchemeTable only accepts ColorScheme instances')
166 173 self[new_scheme.name] = new_scheme
167 174
168 def set_active_scheme(self,scheme,case_sensitive=0):
175 def set_active_scheme(self, scheme, case_sensitive=_sentinel):
169 176 """Set the currently active scheme.
170 177
171 178 Names are by default compared in a case-insensitive way, but this can
172 179 be changed by setting the parameter case_sensitive to true."""
173 180
181 if case_sensitive is _sentinel:
182 case_sensitive = False
183 else:
184 warnings.warn(
185 "set_active_scheme(case_sensitive=...) is Pending "
186 "deprecation. Please comment on "
187 "https://github.com/ipython/ipython/issues/14306 "
188 "to let the ipython maintainer that you are affected.",
189 PendingDeprecationWarning,
190 stacklevel=2,
191 )
192
174 193 scheme_names = list(self.keys())
175 194 if case_sensitive:
176 195 valid_schemes = scheme_names
General Comments 0
You need to be logged in to leave comments. Login now