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
548703a1
Kaydet (Commit)
548703a1
authored
Mar 26, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
The usual.
üst
65e53990
Show whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
172 additions
and
32 deletions
+172
-32
basehttp.py
Lib/dos-8x3/basehttp.py
+0
-0
bastion.py
Lib/dos-8x3/bastion.py
+0
-0
cgihttps.py
Lib/dos-8x3/cgihttps.py
+0
-0
compilea.py
Lib/dos-8x3/compilea.py
+57
-18
configpa.py
Lib/dos-8x3/configpa.py
+4
-3
exceptio.py
Lib/dos-8x3/exceptio.py
+0
-0
fileinpu.py
Lib/dos-8x3/fileinpu.py
+0
-0
formatte.py
Lib/dos-8x3/formatte.py
+0
-0
gopherli.py
Lib/dos-8x3/gopherli.py
+20
-3
macurl2p.py
Lib/dos-8x3/macurl2p.py
+0
-0
mimetype.py
Lib/dos-8x3/mimetype.py
+0
-0
mimewrit.py
Lib/dos-8x3/mimewrit.py
+0
-0
multifil.py
Lib/dos-8x3/multifil.py
+11
-2
posixfil.py
Lib/dos-8x3/posixfil.py
+0
-0
py_compi.py
Lib/dos-8x3/py_compi.py
+36
-5
queue.py
Lib/dos-8x3/queue.py
+0
-0
reconver.py
Lib/dos-8x3/reconver.py
+0
-0
rlcomple.py
Lib/dos-8x3/rlcomple.py
+0
-0
simpleht.py
Lib/dos-8x3/simpleht.py
+0
-0
socketse.py
Lib/dos-8x3/socketse.py
+0
-0
telnetli.py
Lib/dos-8x3/telnetli.py
+2
-0
test_arr.py
Lib/dos-8x3/test_arr.py
+0
-0
test_aud.py
Lib/dos-8x3/test_aud.py
+0
-0
test_bin.py
Lib/dos-8x3/test_bin.py
+0
-0
test_bsd.py
Lib/dos-8x3/test_bsd.py
+0
-0
test_cma.py
Lib/dos-8x3/test_cma.py
+0
-0
test_err.py
Lib/dos-8x3/test_err.py
+0
-0
test_exc.py
Lib/dos-8x3/test_exc.py
+0
-0
test_ima.py
Lib/dos-8x3/test_ima.py
+0
-0
test_img.py
Lib/dos-8x3/test_img.py
+0
-0
test_opc.py
Lib/dos-8x3/test_opc.py
+0
-0
test_reg.py
Lib/dos-8x3/test_reg.py
+0
-0
test_rgb.py
Lib/dos-8x3/test_rgb.py
+0
-0
test_sel.py
Lib/dos-8x3/test_sel.py
+0
-0
test_soc.py
Lib/dos-8x3/test_soc.py
+0
-0
test_str.py
Lib/dos-8x3/test_str.py
+0
-0
test_sun.py
Lib/dos-8x3/test_sun.py
+6
-1
test_tim.py
Lib/dos-8x3/test_tim.py
+0
-0
test_typ.py
Lib/dos-8x3/test_typ.py
+5
-0
test_unp.py
Lib/dos-8x3/test_unp.py
+0
-0
test_xml.py
Lib/dos-8x3/test_xml.py
+25
-0
tracebac.py
Lib/dos-8x3/tracebac.py
+6
-0
No files found.
Lib/dos-8x3/basehttp.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/bastion.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/cgihttps.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/compilea.py
Dosyayı görüntüle @
548703a1
# Routines to force "compilation" of all .py files in a directory
"""Module/script to "compile" all .py files to .pyc (or .pyo) file.
# tree or on sys.path. By default recursion is pruned at a depth of
# 10 and the current directory, if it occurs in sys.path, is skipped.
When called as a script with arguments, this compiles the directories
# When called as a script, compiles argument directories, or sys.path
given as arguments recursively; the -l option prevents it from
# if no arguments.
recursing into directories.
# After a similar module by Sjoerd Mullender.
Without arguments, if compiles all modules on sys.path, without
recursing into subdirectories. (Even though it should do so for
packages -- for now, you'll have to deal with packages separately.)
See module py_compile for details of the actual byte-compilation.
"""
import
os
import
os
import
sys
import
sys
import
py_compile
import
py_compile
def
compile_dir
(
dir
,
maxlevels
=
10
):
def
compile_dir
(
dir
,
maxlevels
=
10
,
ddir
=
None
):
"""Byte-compile all modules in the given directory tree.
Arguments (only dir is required):
dir: the directory to byte-compile
maxlevels: maximum recursion level (default 10)
ddir: if given, purported directory name (this is the
directory name that will show up in error messages)
"""
print
'Listing'
,
dir
,
'...'
print
'Listing'
,
dir
,
'...'
try
:
try
:
names
=
os
.
listdir
(
dir
)
names
=
os
.
listdir
(
dir
)
...
@@ -19,16 +36,18 @@ def compile_dir(dir, maxlevels = 10):
...
@@ -19,16 +36,18 @@ def compile_dir(dir, maxlevels = 10):
names
.
sort
()
names
.
sort
()
for
name
in
names
:
for
name
in
names
:
fullname
=
os
.
path
.
join
(
dir
,
name
)
fullname
=
os
.
path
.
join
(
dir
,
name
)
if
ddir
:
dfile
=
os
.
path
.
join
(
ddir
,
name
)
else
:
dfile
=
None
if
os
.
path
.
isfile
(
fullname
):
if
os
.
path
.
isfile
(
fullname
):
head
,
tail
=
name
[:
-
3
],
name
[
-
3
:]
head
,
tail
=
name
[:
-
3
],
name
[
-
3
:]
if
tail
==
'.py'
:
if
tail
==
'.py'
:
print
'Compiling'
,
fullname
,
'...'
print
'Compiling'
,
fullname
,
'...'
try
:
try
:
py_compile
.
compile
(
fullnam
e
)
py_compile
.
compile
(
fullname
,
None
,
dfil
e
)
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
del
names
[:]
raise
KeyboardInterrupt
print
'
\n
[interrupt]'
break
except
:
except
:
if
type
(
sys
.
exc_type
)
==
type
(
''
):
if
type
(
sys
.
exc_type
)
==
type
(
''
):
exc_type_name
=
sys
.
exc_type
exc_type_name
=
sys
.
exc_type
...
@@ -39,32 +58,52 @@ def compile_dir(dir, maxlevels = 10):
...
@@ -39,32 +58,52 @@ def compile_dir(dir, maxlevels = 10):
name
!=
os
.
curdir
and
name
!=
os
.
pardir
and
\
name
!=
os
.
curdir
and
name
!=
os
.
pardir
and
\
os
.
path
.
isdir
(
fullname
)
and
\
os
.
path
.
isdir
(
fullname
)
and
\
not
os
.
path
.
islink
(
fullname
):
not
os
.
path
.
islink
(
fullname
):
compile_dir
(
fullname
,
maxlevels
-
1
)
compile_dir
(
fullname
,
maxlevels
-
1
,
dfile
)
def
compile_path
(
skip_curdir
=
1
):
def
compile_path
(
skip_curdir
=
1
,
maxlevels
=
0
):
"""Byte-compile all module on sys.path.
Arguments (all optional):
skip_curdir: if true, skip current directory (default true)
maxlevels: max recursion level (default 0)
"""
for
dir
in
sys
.
path
:
for
dir
in
sys
.
path
:
if
(
not
dir
or
dir
==
os
.
curdir
)
and
skip_curdir
:
if
(
not
dir
or
dir
==
os
.
curdir
)
and
skip_curdir
:
print
'Skipping current directory'
print
'Skipping current directory'
else
:
else
:
compile_dir
(
dir
,
0
)
compile_dir
(
dir
,
maxlevels
)
def
main
():
def
main
():
"""Script main program."""
import
getopt
import
getopt
try
:
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'l
'
)
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'ld:
'
)
except
getopt
.
error
,
msg
:
except
getopt
.
error
,
msg
:
print
msg
print
msg
print
"usage: compileall [-l
] [directory ...]"
print
"usage: compileall [-l] [-d destdir
] [directory ...]"
print
"-l: don't recurse down"
print
"-l: don't recurse down"
print
"-d destdir: purported directory name for error messages"
print
"if no arguments, -l sys.path is assumed"
print
"if no arguments, -l sys.path is assumed"
sys
.
exit
(
2
)
maxlevels
=
10
maxlevels
=
10
ddir
=
None
for
o
,
a
in
opts
:
for
o
,
a
in
opts
:
if
o
==
'-l'
:
maxlevels
=
0
if
o
==
'-l'
:
maxlevels
=
0
if
o
==
'-d'
:
ddir
=
a
if
ddir
:
if
len
(
args
)
!=
1
:
print
"-d destdir require exactly one directory argument"
sys
.
exit
(
2
)
try
:
if
args
:
if
args
:
for
dir
in
sys
.
argv
[
1
:]
:
for
dir
in
args
:
compile_dir
(
dir
,
maxlevels
)
compile_dir
(
dir
,
maxlevels
,
ddir
)
else
:
else
:
compile_path
()
compile_path
()
except
KeyboardInterrupt
:
print
"
\n
[interrupt]"
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
()
Lib/dos-8x3/configpa.py
Dosyayı görüntüle @
548703a1
...
@@ -164,13 +164,14 @@ class ConfigParser:
...
@@ -164,13 +164,14 @@ class ConfigParser:
The section DEFAULT is special.
The section DEFAULT is special.
"""
"""
try
:
try
:
d
=
self
.
__sections
[
section
]
.
copy
()
sectdict
=
self
.
__sections
[
section
]
.
copy
()
except
KeyError
:
except
KeyError
:
if
section
==
DEFAULTSECT
:
if
section
==
DEFAULTSECT
:
d
=
{}
sectdict
=
{}
else
:
else
:
raise
NoSectionError
(
section
)
raise
NoSectionError
(
section
)
d
.
update
(
self
.
__defaults
)
d
=
self
.
__defaults
.
copy
()
d
.
update
(
sectdict
)
option
=
string
.
lower
(
option
)
option
=
string
.
lower
(
option
)
try
:
try
:
rawval
=
d
[
option
]
rawval
=
d
[
option
]
...
...
Lib/dos-8x3/exceptio.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/fileinpu.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/formatte.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/gopherli.py
Dosyayı görüntüle @
548703a1
...
@@ -38,10 +38,10 @@ A_PLUS_SOUND = '<'
...
@@ -38,10 +38,10 @@ A_PLUS_SOUND = '<'
# Function mapping all file types to strings; unknown types become TYPE='x'
# Function mapping all file types to strings; unknown types become TYPE='x'
_names
=
dir
()
_names
=
dir
()
_type_to_name_map
=
None
_type_to_name_map
=
{}
def
type_to_name
(
gtype
):
def
type_to_name
(
gtype
):
global
_type_to_name_map
global
_type_to_name_map
if
not
_type_to_name_map
:
if
_type_to_name_map
==
{}
:
for
name
in
_names
:
for
name
in
_names
:
if
name
[:
2
]
==
'A_'
:
if
name
[:
2
]
==
'A_'
:
_type_to_name_map
[
eval
(
name
)]
=
name
[
2
:]
_type_to_name_map
[
eval
(
name
)]
=
name
[
2
:]
...
@@ -75,6 +75,22 @@ def send_selector(selector, host, port = 0):
...
@@ -75,6 +75,22 @@ def send_selector(selector, host, port = 0):
def
send_query
(
selector
,
query
,
host
,
port
=
0
):
def
send_query
(
selector
,
query
,
host
,
port
=
0
):
return
send_selector
(
selector
+
'
\t
'
+
query
,
host
,
port
)
return
send_selector
(
selector
+
'
\t
'
+
query
,
host
,
port
)
# Takes a path as returned by urlparse and returns the appropriate selector
def
path_to_selector
(
path
):
if
path
==
"/"
:
return
"/"
else
:
return
path
[
2
:]
# Cuts initial slash and data type identifier
# Takes a path as returned by urlparse and maps it to a string
# See section 3.4 of RFC 1738 for details
def
path_to_datatype_name
(
path
):
if
path
==
"/"
:
# No way to tell, although "INDEX" is likely
return
"TYPE='unknown'"
else
:
return
type_to_name
(
path
[
1
])
# The following functions interpret the data returned by the gopher
# The following functions interpret the data returned by the gopher
# server according to the expected type, e.g. textfile or directory
# server according to the expected type, e.g. textfile or directory
...
@@ -103,7 +119,8 @@ def get_directory(f):
...
@@ -103,7 +119,8 @@ def get_directory(f):
continue
continue
if
len
(
parts
)
>
4
:
if
len
(
parts
)
>
4
:
if
parts
[
4
:]
!=
[
'+'
]:
if
parts
[
4
:]
!=
[
'+'
]:
print
'(Extra info from server:'
,
parts
[
4
:],
')'
print
'(Extra info from server:'
,
print
parts
[
4
:],
')'
else
:
else
:
parts
.
append
(
''
)
parts
.
append
(
''
)
parts
.
insert
(
0
,
gtype
)
parts
.
insert
(
0
,
gtype
)
...
...
Lib/dos-8x3/macurl2p.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/mimetype.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/mimewrit.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/multifil.py
Dosyayı görüntüle @
548703a1
...
@@ -44,8 +44,17 @@ class MultiFile:
...
@@ -44,8 +44,17 @@ class MultiFile:
return
self
.
lastpos
return
self
.
lastpos
return
self
.
fp
.
tell
()
-
self
.
start
return
self
.
fp
.
tell
()
-
self
.
start
#
#
def
seek
(
self
,
pos
):
def
seek
(
self
,
pos
,
whence
=
0
):
if
not
0
<=
pos
<=
self
.
tell
()
or
\
here
=
self
.
tell
()
if
whence
:
if
whence
==
1
:
pos
=
pos
+
here
elif
whence
==
2
:
if
self
.
level
>
0
:
pos
=
pos
+
self
.
lastpos
else
:
raise
Error
,
"can't use whence=2 yet"
if
not
0
<=
pos
<=
here
or
\
self
.
level
>
0
and
pos
>
self
.
lastpos
:
self
.
level
>
0
and
pos
>
self
.
lastpos
:
raise
Error
,
'bad MultiFile.seek() call'
raise
Error
,
'bad MultiFile.seek() call'
self
.
fp
.
seek
(
pos
+
self
.
start
)
self
.
fp
.
seek
(
pos
+
self
.
start
)
...
...
Lib/dos-8x3/posixfil.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/py_compi.py
Dosyayı görüntüle @
548703a1
# Routine to "compile" a .py file to a .pyc file.
"""Routine to "compile" a .py file to a .pyc (or .pyo) file.
# This has intimate knowledge of how Python/import.c does it.
# By Sjoerd Mullender (I forced him to write it :-).
This module has intimate knowledge of the format of .pyc files.
"""
import
imp
import
imp
MAGIC
=
imp
.
get_magic
()
MAGIC
=
imp
.
get_magic
()
def
wr_long
(
f
,
x
):
def
wr_long
(
f
,
x
):
"Internal; write a 32-bit int to a file in little-endian order."
f
.
write
(
chr
(
x
&
0xff
))
f
.
write
(
chr
(
x
&
0xff
))
f
.
write
(
chr
((
x
>>
8
)
&
0xff
))
f
.
write
(
chr
((
x
>>
8
)
&
0xff
))
f
.
write
(
chr
((
x
>>
16
)
&
0xff
))
f
.
write
(
chr
((
x
>>
16
)
&
0xff
))
f
.
write
(
chr
((
x
>>
24
)
&
0xff
))
f
.
write
(
chr
((
x
>>
24
)
&
0xff
))
def
compile
(
file
,
cfile
=
None
):
def
compile
(
file
,
cfile
=
None
,
dfile
=
None
):
"""Byte-compile one Python source file to Python bytecode.
Arguments:
file: source filename
cfile: target filename; defaults to source with 'c' or 'o' appended
('c' normally, 'o' in optimizing mode, giving .pyc or .pyo)
dfile: purported filename; defaults to source (this is the filename
that will show up in error messages)
Note that it isn't necessary to byte-compile Python modules for
execution efficiency -- Python itself byte-compiles a module when
it is loaded, and if it can, writes out the bytecode to the
corresponding .pyc (or .pyo) file.
However, if a Python installation is shared between users, it is a
good idea to byte-compile all modules upon installation, since
other users may not be able to write in the source directories,
and thus they won't be able to write the .pyc/.pyo file, and then
they would be byte-compiling every module each time it is loaded.
This can slow down program start-up considerably.
See compileall.py for a script/module that uses this module to
byte-compile all installed files (or all files in selected
directories).
"""
import
os
,
marshal
,
__builtin__
import
os
,
marshal
,
__builtin__
f
=
open
(
file
)
f
=
open
(
file
)
try
:
try
:
...
@@ -20,7 +49,9 @@ def compile(file, cfile = None):
...
@@ -20,7 +49,9 @@ def compile(file, cfile = None):
timestamp
=
long
(
os
.
stat
(
file
)[
8
])
timestamp
=
long
(
os
.
stat
(
file
)[
8
])
codestring
=
f
.
read
()
codestring
=
f
.
read
()
f
.
close
()
f
.
close
()
codeobject
=
__builtin__
.
compile
(
codestring
,
file
,
'exec'
)
if
codestring
and
codestring
[
-
1
]
!=
'
\n
'
:
codestring
=
codestring
+
'
\n
'
codeobject
=
__builtin__
.
compile
(
codestring
,
dfile
or
file
,
'exec'
)
if
not
cfile
:
if
not
cfile
:
cfile
=
file
+
(
__debug__
and
'c'
or
'o'
)
cfile
=
file
+
(
__debug__
and
'c'
or
'o'
)
fc
=
open
(
cfile
,
'wb'
)
fc
=
open
(
cfile
,
'wb'
)
...
...
Lib/dos-8x3/queue.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/reconver.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/rlcomple.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/simpleht.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/socketse.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/telnetli.py
Dosyayı görüntüle @
548703a1
...
@@ -188,6 +188,7 @@ class Telnet:
...
@@ -188,6 +188,7 @@ class Telnet:
"""
"""
if
IAC
in
buffer
:
if
IAC
in
buffer
:
buffer
=
string
.
replace
(
buffer
,
IAC
,
IAC
+
IAC
)
buffer
=
string
.
replace
(
buffer
,
IAC
,
IAC
+
IAC
)
self
.
msg
(
"send
%
s"
,
`buffer`
)
self
.
sock
.
send
(
buffer
)
self
.
sock
.
send
(
buffer
)
def
read_until
(
self
,
match
,
timeout
=
None
):
def
read_until
(
self
,
match
,
timeout
=
None
):
...
@@ -365,6 +366,7 @@ class Telnet:
...
@@ -365,6 +366,7 @@ class Telnet:
# The buffer size should be fairly small so as to avoid quadratic
# The buffer size should be fairly small so as to avoid quadratic
# behavior in process_rawq() above
# behavior in process_rawq() above
buf
=
self
.
sock
.
recv
(
50
)
buf
=
self
.
sock
.
recv
(
50
)
self
.
msg
(
"recv
%
s"
,
`buf`
)
self
.
eof
=
(
not
buf
)
self
.
eof
=
(
not
buf
)
self
.
rawq
=
self
.
rawq
+
buf
self
.
rawq
=
self
.
rawq
+
buf
...
...
Lib/dos-8x3/test_arr.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_aud.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_bin.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_bsd.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_cma.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_err.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_exc.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_ima.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_img.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_opc.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_reg.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_rgb.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_sel.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_soc.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_str.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_sun.py
Dosyayı görüntüle @
548703a1
...
@@ -5,7 +5,12 @@ import os
...
@@ -5,7 +5,12 @@ import os
def
findfile
(
file
):
def
findfile
(
file
):
if
os
.
path
.
isabs
(
file
):
return
file
if
os
.
path
.
isabs
(
file
):
return
file
import
sys
import
sys
for
dn
in
sys
.
path
:
path
=
sys
.
path
try
:
path
=
[
os
.
path
.
dirname
(
__file__
)]
+
path
except
NameError
:
pass
for
dn
in
path
:
fn
=
os
.
path
.
join
(
dn
,
file
)
fn
=
os
.
path
.
join
(
dn
,
file
)
if
os
.
path
.
exists
(
fn
):
return
fn
if
os
.
path
.
exists
(
fn
):
return
fn
return
file
return
file
...
...
Lib/dos-8x3/test_tim.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_typ.py
Dosyayı görüntüle @
548703a1
...
@@ -161,6 +161,11 @@ if a <> [-2,-1,0,1,2]: raise TestFailed, 'list sort'
...
@@ -161,6 +161,11 @@ if a <> [-2,-1,0,1,2]: raise TestFailed, 'list sort'
def
revcmp
(
a
,
b
):
return
cmp
(
b
,
a
)
def
revcmp
(
a
,
b
):
return
cmp
(
b
,
a
)
a
.
sort
(
revcmp
)
a
.
sort
(
revcmp
)
if
a
<>
[
2
,
1
,
0
,
-
1
,
-
2
]:
raise
TestFailed
,
'list sort with cmp func'
if
a
<>
[
2
,
1
,
0
,
-
1
,
-
2
]:
raise
TestFailed
,
'list sort with cmp func'
# The following dumps core in unpatched Python 1.5:
def
myComparison
(
x
,
y
):
return
cmp
(
x
%
3
,
y
%
7
)
z
=
range
(
12
)
z
.
sort
(
myComparison
)
print
'6.6 Mappings == Dictionaries'
print
'6.6 Mappings == Dictionaries'
d
=
{}
d
=
{}
...
...
Lib/dos-8x3/test_unp.py
Dosyayı görüntüle @
548703a1
Lib/dos-8x3/test_xml.py
0 → 100644
Dosyayı görüntüle @
548703a1
'''Test module to thest the xmllib module.
Sjoerd Mullender
'''
from
test_support
import
verbose
testdoc
=
"""
\
<?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
<!-- comments aren't allowed before the <?xml?> tag,
but they are allowed before the <!DOCTYPE> tag -->
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
"""
import
xmllib
if
verbose
:
parser
=
xmllib
.
TestXMLParser
()
else
:
parser
=
xmllib
.
XMLParser
()
for
c
in
testdoc
:
parser
.
feed
(
c
)
parser
.
close
()
Lib/dos-8x3/tracebac.py
Dosyayı görüntüle @
548703a1
...
@@ -87,6 +87,8 @@ def format_exception(etype, value, tb, limit = None):
...
@@ -87,6 +87,8 @@ def format_exception(etype, value, tb, limit = None):
if
tb
:
if
tb
:
list
=
[
'Traceback (innermost last):
\n
'
]
list
=
[
'Traceback (innermost last):
\n
'
]
list
=
list
+
format_tb
(
tb
,
limit
)
list
=
list
+
format_tb
(
tb
,
limit
)
else
:
list
=
[]
list
=
list
+
format_exception_only
(
etype
,
value
)
list
=
list
+
format_exception_only
(
etype
,
value
)
return
list
return
list
...
@@ -186,9 +188,13 @@ def extract_stack(f=None, limit = None):
...
@@ -186,9 +188,13 @@ def extract_stack(f=None, limit = None):
# with -O on).
# with -O on).
# Coded by Marc-Andre Lemburg from the example of PyCode_Addr2Line()
# Coded by Marc-Andre Lemburg from the example of PyCode_Addr2Line()
# in compile.c.
# in compile.c.
# Revised version by Jim Hugunin to work with JPython too.
def
tb_lineno
(
tb
):
def
tb_lineno
(
tb
):
c
=
tb
.
tb_frame
.
f_code
c
=
tb
.
tb_frame
.
f_code
if
not
hasattr
(
c
,
'co_lnotab'
):
return
tb
.
tb_lineno
tab
=
c
.
co_lnotab
tab
=
c
.
co_lnotab
line
=
c
.
co_firstlineno
line
=
c
.
co_firstlineno
stopat
=
tb
.
tb_lasti
stopat
=
tb
.
tb_lasti
...
...
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