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
d5825ccd
Kaydet (Commit)
d5825ccd
authored
Eyl 05, 2010
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Take advantage of the frozenset constant optimization.
üst
0d739d70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
_markupbase.py
Lib/_markupbase.py
+4
-4
ftplib.py
Lib/ftplib.py
+7
-7
No files found.
Lib/_markupbase.py
Dosyayı görüntüle @
d5825ccd
...
@@ -122,7 +122,7 @@ class ParserBase:
...
@@ -122,7 +122,7 @@ class ParserBase:
# this could be handled in a separate doctype parser
# this could be handled in a separate doctype parser
if
decltype
==
"doctype"
:
if
decltype
==
"doctype"
:
j
=
self
.
_parse_doctype_subset
(
j
+
1
,
i
)
j
=
self
.
_parse_doctype_subset
(
j
+
1
,
i
)
elif
decltype
in
(
"attlist"
,
"linktype"
,
"link"
,
"element"
)
:
elif
decltype
in
{
"attlist"
,
"linktype"
,
"link"
,
"element"
}
:
# must tolerate []'d groups in a content model in an element declaration
# must tolerate []'d groups in a content model in an element declaration
# also in data attribute specifications of attlist declaration
# also in data attribute specifications of attlist declaration
# also link type declaration subsets in linktype declarations
# also link type declaration subsets in linktype declarations
...
@@ -145,10 +145,10 @@ class ParserBase:
...
@@ -145,10 +145,10 @@ class ParserBase:
sectName
,
j
=
self
.
_scan_name
(
i
+
3
,
i
)
sectName
,
j
=
self
.
_scan_name
(
i
+
3
,
i
)
if
j
<
0
:
if
j
<
0
:
return
j
return
j
if
sectName
in
(
"temp"
,
"cdata"
,
"ignore"
,
"include"
,
"rcdata"
)
:
if
sectName
in
{
"temp"
,
"cdata"
,
"ignore"
,
"include"
,
"rcdata"
}
:
# look for standard ]]> ending
# look for standard ]]> ending
match
=
_markedsectionclose
.
search
(
rawdata
,
i
+
3
)
match
=
_markedsectionclose
.
search
(
rawdata
,
i
+
3
)
elif
sectName
in
(
"if"
,
"else"
,
"endif"
)
:
elif
sectName
in
{
"if"
,
"else"
,
"endif"
}
:
# look for MS Office ]> ending
# look for MS Office ]> ending
match
=
_msmarkedsectionclose
.
search
(
rawdata
,
i
+
3
)
match
=
_msmarkedsectionclose
.
search
(
rawdata
,
i
+
3
)
else
:
else
:
...
@@ -203,7 +203,7 @@ class ParserBase:
...
@@ -203,7 +203,7 @@ class ParserBase:
name
,
j
=
self
.
_scan_name
(
j
+
2
,
declstartpos
)
name
,
j
=
self
.
_scan_name
(
j
+
2
,
declstartpos
)
if
j
==
-
1
:
if
j
==
-
1
:
return
-
1
return
-
1
if
name
not
in
(
"attlist"
,
"element"
,
"entity"
,
"notation"
)
:
if
name
not
in
{
"attlist"
,
"element"
,
"entity"
,
"notation"
}
:
self
.
updatepos
(
declstartpos
,
j
+
2
)
self
.
updatepos
(
declstartpos
,
j
+
2
)
self
.
error
(
self
.
error
(
"unknown declaration
%
r in internal subset"
%
name
)
"unknown declaration
%
r in internal subset"
%
name
)
...
...
Lib/ftplib.py
Dosyayı görüntüle @
d5825ccd
...
@@ -171,7 +171,7 @@ class FTP:
...
@@ -171,7 +171,7 @@ class FTP:
def
sanitize
(
self
,
s
):
def
sanitize
(
self
,
s
):
if
s
[:
5
]
==
'pass '
or
s
[:
5
]
==
'PASS '
:
if
s
[:
5
]
==
'pass '
or
s
[:
5
]
==
'PASS '
:
i
=
len
(
s
)
i
=
len
(
s
)
while
i
>
5
and
s
[
i
-
1
]
in
'
\r\n
'
:
while
i
>
5
and
s
[
i
-
1
]
in
{
'
\r
'
,
'
\n
'
}
:
i
=
i
-
1
i
=
i
-
1
s
=
s
[:
5
]
+
'*'
*
(
i
-
5
)
+
s
[
i
:]
s
=
s
[:
5
]
+
'*'
*
(
i
-
5
)
+
s
[
i
:]
return
repr
(
s
)
return
repr
(
s
)
...
@@ -221,7 +221,7 @@ class FTP:
...
@@ -221,7 +221,7 @@ class FTP:
if
self
.
debugging
:
print
(
'*resp*'
,
self
.
sanitize
(
resp
))
if
self
.
debugging
:
print
(
'*resp*'
,
self
.
sanitize
(
resp
))
self
.
lastresp
=
resp
[:
3
]
self
.
lastresp
=
resp
[:
3
]
c
=
resp
[:
1
]
c
=
resp
[:
1
]
if
c
in
(
'1'
,
'2'
,
'3'
)
:
if
c
in
{
'1'
,
'2'
,
'3'
}
:
return
resp
return
resp
if
c
==
'4'
:
if
c
==
'4'
:
raise
error_temp
(
resp
)
raise
error_temp
(
resp
)
...
@@ -245,7 +245,7 @@ class FTP:
...
@@ -245,7 +245,7 @@ class FTP:
if
self
.
debugging
>
1
:
print
(
'*put urgent*'
,
self
.
sanitize
(
line
))
if
self
.
debugging
>
1
:
print
(
'*put urgent*'
,
self
.
sanitize
(
line
))
self
.
sock
.
sendall
(
line
,
MSG_OOB
)
self
.
sock
.
sendall
(
line
,
MSG_OOB
)
resp
=
self
.
getmultiline
()
resp
=
self
.
getmultiline
()
if
resp
[:
3
]
not
in
(
'426'
,
'225'
,
'226'
)
:
if
resp
[:
3
]
not
in
{
'426'
,
'225'
,
'226'
}
:
raise
error_proto
(
resp
)
raise
error_proto
(
resp
)
def
sendcmd
(
self
,
cmd
):
def
sendcmd
(
self
,
cmd
):
...
@@ -375,7 +375,7 @@ class FTP:
...
@@ -375,7 +375,7 @@ class FTP:
if
not
user
:
user
=
'anonymous'
if
not
user
:
user
=
'anonymous'
if
not
passwd
:
passwd
=
''
if
not
passwd
:
passwd
=
''
if
not
acct
:
acct
=
''
if
not
acct
:
acct
=
''
if
user
==
'anonymous'
and
passwd
in
(
''
,
'-'
)
:
if
user
==
'anonymous'
and
passwd
in
{
''
,
'-'
}
:
# If there is no anonymous ftp password specified
# If there is no anonymous ftp password specified
# then we'll just use anonymous@
# then we'll just use anonymous@
# We don't send any other thing because:
# We don't send any other thing because:
...
@@ -534,7 +534,7 @@ class FTP:
...
@@ -534,7 +534,7 @@ class FTP:
def
delete
(
self
,
filename
):
def
delete
(
self
,
filename
):
'''Delete a file.'''
'''Delete a file.'''
resp
=
self
.
sendcmd
(
'DELE '
+
filename
)
resp
=
self
.
sendcmd
(
'DELE '
+
filename
)
if
resp
[:
3
]
in
(
'250'
,
'200'
)
:
if
resp
[:
3
]
in
{
'250'
,
'200'
}
:
return
resp
return
resp
else
:
else
:
raise
error_reply
(
resp
)
raise
error_reply
(
resp
)
...
@@ -897,9 +897,9 @@ def ftpcp(source, sourcename, target, targetname = '', type = 'I'):
...
@@ -897,9 +897,9 @@ def ftpcp(source, sourcename, target, targetname = '', type = 'I'):
# transfer request.
# transfer request.
# So: STOR before RETR, because here the target is a "user".
# So: STOR before RETR, because here the target is a "user".
treply
=
target
.
sendcmd
(
'STOR '
+
targetname
)
treply
=
target
.
sendcmd
(
'STOR '
+
targetname
)
if
treply
[:
3
]
not
in
(
'125'
,
'150'
)
:
raise
error_proto
# RFC 959
if
treply
[:
3
]
not
in
{
'125'
,
'150'
}
:
raise
error_proto
# RFC 959
sreply
=
source
.
sendcmd
(
'RETR '
+
sourcename
)
sreply
=
source
.
sendcmd
(
'RETR '
+
sourcename
)
if
sreply
[:
3
]
not
in
(
'125'
,
'150'
)
:
raise
error_proto
# RFC 959
if
sreply
[:
3
]
not
in
{
'125'
,
'150'
}
:
raise
error_proto
# RFC 959
source
.
voidresp
()
source
.
voidresp
()
target
.
voidresp
()
target
.
voidresp
()
...
...
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