Reformatted with automated tools and minor fixes.

This commit is contained in:
2021-04-28 23:09:35 -07:00
parent bf0b7a1cb7
commit b8bc24cf6f
24 changed files with 209 additions and 39 deletions

View File

@ -1,6 +1,6 @@
"""Define a Jinja2 Processor which applies programmable templating to the input stream."""
from typing import Iterable, Optional, Dict, cast
from typing import Dict, Iterable, Optional, cast
from jinja2 import Environment, FileSystemLoader
@ -22,7 +22,7 @@ class Jinja2(PassThrough):
iterable: The post-processed output stream
"""
ctx = cast(Dict, ctx)
template_env = Environment(loader=FileSystemLoader(ctx["templates"]), extensions=['jinja2.ext.do'])
template_env = Environment(loader=FileSystemLoader(ctx["templates"]), extensions=["jinja2.ext.do"])
template_env.globals.update(ctx["globals"])
template_env.filters.update(ctx["filters"])
tmpl = template_env.from_string("".join([x for x in input_file]))

View File

@ -3,8 +3,7 @@
the target template is rendered)."""
import os
from typing import Iterable, Optional, Dict, cast
from typing import Dict, Iterable, Optional, cast
from jinja2 import Environment, FileSystemLoader
@ -52,7 +51,7 @@ class Jinja2PageEmbed(Processor):
iterable: The post-processed output stream
"""
ctx = cast(Dict, ctx)
template_env = Environment(loader=FileSystemLoader(ctx["templates"]), extensions=['jinja2.ext.do'])
template_env = Environment(loader=FileSystemLoader(ctx["templates"]), extensions=["jinja2.ext.do"])
template_env.globals.update(ctx["globals"])
template_env.filters.update(ctx["filters"])
tmpl = template_env.get_template(ctx["template"])

View File

@ -1,10 +1,10 @@
"""Passthrough progcessor which takes input and returns it."""
import os
from typing import Dict, Iterable, Optional, cast
from .processors import Processor, PassthroughException
from ..utils import guess_mime
from typing import Iterable, Optional, Dict, cast
from .processors import PassthroughException, Processor
class PassThrough(Processor):

View File

@ -2,8 +2,7 @@
import io
import os
from typing import Iterable, Optional, Dict
from typing import Dict, Iterable, Optional
import markdown

View File

@ -1,6 +1,5 @@
import abc
from typing import Iterable, Optional, Dict
from typing import Dict, Iterable, Optional
class PassthroughException(Exception):