diff sat_frontends/jp/output_xml.py @ 2624:56f94936df1e

code style reformatting using black
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 20:14:46 +0200
parents 12bf089f0bf3
children 003b8b4b56a7
line wrap: on
line diff
--- a/sat_frontends/jp/output_xml.py	Wed Jun 27 07:51:29 2018 +0200
+++ b/sat_frontends/jp/output_xml.py	Wed Jun 27 20:14:46 2018 +0200
@@ -23,8 +23,10 @@
 from sat.core.i18n import _
 from lxml import etree
 from sat.core.log import getLogger
+
 log = getLogger(__name__)
 import sys
+
 try:
     import pygments
     from pygments.lexers.html import XmlLexer
@@ -34,8 +36,8 @@
 
 
 __outputs__ = ["XML"]
-RAW = u'xml_raw'
-PRETTY = u'xml_pretty'
+RAW = u"xml_raw"
+PRETTY = u"xml_pretty"
 
 
 class XML(object):
@@ -50,18 +52,23 @@
 
     def colorize(self, xml):
         if pygments is None:
-            self.host.disp(_(u'Pygments is not available, syntax highlighting is not possible. Please install if from http://pygments.org or with pip install pygments'), error=True)
+            self.host.disp(
+                _(
+                    u"Pygments is not available, syntax highlighting is not possible. Please install if from http://pygments.org or with pip install pygments"
+                ),
+                error=True,
+            )
             return xml
         if not sys.stdout.isatty():
             return xml
-        lexer = XmlLexer(encoding='utf-8')
-        formatter = TerminalFormatter(bg=u'dark')
+        lexer = XmlLexer(encoding="utf-8")
+        formatter = TerminalFormatter(bg=u"dark")
         return pygments.highlight(xml, lexer, formatter)
 
     def format(self, data, pretty=True):
         parser = etree.XMLParser(remove_blank_text=True)
         tree = etree.fromstring(data, parser)
-        xml = etree.tostring(tree, encoding='unicode', pretty_print=pretty)
+        xml = etree.tostring(tree, encoding="unicode", pretty_print=pretty)
         return self.colorize(xml)
 
     def format_no_pretty(self, data):
@@ -70,13 +77,13 @@
     def pretty(self, data):
         self.host.disp(self.format(data))
 
-    def pretty_list(self, data, separator=u'\n'):
+    def pretty_list(self, data, separator=u"\n"):
         list_pretty = map(self.format, data)
         self.host.disp(separator.join(list_pretty))
 
     def raw(self, data):
         self.host.disp(self.format_no_pretty(data))
 
-    def list_raw(self, data, separator=u'\n'):
+    def list_raw(self, data, separator=u"\n"):
         list_no_pretty = map(self.format_no_pretty, data)
         self.host.disp(separator.join(list_no_pretty))