Fixed a regression with xonfig styles

The "xonfig styles" command was reporting
AttributeError: module 'pygments' has no attribute 'styles'

Now we import the styles packages explicitly
This commit is contained in:
Morten Enemark Lund 2018-07-18 21:02:15 +02:00
parent e1f2bcd5ed
commit 15d6affece
3 changed files with 17 additions and 2 deletions

View file

@ -0,0 +1,13 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed a regression with ``xonfig styles`` reporting ``AttributeError: module 'pygments' has no attribute 'styles'``
**Security:** None

View file

@ -279,7 +279,8 @@ class PromptToolkitShell(BaseShell):
"""Returns an iterable of all available style names."""
if not HAS_PYGMENTS:
return ['For other xonsh styles, please install pygments']
return pygments.styles.get_all_styles()
from pygments.styles import get_all_styles
return get_all_styles()
def color_style(self):
"""Returns the current color map."""

View file

@ -286,7 +286,8 @@ class PromptToolkit2Shell(BaseShell):
"""Returns an iterable of all available style names."""
if not HAS_PYGMENTS:
return ['For other xonsh styles, please install pygments']
return pygments.styles.get_all_styles()
from pygments.styles import get_all_styles
return get_all_styles()
def color_style(self):
"""Returns the current color map."""