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
66d9919c
Kaydet (Commit)
66d9919c
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
ee5e61d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
mhlib.py
Lib/mhlib.py
+20
-20
regsub.py
Lib/regsub.py
+2
-3
No files found.
Lib/mhlib.py
Dosyayı görüntüle @
66d9919c
...
...
@@ -216,7 +216,7 @@ class MH:
"""Create a new folder (or raise os.error if it cannot be created)."""
protect
=
pickline
(
self
.
profile
,
'Folder-Protect'
)
if
protect
and
isnumeric
(
protect
):
mode
=
string
.
atoi
(
protect
,
8
)
mode
=
int
(
protect
,
8
)
else
:
mode
=
FOLDER_PROTECT
os
.
mkdir
(
os
.
path
.
join
(
self
.
getpath
(),
name
),
mode
)
...
...
@@ -286,7 +286,7 @@ class Folder:
for
name
in
os
.
listdir
(
self
.
getfullname
()):
if
match
(
name
):
append
(
name
)
messages
=
map
(
string
.
atoi
,
messages
)
messages
=
map
(
int
,
messages
)
messages
.
sort
()
if
messages
:
self
.
last
=
messages
[
-
1
]
...
...
@@ -305,12 +305,12 @@ class Folder:
while
1
:
line
=
f
.
readline
()
if
not
line
:
break
fields
=
string
.
splitfields
(
line
,
':'
)
fields
=
line
.
split
(
':'
)
if
len
(
fields
)
!=
2
:
self
.
error
(
'bad sequence in
%
s:
%
s'
%
(
fullname
,
string
.
strip
(
line
)))
key
=
string
.
strip
(
fields
[
0
]
)
value
=
IntSet
(
string
.
strip
(
fields
[
1
]
),
' '
)
.
tolist
()
(
fullname
,
line
.
strip
(
)))
key
=
fields
[
0
]
.
strip
(
)
value
=
IntSet
(
fields
[
1
]
.
strip
(
),
' '
)
.
tolist
()
sequences
[
key
]
=
value
return
sequences
...
...
@@ -360,7 +360,7 @@ class Folder:
if
seq
==
'all'
:
return
all
# Test for X:Y before X-Y because 'seq:-n' matches both
i
=
s
tring
.
find
(
seq
,
':'
)
i
=
s
eq
.
find
(
':'
)
if
i
>=
0
:
head
,
dir
,
tail
=
seq
[:
i
],
''
,
seq
[
i
+
1
:]
if
tail
[:
1
]
in
'-+'
:
...
...
@@ -368,7 +368,7 @@ class Folder:
if
not
isnumeric
(
tail
):
raise
Error
,
"bad message list
%
s"
%
seq
try
:
count
=
string
.
atoi
(
tail
)
count
=
int
(
tail
)
except
(
ValueError
,
OverflowError
):
# Can't use sys.maxint because of i+count below
count
=
len
(
all
)
...
...
@@ -398,7 +398,7 @@ class Folder:
i
=
bisect
(
all
,
anchor
-
1
)
return
all
[
i
:
i
+
count
]
# Test for X-Y next
i
=
s
tring
.
find
(
seq
,
'-'
)
i
=
s
eq
.
find
(
'-'
)
if
i
>=
0
:
begin
=
self
.
_parseindex
(
seq
[:
i
],
all
)
end
=
self
.
_parseindex
(
seq
[
i
+
1
:],
all
)
...
...
@@ -431,7 +431,7 @@ class Folder:
"""Internal: parse a message number (or cur, first, etc.)."""
if
isnumeric
(
seq
):
try
:
return
string
.
atoi
(
seq
)
return
int
(
seq
)
except
(
OverflowError
,
ValueError
):
return
sys
.
maxint
if
seq
in
(
'cur'
,
'.'
):
...
...
@@ -681,16 +681,16 @@ class Message(mimetools.Message):
decide which headers to return (its argument is the header
name converted to lower case)."""
if
not
pred
:
return
string
.
joinfields
(
self
.
headers
,
''
)
return
''
.
join
(
self
.
headers
)
headers
=
[]
hit
=
0
for
line
in
self
.
headers
:
if
line
[
0
]
not
in
string
.
whitespace
:
i
=
string
.
find
(
line
,
':'
)
i
=
line
.
find
(
':'
)
if
i
>
0
:
hit
=
pred
(
string
.
lower
(
line
[:
i
]
))
hit
=
pred
(
line
[:
i
]
.
lower
(
))
if
hit
:
headers
.
append
(
line
)
return
string
.
joinfields
(
headers
,
''
)
return
''
.
joinfields
(
headers
)
def
getbodytext
(
self
,
decode
=
1
):
"""Return the message's body text as string. This undoes a
...
...
@@ -887,11 +887,11 @@ class IntSet:
def
fromstring
(
self
,
data
):
import
string
new
=
[]
for
part
in
string
.
splitfields
(
data
,
self
.
sep
):
for
part
in
data
.
split
(
self
.
sep
):
list
=
[]
for
subp
in
string
.
splitfields
(
part
,
self
.
rng
):
s
=
s
tring
.
strip
(
subp
)
list
.
append
(
string
.
atoi
(
s
))
for
subp
in
part
.
split
(
self
.
rng
):
s
=
s
ubp
.
strip
(
)
list
.
append
(
int
(
s
))
if
len
(
list
)
==
1
:
new
.
append
((
list
[
0
],
list
[
0
]))
elif
len
(
list
)
==
2
and
list
[
0
]
<=
list
[
1
]:
...
...
@@ -921,7 +921,7 @@ def pickline(file, key, casefold = 1):
if
not
line
or
line
[
0
]
not
in
string
.
whitespace
:
break
text
=
text
+
line
return
string
.
strip
(
text
)
return
text
.
strip
(
)
return
None
def
updateline
(
file
,
key
,
value
,
casefold
=
1
):
...
...
@@ -996,7 +996,7 @@ def test():
except
Error
,
msg
:
print
"Error:"
,
msg
stuff
=
os
.
popen
(
"pick
%
s 2>/dev/null"
%
`seq`
)
.
read
()
list
=
map
(
string
.
atoi
,
string
.
split
(
stuff
))
list
=
map
(
int
,
stuff
.
split
(
))
print
list
,
"<-- pick"
do
(
'f.listmessages()'
)
...
...
Lib/regsub.py
Dosyayı görüntüle @
66d9919c
...
...
@@ -107,11 +107,10 @@ def intsplit(str, pat, maxsplit, retain):
# Capitalize words split using a pattern
def
capwords
(
str
,
pat
=
'[^a-zA-Z0-9_]+'
):
import
string
words
=
splitx
(
str
,
pat
)
for
i
in
range
(
0
,
len
(
words
),
2
):
words
[
i
]
=
string
.
capitalize
(
words
[
i
]
)
return
string
.
joinfields
(
words
,
""
)
words
[
i
]
=
words
[
i
]
.
capitalize
(
)
return
""
.
joinfields
(
words
)
# Internal subroutines:
...
...
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