Patchwork [3,of,4] templater: hide private variable of _hybrid

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

Comments

Yuya Nishihara - April 4, 2017, 4 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1491312006 -32400
#      Tue Apr 04 22:20:06 2017 +0900
# Node ID a78c9de39862cd089aaddd9536902c7c52dfe1e6
# Parent  1c90b99b7e835b4f8d65329170a4830370ab2f04
templater: hide private variable of _hybrid

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -32,21 +32,21 @@  class _hybrid(object):
 
     def __init__(self, gen, values, makemap, joinfmt):
         self.gen = gen
-        self.values = values
+        self._values = values
         self._makemap = makemap
         self.joinfmt = joinfmt
     def itermaps(self):
         makemap = self._makemap
-        for x in self.values:
+        for x in self._values:
             yield makemap(x)
     def __contains__(self, x):
-        return x in self.values
+        return x in self._values
     def __len__(self):
-        return len(self.values)
+        return len(self._values)
     def __getattr__(self, name):
         if name != 'get':
             raise AttributeError(name)
-        return getattr(self.values, name)
+        return getattr(self._values, name)
 
 def unwraphybrid(thing):
     """Return an object which can be stringified possibly by using a legacy