# HG changeset patch # User Augie Fackler # Date 1452959428 18000 # Node ID 52a4ad62b006e8ee2c8ffa95e7162da18824875b # Parent e7bd55db011b0d2ffa246fc7c9c3276d08f6be41 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. diff -r e7bd55db011b -r 52a4ad62b006 mercurial/bundle2.py --- a/mercurial/bundle2.py Fri Jan 15 16:16:25 2016 +0100 +++ b/mercurial/bundle2.py Sat Jan 16 10:50:28 2016 -0500 @@ -851,13 +851,15 @@ self._advisoryparams, self._data, self.mandatory) # methods used to defines the part content - def __setdata(self, data): + @property + def data(self): + return self._data + + @data.setter + def data(self, data): if self._generated is not None: raise error.ReadOnlyPartError('part is being generated') self._data = data - def __getdata(self): - return self._data - data = property(__getdata, __setdata) @property def mandatoryparams(self): diff -r e7bd55db011b -r 52a4ad62b006 mercurial/scmutil.py --- 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.'''