Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
cpython
Commits
6e025bcd
Commit
6e025bcd
authored
24 years ago
by
Eric S. Raymond
Browse files
Options
Download
Email Patches
Plain Diff
String method cleanup.
parent
c8c6aa20
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
13 deletions
+7
-13
Lib/mhlib.py
Lib/mhlib.py
+2
-4
Lib/mimify.py
Lib/mimify.py
+1
-1
Lib/pre.py
Lib/pre.py
+1
-3
Lib/token.py
Lib/token.py
+1
-1
Lib/traceback.py
Lib/traceback.py
+2
-4
No files found.
Lib/mhlib.py
View file @
6e025bcd
...
...
@@ -76,7 +76,6 @@ import os
import
sys
from
stat
import
ST_NLINK
import
re
import
string
import
mimetools
import
multifile
import
shutil
...
...
@@ -685,7 +684,7 @@ class Message(mimetools.Message):
headers
=
[]
hit
=
0
for
line
in
self
.
headers
:
if
line
[
0
]
not
in
string
.
white
space
:
if
not
line
[
0
]
.
is
space
()
:
i
=
line
.
find
(
':'
)
if
i
>
0
:
hit
=
pred
(
line
[:
i
].
lower
())
...
...
@@ -885,7 +884,6 @@ class IntSet:
self
.
normalize
()
def
fromstring
(
self
,
data
):
import
string
new
=
[]
for
part
in
data
.
split
(
self
.
sep
):
list
=
[]
...
...
@@ -918,7 +916,7 @@ def pickline(file, key, casefold = 1):
text
=
line
[
len
(
key
)
+
1
:]
while
1
:
line
=
f
.
readline
()
if
not
line
or
line
[
0
]
not
in
string
.
white
space
:
if
not
line
or
not
line
[
0
]
.
is
space
()
:
break
text
=
text
+
line
return
text
.
strip
()
...
...
This diff is collapsed.
Click to expand it.
Lib/mimify.py
View file @
6e025bcd
...
...
@@ -110,7 +110,7 @@ def mime_decode_header(line):
break
match
=
res
.
group
(
1
)
# convert underscores to spaces (before =XX conversion!)
match
=
' '
.
join
(
string
.
split
(
match
,
'_'
))
match
=
' '
.
join
(
match
.
split
(
'_'
))
newline
=
newline
+
line
[
pos
:
res
.
start
(
0
)]
+
mime_decode
(
match
)
pos
=
res
.
end
(
0
)
return
newline
+
line
[
pos
:]
...
...
This diff is collapsed.
Click to expand it.
Lib/pre.py
View file @
6e025bcd
...
...
@@ -85,7 +85,6 @@ This module also defines an exception 'error'.
import
sys
import
string
from
pcre
import
*
#
...
...
@@ -223,10 +222,9 @@ def escape(pattern):
"""
result
=
list
(
pattern
)
alphanum
=
string
.
letters
+
'_'
+
string
.
digits
for
i
in
range
(
len
(
pattern
)):
char
=
pattern
[
i
]
if
char
not
in
alpha
num
:
if
not
char
.
isal
num
()
:
if
char
==
'
\000
'
:
result
[
i
]
=
'
\\
000'
else
:
result
[
i
]
=
'
\\
'
+
char
return
''
.
join
(
result
)
...
...
This diff is collapsed.
Click to expand it.
Lib/token.py
View file @
6e025bcd
...
...
@@ -104,7 +104,7 @@ def main():
match
=
prog
.
match
(
line
)
if
match
:
name
,
val
=
match
.
group
(
1
,
2
)
val
=
string
.
atoi
(
val
)
val
=
int
(
val
)
tokens
[
val
]
=
name
# reverse so we can sort them...
keys
=
tokens
.
keys
()
keys
.
sort
()
...
...
This diff is collapsed.
Click to expand it.
Lib/traceback.py
View file @
6e025bcd
"""Extract, format and print information about Python stack traces."""
import
linecache
import
string
import
sys
import
types
...
...
@@ -154,13 +153,12 @@ def format_exception_only(etype, value):
list
.
append
(
' File "%s", line %d
\n
'
%
(
filename
,
lineno
))
i
=
0
while
i
<
len
(
line
)
and
\
line
[
i
]
in
string
.
whitespace
:
while
i
<
len
(
line
)
and
line
[
i
].
isspace
():
i
=
i
+
1
list
.
append
(
' %s
\n
'
%
line
.
strip
())
s
=
' '
for
c
in
line
[
i
:
offset
-
1
]:
if
c
in
string
.
white
space
:
if
c
.
is
space
()
:
s
=
s
+
c
else
:
s
=
s
+
' '
...
...
This diff is collapsed.
Click to expand it.
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