changeset 29779:997e8cf4d0a2

pycompat: avoid using an extra function We have a single line function which just lowercase the letters and replaces "_" with "". Its better to avoid that function call. Moreover we calling this function around 33 times.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 13 Aug 2016 04:21:42 +0530
parents 594035c1adc7
children 531e85eec23c
files mercurial/pycompat.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pycompat.py	Sat Aug 13 03:03:01 2016 +0530
+++ b/mercurial/pycompat.py	Sat Aug 13 04:21:42 2016 +0530
@@ -41,11 +41,10 @@
 
     copies items from origin to alias
     """
-    def hgcase(item):
-        return item.replace('_', '').lower()
     for item in items:
         try:
-            setattr(alias, hgcase(item), getattr(origin, item))
+            lcase = item.replace('_', '').lower()
+            setattr(alias, lcase, getattr(origin, item))
         except AttributeError:
             pass