[Python-checkins] python/dist/src/Lib tarfile.py,1.22,1.23

gvanrossum at users.sourceforge.net gvanrossum at users.sourceforge.net
Sun Jan 16 01:16:16 CET 2005


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27534
Modified Files:
	tarfile.py 
Log Message:
Use decorators.
Index: tarfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- tarfile.py	31 Dec 2004 19:15:26 -0000	1.22
+++ tarfile.py	16 Jan 2005 00:16:11 -0000	1.23
@@ -656,6 +656,7 @@
 def __repr__(self):
 return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self))
 
+ @classmethod
 def frombuf(cls, buf):
 """Construct a TarInfo object from a 512 byte string buffer.
 """
@@ -699,8 +700,6 @@
 tarinfo.name += "/"
 return tarinfo
 
- frombuf = classmethod(frombuf)
-
 def tobuf(self):
 """Return a tar header block as a 512 byte string.
 """
@@ -858,6 +857,7 @@
 # the super-constructor. A sub-constructor is registered and made available
 # by adding it to the mapping in OPEN_METH.
 
+ @classmethod
 def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512):
 """Open a tar archive for reading, writing or appending. Return
 an appropriate TarFile class.
@@ -923,8 +923,7 @@
 
 raise ValueError, "undiscernible mode"
 
- open = classmethod(open)
-
+ @classmethod
 def taropen(cls, name, mode="r", fileobj=None):
 """Open uncompressed tar archive name for reading or writing.
 """
@@ -932,8 +931,7 @@
 raise ValueError, "mode must be 'r', 'a' or 'w'"
 return cls(name, mode, fileobj)
 
- taropen = classmethod(taropen)
-
+ @classmethod
 def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9):
 """Open gzip compressed tar archive name for reading or writing.
 Appending is not allowed.
@@ -970,8 +968,7 @@
 t._extfileobj = False
 return t
 
- gzopen = classmethod(gzopen)
-
+ @classmethod
 def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9):
 """Open bzip2 compressed tar archive name for reading or writing.
 Appending is not allowed.
@@ -1002,8 +999,6 @@
 t._extfileobj = False
 return t
 
- bz2open = classmethod(bz2open)
-
 # All *open() methods are registered here.
 OPEN_METH = {
 "tar": "taropen", # uncompressed tar


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /