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
b9c24fb5
Kaydet (Commit)
b9c24fb5
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
341f929f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
nntplib.py
Lib/nntplib.py
+9
-10
No files found.
Lib/nntplib.py
Dosyayı görüntüle @
b9c24fb5
...
@@ -31,7 +31,6 @@ are strings, not numbers, since they are rarely used for calculations.
...
@@ -31,7 +31,6 @@ are strings, not numbers, since they are rarely used for calculations.
# Imports
# Imports
import
re
import
re
import
socket
import
socket
import
string
__all__
=
[
"NNTP"
,
"NNTPReplyError"
,
"NNTPTemporaryError"
,
__all__
=
[
"NNTP"
,
"NNTPReplyError"
,
"NNTPTemporaryError"
,
"NNTPPermanentError"
,
"NNTPProtocolError"
,
"NNTPDataError"
,
"NNTPPermanentError"
,
"NNTPProtocolError"
,
"NNTPDataError"
,
...
@@ -267,7 +266,7 @@ class NNTP:
...
@@ -267,7 +266,7 @@ class NNTP:
resp
,
list
=
self
.
longcmd
(
'LIST'
)
resp
,
list
=
self
.
longcmd
(
'LIST'
)
for
i
in
range
(
len
(
list
)):
for
i
in
range
(
len
(
list
)):
# Parse lines into "group last first flag"
# Parse lines into "group last first flag"
list
[
i
]
=
tuple
(
string
.
split
(
list
[
i
]
))
list
[
i
]
=
tuple
(
list
[
i
]
.
split
(
))
return
resp
,
list
return
resp
,
list
def
group
(
self
,
name
):
def
group
(
self
,
name
):
...
@@ -283,7 +282,7 @@ class NNTP:
...
@@ -283,7 +282,7 @@ class NNTP:
resp
=
self
.
shortcmd
(
'GROUP '
+
name
)
resp
=
self
.
shortcmd
(
'GROUP '
+
name
)
if
resp
[:
3
]
!=
'211'
:
if
resp
[:
3
]
!=
'211'
:
raise
NNTPReplyError
(
resp
)
raise
NNTPReplyError
(
resp
)
words
=
string
.
split
(
resp
)
words
=
resp
.
split
(
)
count
=
first
=
last
=
0
count
=
first
=
last
=
0
n
=
len
(
words
)
n
=
len
(
words
)
if
n
>
1
:
if
n
>
1
:
...
@@ -293,7 +292,7 @@ class NNTP:
...
@@ -293,7 +292,7 @@ class NNTP:
if
n
>
3
:
if
n
>
3
:
last
=
words
[
3
]
last
=
words
[
3
]
if
n
>
4
:
if
n
>
4
:
name
=
string
.
lower
(
words
[
4
]
)
name
=
words
[
4
]
.
lower
(
)
return
resp
,
count
,
first
,
last
,
name
return
resp
,
count
,
first
,
last
,
name
def
help
(
self
):
def
help
(
self
):
...
@@ -307,7 +306,7 @@ class NNTP:
...
@@ -307,7 +306,7 @@ class NNTP:
"""Internal: parse the response of a STAT, NEXT or LAST command."""
"""Internal: parse the response of a STAT, NEXT or LAST command."""
if
resp
[:
2
]
!=
'22'
:
if
resp
[:
2
]
!=
'22'
:
raise
NNTPReplyError
(
resp
)
raise
NNTPReplyError
(
resp
)
words
=
string
.
split
(
resp
)
words
=
resp
.
split
(
)
nr
=
0
nr
=
0
id
=
''
id
=
''
n
=
len
(
words
)
n
=
len
(
words
)
...
@@ -414,14 +413,14 @@ class NNTP:
...
@@ -414,14 +413,14 @@ class NNTP:
resp
,
lines
=
self
.
longcmd
(
'XOVER '
+
start
+
'-'
+
end
)
resp
,
lines
=
self
.
longcmd
(
'XOVER '
+
start
+
'-'
+
end
)
xover_lines
=
[]
xover_lines
=
[]
for
line
in
lines
:
for
line
in
lines
:
elem
=
string
.
splitfields
(
line
,
"
\t
"
)
elem
=
line
.
split
(
"
\t
"
)
try
:
try
:
xover_lines
.
append
((
elem
[
0
],
xover_lines
.
append
((
elem
[
0
],
elem
[
1
],
elem
[
1
],
elem
[
2
],
elem
[
2
],
elem
[
3
],
elem
[
3
],
elem
[
4
],
elem
[
4
],
string
.
split
(
elem
[
5
]
),
elem
[
5
]
.
split
(
),
elem
[
6
],
elem
[
6
],
elem
[
7
]))
elem
[
7
]))
except
IndexError
:
except
IndexError
:
...
@@ -439,7 +438,7 @@ class NNTP:
...
@@ -439,7 +438,7 @@ class NNTP:
resp
,
raw_lines
=
self
.
longcmd
(
'XGTITLE '
+
group
)
resp
,
raw_lines
=
self
.
longcmd
(
'XGTITLE '
+
group
)
lines
=
[]
lines
=
[]
for
raw_line
in
raw_lines
:
for
raw_line
in
raw_lines
:
match
=
line_pat
.
search
(
string
.
strip
(
raw_line
))
match
=
line_pat
.
search
(
raw_line
.
strip
(
))
if
match
:
if
match
:
lines
.
append
(
match
.
group
(
1
,
2
))
lines
.
append
(
match
.
group
(
1
,
2
))
return
resp
,
lines
return
resp
,
lines
...
@@ -455,7 +454,7 @@ class NNTP:
...
@@ -455,7 +454,7 @@ class NNTP:
if
resp
[:
3
]
!=
'223'
:
if
resp
[:
3
]
!=
'223'
:
raise
NNTPReplyError
(
resp
)
raise
NNTPReplyError
(
resp
)
try
:
try
:
[
resp_num
,
path
]
=
string
.
split
(
resp
)
[
resp_num
,
path
]
=
resp
.
split
(
)
except
ValueError
:
except
ValueError
:
raise
NNTPReplyError
(
resp
)
raise
NNTPReplyError
(
resp
)
else
:
else
:
...
@@ -472,7 +471,7 @@ class NNTP:
...
@@ -472,7 +471,7 @@ class NNTP:
resp
=
self
.
shortcmd
(
"DATE"
)
resp
=
self
.
shortcmd
(
"DATE"
)
if
resp
[:
3
]
!=
'111'
:
if
resp
[:
3
]
!=
'111'
:
raise
NNTPReplyError
(
resp
)
raise
NNTPReplyError
(
resp
)
elem
=
string
.
split
(
resp
)
elem
=
resp
.
split
(
)
if
len
(
elem
)
!=
2
:
if
len
(
elem
)
!=
2
:
raise
NNTPDataError
(
resp
)
raise
NNTPDataError
(
resp
)
date
=
elem
[
1
][
2
:
8
]
date
=
elem
[
1
][
2
:
8
]
...
...
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