# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1521287802 -32400 # Sat Mar 17 20:56:42 2018 +0900 # Node ID 9a9b1047830a742e914d7085cfd9df34f5577d64 # Parent c8be87f32f1cdf473685b8302300265d57f3b512 templater: mark .gen as a private attribute
diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -56,12 +56,13 @@ class hybrid(wrapped): def __init__(self, gen, values, makemap, joinfmt, keytype=None): if gen is not None: - self.gen = gen # generator or function returning generator + self._gen = gen # generator or function returning generator self._values = values self._makemap = makemap self.joinfmt = joinfmt self.keytype = keytype # hint for 'x in y' where type(x) is unresolved - def gen(self): + + def _gen(self): """Default generator to stringify this as {join(self, ' ')}""" for i, x in enumerate(self._values): if i > 0: @@ -74,7 +75,7 @@ class hybrid(wrapped): def show(self, context): # TODO: switch gen to context-based API? - gen = self.gen + gen = self._gen if callable(gen): return gen() return gen @@ -108,12 +109,12 @@ class mappable(wrapped): def __init__(self, gen, key, value, makemap): if gen is not None: - self.gen = gen # generator or function returning generator + self._gen = gen # generator or function returning generator self._key = key self._value = value # may be generator of strings self._makemap = makemap - def gen(self): + def _gen(self): yield pycompat.bytestr(self._value) def tomap(self): @@ -124,7 +125,7 @@ class mappable(wrapped): def show(self, context): # TODO: switch gen to context-based API? - gen = self.gen + gen = self._gen if callable(gen): return gen() return gen _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel