Mercurial > public > mercurial-scm > hg
comparison mercurial/smartset.py @ 38575:152f4822d210
pycompat: move rapply() from util
I want to use rapply() in utils.* modules, but that would introduce a
reference cycle util -> utils.* -> util. Moving rapply() to pycompat
should be okay since it mostly serves as a compatibility helper.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 10 Jun 2018 17:07:29 +0900 |
parents | f3033692ccef |
children | a3130208db1c |
comparison
equal
deleted
inserted
replaced
38574:f442c9494ec7 | 38575:152f4822d210 |
---|---|
27 ======== ================================= | 27 ======== ================================= |
28 """ | 28 """ |
29 if r is None: | 29 if r is None: |
30 return '' | 30 return '' |
31 elif isinstance(r, tuple): | 31 elif isinstance(r, tuple): |
32 return r[0] % util.rapply(pycompat.maybebytestr, r[1:]) | 32 return r[0] % pycompat.rapply(pycompat.maybebytestr, r[1:]) |
33 elif isinstance(r, bytes): | 33 elif isinstance(r, bytes): |
34 return r | 34 return r |
35 elif callable(r): | 35 elif callable(r): |
36 return r() | 36 return r() |
37 else: | 37 else: |