mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-29776: Use decorator syntax for properties. (#585)
This commit is contained in:
parent
c85a26628c
commit
bdf6b910f9
10 changed files with 53 additions and 34 deletions
|
@ -761,17 +761,21 @@ class TarInfo(object):
|
|||
|
||||
# In pax headers the "name" and "linkname" field are called
|
||||
# "path" and "linkpath".
|
||||
def _getpath(self):
|
||||
@property
|
||||
def path(self):
|
||||
return self.name
|
||||
def _setpath(self, name):
|
||||
self.name = name
|
||||
path = property(_getpath, _setpath)
|
||||
|
||||
def _getlinkpath(self):
|
||||
@path.setter
|
||||
def path(self, name):
|
||||
self.name = name
|
||||
|
||||
@property
|
||||
def linkpath(self):
|
||||
return self.linkname
|
||||
def _setlinkpath(self, linkname):
|
||||
|
||||
@linkpath.setter
|
||||
def linkpath(self, linkname):
|
||||
self.linkname = linkname
|
||||
linkpath = property(_getlinkpath, _setlinkpath)
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue