Mercurial > hg-stable
changeset 37887:395571419274
formatter: ditch namedtuple in favor of attr
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 03 May 2018 15:08:16 +0900 |
parents | 3fe1c9263024 |
children | 853001c84114 |
files | mercurial/formatter.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/formatter.py Sun Apr 29 15:52:01 2018 +0900 +++ b/mercurial/formatter.py Thu May 03 15:08:16 2018 +0900 @@ -107,7 +107,6 @@ from __future__ import absolute_import, print_function -import collections import contextlib import itertools import os @@ -117,6 +116,9 @@ hex, short, ) +from .thirdparty import ( + attr, +) from . import ( error, @@ -413,8 +415,11 @@ baseformatter.end(self) self._renderitem('docfooter', {}) -templatespec = collections.namedtuple(r'templatespec', - r'ref tmpl mapfile') +@attr.s(frozen=True) +class templatespec(object): + ref = attr.ib() + tmpl = attr.ib() + mapfile = attr.ib() def lookuptemplate(ui, topic, tmpl): """Find the template matching the given -T/--template spec 'tmpl'