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
2bb96f59
Kaydet (Commit)
2bb96f59
authored
Eki 23, 2011
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Cleanup code: remove int/long idioms and simplify a while statement.
üst
8d48b43e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
35 deletions
+10
-35
ftplib.py
Lib/ftplib.py
+4
-13
optparse.py
Lib/optparse.py
+1
-4
pickletools.py
Lib/pickletools.py
+1
-4
xdrlib.py
Lib/xdrlib.py
+1
-5
client.py
Lib/xmlrpc/client.py
+3
-9
No files found.
Lib/ftplib.py
Dosyayı görüntüle @
2bb96f59
...
@@ -175,10 +175,8 @@ class FTP:
...
@@ -175,10 +175,8 @@ class FTP:
# Internal: "sanitize" a string for printing
# Internal: "sanitize" a string for printing
def
sanitize
(
self
,
s
):
def
sanitize
(
self
,
s
):
if
s
[:
5
]
==
'pass '
or
s
[:
5
]
==
'PASS '
:
if
s
[:
5
]
in
{
'pass '
,
'PASS '
}:
i
=
len
(
s
)
i
=
len
(
s
.
rstrip
(
'
\r\n
'
))
while
i
>
5
and
s
[
i
-
1
]
in
{
'
\r
'
,
'
\n
'
}:
i
=
i
-
1
s
=
s
[:
5
]
+
'*'
*
(
i
-
5
)
+
s
[
i
:]
s
=
s
[:
5
]
+
'*'
*
(
i
-
5
)
+
s
[
i
:]
return
repr
(
s
)
return
repr
(
s
)
...
@@ -596,10 +594,7 @@ class FTP:
...
@@ -596,10 +594,7 @@ class FTP:
resp
=
self
.
sendcmd
(
'SIZE '
+
filename
)
resp
=
self
.
sendcmd
(
'SIZE '
+
filename
)
if
resp
[:
3
]
==
'213'
:
if
resp
[:
3
]
==
'213'
:
s
=
resp
[
3
:]
.
strip
()
s
=
resp
[
3
:]
.
strip
()
try
:
return
int
(
s
)
return
int
(
s
)
except
(
OverflowError
,
ValueError
):
return
int
(
s
)
def
mkd
(
self
,
dirname
):
def
mkd
(
self
,
dirname
):
'''Make a directory, return its full pathname.'''
'''Make a directory, return its full pathname.'''
...
@@ -861,11 +856,7 @@ def parse150(resp):
...
@@ -861,11 +856,7 @@ def parse150(resp):
m
=
_150_re
.
match
(
resp
)
m
=
_150_re
.
match
(
resp
)
if
not
m
:
if
not
m
:
return
None
return
None
s
=
m
.
group
(
1
)
return
int
(
m
.
group
(
1
))
try
:
return
int
(
s
)
except
(
OverflowError
,
ValueError
):
return
int
(
s
)
_227_re
=
None
_227_re
=
None
...
...
Lib/optparse.py
Dosyayı görüntüle @
2bb96f59
...
@@ -417,11 +417,8 @@ def _parse_num(val, type):
...
@@ -417,11 +417,8 @@ def _parse_num(val, type):
def
_parse_int
(
val
):
def
_parse_int
(
val
):
return
_parse_num
(
val
,
int
)
return
_parse_num
(
val
,
int
)
def
_parse_long
(
val
):
return
_parse_num
(
val
,
int
)
_builtin_cvt
=
{
"int"
:
(
_parse_int
,
_
(
"integer"
)),
_builtin_cvt
=
{
"int"
:
(
_parse_int
,
_
(
"integer"
)),
"long"
:
(
_parse_
long
,
_
(
"long
integer"
)),
"long"
:
(
_parse_
int
,
_
(
"
integer"
)),
"float"
:
(
float
,
_
(
"floating-point"
)),
"float"
:
(
float
,
_
(
"floating-point"
)),
"complex"
:
(
complex
,
_
(
"complex"
))
}
"complex"
:
(
complex
,
_
(
"complex"
))
}
...
...
Lib/pickletools.py
Dosyayı görüntüle @
2bb96f59
...
@@ -510,10 +510,7 @@ def read_decimalnl_short(f):
...
@@ -510,10 +510,7 @@ def read_decimalnl_short(f):
elif
s
==
b
"01"
:
elif
s
==
b
"01"
:
return
True
return
True
try
:
return
int
(
s
)
return
int
(
s
)
except
OverflowError
:
return
int
(
s
)
def
read_decimalnl_long
(
f
):
def
read_decimalnl_long
(
f
):
r"""
r"""
...
...
Lib/xdrlib.py
Dosyayı görüntüle @
2bb96f59
...
@@ -141,11 +141,7 @@ class Unpacker:
...
@@ -141,11 +141,7 @@ class Unpacker:
data
=
self
.
__buf
[
i
:
j
]
data
=
self
.
__buf
[
i
:
j
]
if
len
(
data
)
<
4
:
if
len
(
data
)
<
4
:
raise
EOFError
raise
EOFError
x
=
struct
.
unpack
(
'>L'
,
data
)[
0
]
return
struct
.
unpack
(
'>L'
,
data
)[
0
]
try
:
return
int
(
x
)
except
OverflowError
:
return
x
def
unpack_int
(
self
):
def
unpack_int
(
self
):
i
=
self
.
__pos
i
=
self
.
__pos
...
...
Lib/xmlrpc/client.py
Dosyayı görüntüle @
2bb96f59
...
@@ -535,15 +535,6 @@ class Marshaller:
...
@@ -535,15 +535,6 @@ class Marshaller:
write
(
"<value><nil/></value>"
)
write
(
"<value><nil/></value>"
)
dispatch
[
type
(
None
)]
=
dump_nil
dispatch
[
type
(
None
)]
=
dump_nil
def
dump_int
(
self
,
value
,
write
):
# in case ints are > 32 bits
if
value
>
MAXINT
or
value
<
MININT
:
raise
OverflowError
(
"int exceeds XML-RPC limits"
)
write
(
"<value><int>"
)
write
(
str
(
value
))
write
(
"</int></value>
\n
"
)
#dispatch[int] = dump_int
def
dump_bool
(
self
,
value
,
write
):
def
dump_bool
(
self
,
value
,
write
):
write
(
"<value><boolean>"
)
write
(
"<value><boolean>"
)
write
(
value
and
"1"
or
"0"
)
write
(
value
and
"1"
or
"0"
)
...
@@ -558,6 +549,9 @@ class Marshaller:
...
@@ -558,6 +549,9 @@ class Marshaller:
write
(
"</int></value>
\n
"
)
write
(
"</int></value>
\n
"
)
dispatch
[
int
]
=
dump_long
dispatch
[
int
]
=
dump_long
# backward compatible
dump_int
=
dump_long
def
dump_double
(
self
,
value
,
write
):
def
dump_double
(
self
,
value
,
write
):
write
(
"<value><double>"
)
write
(
"<value><double>"
)
write
(
repr
(
value
))
write
(
repr
(
value
))
...
...
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