Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.py @ 27879:52a4ad62b006
cleanup: use modern @property/@foo.setter property specification
We can use this now that we're 2.6+, and this is more idiomatic modern
Python.
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 16 Jan 2016 10:50:28 -0500 |
parents | 4133a306606c |
children | 2d6a89e79b48 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Fri Jan 15 16:16:25 2016 +0100 +++ b/mercurial/scmutil.py Sat Jan 16 10:50:28 2016 -0500 @@ -448,22 +448,22 @@ if realpath: base = os.path.realpath(base) self.base = base - self._setmustaudit(audit) + self.mustaudit = audit self.createmode = None self._trustnlink = None - def _getmustaudit(self): + @property + def mustaudit(self): return self._audit - def _setmustaudit(self, onoff): + @mustaudit.setter + def mustaudit(self, onoff): self._audit = onoff if onoff: self.audit = pathutil.pathauditor(self.base) else: self.audit = util.always - mustaudit = property(_getmustaudit, _setmustaudit) - @util.propertycache def _cansymlink(self): return util.checklink(self.base) @@ -561,14 +561,14 @@ def __init__(self, vfs): self.vfs = vfs - def _getmustaudit(self): + @property + def mustaudit(self): return self.vfs.mustaudit - def _setmustaudit(self, onoff): + @mustaudit.setter + def mustaudit(self, onoff): self.vfs.mustaudit = onoff - mustaudit = property(_getmustaudit, _setmustaudit) - class filtervfs(abstractvfs, auditvfs): '''Wrapper vfs for filtering filenames with a function.'''