repoview: use class literal for creating filteredchangelog
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 08 Nov 2019 11:23:22 -0800
changeset 43510 85628a595c37
parent 43509 7fd16ddabaa0
child 43511 8e175a3d64bd
repoview: use class literal for creating filteredchangelog The type name is constant, so we don't need to create it dynamically using type(). As suggested by Yuya. Differential Revision: https://phab.mercurial-scm.org/D7364
mercurial/repoview.py
--- a/mercurial/repoview.py	Thu Nov 07 14:59:11 2019 -0500
+++ b/mercurial/repoview.py	Fri Nov 08 11:23:22 2019 -0800
@@ -227,9 +227,10 @@
     cl = copy.copy(unfichangelog)
     cl.filteredrevs = filteredrevs
 
-    cl.__class__ = type(
-        'filteredchangelog', (filteredchangelogmixin, cl.__class__), {}
-    )
+    class filteredchangelog(filteredchangelogmixin, cl.__class__):
+        pass
+
+    cl.__class__ = filteredchangelog
 
     return cl