Patchwork [4,of,6] templater: mark .keytype as a private attribute

login
register
mail settings
Submitter Yuya Nishihara
Date June 8, 2018, 2:51 p.m.
Message ID <8fc143c310c8154b978d.1528469510@mimosa>
Download mbox | patch
Permalink /patch/32032/
State Accepted
Headers show

Comments

Yuya Nishihara - June 8, 2018, 2:51 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521811918 -32400
#      Fri Mar 23 22:31:58 2018 +0900
# Node ID 8fc143c310c8154b978df8509929b8ac9940029b
# Parent  7837f4a52b85cc034c7b3b9e79e53941552c27e6
templater: mark .keytype as a private attribute

Patch

diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -183,17 +183,17 @@  class hybrid(wrapped):
         self._values = values
         self._makemap = makemap
         self._joinfmt = joinfmt
-        self.keytype = keytype  # hint for 'x in y' where type(x) is unresolved
+        self._keytype = keytype  # hint for 'x in y' where type(x) is unresolved
 
     def contains(self, context, mapping, item):
-        item = unwrapastype(context, mapping, item, self.keytype)
+        item = unwrapastype(context, mapping, item, self._keytype)
         return item in self._values
 
     def getmember(self, context, mapping, key):
         # TODO: maybe split hybrid list/dict types?
         if not util.safehasattr(self._values, 'get'):
             raise error.ParseError(_('not a dictionary'))
-        key = unwrapastype(context, mapping, key, self.keytype)
+        key = unwrapastype(context, mapping, key, self._keytype)
         return self._wrapvalue(key, self._values.get(key))
 
     def getmin(self, context, mapping):