Skip to content

Commit

Permalink
Formatted code to match Black's 88 column limit
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Jun 7, 2022
1 parent 3136525 commit 2e7d68b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 35 deletions.
10 changes: 5 additions & 5 deletions examples/jinja.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
A simple example that renders a Jinja2 template and prints out the result.
Notice that this example uses FileSystemLoader instead of the default PackageLoader because this
script is not part of a package. In practical applications, however, it is recommended to store
the templates in a directory within the application's package tree and use PackageLoader with the
``package_name`` option so they can be accessed regardless of where the application has been
installed.
Notice that this example uses FileSystemLoader instead of the default PackageLoader
because this script is not part of a package. In practical applications, however, it is
recommended to store the templates in a directory within the application's package tree
and use PackageLoader with the ``package_name`` option so they can be accessed
regardless of where the application has been installed.
"""

from pathlib import Path
Expand Down
10 changes: 5 additions & 5 deletions examples/mako_.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
A simple example that renders a Mako template and prints out the result.
Notice that this example specifies the template search path using the ``directories`` option
instead of ``package_paths`` because this script is not part of a package. In practical
applications, however, it is recommended to store the templates in a directory within the
application's package tree so it can be accessed regardless of where the application has been
installed.
Notice that this example specifies the template search path using the ``directories``
option instead of ``package_paths`` because this script is not part of a package. In
practical applications, however, it is recommended to store the templates in a directory
within the application's package tree so it can be accessed regardless of where the
application has been installed.
"""

from datetime import datetime
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ skip_gitignore = true
profile = "black"

[tool.flake8]
max-line-length = 99
max-line-length = 88

[tool.pytest.ini_options]
addopts = "-rsx --tb=short"
Expand Down
12 changes: 6 additions & 6 deletions src/asphalt/templating/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def render(self, template: str, **vars) -> str:
"""
Render the named template.
:param template: name of the template file, relative to any of the configured template
directories
:param template: name of the template file, relative to any of the configured
template directories
:param vars: extra context variables made available to templates
:return: the rendered results
"""
Expand All @@ -36,11 +36,11 @@ class TemplateRendererProxy(TemplateRenderer):
"""
Context-bound template renderer proxy.
Adds the bound context to the variables passed to :meth:`~TemplateRenderer.render` as ``ctx``,
unless a variable by that name was explicitly passed.
Adds the bound context to the variables passed to :meth:`~TemplateRenderer.render`
as ``ctx``, unless a variable by that name was explicitly passed.
Any variables and methods provided by the underlying renderer can be directly accessed through
this proxy object.
Any variables and methods provided by the underlying renderer can be directly
accessed through this proxy object.
"""

__slots__ = "_ctx", "_renderer"
Expand Down
10 changes: 6 additions & 4 deletions src/asphalt/templating/renderers/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ class DjangoRenderer(TemplateRenderer):
"""
Renders Django templates.
:param engine: a Django template engine object or keyword arguments for its constructor
:param package_paths: if given, looks up the directories containing the given package and fills
in or extends the ``dirs`` argument for :class:`~django.template.Engine`. The value will be
interpreted by :func:`~asphalt.templating.util.package_to_directory`.
:param engine: a Django template engine object or keyword arguments for its
constructor
:param package_paths: if given, looks up the directories containing the given
package and fills in or extends the ``dirs`` argument for
:class:`~django.template.Engine`. The value will be interpreted by
:func:`~asphalt.templating.util.package_to_directory`.
"""

__slots__ = "engine"
Expand Down
10 changes: 6 additions & 4 deletions src/asphalt/templating/renderers/jinja2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ class Jinja2Renderer(TemplateRenderer):
"""
Renders Jinja2 templates.
A new template loader will be created if no environment is supplied or it does not already have
a loader in it.
A new template loader will be created if no environment is supplied, or it does not
already have a loader in it.
.. seealso:: `Jinja2 API Docs <http://jinja.pocoo.org/docs/dev/api/#loaders>`_
:param environment: a Jinja2 environment object or keyword arguments for its constructor
:param loader_class: a Jinja2 template loader class or a ``module:varname`` reference to one
:param environment: a Jinja2 environment object or keyword arguments for its
constructor
:param loader_class: a Jinja2 template loader class or a ``module:varname``
reference to one
:param loader_args: extra arguments to pass to the loader class
"""

Expand Down
16 changes: 9 additions & 7 deletions src/asphalt/templating/renderers/mako.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ class MakoRenderer(TemplateRenderer):
Renders Mako templates.
.. note:: By default, the ``filesystem_checks`` argument of
:class:`~mako.lookup.TemplateLookup` is set to the value of the ``__debug__`` variable.
This means that in production mode, it will not check for template changes. If a template is
edited in production mode, the application must be restarted for the changes to take effect.
:param package_paths: if given, looks up the directories containing the given package and fills
in the ``directories`` argument for :class:`~mako.lookup.TemplateLookup`. The value will be
interpreted by :func:`~asphalt.templating.util.package_to_directory`.
:class:`~mako.lookup.TemplateLookup` is set to the value of the ``__debug__``
variable. This means that in production mode, it will not check for template
changes. If a template is edited in production mode, the application must be
restarted for the changes to take effect.
:param package_paths: if given, looks up the directories containing the given
package and fills in the ``directories`` argument for
:class:`~mako.lookup.TemplateLookup`. The value will be interpreted by
:func:`~asphalt.templating.util.package_to_directory`.
:param loader_args: extra arguments to pass to :class:`~mako.lookup.TemplateLookup`
"""

Expand Down
7 changes: 4 additions & 3 deletions src/asphalt/templating/renderers/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ class TornadoRenderer(TemplateRenderer):
"""
Renders Tornado templates.
:param package_path: if given, looks up the directory containing the given package and fills in
the ``root_directory`` argument for :class:`~tornado.template.Loader`. The value will be
interpreted by :func:`~asphalt.templating.util.package_to_directory`.
:param package_path: if given, looks up the directory containing the given package
and fills in he ``root_directory`` argument for
:class:`~tornado.template.Loader`. The value will be interpreted by
:func:`~asphalt.templating.util.package_to_directory`.
:param loader_args: extra arguments to pass to :class:`~tornado.template.Loader`
"""

Expand Down

0 comments on commit 2e7d68b

Please sign in to comment.