Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0c24e8b8
Kaydet (Commit)
0c24e8b8
authored
Agu 02, 2008
tarafından
Lars Gustäbel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove the TarFileCompat class from tarfile.py.
üst
8e746e3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
63 deletions
+3
-63
tarfile.rst
Doc/library/tarfile.rst
+1
-15
tarfile.py
Lib/tarfile.py
+0
-48
NEWS
Misc/NEWS
+2
-0
No files found.
Doc/library/tarfile.rst
Dosyayı görüntüle @
0c24e8b8
...
@@ -119,21 +119,7 @@ Some facts and figures:
...
@@ -119,21 +119,7 @@ Some facts and figures:
module can read.
module can read.
.. class:: TarFileCompat(filename, mode='r', compression=TAR_PLAIN)
The :mod:`tarfile` module defines the following exceptions:
Class for limited access to tar archives with a :mod:`zipfile`\ -like interface.
Please consult the documentation of the :mod:`zipfile` module for more details.
*compression* must be one of the following constants:
.. data:: TAR_PLAIN
Constant for an uncompressed tar archive.
.. data:: TAR_GZIPPED
Constant for a :mod:`gzip` compressed tar archive.
.. exception:: TarError
.. exception:: TarError
...
...
Lib/tarfile.py
Dosyayı görüntüle @
0c24e8b8
...
@@ -2451,54 +2451,6 @@ class _ringbuffer(list):
...
@@ -2451,54 +2451,6 @@ class _ringbuffer(list):
self
.
idx
=
idx
self
.
idx
=
idx
return
item
return
item
#---------------------------------------------
# zipfile compatible TarFile class
#---------------------------------------------
TAR_PLAIN
=
0
# zipfile.ZIP_STORED
TAR_GZIPPED
=
8
# zipfile.ZIP_DEFLATED
class
TarFileCompat
:
"""TarFile class compatible with standard module zipfile's
ZipFile class.
"""
def
__init__
(
self
,
file
,
mode
=
"r"
,
compression
=
TAR_PLAIN
):
if
compression
==
TAR_PLAIN
:
self
.
tarfile
=
TarFile
.
taropen
(
file
,
mode
)
elif
compression
==
TAR_GZIPPED
:
self
.
tarfile
=
TarFile
.
gzopen
(
file
,
mode
)
else
:
raise
ValueError
(
"unknown compression constant"
)
if
mode
[
0
:
1
]
==
"r"
:
members
=
self
.
tarfile
.
getmembers
()
for
m
in
members
:
m
.
filename
=
m
.
name
m
.
file_size
=
m
.
size
m
.
date_time
=
time
.
gmtime
(
m
.
mtime
)[:
6
]
def
namelist
(
self
):
return
map
(
lambda
m
:
m
.
name
,
self
.
infolist
())
def
infolist
(
self
):
return
filter
(
lambda
m
:
m
.
type
in
REGULAR_TYPES
,
self
.
tarfile
.
getmembers
())
def
printdir
(
self
):
self
.
tarfile
.
list
()
def
testzip
(
self
):
return
def
getinfo
(
self
,
name
):
return
self
.
tarfile
.
getmember
(
name
)
def
read
(
self
,
name
):
return
self
.
tarfile
.
extractfile
(
self
.
tarfile
.
getmember
(
name
))
.
read
()
def
write
(
self
,
filename
,
arcname
=
None
,
compress_type
=
None
):
self
.
tarfile
.
add
(
filename
,
arcname
)
def
writestr
(
self
,
zinfo
,
bytes
):
from
io
import
StringIO
import
calendar
zinfo
.
name
=
zinfo
.
filename
zinfo
.
size
=
zinfo
.
file_size
zinfo
.
mtime
=
calendar
.
timegm
(
zinfo
.
date_time
)
self
.
tarfile
.
addfile
(
zinfo
,
StringIO
(
bytes
))
def
close
(
self
):
self
.
tarfile
.
close
()
#class TarFileCompat
#--------------------
#--------------------
# exported functions
# exported functions
#--------------------
#--------------------
...
...
Misc/NEWS
Dosyayı görüntüle @
0c24e8b8
...
@@ -18,6 +18,8 @@ Core and Builtins
...
@@ -18,6 +18,8 @@ Core and Builtins
Library
Library
-------
-------
- Remove the TarFileCompat class from tarfile.py.
- Issue #2491: os.fdopen is now almost an alias for the built-in open(), and
- Issue #2491: os.fdopen is now almost an alias for the built-in open(), and
accepts the same parameters. It just checks that its first argument is an
accepts the same parameters. It just checks that its first argument is an
integer.
integer.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment