@@ -717,11 +717,32 @@ class TarInfo(object):
717717 usually created internally.
718718 """
719719
720- __slots__ = ("name" , "mode" , "uid" , "gid" , "size" , "mtime" ,
721- "chksum" , "type" , "linkname" , "uname" , "gname" ,
722- "devmajor" , "devminor" ,
723- "offset" , "offset_data" , "pax_headers" , "sparse" ,
724- "tarfile" , "_sparse_structs" , "_link_target" )
720+ __slots__ = dict (
721+ name = 'Name of the archive member.' ,
722+ mode = 'Permission bits.' ,
723+ uid = 'User ID of the user who originally stored this member.' ,
724+ gid = 'Group ID of the user who originally stored this member.' ,
725+ size = 'Size in bytes.' ,
726+ mtime = 'Time of last modification.' ,
727+ chksum = 'Header checksum.' ,
728+ type = ('File type. type is usually one of these constants: '
729+ 'REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, '
730+ 'CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.' ),
731+ linkname = ('Name of the target file name, which is only present '
732+ 'in TarInfo objects of type LNKTYPE and SYMTYPE.' ),
733+ uname = 'User name.' ,
734+ gname = 'Group name.' ,
735+ devmajor = 'Device major number.' ,
736+ devminor = 'Device minor number.' ,
737+ offset = 'The tar header starts here.' ,
738+ offset_data = "The file's data starts here." ,
739+ pax_headers = ('A dictionary containing key-value pairs of an '
740+ 'associated pax extended header.' ),
741+ sparse = 'Sparse member information.' ,
742+ tarfile = None ,
743+ _sparse_structs = None ,
744+ _link_target = None ,
745+ )
725746
726747 def __init__ (self , name = "" ):
727748 """Construct a TarInfo object. name is the optional name
@@ -747,10 +768,9 @@ def __init__(self, name=""):
747768 self .sparse = None # sparse member information
748769 self .pax_headers = {} # pax header information
749770
750- # In pax headers the "name" and "linkname" field are called
751- # "path" and "linkpath".
752771 @property
753772 def path (self ):
773+ 'In pax headers, "name" is called "path".'
754774 return self .name
755775
756776 @path .setter
@@ -759,6 +779,7 @@ def path(self, name):
759779
760780 @property
761781 def linkpath (self ):
782+ 'In pax headers, "linkname" is called "linkpath".'
762783 return self .linkname
763784
764785 @linkpath .setter
@@ -1350,24 +1371,42 @@ def _block(self, count):
13501371 return blocks * BLOCKSIZE
13511372
13521373 def isreg (self ):
1374+ 'Return True if the Tarinfo object is a regular file.'
13531375 return self .type in REGULAR_TYPES
1376+
13541377 def isfile (self ):
1378+ 'Return True if the Tarinfo object is a regular file.'
13551379 return self .isreg ()
1380+
13561381 def isdir (self ):
1382+ 'Return True if it is a directory.'
13571383 return self .type == DIRTYPE
1384+
13581385 def issym (self ):
1386+ 'Return True if it is a symbolic link.'
13591387 return self .type == SYMTYPE
1388+
13601389 def islnk (self ):
1390+ 'Return True if it is a hard link.'
13611391 return self .type == LNKTYPE
1392+
13621393 def ischr (self ):
1394+ 'Return True if it is a character device.'
13631395 return self .type == CHRTYPE
1396+
13641397 def isblk (self ):
1398+ 'Return True if it is a block device.'
13651399 return self .type == BLKTYPE
1400+
13661401 def isfifo (self ):
1402+ 'Return True if it is a FIFO.'
13671403 return self .type == FIFOTYPE
1404+
13681405 def issparse (self ):
13691406 return self .sparse is not None
1407+
13701408 def isdev (self ):
1409+ 'Return True if it is one of character device, block device or FIFO.'
13711410 return self .type in (CHRTYPE , BLKTYPE , FIFOTYPE )
13721411# class TarInfo
13731412
0 commit comments