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
836e9aab
Kaydet (Commit)
836e9aab
authored
Ara 10, 2011
tarafından
Giampaolo Rodola'
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix #13563: make use of with statement in ftplib.py where needed
üst
313b2ad1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
20 deletions
+5
-20
ftplib.py
Lib/ftplib.py
+5
-20
No files found.
Lib/ftplib.py
Dosyayı görüntüle @
836e9aab
...
...
@@ -359,8 +359,7 @@ class FTP:
conn
.
close
()
raise
else
:
sock
=
self
.
makeport
()
try
:
with
self
.
makeport
()
as
sock
:
if
rest
is
not
None
:
self
.
sendcmd
(
"REST
%
s"
%
rest
)
resp
=
self
.
sendcmd
(
cmd
)
...
...
@@ -372,8 +371,6 @@ class FTP:
conn
,
sockaddr
=
sock
.
accept
()
if
self
.
timeout
is
not
_GLOBAL_DEFAULT_TIMEOUT
:
conn
.
settimeout
(
self
.
timeout
)
finally
:
sock
.
close
()
if
resp
[:
3
]
==
'150'
:
# this is conditional in case we received a 125
size
=
parse150
(
resp
)
...
...
@@ -753,8 +750,7 @@ else:
def
retrbinary
(
self
,
cmd
,
callback
,
blocksize
=
8192
,
rest
=
None
):
self
.
voidcmd
(
'TYPE I'
)
conn
=
self
.
transfercmd
(
cmd
,
rest
)
try
:
with
self
.
transfercmd
(
cmd
,
rest
)
as
conn
:
while
1
:
data
=
conn
.
recv
(
blocksize
)
if
not
data
:
...
...
@@ -763,8 +759,6 @@ else:
# shutdown ssl layer
if
isinstance
(
conn
,
ssl
.
SSLSocket
):
conn
.
unwrap
()
finally
:
conn
.
close
()
return
self
.
voidresp
()
def
retrlines
(
self
,
cmd
,
callback
=
None
):
...
...
@@ -772,7 +766,7 @@ else:
resp
=
self
.
sendcmd
(
'TYPE A'
)
conn
=
self
.
transfercmd
(
cmd
)
fp
=
conn
.
makefile
(
'r'
,
encoding
=
self
.
encoding
)
try
:
with
fp
,
conn
:
while
1
:
line
=
fp
.
readline
()
if
self
.
debugging
>
2
:
print
(
'*retr*'
,
repr
(
line
))
...
...
@@ -786,15 +780,11 @@ else:
# shutdown ssl layer
if
isinstance
(
conn
,
ssl
.
SSLSocket
):
conn
.
unwrap
()
finally
:
fp
.
close
()
conn
.
close
()
return
self
.
voidresp
()
def
storbinary
(
self
,
cmd
,
fp
,
blocksize
=
8192
,
callback
=
None
,
rest
=
None
):
self
.
voidcmd
(
'TYPE I'
)
conn
=
self
.
transfercmd
(
cmd
,
rest
)
try
:
with
self
.
transfercmd
(
cmd
,
rest
)
as
conn
:
while
1
:
buf
=
fp
.
read
(
blocksize
)
if
not
buf
:
break
...
...
@@ -803,14 +793,11 @@ else:
# shutdown ssl layer
if
isinstance
(
conn
,
ssl
.
SSLSocket
):
conn
.
unwrap
()
finally
:
conn
.
close
()
return
self
.
voidresp
()
def
storlines
(
self
,
cmd
,
fp
,
callback
=
None
):
self
.
voidcmd
(
'TYPE A'
)
conn
=
self
.
transfercmd
(
cmd
)
try
:
with
self
.
transfercmd
(
cmd
)
as
conn
:
while
1
:
buf
=
fp
.
readline
()
if
not
buf
:
break
...
...
@@ -822,8 +809,6 @@ else:
# shutdown ssl layer
if
isinstance
(
conn
,
ssl
.
SSLSocket
):
conn
.
unwrap
()
finally
:
conn
.
close
()
return
self
.
voidresp
()
def
abort
(
self
):
...
...
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