[PATCH 1 of 4] templater: rewrite docstring of templater.__init__()

Gregory Szorc gregory.szorc at gmail.com
Fri Dec 22 13:41:02 EST 2017


On Fri, Dec 22, 2017 at 6:08 AM, Yuya Nishihara <yuya at tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1513944737 -32400
> #      Fri Dec 22 21:12:17 2017 +0900
> # Node ID a311f085ddf3e7d64d741a0e6f98c8f461d22fb1
> # Parent  bb6a80fc969a2c5da80cbb7f29de7ca576c4e251
> templater: rewrite docstring of templater.__init__()
>

Queued 1-3.


>
> More importantly, this patch adds what the cache is.
>
> diff --git a/mercurial/templater.py b/mercurial/templater.py
> --- a/mercurial/templater.py
> +++ b/mercurial/templater.py
> @@ -1434,13 +1434,19 @@ class templater(object):
>
>      def __init__(self, filters=None, defaults=None, resources=None,
>                   cache=None, aliases=(), minchunk=1024, maxchunk=65536):
> -        '''set up template engine.
> -        filters is dict of functions. each transforms a value into
> another.
> -        defaults is dict of default map definitions.
> -        resources is dict of internal data (e.g. cache), which are
> inaccessible
> -        from user template.
> -        aliases is list of alias (name, replacement) pairs.
> -        '''
> +        """Create template engine optionally with preloaded template
> fragments
> +
> +        - ``filters``: a dict of functions to transform a value into
> another.
> +        - ``defaults``: a dict of symbol values/functions; may be
> overridden
> +          by a ``mapping`` dict.
> +        - ``resources``: a dict of internal data (e.g. cache),
> inaccessible
> +          from user template; may be overridden by a ``mapping`` dict.
> +        - ``cache``: a dict of preloaded template fragments.
> +        - ``aliases``: a list of alias (name, replacement) pairs.
> +
> +        self.cache may be updated later to register additional template
> +        fragments.
> +        """
>          if filters is None:
>              filters = {}
>          if defaults is None:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20171222/a3555836/attachment.html>


More information about the Mercurial-devel mailing list