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
6b8c5283
Kaydet (Commit)
6b8c5283
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
909bc1cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
mimify.py
Lib/mimify.py
+7
-7
telnetlib.py
Lib/telnetlib.py
+3
-4
No files found.
Lib/mimify.py
Dosyayı görüntüle @
6b8c5283
...
...
@@ -27,7 +27,7 @@ CHARSET = 'ISO-8859-1' # default charset for non-US-ASCII mail
QUOTE
=
'> '
# string replies are quoted with
# End configure
import
re
,
string
import
re
__all__
=
[
"mimify"
,
"unmimify"
,
"mime_encode_header"
,
"mime_decode_header"
]
...
...
@@ -96,7 +96,7 @@ def mime_decode(line):
if
res
is
None
:
break
newline
=
newline
+
line
[
pos
:
res
.
start
(
0
)]
+
\
chr
(
string
.
atoi
(
res
.
group
(
1
),
16
))
chr
(
int
(
res
.
group
(
1
),
16
))
pos
=
res
.
end
(
0
)
return
newline
+
line
[
pos
:]
...
...
@@ -110,7 +110,7 @@ def mime_decode_header(line):
break
match
=
res
.
group
(
1
)
# convert underscores to spaces (before =XX conversion!)
match
=
string
.
join
(
string
.
split
(
match
,
'_'
),
' '
)
match
=
' '
.
join
(
string
.
split
(
match
,
'_'
)
)
newline
=
newline
+
line
[
pos
:
res
.
start
(
0
)]
+
mime_decode
(
match
)
pos
=
res
.
end
(
0
)
return
newline
+
line
[
pos
:]
...
...
@@ -232,14 +232,14 @@ def mime_encode(line, header):
pos
=
0
if
len
(
line
)
>=
5
and
line
[:
5
]
==
'From '
:
# quote 'From ' at the start of a line for stupid mailers
newline
=
string
.
upper
(
'=
%02
x'
%
ord
(
'F'
)
)
newline
=
(
'=
%02
x'
%
ord
(
'F'
))
.
upper
(
)
pos
=
1
while
1
:
res
=
reg
.
search
(
line
,
pos
)
if
res
is
None
:
break
newline
=
newline
+
line
[
pos
:
res
.
start
(
0
)]
+
\
string
.
upper
(
'=
%02
x'
%
ord
(
res
.
group
(
0
))
)
(
'=
%02
x'
%
ord
(
res
.
group
(
0
)))
.
upper
(
)
pos
=
res
.
end
(
0
)
line
=
newline
+
line
[
pos
:]
...
...
@@ -346,7 +346,7 @@ def mimify_part(ifile, ofile, is_mime):
if
chrset_res
:
if
has_iso_chars
:
# change us-ascii into iso-8859-1
if
string
.
lower
(
chrset_res
.
group
(
2
)
)
==
'us-ascii'
:
if
chrset_res
.
group
(
2
)
.
lower
(
)
==
'us-ascii'
:
line
=
'
%
s
%
s
%
s'
%
(
chrset_res
.
group
(
1
),
CHARSET
,
chrset_res
.
group
(
3
))
...
...
@@ -447,7 +447,7 @@ if __name__ == '__main__' or (len(sys.argv) > 0 and sys.argv[0] == 'mimify'):
encode
=
unmimify
elif
o
==
'-l'
:
try
:
MAXLEN
=
string
.
atoi
(
a
)
MAXLEN
=
int
(
a
)
except
:
print
usage
sys
.
exit
(
1
)
...
...
Lib/telnetlib.py
Dosyayı görüntüle @
6b8c5283
...
...
@@ -40,7 +40,6 @@ To do:
import
sys
import
socket
import
select
import
string
# Tunable parameters
DEBUGLEVEL
=
0
...
...
@@ -187,7 +186,7 @@ class Telnet:
"""
if
IAC
in
buffer
:
buffer
=
string
.
replace
(
buffer
,
IAC
,
IAC
+
IAC
)
buffer
=
buffer
.
replace
(
IAC
,
IAC
+
IAC
)
self
.
msg
(
"send
%
s"
,
`buffer`
)
self
.
sock
.
send
(
buffer
)
...
...
@@ -201,7 +200,7 @@ class Telnet:
"""
n
=
len
(
match
)
self
.
process_rawq
()
i
=
s
tring
.
find
(
self
.
cookedq
,
match
)
i
=
s
elf
.
cookedq
.
find
(
match
)
if
i
>=
0
:
i
=
i
+
n
buf
=
self
.
cookedq
[:
i
]
...
...
@@ -215,7 +214,7 @@ class Telnet:
i
=
max
(
0
,
len
(
self
.
cookedq
)
-
n
)
self
.
fill_rawq
()
self
.
process_rawq
()
i
=
s
tring
.
find
(
self
.
cookedq
,
match
,
i
)
i
=
s
elf
.
cookedq
.
find
(
match
,
i
)
if
i
>=
0
:
i
=
i
+
n
buf
=
self
.
cookedq
[:
i
]
...
...
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