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
ac6df95d
Kaydet (Commit)
ac6df95d
authored
May 13, 2003
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix use of 'file' as a variable name.
(I've tested the fixes, but please proofread anyway.)
üst
bf1bef82
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
108 additions
and
107 deletions
+108
-107
byteyears.py
Tools/scripts/byteyears.py
+6
-6
dutree.py
Tools/scripts/dutree.py
+2
-2
eptags.py
Tools/scripts/eptags.py
+8
-8
finddiv.py
Tools/scripts/finddiv.py
+8
-8
fixdiv.py
Tools/scripts/fixdiv.py
+8
-8
fixheader.py
Tools/scripts/fixheader.py
+10
-10
fixps.py
Tools/scripts/fixps.py
+6
-6
ftpmirror.py
Tools/scripts/ftpmirror.py
+3
-3
ifdef.py
Tools/scripts/ifdef.py
+3
-3
mkreal.py
Tools/scripts/mkreal.py
+3
-3
objgraph.py
Tools/scripts/objgraph.py
+18
-18
pindent.py
Tools/scripts/pindent.py
+2
-2
ptags.py
Tools/scripts/ptags.py
+8
-7
suff.py
Tools/scripts/suff.py
+7
-7
untabify.py
Tools/scripts/untabify.py
+9
-9
which.py
Tools/scripts/which.py
+7
-7
No files found.
Tools/scripts/byteyears.py
Dosyayı görüntüle @
ac6df95d
...
@@ -34,15 +34,15 @@ status = 0 # Exit status, set to 1 on errors
...
@@ -34,15 +34,15 @@ status = 0 # Exit status, set to 1 on errors
# Compute max file name length
# Compute max file name length
maxlen
=
1
maxlen
=
1
for
file
in
sys
.
argv
[
1
:]:
for
file
name
in
sys
.
argv
[
1
:]:
if
len
(
file
)
>
maxlen
:
maxlen
=
len
(
file
)
maxlen
=
max
(
maxlen
,
len
(
filename
)
)
# Process each argument in turn
# Process each argument in turn
for
file
in
sys
.
argv
[
1
:]:
for
file
name
in
sys
.
argv
[
1
:]:
try
:
try
:
st
=
statfunc
(
file
)
st
=
statfunc
(
file
name
)
except
os
.
error
,
msg
:
except
os
.
error
,
msg
:
sys
.
stderr
.
write
(
'can
\'
t stat '
+
`file`
+
': '
+
`msg`
+
'
\n
'
)
sys
.
stderr
.
write
(
'can
\'
t stat '
+
`file
name
`
+
': '
+
`msg`
+
'
\n
'
)
status
=
1
status
=
1
st
=
()
st
=
()
if
st
:
if
st
:
...
@@ -50,7 +50,7 @@ for file in sys.argv[1:]:
...
@@ -50,7 +50,7 @@ for file in sys.argv[1:]:
size
=
st
[
ST_SIZE
]
size
=
st
[
ST_SIZE
]
age
=
now
-
anytime
age
=
now
-
anytime
byteyears
=
float
(
size
)
*
float
(
age
)
/
secs_per_year
byteyears
=
float
(
size
)
*
float
(
age
)
/
secs_per_year
print
file
.
ljust
(
maxlen
),
print
file
name
.
ljust
(
maxlen
),
print
repr
(
int
(
byteyears
))
.
rjust
(
8
)
print
repr
(
int
(
byteyears
))
.
rjust
(
8
)
sys
.
exit
(
status
)
sys
.
exit
(
status
)
Tools/scripts/dutree.py
Dosyayı görüntüle @
ac6df95d
...
@@ -11,8 +11,8 @@ def main():
...
@@ -11,8 +11,8 @@ def main():
while
line
[
i
]
in
'0123456789'
:
i
=
i
+
1
while
line
[
i
]
in
'0123456789'
:
i
=
i
+
1
size
=
eval
(
line
[:
i
])
size
=
eval
(
line
[:
i
])
while
line
[
i
]
in
'
\t
'
:
i
=
i
+
1
while
line
[
i
]
in
'
\t
'
:
i
=
i
+
1
file
=
line
[
i
:
-
1
]
file
name
=
line
[
i
:
-
1
]
comps
=
file
.
split
(
'/'
)
comps
=
file
name
.
split
(
'/'
)
if
comps
[
0
]
==
''
:
comps
[
0
]
=
'/'
if
comps
[
0
]
==
''
:
comps
[
0
]
=
'/'
if
comps
[
len
(
comps
)
-
1
]
==
''
:
del
comps
[
len
(
comps
)
-
1
]
if
comps
[
len
(
comps
)
-
1
]
==
''
:
del
comps
[
len
(
comps
)
-
1
]
total
,
d
=
store
(
size
,
comps
,
total
,
d
)
total
,
d
=
store
(
size
,
comps
,
total
,
d
)
...
...
Tools/scripts/eptags.py
Dosyayı görüntüle @
ac6df95d
...
@@ -21,12 +21,12 @@ import sys,re
...
@@ -21,12 +21,12 @@ import sys,re
expr
=
r'^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]'
expr
=
r'^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]'
matcher
=
re
.
compile
(
expr
)
matcher
=
re
.
compile
(
expr
)
def
treat_file
(
file
,
outfp
):
def
treat_file
(
file
name
,
outfp
):
"""Append tags found in file named 'file' to the open file 'outfp'"""
"""Append tags found in file named 'file
name
' to the open file 'outfp'"""
try
:
try
:
fp
=
open
(
file
,
'r'
)
fp
=
open
(
file
name
,
'r'
)
except
:
except
:
sys
.
stderr
.
write
(
'Cannot open
%
s
\n
'
%
file
)
sys
.
stderr
.
write
(
'Cannot open
%
s
\n
'
%
file
name
)
return
return
charno
=
0
charno
=
0
lineno
=
0
lineno
=
0
...
@@ -39,18 +39,18 @@ def treat_file(file, outfp):
...
@@ -39,18 +39,18 @@ def treat_file(file, outfp):
lineno
=
lineno
+
1
lineno
=
lineno
+
1
m
=
matcher
.
search
(
line
)
m
=
matcher
.
search
(
line
)
if
m
:
if
m
:
tag
=
m
.
group
(
0
)
+
'
\177
%
d,
%
d
\n
'
%
(
lineno
,
charno
)
tag
=
m
.
group
(
0
)
+
'
\177
%
d,
%
d
\n
'
%
(
lineno
,
charno
)
tags
.
append
(
tag
)
tags
.
append
(
tag
)
size
=
size
+
len
(
tag
)
size
=
size
+
len
(
tag
)
charno
=
charno
+
len
(
line
)
charno
=
charno
+
len
(
line
)
outfp
.
write
(
'
\f\n
%
s,
%
d
\n
'
%
(
fil
e
,
size
))
outfp
.
write
(
'
\f\n
%
s,
%
d
\n
'
%
(
filenam
e
,
size
))
for
tag
in
tags
:
for
tag
in
tags
:
outfp
.
write
(
tag
)
outfp
.
write
(
tag
)
def
main
():
def
main
():
outfp
=
open
(
'TAGS'
,
'w'
)
outfp
=
open
(
'TAGS'
,
'w'
)
for
file
in
sys
.
argv
[
1
:]:
for
file
name
in
sys
.
argv
[
1
:]:
treat_file
(
file
,
outfp
)
treat_file
(
file
name
,
outfp
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
()
main
()
Tools/scripts/finddiv.py
Dosyayı görüntüle @
ac6df95d
...
@@ -37,8 +37,8 @@ def main():
...
@@ -37,8 +37,8 @@ def main():
if
o
==
"-l"
:
if
o
==
"-l"
:
listnames
=
1
listnames
=
1
exit
=
None
exit
=
None
for
file
in
args
:
for
file
name
in
args
:
x
=
process
(
file
,
listnames
)
x
=
process
(
file
name
,
listnames
)
exit
=
exit
or
x
exit
=
exit
or
x
return
exit
return
exit
...
@@ -47,11 +47,11 @@ def usage(msg):
...
@@ -47,11 +47,11 @@ def usage(msg):
sys
.
stderr
.
write
(
"Usage:
%
s [-l] file ...
\n
"
%
sys
.
argv
[
0
])
sys
.
stderr
.
write
(
"Usage:
%
s [-l] file ...
\n
"
%
sys
.
argv
[
0
])
sys
.
stderr
.
write
(
"Try `
%
s -h' for more information.
\n
"
%
sys
.
argv
[
0
])
sys
.
stderr
.
write
(
"Try `
%
s -h' for more information.
\n
"
%
sys
.
argv
[
0
])
def
process
(
file
,
listnames
):
def
process
(
file
name
,
listnames
):
if
os
.
path
.
isdir
(
file
):
if
os
.
path
.
isdir
(
file
name
):
return
processdir
(
file
,
listnames
)
return
processdir
(
file
name
,
listnames
)
try
:
try
:
fp
=
open
(
file
)
fp
=
open
(
file
name
)
except
IOError
,
msg
:
except
IOError
,
msg
:
sys
.
stderr
.
write
(
"Can't open:
%
s
\n
"
%
msg
)
sys
.
stderr
.
write
(
"Can't open:
%
s
\n
"
%
msg
)
return
1
return
1
...
@@ -60,11 +60,11 @@ def process(file, listnames):
...
@@ -60,11 +60,11 @@ def process(file, listnames):
for
type
,
token
,
(
row
,
col
),
end
,
line
in
g
:
for
type
,
token
,
(
row
,
col
),
end
,
line
in
g
:
if
token
in
(
"/"
,
"/="
):
if
token
in
(
"/"
,
"/="
):
if
listnames
:
if
listnames
:
print
file
print
file
name
break
break
if
row
!=
lastrow
:
if
row
!=
lastrow
:
lastrow
=
row
lastrow
=
row
print
"
%
s:
%
d:
%
s"
%
(
file
,
row
,
line
),
print
"
%
s:
%
d:
%
s"
%
(
file
name
,
row
,
line
),
fp
.
close
()
fp
.
close
()
def
processdir
(
dir
,
listnames
):
def
processdir
(
dir
,
listnames
):
...
...
Tools/scripts/fixdiv.py
Dosyayı görüntüle @
ac6df95d
...
@@ -164,8 +164,8 @@ def main():
...
@@ -164,8 +164,8 @@ def main():
return
return
files
.
sort
()
files
.
sort
()
exit
=
None
exit
=
None
for
file
in
files
:
for
file
name
in
files
:
x
=
process
(
file
,
warnings
[
fil
e
])
x
=
process
(
file
name
,
warnings
[
filenam
e
])
exit
=
exit
or
x
exit
=
exit
or
x
return
exit
return
exit
...
@@ -194,23 +194,23 @@ def readwarnings(warningsfile):
...
@@ -194,23 +194,23 @@ def readwarnings(warningsfile):
if
line
.
find
(
"division"
)
>=
0
:
if
line
.
find
(
"division"
)
>=
0
:
sys
.
stderr
.
write
(
"Warning: ignored input "
+
line
)
sys
.
stderr
.
write
(
"Warning: ignored input "
+
line
)
continue
continue
file
,
lineno
,
what
=
m
.
groups
()
file
name
,
lineno
,
what
=
m
.
groups
()
list
=
warnings
.
get
(
file
)
list
=
warnings
.
get
(
file
name
)
if
list
is
None
:
if
list
is
None
:
warnings
[
file
]
=
list
=
[]
warnings
[
file
name
]
=
list
=
[]
list
.
append
((
int
(
lineno
),
intern
(
what
)))
list
.
append
((
int
(
lineno
),
intern
(
what
)))
f
.
close
()
f
.
close
()
return
warnings
return
warnings
def
process
(
file
,
list
):
def
process
(
file
name
,
list
):
print
"-"
*
70
print
"-"
*
70
assert
list
# if this fails, readwarnings() is broken
assert
list
# if this fails, readwarnings() is broken
try
:
try
:
fp
=
open
(
file
)
fp
=
open
(
file
name
)
except
IOError
,
msg
:
except
IOError
,
msg
:
sys
.
stderr
.
write
(
"can't open:
%
s
\n
"
%
msg
)
sys
.
stderr
.
write
(
"can't open:
%
s
\n
"
%
msg
)
return
1
return
1
print
"Index:"
,
file
print
"Index:"
,
file
name
f
=
FileContext
(
fp
)
f
=
FileContext
(
fp
)
list
.
sort
()
list
.
sort
()
index
=
0
# list[:index] has been processed, list[index:] is still to do
index
=
0
# list[:index] has been processed, list[index:] is still to do
...
...
Tools/scripts/fixheader.py
Dosyayı görüntüle @
ac6df95d
...
@@ -6,28 +6,28 @@ import sys
...
@@ -6,28 +6,28 @@ import sys
def
main
():
def
main
():
args
=
sys
.
argv
[
1
:]
args
=
sys
.
argv
[
1
:]
for
file
in
args
:
for
file
name
in
args
:
process
(
file
)
process
(
file
name
)
def
process
(
file
):
def
process
(
file
name
):
try
:
try
:
f
=
open
(
file
,
'r'
)
f
=
open
(
file
name
,
'r'
)
except
IOError
,
msg
:
except
IOError
,
msg
:
sys
.
stderr
.
write
(
'
%
s: can
\'
t open:
%
s
\n
'
%
(
file
,
str
(
msg
)))
sys
.
stderr
.
write
(
'
%
s: can
\'
t open:
%
s
\n
'
%
(
file
name
,
str
(
msg
)))
return
return
data
=
f
.
read
()
data
=
f
.
read
()
f
.
close
()
f
.
close
()
if
data
[:
2
]
<>
'/*'
:
if
data
[:
2
]
<>
'/*'
:
sys
.
stderr
.
write
(
'
%
s does not begin with C comment
\n
'
%
file
)
sys
.
stderr
.
write
(
'
%
s does not begin with C comment
\n
'
%
file
name
)
return
return
try
:
try
:
f
=
open
(
file
,
'w'
)
f
=
open
(
file
name
,
'w'
)
except
IOError
,
msg
:
except
IOError
,
msg
:
sys
.
stderr
.
write
(
'
%
s: can
\'
t write:
%
s
\n
'
%
(
file
,
str
(
msg
)))
sys
.
stderr
.
write
(
'
%
s: can
\'
t write:
%
s
\n
'
%
(
file
name
,
str
(
msg
)))
return
return
sys
.
stderr
.
write
(
'Processing
%
s ...
\n
'
%
file
)
sys
.
stderr
.
write
(
'Processing
%
s ...
\n
'
%
file
name
)
magic
=
'Py_'
magic
=
'Py_'
for
c
in
file
:
for
c
in
file
name
:
if
ord
(
c
)
<=
0x80
and
c
.
isalnum
():
if
ord
(
c
)
<=
0x80
and
c
.
isalnum
():
magic
=
magic
+
c
.
upper
()
magic
=
magic
+
c
.
upper
()
else
:
magic
=
magic
+
'_'
else
:
magic
=
magic
+
'_'
...
...
Tools/scripts/fixps.py
Dosyayı görüntüle @
ac6df95d
...
@@ -8,23 +8,23 @@ import re
...
@@ -8,23 +8,23 @@ import re
def
main
():
def
main
():
for
file
in
sys
.
argv
[
1
:]:
for
file
name
in
sys
.
argv
[
1
:]:
try
:
try
:
f
=
open
(
file
,
'r'
)
f
=
open
(
file
name
,
'r'
)
except
IOError
,
msg
:
except
IOError
,
msg
:
print
file
,
': can
\'
t open :'
,
msg
print
file
name
,
': can
\'
t open :'
,
msg
continue
continue
line
=
f
.
readline
()
line
=
f
.
readline
()
if
not
re
.
match
(
'^#! */usr/local/bin/python'
,
line
):
if
not
re
.
match
(
'^#! */usr/local/bin/python'
,
line
):
print
file
,
': not a /usr/local/bin/python script'
print
file
name
,
': not a /usr/local/bin/python script'
f
.
close
()
f
.
close
()
continue
continue
rest
=
f
.
read
()
rest
=
f
.
read
()
f
.
close
()
f
.
close
()
line
=
re
.
sub
(
'/usr/local/bin/python'
,
line
=
re
.
sub
(
'/usr/local/bin/python'
,
'/usr/bin/env python'
,
line
)
'/usr/bin/env python'
,
line
)
print
file
,
':'
,
`line`
print
file
name
,
':'
,
`line`
f
=
open
(
file
,
"w"
)
f
=
open
(
file
name
,
"w"
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
rest
)
f
.
write
(
rest
)
f
.
close
()
f
.
close
()
...
...
Tools/scripts/ftpmirror.py
Dosyayı görüntüle @
ac6df95d
...
@@ -384,9 +384,9 @@ def makedir(pathname):
...
@@ -384,9 +384,9 @@ def makedir(pathname):
# rval() but is still somewhat readable (i.e. not a single long line).
# rval() but is still somewhat readable (i.e. not a single long line).
# Also creates a backup file.
# Also creates a backup file.
def
writedict
(
dict
,
filename
):
def
writedict
(
dict
,
filename
):
dir
,
f
il
e
=
os
.
path
.
split
(
filename
)
dir
,
f
nam
e
=
os
.
path
.
split
(
filename
)
tempname
=
os
.
path
.
join
(
dir
,
'@'
+
f
il
e
)
tempname
=
os
.
path
.
join
(
dir
,
'@'
+
f
nam
e
)
backup
=
os
.
path
.
join
(
dir
,
f
il
e
+
'~'
)
backup
=
os
.
path
.
join
(
dir
,
f
nam
e
+
'~'
)
try
:
try
:
os
.
unlink
(
backup
)
os
.
unlink
(
backup
)
except
os
.
error
:
except
os
.
error
:
...
...
Tools/scripts/ifdef.py
Dosyayı görüntüle @
ac6df95d
...
@@ -42,11 +42,11 @@ def main():
...
@@ -42,11 +42,11 @@ def main():
undefs
.
append
(
a
)
undefs
.
append
(
a
)
if
not
args
:
if
not
args
:
args
=
[
'-'
]
args
=
[
'-'
]
for
file
in
args
:
for
file
name
in
args
:
if
file
==
'-'
:
if
file
name
==
'-'
:
process
(
sys
.
stdin
,
sys
.
stdout
)
process
(
sys
.
stdin
,
sys
.
stdout
)
else
:
else
:
f
=
open
(
file
,
'r'
)
f
=
open
(
file
name
,
'r'
)
process
(
f
,
sys
.
stdout
)
process
(
f
,
sys
.
stdout
)
f
.
close
()
f
.
close
()
...
...
Tools/scripts/mkreal.py
Dosyayı görüntüle @
ac6df95d
...
@@ -38,9 +38,9 @@ def mkrealdir(name):
...
@@ -38,9 +38,9 @@ def mkrealdir(name):
os
.
chmod
(
name
,
mode
)
os
.
chmod
(
name
,
mode
)
linkto
=
join
(
os
.
pardir
,
linkto
)
linkto
=
join
(
os
.
pardir
,
linkto
)
#
#
for
file
in
files
:
for
file
name
in
files
:
if
file
not
in
(
os
.
curdir
,
os
.
pardir
):
if
file
name
not
in
(
os
.
curdir
,
os
.
pardir
):
os
.
symlink
(
join
(
linkto
,
file
),
join
(
name
,
fil
e
))
os
.
symlink
(
join
(
linkto
,
file
name
),
join
(
name
,
filenam
e
))
def
main
():
def
main
():
sys
.
stdout
=
sys
.
stderr
sys
.
stdout
=
sys
.
stderr
...
...
Tools/scripts/objgraph.py
Dosyayı görüntüle @
ac6df95d
...
@@ -63,9 +63,9 @@ undef2file = {}
...
@@ -63,9 +63,9 @@ undef2file = {}
# Read one input file and merge the data into the tables.
# Read one input file and merge the data into the tables.
# Argument is an open file.
# Argument is an open file.
#
#
def
readinput
(
f
ile
):
def
readinput
(
f
p
):
while
1
:
while
1
:
s
=
f
ile
.
readline
()
s
=
f
p
.
readline
()
if
not
s
:
if
not
s
:
break
break
# If you get any output from this line,
# If you get any output from this line,
...
@@ -88,9 +88,9 @@ def readinput(file):
...
@@ -88,9 +88,9 @@ def readinput(file):
def
printcallee
():
def
printcallee
():
flist
=
file2undef
.
keys
()
flist
=
file2undef
.
keys
()
flist
.
sort
()
flist
.
sort
()
for
file
in
flist
:
for
file
name
in
flist
:
print
file
+
':'
print
file
name
+
':'
elist
=
file2undef
[
file
]
elist
=
file2undef
[
file
name
]
elist
.
sort
()
elist
.
sort
()
for
ext
in
elist
:
for
ext
in
elist
:
if
len
(
ext
)
>=
8
:
if
len
(
ext
)
>=
8
:
...
@@ -107,38 +107,38 @@ def printcallee():
...
@@ -107,38 +107,38 @@ def printcallee():
def
printcaller
():
def
printcaller
():
files
=
file2def
.
keys
()
files
=
file2def
.
keys
()
files
.
sort
()
files
.
sort
()
for
file
in
files
:
for
file
name
in
files
:
callers
=
[]
callers
=
[]
for
label
in
file2def
[
file
]:
for
label
in
file2def
[
file
name
]:
if
undef2file
.
has_key
(
label
):
if
undef2file
.
has_key
(
label
):
callers
=
callers
+
undef2file
[
label
]
callers
=
callers
+
undef2file
[
label
]
if
callers
:
if
callers
:
callers
.
sort
()
callers
.
sort
()
print
file
+
':'
print
file
name
+
':'
lastfn
=
''
lastfn
=
''
for
fn
in
callers
:
for
fn
in
callers
:
if
fn
<>
lastfn
:
if
fn
<>
lastfn
:
print
'
\t
'
+
fn
print
'
\t
'
+
fn
lastfn
=
fn
lastfn
=
fn
else
:
else
:
print
file
+
': unused'
print
file
name
+
': unused'
# Print undefine names and where they are used.
# Print undefine
d
names and where they are used.
#
#
def
printundef
():
def
printundef
():
undefs
=
{}
undefs
=
{}
for
file
in
file2undef
.
keys
():
for
file
name
in
file2undef
.
keys
():
for
ext
in
file2undef
[
file
]:
for
ext
in
file2undef
[
file
name
]:
if
not
def2file
.
has_key
(
ext
):
if
not
def2file
.
has_key
(
ext
):
store
(
undefs
,
ext
,
file
)
store
(
undefs
,
ext
,
file
name
)
elist
=
undefs
.
keys
()
elist
=
undefs
.
keys
()
elist
.
sort
()
elist
.
sort
()
for
ext
in
elist
:
for
ext
in
elist
:
print
ext
+
':'
print
ext
+
':'
flist
=
undefs
[
ext
]
flist
=
undefs
[
ext
]
flist
.
sort
()
flist
.
sort
()
for
file
in
flist
:
for
file
name
in
flist
:
print
'
\t
'
+
file
print
'
\t
'
+
file
name
# Print warning messages about names defined in more than one file.
# Print warning messages about names defined in more than one file.
#
#
...
@@ -181,11 +181,11 @@ def main():
...
@@ -181,11 +181,11 @@ def main():
optu
=
optc
=
optd
=
1
optu
=
optc
=
optd
=
1
if
not
args
:
if
not
args
:
args
=
[
'-'
]
args
=
[
'-'
]
for
file
in
args
:
for
file
name
in
args
:
if
file
==
'-'
:
if
file
name
==
'-'
:
readinput
(
sys
.
stdin
)
readinput
(
sys
.
stdin
)
else
:
else
:
readinput
(
open
(
file
,
'r'
))
readinput
(
open
(
file
name
,
'r'
))
#
#
warndups
()
warndups
()
#
#
...
...
Tools/scripts/pindent.py
Dosyayı görüntüle @
ac6df95d
...
@@ -531,8 +531,8 @@ def test():
...
@@ -531,8 +531,8 @@ def test():
action
(
sys
.
stdin
,
sys
.
stdout
,
stepsize
,
tabsize
,
expandtabs
)
action
(
sys
.
stdin
,
sys
.
stdout
,
stepsize
,
tabsize
,
expandtabs
)
else
:
else
:
action
=
eval
(
action
+
'_file'
)
action
=
eval
(
action
+
'_file'
)
for
file
in
args
:
for
file
name
in
args
:
action
(
file
,
stepsize
,
tabsize
,
expandtabs
)
action
(
file
name
,
stepsize
,
tabsize
,
expandtabs
)
# end for
# end for
# end if
# end if
# end def test
# end def test
...
...
Tools/scripts/ptags.py
Dosyayı görüntüle @
ac6df95d
...
@@ -16,7 +16,8 @@ tags = [] # Modified global variable!
...
@@ -16,7 +16,8 @@ tags = [] # Modified global variable!
def
main
():
def
main
():
args
=
sys
.
argv
[
1
:]
args
=
sys
.
argv
[
1
:]
for
file
in
args
:
treat_file
(
file
)
for
filename
in
args
:
treat_file
(
filename
)
if
tags
:
if
tags
:
fp
=
open
(
'tags'
,
'w'
)
fp
=
open
(
'tags'
,
'w'
)
tags
.
sort
()
tags
.
sort
()
...
@@ -26,16 +27,16 @@ def main():
...
@@ -26,16 +27,16 @@ def main():
expr
=
'^[
\t
]*(def|class)[
\t
]+([a-zA-Z0-9_]+)[
\t
]*[:
\
(]'
expr
=
'^[
\t
]*(def|class)[
\t
]+([a-zA-Z0-9_]+)[
\t
]*[:
\
(]'
matcher
=
re
.
compile
(
expr
)
matcher
=
re
.
compile
(
expr
)
def
treat_file
(
file
):
def
treat_file
(
file
name
):
try
:
try
:
fp
=
open
(
file
,
'r'
)
fp
=
open
(
file
name
,
'r'
)
except
:
except
:
sys
.
stderr
.
write
(
'Cannot open
%
s
\n
'
%
file
)
sys
.
stderr
.
write
(
'Cannot open
%
s
\n
'
%
file
name
)
return
return
base
=
os
.
path
.
basename
(
file
)
base
=
os
.
path
.
basename
(
file
name
)
if
base
[
-
3
:]
==
'.py'
:
if
base
[
-
3
:]
==
'.py'
:
base
=
base
[:
-
3
]
base
=
base
[:
-
3
]
s
=
base
+
'
\t
'
+
file
+
'
\t
'
+
'1
\n
'
s
=
base
+
'
\t
'
+
file
name
+
'
\t
'
+
'1
\n
'
tags
.
append
(
s
)
tags
.
append
(
s
)
while
1
:
while
1
:
line
=
fp
.
readline
()
line
=
fp
.
readline
()
...
@@ -45,7 +46,7 @@ def treat_file(file):
...
@@ -45,7 +46,7 @@ def treat_file(file):
if
m
:
if
m
:
content
=
m
.
group
(
0
)
content
=
m
.
group
(
0
)
name
=
m
.
group
(
2
)
name
=
m
.
group
(
2
)
s
=
name
+
'
\t
'
+
file
+
'
\t
/^'
+
content
+
'/
\n
'
s
=
name
+
'
\t
'
+
file
name
+
'
\t
/^'
+
content
+
'/
\n
'
tags
.
append
(
s
)
tags
.
append
(
s
)
main
()
main
()
Tools/scripts/suff.py
Dosyayı görüntüle @
ac6df95d
...
@@ -9,21 +9,21 @@ import sys
...
@@ -9,21 +9,21 @@ import sys
def
main
():
def
main
():
files
=
sys
.
argv
[
1
:]
files
=
sys
.
argv
[
1
:]
suffixes
=
{}
suffixes
=
{}
for
file
in
files
:
for
file
name
in
files
:
suff
=
getsuffix
(
file
)
suff
=
getsuffix
(
file
name
)
if
not
suffixes
.
has_key
(
suff
):
if
not
suffixes
.
has_key
(
suff
):
suffixes
[
suff
]
=
[]
suffixes
[
suff
]
=
[]
suffixes
[
suff
]
.
append
(
file
)
suffixes
[
suff
]
.
append
(
file
name
)
keys
=
suffixes
.
keys
()
keys
=
suffixes
.
keys
()
keys
.
sort
()
keys
.
sort
()
for
suff
in
keys
:
for
suff
in
keys
:
print
`suff`
,
len
(
suffixes
[
suff
])
print
`suff`
,
len
(
suffixes
[
suff
])
def
getsuffix
(
file
):
def
getsuffix
(
file
name
):
suff
=
''
suff
=
''
for
i
in
range
(
len
(
file
)):
for
i
in
range
(
len
(
file
name
)):
if
file
[
i
]
==
'.'
:
if
file
name
[
i
]
==
'.'
:
suff
=
file
[
i
:]
suff
=
file
name
[
i
:]
return
suff
return
suff
main
()
main
()
Tools/scripts/untabify.py
Dosyayı görüntüle @
ac6df95d
...
@@ -20,33 +20,33 @@ def main():
...
@@ -20,33 +20,33 @@ def main():
if
optname
==
'-t'
:
if
optname
==
'-t'
:
tabsize
=
int
(
optvalue
)
tabsize
=
int
(
optvalue
)
for
file
in
args
:
for
file
name
in
args
:
process
(
file
,
tabsize
)
process
(
file
name
,
tabsize
)
def
process
(
file
,
tabsize
):
def
process
(
file
name
,
tabsize
):
try
:
try
:
f
=
open
(
file
)
f
=
open
(
file
name
)
text
=
f
.
read
()
text
=
f
.
read
()
f
.
close
()
f
.
close
()
except
IOError
,
msg
:
except
IOError
,
msg
:
print
"
%
s: I/O error:
%
s"
%
(
`file`
,
str
(
msg
))
print
"
%
s: I/O error:
%
s"
%
(
`file
name
`
,
str
(
msg
))
return
return
newtext
=
text
.
expandtabs
(
tabsize
)
newtext
=
text
.
expandtabs
(
tabsize
)
if
newtext
==
text
:
if
newtext
==
text
:
return
return
backup
=
file
+
"~"
backup
=
file
name
+
"~"
try
:
try
:
os
.
unlink
(
backup
)
os
.
unlink
(
backup
)
except
os
.
error
:
except
os
.
error
:
pass
pass
try
:
try
:
os
.
rename
(
file
,
backup
)
os
.
rename
(
file
name
,
backup
)
except
os
.
error
:
except
os
.
error
:
pass
pass
f
=
open
(
file
,
"w"
)
f
=
open
(
file
name
,
"w"
)
f
.
write
(
newtext
)
f
.
write
(
newtext
)
f
.
close
()
f
.
close
()
print
file
print
file
name
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
()
Tools/scripts/which.py
Dosyayı görüntüle @
ac6df95d
...
@@ -25,29 +25,29 @@ if sys.argv[1:] and sys.argv[1][:2] == '-l':
...
@@ -25,29 +25,29 @@ if sys.argv[1:] and sys.argv[1][:2] == '-l':
for
prog
in
sys
.
argv
[
1
:]:
for
prog
in
sys
.
argv
[
1
:]:
ident
=
()
ident
=
()
for
dir
in
pathlist
:
for
dir
in
pathlist
:
file
=
os
.
path
.
join
(
dir
,
prog
)
file
name
=
os
.
path
.
join
(
dir
,
prog
)
try
:
try
:
st
=
os
.
stat
(
file
)
st
=
os
.
stat
(
file
name
)
except
os
.
error
:
except
os
.
error
:
continue
continue
if
not
S_ISREG
(
st
[
ST_MODE
]):
if
not
S_ISREG
(
st
[
ST_MODE
]):
msg
(
file
+
': not a disk file'
)
msg
(
file
name
+
': not a disk file'
)
else
:
else
:
mode
=
S_IMODE
(
st
[
ST_MODE
])
mode
=
S_IMODE
(
st
[
ST_MODE
])
if
mode
&
0111
:
if
mode
&
0111
:
if
not
ident
:
if
not
ident
:
print
file
print
file
name
ident
=
st
[:
3
]
ident
=
st
[:
3
]
else
:
else
:
if
st
[:
3
]
==
ident
:
if
st
[:
3
]
==
ident
:
s
=
'same as: '
s
=
'same as: '
else
:
else
:
s
=
'also: '
s
=
'also: '
msg
(
s
+
file
)
msg
(
s
+
file
name
)
else
:
else
:
msg
(
file
+
': not executable'
)
msg
(
file
name
+
': not executable'
)
if
longlist
:
if
longlist
:
sts
=
os
.
system
(
'ls '
+
longlist
+
' '
+
file
)
sts
=
os
.
system
(
'ls '
+
longlist
+
' '
+
file
name
)
if
sts
:
msg
(
'"ls -l" exit status: '
+
`sts`
)
if
sts
:
msg
(
'"ls -l" exit status: '
+
`sts`
)
if
not
ident
:
if
not
ident
:
msg
(
prog
+
': not found'
)
msg
(
prog
+
': not found'
)
...
...
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