Patchwork [1,of,4] templater: rewrite doc of _hybrid class as docstring

login
register
mail settings
Submitter Yuya Nishihara
Date April 4, 2017, 4 p.m.
Message ID <41891582b5c66541a401.1491321656@mimosa>
Download mbox | patch
Permalink /patch/19953/
State Accepted
Headers show

Comments

Yuya Nishihara - April 4, 2017, 4 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1461492934 -32400
#      Sun Apr 24 19:15:34 2016 +0900
# Node ID 41891582b5c66541a40147e30e55153b6a0f2d79
# Parent  81abd0d12c8641df666d356f6033d84cd55977a8
templater: rewrite doc of _hybrid class as docstring

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -19,14 +19,17 @@  from . import (
     util,
 )
 
-# This helper class allows us to handle both:
-#  "{files}" (legacy command-line-specific list hack) and
-#  "{files % '{file}\n'}" (hgweb-style with inlining and function support)
-# and to access raw values:
-#  "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
-#  "{get(extras, key)}"
+class _hybrid(object):
+    """Wrapper for list or dict to support legacy template
 
-class _hybrid(object):
+    This class allows us to handle both:
+    - "{files}" (legacy command-line-specific list hack) and
+    - "{files % '{file}\n'}" (hgweb-style with inlining and function support)
+    and to access raw values:
+    - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
+    - "{get(extras, key)}"
+    """
+
     def __init__(self, gen, values, makemap, joinfmt):
         self.gen = gen
         self.values = values