mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 15:57:43 +03:00
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.
This commit is contained in:
parent
1eb9840e42
commit
0ce0d571e7
@ -41,11 +41,10 @@ def _alias(alias, origin, items):
|
||||
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user