Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b49f4a4b
Commit
b49f4a4b
authored
Feb 09, 2001
by
Eric S. Raymond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
String method conversion.
parent
20e4423a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
20 deletions
+13
-20
Lib/BaseHTTPServer.py
Lib/BaseHTTPServer.py
+3
-4
Lib/asynchat.py
Lib/asynchat.py
+1
-2
Lib/asyncore.py
Lib/asyncore.py
+2
-9
Lib/bdb.py
Lib/bdb.py
+6
-4
Lib/binhex.py
Lib/binhex.py
+1
-1
No files found.
Lib/BaseHTTPServer.py
View file @
b49f4a4b
...
@@ -68,7 +68,6 @@ __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
...
@@ -68,7 +68,6 @@ __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
import
sys
import
sys
import
time
import
time
import
socket
# For gethostbyaddr()
import
socket
# For gethostbyaddr()
import
string
import
mimetools
import
mimetools
import
SocketServer
import
SocketServer
...
@@ -203,7 +202,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
...
@@ -203,7 +202,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
"""
"""
# The Python system version, truncated to its first component.
# The Python system version, truncated to its first component.
sys_version
=
"Python/"
+
s
tring
.
split
(
sys
.
version
)[
0
]
sys_version
=
"Python/"
+
s
ys
.
version
.
split
(
)[
0
]
# The server software version. You may want to override this.
# The server software version. You may want to override this.
# The format is multiple whitespace-separated strings,
# The format is multiple whitespace-separated strings,
...
@@ -228,7 +227,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
...
@@ -228,7 +227,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
elif
requestline
[
-
1
:]
==
'
\
n
'
:
elif
requestline
[
-
1
:]
==
'
\
n
'
:
requestline
=
requestline
[:
-
1
]
requestline
=
requestline
[:
-
1
]
self
.
requestline
=
requestline
self
.
requestline
=
requestline
words
=
string
.
split
(
requestline
)
words
=
requestline
.
split
(
)
if
len
(
words
)
==
3
:
if
len
(
words
)
==
3
:
[
command
,
path
,
version
]
=
words
[
command
,
path
,
version
]
=
words
if
version
[:
5
]
!=
'HTTP/'
:
if
version
[:
5
]
!=
'HTTP/'
:
...
@@ -468,7 +467,7 @@ def test(HandlerClass = BaseHTTPRequestHandler,
...
@@ -468,7 +467,7 @@ def test(HandlerClass = BaseHTTPRequestHandler,
"""
"""
if
sys
.
argv
[
1
:]:
if
sys
.
argv
[
1
:]:
port
=
s
tring
.
atoi
(
sys
.
argv
[
1
]
)
port
=
s
ys
.
argv
[
1
].
atoi
(
)
else
:
else
:
port
=
8000
port
=
8000
server_address
=
(
''
,
port
)
server_address
=
(
''
,
port
)
...
...
Lib/asynchat.py
View file @
b49f4a4b
...
@@ -48,7 +48,6 @@ you - by calling your self.found_terminator() method.
...
@@ -48,7 +48,6 @@ you - by calling your self.found_terminator() method.
import
socket
import
socket
import
asyncore
import
asyncore
import
string
class
async_chat
(
asyncore
.
dispatcher
):
class
async_chat
(
asyncore
.
dispatcher
):
"""This is an abstract class. You must derive from this class, and add
"""This is an abstract class. You must derive from this class, and add
...
@@ -120,7 +119,7 @@ class async_chat (asyncore.dispatcher):
...
@@ -120,7 +119,7 @@ class async_chat (asyncore.dispatcher):
# 3) end of buffer does not match any prefix:
# 3) end of buffer does not match any prefix:
# collect data
# collect data
terminator_len
=
len
(
terminator
)
terminator_len
=
len
(
terminator
)
index
=
string
.
find
(
self
.
ac_in_buffer
,
terminato
r
)
index
=
terminator
.
find
(
self
.
ac_in_buffe
r
)
if
index
!=
-
1
:
if
index
!=
-
1
:
# we found the terminator
# we found the terminator
if
index
>
0
:
if
index
>
0
:
...
...
Lib/asyncore.py
View file @
b49f4a4b
...
@@ -49,7 +49,6 @@ sophisticated high-performance network servers and clients a snap.
...
@@ -49,7 +49,6 @@ sophisticated high-performance network servers and clients a snap.
import
exceptions
import
exceptions
import
select
import
select
import
socket
import
socket
import
string
import
sys
import
sys
import
os
import
os
...
@@ -219,7 +218,7 @@ class dispatcher:
...
@@ -219,7 +218,7 @@ class dispatcher:
status
.
append
(
'%s:%d'
%
self
.
addr
)
status
.
append
(
'%s:%d'
%
self
.
addr
)
return
'<%s %s at %x>'
%
(
return
'<%s %s at %x>'
%
(
self
.
__class__
.
__name__
,
self
.
__class__
.
__name__
,
string
.
join
(
status
,
' '
),
' '
.
join
(
status
),
id
(
self
)
id
(
self
)
)
)
except
:
except
:
...
@@ -480,13 +479,7 @@ def compact_traceback ():
...
@@ -480,13 +479,7 @@ def compact_traceback ():
del
tb
del
tb
file
,
function
,
line
=
tbinfo
[
-
1
]
file
,
function
,
line
=
tbinfo
[
-
1
]
info
=
'['
+
string
.
join
(
info
=
'['
+
'] ['
.
join
(
map
(
lambda
x
:
'|'
.
join
(
x
),
tbinfo
))
+
']'
map
(
lambda
x
:
string
.
join
(
x
,
'|'
),
tbinfo
),
'] ['
)
+
']'
return
(
file
,
function
,
line
),
t
,
v
,
info
return
(
file
,
function
,
line
),
t
,
v
,
info
def
close_all
(
map
=
None
):
def
close_all
(
map
=
None
):
...
...
Lib/bdb.py
View file @
b49f4a4b
...
@@ -306,7 +306,7 @@ class Bdb:
...
@@ -306,7 +306,7 @@ class Bdb:
#
#
def
format_stack_entry
(
self
,
frame_lineno
,
lprefix
=
': '
):
def
format_stack_entry
(
self
,
frame_lineno
,
lprefix
=
': '
):
import
linecache
,
repr
,
string
import
linecache
,
repr
frame
,
lineno
=
frame_lineno
frame
,
lineno
=
frame_lineno
filename
=
self
.
canonic
(
frame
.
f_code
.
co_filename
)
filename
=
self
.
canonic
(
frame
.
f_code
.
co_filename
)
s
=
filename
+
'('
+
`lineno`
+
')'
s
=
filename
+
'('
+
`lineno`
+
')'
...
@@ -327,7 +327,7 @@ class Bdb:
...
@@ -327,7 +327,7 @@ class Bdb:
s
=
s
+
'->'
s
=
s
+
'->'
s
=
s
+
repr
.
repr
(
rv
)
s
=
s
+
repr
.
repr
(
rv
)
line
=
linecache
.
getline
(
filename
,
lineno
)
line
=
linecache
.
getline
(
filename
,
lineno
)
if
line
:
s
=
s
+
lprefix
+
string
.
strip
(
line
)
if
line
:
s
=
s
+
lprefix
+
line
.
strip
(
)
return
s
return
s
# The following two methods can be called by clients to use
# The following two methods can be called by clients to use
...
@@ -534,12 +534,12 @@ class Tdb(Bdb):
...
@@ -534,12 +534,12 @@ class Tdb(Bdb):
if
not
name
:
name
=
'???'
if
not
name
:
name
=
'???'
print
'+++ call'
,
name
,
args
print
'+++ call'
,
name
,
args
def
user_line
(
self
,
frame
):
def
user_line
(
self
,
frame
):
import
linecache
,
string
import
linecache
name
=
frame
.
f_code
.
co_name
name
=
frame
.
f_code
.
co_name
if
not
name
:
name
=
'???'
if
not
name
:
name
=
'???'
fn
=
self
.
canonic
(
frame
.
f_code
.
co_filename
)
fn
=
self
.
canonic
(
frame
.
f_code
.
co_filename
)
line
=
linecache
.
getline
(
fn
,
frame
.
f_lineno
)
line
=
linecache
.
getline
(
fn
,
frame
.
f_lineno
)
print
'+++'
,
fn
,
frame
.
f_lineno
,
name
,
':'
,
string
.
strip
(
line
)
print
'+++'
,
fn
,
frame
.
f_lineno
,
name
,
':'
,
line
.
strip
(
)
def
user_return
(
self
,
frame
,
retval
):
def
user_return
(
self
,
frame
,
retval
):
print
'+++ return'
,
retval
print
'+++ return'
,
retval
def
user_exception
(
self
,
frame
,
exc_stuff
):
def
user_exception
(
self
,
frame
,
exc_stuff
):
...
@@ -558,3 +558,5 @@ def bar(a):
...
@@ -558,3 +558,5 @@ def bar(a):
def
test
():
def
test
():
t
=
Tdb
()
t
=
Tdb
()
t
.
run
(
'import bdb; bdb.foo(10)'
)
t
.
run
(
'import bdb; bdb.foo(10)'
)
# end
Lib/binhex.py
View file @
b49f4a4b
...
@@ -102,7 +102,7 @@ else:
...
@@ -102,7 +102,7 @@ else:
dsize
=
fp
.
tell
()
dsize
=
fp
.
tell
()
fp
.
close
()
fp
.
close
()
dir
,
file
=
os
.
path
.
split
(
name
)
dir
,
file
=
os
.
path
.
split
(
name
)
file
=
string
.
replace
(
file
,
':'
,
'-'
,
1
)
file
=
file
.
replace
(
':'
,
'-'
,
1
)
return
file
,
finfo
,
dsize
,
0
return
file
,
finfo
,
dsize
,
0
class
openrsrc
:
class
openrsrc
:
...
...
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