IffGit has a new shared runner for building Docker images in GitLab CI. Visit https://iffgit.fz-juelich.de/examples/ci-docker-in-docker for more details.

Commit 724c0cbc authored by Ingo Meyer's avatar Ingo Meyer
Browse files

Reformat the code with black and isort

parent 0d305be7
from .writers import rst2html_extended_main, rst2latex_extended_main
__all__ = ('rst2html_extended_main', 'rst2latex_extended_main')
__all__ = ("rst2html_extended_main", "rst2latex_extended_main")
__version_info__ = (0, 3, 0)
__version__ = '.'.join(map(str, __version_info__))
__version__ = ".".join(map(str, __version_info__))
from .code_directive import CodeBlock
from .embedded_image_directive import EmbeddedImage, EmbeddedFigure
from .embedded_image_directive import EmbeddedFigure, EmbeddedImage
from .jupyter_outbox_directive import JupyterOutbox
from .tikz_directive import Tikz, TikzFigure
from .output_mode import get_output_mode, set_output_mode
from .tikz_directive import Tikz, TikzFigure
__all__ = ("CodeBlock", "EmbeddedImage", "EmbeddedFigure", "JupyterOutbox", "Tikz", "TikzFigure", "get_output_mode",
"set_output_mode")
__all__ = (
"CodeBlock",
"EmbeddedImage",
"EmbeddedFigure",
"JupyterOutbox",
"Tikz",
"TikzFigure",
"get_output_mode",
"set_output_mode",
)
# -*- coding: utf-8 -*-
import base64
import requests
import os
import shutil
import subprocess
import tempfile
import requests
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import sys
from io import BytesIO
from PIL import Image
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives, states
from docutils.nodes import fully_normalize_name, whitespace_normalize_name
from docutils.parsers.rst import Directive, directives, states
from docutils.parsers.rst.roles import set_classes
from .output_mode import get_output_mode
from PIL import Image
from .output_mode import get_output_mode
TMP_IMAGE_FILENAME = "_downloaded_image{i:04d}.{ext}"
TMP_QPDF_OUT_FILENAME = "_qpdf_out.pdf"
......
......@@ -11,5 +11,7 @@ class JupyterOutbox(Directive):
def run(self):
content = u"\n".join(self.content)
latex = u"\\begin{{minted}}[bgcolor=white,breakanywhere=true,breaklines=true,linenos=false]{{text}}\n{}\n\\end{{minted}}".format(content)
latex = u"\\begin{{minted}}[bgcolor=white,breakanywhere=true,breaklines=true,linenos=false]{{text}}\n{}\n\\end{{minted}}".format(
content
)
return [nodes.raw("", latex, format="latex")]
......@@ -2,20 +2,20 @@
import base64
import codecs
import jinja2
import os
import tempfile
import shutil
import subprocess
import sys
from PIL import Image
import tempfile
import jinja2
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives, states
from docutils.nodes import fully_normalize_name, whitespace_normalize_name
from docutils.parsers.rst import Directive, directives, states
from docutils.parsers.rst.roles import set_classes
from .output_mode import get_output_mode
from PIL import Image
from .output_mode import get_output_mode
TEMPLATE_LATEX = u"""
\\documentclass{%- if document_options -%}[{{ document_options }}]{%- endif -%}{standalone}
......@@ -49,7 +49,7 @@ TMP_PNG_FILENAME = "tikz_picture.png"
OUT_PNG_FILENAME = "_tikz_rendered{:04d}.png"
TMP_SVG_FILENAME = "tikz_picture.svg"
OUT_SVG_FILENAME = "_tikz_rendered{:04d}.svg"
BUILD_DIRECTORY = '.'
BUILD_DIRECTORY = "."
class TemporaryDirectory(object):
......@@ -143,7 +143,7 @@ def convert_image_to_html_base64(image_filepath):
if filetype == "svg":
filetype = "svg+xml"
with open(image_filepath.encode(sys.getfilesystemencoding()), "rb") as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
return "data:image/{format};base64,".format(format=filetype) + encoded_string
......
......@@ -4,6 +4,6 @@ from .directives import tikz_directive
def setup(app):
tikz_directive.BUILD_DIRECTORY = app.outdir
app.add_directive('tikz', directives.Tikz)
app.connect('builder-inited', lambda app: directives.set_output_mode(app.builder.format))
return {'version': '0.1'}
app.add_directive("tikz", directives.Tikz)
app.connect("builder-inited", lambda app: directives.set_output_mode(app.builder.format))
return {"version": "0.1"}
from .rst2html_extended import main as rst2html_extended_main
from .rst2latex_extended import main as rst2latex_extended_main
__all__ = ('rst2html_extended_main', 'rst2latex_extended_main')
__all__ = ("rst2html_extended_main", "rst2latex_extended_main")
......@@ -16,11 +16,11 @@ try:
except:
pass
from docutils.core import publish_cmdline, default_description
from docutils.core import default_description, publish_cmdline
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.body import ParsedLiteral
from ..directives import EmbeddedImage, EmbeddedFigure, Tikz, TikzFigure, set_output_mode
from ..directives import EmbeddedFigure, EmbeddedImage, Tikz, TikzFigure, set_output_mode
description = "Generates (X)HTML documents from standalone reStructuredText " "sources. " + default_description
......@@ -35,5 +35,5 @@ def main():
publish_cmdline(writer_name="html", description=description)
if __name__ == '__main__':
if __name__ == "__main__":
main()
......@@ -19,8 +19,8 @@ except:
from docutils.core import publish_cmdline
from docutils.parsers.rst import directives
from ..directives import CodeBlock, EmbeddedImage, EmbeddedFigure, JupyterOutbox, Tikz, TikzFigure, set_output_mode
from ..directives import CodeBlock, EmbeddedFigure, EmbeddedImage, JupyterOutbox, Tikz, TikzFigure, set_output_mode
description = (
"Generates LaTeX documents from standalone reStructuredText "
......@@ -44,5 +44,5 @@ def main():
publish_cmdline(writer_name="latex", description=description)
if __name__ == '__main__':
if __name__ == "__main__":
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment