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
15f27fb6
Kaydet (Commit)
15f27fb6
authored
Ara 10, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapt to modern times...
üst
1d974174
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
25 deletions
+27
-25
objgraph.py
Tools/scripts/objgraph.py
+10
-8
pdeps.py
Tools/scripts/pdeps.py
+17
-17
No files found.
Tools/scripts/objgraph.py
Dosyayı görüntüle @
15f27fb6
#!/usr/local/python
#!/usr/local/
bin/
python
# objgraph
#
...
...
@@ -21,9 +21,9 @@
import
sys
import
string
import
path
import
os
import
getopt
import
regex
p
import
regex
# Types of symbols.
#
...
...
@@ -33,7 +33,7 @@ ignore = 'Nntrgdsbavuc'
# Regular expression to parse "nm -o" output.
#
matcher
=
regex
p
.
compile
(
'(.*):
\t
?........ (.) (.*
)$'
)
matcher
=
regex
.
compile
(
'
\
(.*
\
):
\t
?........
\
(.
\
)
\
(.*
\
)$'
)
# Store "item" in "dict" under "key".
# The dictionary maps keys to lists of items.
...
...
@@ -66,12 +66,13 @@ undef2file = {}
#
def
readinput
(
file
):
while
1
:
s
=
file
.
readline
(
200
)
# Arbitrary, but reasonable limit
s
=
file
.
readline
(
)
if
not
s
:
break
# If you get an
exception on
this line,
# If you get an
y output from
this line,
# it is probably caused by an unexpected input line:
(
ra
,
rb
),
(
r1a
,
r1b
),
(
r2a
,
r2b
),
(
r3a
,
r3b
)
=
matcher
.
exec
(
s
)
if
matcher
.
search
(
s
)
<
0
:
s
;
continue
# Shouldn't happen
(
ra
,
rb
),
(
r1a
,
r1b
),
(
r2a
,
r2b
),
(
r3a
,
r3b
)
=
matcher
.
regs
[:
4
]
fn
,
name
,
type
=
s
[
r1a
:
r1b
],
s
[
r3a
:
r3b
],
s
[
r2a
:
r2b
]
if
type
in
definitions
:
store
(
def2file
,
name
,
fn
)
...
...
@@ -160,7 +161,8 @@ def main():
optlist
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'cdu'
)
except
getopt
.
error
:
sys
.
stdout
=
sys
.
stderr
print
'Usage:'
,
path
.
basename
(
sys
.
argv
[
0
]),
'[-cdu] [file] ...'
print
'Usage:'
,
os
.
path
.
basename
(
sys
.
argv
[
0
]),
print
'[-cdu] [file] ...'
print
'-c: print callers per objectfile'
print
'-d: print callees per objectfile'
print
'-u: print usage of undefined symbols'
...
...
Tools/scripts/pdeps.py
Dosyayı görüntüle @
15f27fb6
#! /usr/local/python
#! /usr/local/
bin/
python
# pdeps
#
...
...
@@ -21,8 +21,8 @@
import
sys
import
regex
p
import
path
import
regex
import
os
import
string
...
...
@@ -58,15 +58,15 @@ def main():
# Compiled regular expressions to search for import statements
#
m_import
=
regex
p
.
compile
(
'^[
\t
]*from[
\t
]+([^
\t
]+
)[
\t
]+'
)
m_from
=
regex
p
.
compile
(
'^[
\t
]*import[
\t
]+([^#]+
)'
)
m_import
=
regex
.
compile
(
'^[
\t
]*from[
\t
]+
\
([^
\t
]+
\
)[
\t
]+'
)
m_from
=
regex
.
compile
(
'^[
\t
]*import[
\t
]+
\
([^#]+
\
)'
)
# Collect data from one file
#
def
process
(
filename
,
table
):
fp
=
open
(
filename
,
'r'
)
mod
=
path
.
basename
(
filename
)
mod
=
os
.
path
.
basename
(
filename
)
if
mod
[
-
3
:]
==
'.py'
:
mod
=
mod
[:
-
3
]
table
[
mod
]
=
list
=
[]
...
...
@@ -77,17 +77,17 @@ def process(filename, table):
nextline
=
fp
.
readline
()
if
not
nextline
:
break
line
=
line
[:
-
1
]
+
nextline
result
=
m_import
.
exec
(
line
)
if
not
result
:
result
=
m_from
.
exec
(
line
)
if
result
:
(
a
,
b
),
(
a1
,
b1
)
=
result
words
=
string
.
splitfields
(
line
[
a1
:
b1
],
','
)
# print '#', line, words
for
word
in
words
:
word
=
string
.
strip
(
word
)
if
word
not
in
list
:
list
.
append
(
word
)
if
m_import
.
match
(
line
)
>=
0
:
(
a
,
b
),
(
a1
,
b1
)
=
m_import
.
regs
[:
2
]
elif
m_from
.
match
(
line
)
>=
0
:
(
a
,
b
),
(
a1
,
b1
)
=
m_from
.
regs
[:
2
]
else
:
continue
words
=
string
.
splitfields
(
line
[
a1
:
b1
],
','
)
# print '#', line, words
for
word
in
words
:
word
=
string
.
strip
(
word
)
if
word
not
in
list
:
list
.
append
(
word
)
# Compute closure (this is in fact totally general)
...
...
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