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
c95bf69f
Kaydet (Commit)
c95bf69f
authored
Şub 09, 2001
tarafından
Eric S. Raymond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
String method conversion.
üst
7e9b4f58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
ftplib.py
Lib/ftplib.py
+13
-13
No files found.
Lib/ftplib.py
Dosyayı görüntüle @
c95bf69f
...
@@ -238,10 +238,10 @@ class FTP:
...
@@ -238,10 +238,10 @@ class FTP:
'''Send a PORT command with the current host and the given
'''Send a PORT command with the current host and the given
port number.
port number.
'''
'''
hbytes
=
string
.
splitfields
(
host
,
'.'
)
hbytes
=
host
.
split
(
'.'
)
pbytes
=
[
`port/256`
,
`port%256`
]
pbytes
=
[
`port/256`
,
`port%256`
]
bytes
=
hbytes
+
pbytes
bytes
=
hbytes
+
pbytes
cmd
=
'PORT '
+
string
.
joinfields
(
bytes
,
','
)
cmd
=
'PORT '
+
','
.
join
(
bytes
)
return
self
.
voidcmd
(
cmd
)
return
self
.
voidcmd
(
cmd
)
def
makeport
(
self
):
def
makeport
(
self
):
...
@@ -456,7 +456,7 @@ class FTP:
...
@@ -456,7 +456,7 @@ class FTP:
# Note that the RFC doesn't say anything about 'SIZE'
# Note that the RFC doesn't say anything about 'SIZE'
resp
=
self
.
sendcmd
(
'SIZE '
+
filename
)
resp
=
self
.
sendcmd
(
'SIZE '
+
filename
)
if
resp
[:
3
]
==
'213'
:
if
resp
[:
3
]
==
'213'
:
return
string
.
atoi
(
string
.
strip
(
resp
[
3
:]
))
return
int
(
resp
[
3
:]
.
strip
(
))
def
mkd
(
self
,
dirname
):
def
mkd
(
self
,
dirname
):
'''Make a directory, return its full pathname.'''
'''Make a directory, return its full pathname.'''
...
@@ -500,7 +500,7 @@ def parse150(resp):
...
@@ -500,7 +500,7 @@ def parse150(resp):
_150_re
=
re
.
compile
(
"150 .*
\
((
\
d+) bytes
\
)"
,
re
.
IGNORECASE
)
_150_re
=
re
.
compile
(
"150 .*
\
((
\
d+) bytes
\
)"
,
re
.
IGNORECASE
)
m
=
_150_re
.
match
(
resp
)
m
=
_150_re
.
match
(
resp
)
if
m
:
if
m
:
return
string
.
atoi
(
m
.
group
(
1
))
return
int
(
m
.
group
(
1
))
return
None
return
None
...
@@ -511,16 +511,16 @@ def parse227(resp):
...
@@ -511,16 +511,16 @@ def parse227(resp):
if
resp
[:
3
]
!=
'227'
:
if
resp
[:
3
]
!=
'227'
:
raise
error_reply
,
resp
raise
error_reply
,
resp
left
=
string
.
find
(
resp
,
'('
)
left
=
resp
.
find
(
'('
)
if
left
<
0
:
raise
error_proto
,
resp
if
left
<
0
:
raise
error_proto
,
resp
right
=
string
.
find
(
resp
,
')'
,
left
+
1
)
right
=
resp
.
find
(
')'
,
left
+
1
)
if
right
<
0
:
if
right
<
0
:
raise
error_proto
,
resp
# should contain '(h1,h2,h3,h4,p1,p2)'
raise
error_proto
,
resp
# should contain '(h1,h2,h3,h4,p1,p2)'
numbers
=
string
.
split
(
resp
[
left
+
1
:
right
],
','
)
numbers
=
resp
[
left
+
1
:
right
]
.
split
(
','
)
if
len
(
numbers
)
!=
6
:
if
len
(
numbers
)
!=
6
:
raise
error_proto
,
resp
raise
error_proto
,
resp
host
=
string
.
join
(
numbers
[:
4
],
'.'
)
host
=
'.'
.
join
(
numbers
[:
4
]
)
port
=
(
string
.
atoi
(
numbers
[
4
])
<<
8
)
+
string
.
atoi
(
numbers
[
5
])
port
=
(
int
(
numbers
[
4
])
<<
8
)
+
int
(
numbers
[
5
])
return
host
,
port
return
host
,
port
...
@@ -598,13 +598,13 @@ class Netrc:
...
@@ -598,13 +598,13 @@ class Netrc:
while
1
:
while
1
:
line
=
fp
.
readline
()
line
=
fp
.
readline
()
if
not
line
:
break
if
not
line
:
break
if
in_macro
and
string
.
strip
(
line
):
if
in_macro
and
line
.
strip
(
):
macro_lines
.
append
(
line
)
macro_lines
.
append
(
line
)
continue
continue
elif
in_macro
:
elif
in_macro
:
self
.
__macros
[
macro_name
]
=
tuple
(
macro_lines
)
self
.
__macros
[
macro_name
]
=
tuple
(
macro_lines
)
in_macro
=
0
in_macro
=
0
words
=
string
.
split
(
line
)
words
=
line
.
split
(
)
host
=
user
=
passwd
=
acct
=
None
host
=
user
=
passwd
=
acct
=
None
default
=
0
default
=
0
i
=
0
i
=
0
...
@@ -617,7 +617,7 @@ class Netrc:
...
@@ -617,7 +617,7 @@ class Netrc:
if
w1
==
'default'
:
if
w1
==
'default'
:
default
=
1
default
=
1
elif
w1
==
'machine'
and
w2
:
elif
w1
==
'machine'
and
w2
:
host
=
string
.
lower
(
w2
)
host
=
w2
.
lower
(
)
i
=
i
+
1
i
=
i
+
1
elif
w1
==
'login'
and
w2
:
elif
w1
==
'login'
and
w2
:
user
=
w2
user
=
w2
...
@@ -659,7 +659,7 @@ class Netrc:
...
@@ -659,7 +659,7 @@ class Netrc:
password, and the accounting field.
password, and the accounting field.
"""
"""
host
=
string
.
lower
(
host
)
host
=
host
.
lower
(
)
user
=
passwd
=
acct
=
None
user
=
passwd
=
acct
=
None
if
self
.
__hosts
.
has_key
(
host
):
if
self
.
__hosts
.
has_key
(
host
):
user
,
passwd
,
acct
=
self
.
__hosts
[
host
]
user
,
passwd
,
acct
=
self
.
__hosts
[
host
]
...
...
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