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
a608bb22
Kaydet (Commit)
a608bb22
authored
Haz 15, 2006
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Whitespace normalization.
üst
84b0f581
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
test_zipfile.py
Lib/test/test_zipfile.py
+4
-4
zipfile.py
Lib/zipfile.py
+11
-11
No files found.
Lib/test/test_zipfile.py
Dosyayı görüntüle @
a608bb22
...
...
@@ -46,7 +46,7 @@ class TestsWithSourceFile(unittest.TestCase):
zipfp
.
printdir
()
finally
:
sys
.
stdout
=
stdout
directory
=
fp
.
getvalue
()
lines
=
directory
.
splitlines
()
self
.
assertEquals
(
len
(
lines
),
4
)
# Number of files + header
...
...
@@ -133,13 +133,13 @@ class TestZip64InSmallFiles(unittest.TestCase):
def
largeFileExceptionTest
(
self
,
f
,
compression
):
zipfp
=
zipfile
.
ZipFile
(
f
,
"w"
,
compression
)
self
.
assertRaises
(
zipfile
.
LargeZipFile
,
self
.
assertRaises
(
zipfile
.
LargeZipFile
,
zipfp
.
write
,
TESTFN
,
"another"
+
os
.
extsep
+
"name"
)
zipfp
.
close
()
def
largeFileExceptionTest2
(
self
,
f
,
compression
):
zipfp
=
zipfile
.
ZipFile
(
f
,
"w"
,
compression
)
self
.
assertRaises
(
zipfile
.
LargeZipFile
,
self
.
assertRaises
(
zipfile
.
LargeZipFile
,
zipfp
.
writestr
,
"another"
+
os
.
extsep
+
"name"
,
self
.
data
)
zipfp
.
close
()
...
...
@@ -171,7 +171,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
zipfp
.
printdir
()
finally
:
sys
.
stdout
=
stdout
directory
=
fp
.
getvalue
()
lines
=
directory
.
splitlines
()
self
.
assertEquals
(
len
(
lines
),
4
)
# Number of files + header
...
...
Lib/zipfile.py
Dosyayı görüntüle @
a608bb22
...
...
@@ -17,7 +17,7 @@ class BadZipfile(Exception):
class
LargeZipFile
(
Exception
):
"""
"""
Raised when writing a zipfile, the zipfile requires ZIP64 extensions
and those extensions are disabled.
"""
...
...
@@ -99,20 +99,20 @@ def _EndRecData64(fpin, offset, endrec):
fpin
.
seek
(
offset
-
locatorSize
,
2
)
data
=
fpin
.
read
(
locatorSize
)
sig
,
diskno
,
reloff
,
disks
=
struct
.
unpack
(
structEndArchive64Locator
,
data
)
if
sig
!=
stringEndArchive64Locator
:
if
sig
!=
stringEndArchive64Locator
:
return
endrec
if
diskno
!=
0
or
disks
!=
1
:
raise
BadZipfile
(
"zipfiles that span multiple disks are not supported"
)
# Assume no 'zip64 extensible data'
# Assume no 'zip64 extensible data'
endArchiveSize
=
struct
.
calcsize
(
structEndArchive64
)
fpin
.
seek
(
offset
-
locatorSize
-
endArchiveSize
,
2
)
data
=
fpin
.
read
(
endArchiveSize
)
sig
,
sz
,
create_version
,
read_version
,
disk_num
,
disk_dir
,
\
dircount
,
dircount2
,
dirsize
,
diroffset
=
\
struct
.
unpack
(
structEndArchive64
,
data
)
if
sig
!=
stringEndArchive64
:
if
sig
!=
stringEndArchive64
:
return
endrec
# Update the original endrec using data from the ZIP64 record
...
...
@@ -294,7 +294,7 @@ class ZipInfo (object):
idx
+=
1
extra
=
extra
[
ln
+
4
:]
class
ZipFile
:
""" Class with methods to open, read, write, close, list zip files.
...
...
@@ -642,7 +642,7 @@ class ZipFile:
records."""
if
self
.
fp
is
None
:
return
if
self
.
mode
in
(
"w"
,
"a"
)
and
self
.
_didModify
:
# write ending records
count
=
0
pos1
=
self
.
fp
.
tell
()
...
...
@@ -674,7 +674,7 @@ class ZipFile:
extra_data
=
struct
.
pack
(
'<hh'
+
'q'
*
len
(
extra
),
1
,
8
*
len
(
extra
),
*
extra
)
+
extra_data
extract_version
=
max
(
45
,
zinfo
.
extract_version
)
create_version
=
max
(
45
,
zinfo
.
create_version
)
else
:
...
...
@@ -704,7 +704,7 @@ class ZipFile:
self
.
fp
.
write
(
zip64endrec
)
zip64locrec
=
struct
.
pack
(
structEndArchive64Locator
,
structEndArchive64Locator
,
stringEndArchive64Locator
,
0
,
pos2
,
1
)
self
.
fp
.
write
(
zip64locrec
)
...
...
@@ -862,7 +862,7 @@ def main(args = None):
zf
=
ZipFile
(
args
[
1
],
'r'
)
out
=
args
[
2
]
for
path
in
zf
.
namelist
():
if
path
.
startswith
(
'./'
):
if
path
.
startswith
(
'./'
):
tgt
=
os
.
path
.
join
(
out
,
path
[
2
:])
else
:
tgt
=
os
.
path
.
join
(
out
,
path
)
...
...
@@ -885,9 +885,9 @@ def main(args = None):
zf
.
write
(
path
,
zippath
,
ZIP_DEFLATED
)
elif
os
.
path
.
isdir
(
path
):
for
nm
in
os
.
listdir
(
path
):
addToZip
(
zf
,
addToZip
(
zf
,
os
.
path
.
join
(
path
,
nm
),
os
.
path
.
join
(
zippath
,
nm
))
# else: ignore
# else: ignore
zf
=
ZipFile
(
args
[
1
],
'w'
,
allowZip64
=
True
)
for
src
in
args
[
2
:]:
...
...
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