# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1595361937 25200
#      Tue Jul 21 13:05:37 2020 -0700
# Node ID e2ec3616715130e359815bc30536fae2619ea70f
# Parent  55464c0b3a89c52672e1fe816fddf4e391a51768
templater: simplify templatepaths() to avoid iterating a singleton list

The function iterates over a hard-coded list of one element since
d844e220792a (templater: don't search randomly for templates - trust
util.datapath, 2014-09-28).

Differential Revision: https://phab.mercurial-scm.org/D8785

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1047,12 +1047,8 @@
 
 def templatepaths():
     '''return locations used for template files.'''
-    pathsrel = [b'templates']
-    paths = [
-        os.path.normpath(os.path.join(resourceutil.datapath, f))
-        for f in pathsrel
-    ]
-    return [p for p in paths if os.path.isdir(p)]
+    path = os.path.normpath(os.path.join(resourceutil.datapath, b'templates'))
+    return [path] if os.path.isdir(path) else []
 
 
 def templatepath(name):