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
dfbfe736
Kaydet (Commit)
dfbfe736
authored
Nis 21, 2003
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add helper function to get module name taking packages into account.
üst
38732e10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
trace.py
Lib/trace.py
+22
-1
No files found.
Lib/trace.py
Dosyayı görüntüle @
dfbfe736
...
...
@@ -157,10 +157,29 @@ class Ignore:
def
modname
(
path
):
"""Return a plausible module name for the patch."""
base
=
os
.
path
.
basename
(
path
)
filename
,
ext
=
os
.
path
.
splitext
(
base
)
return
filename
def
fullmodname
(
path
):
"""Return a plausible module name for the patch."""
# If the file 'path' is part of a package, then the filename isn't
# enough to uniquely identify it. Try to do the right thing by
# looking in sys.path for the longest matching prefix. We'll
# assume that the rest is the package name.
longest
=
""
for
dir
in
sys
.
path
:
if
path
.
startswith
(
dir
)
and
path
[
len
(
dir
)]
==
os
.
path
.
sep
:
if
len
(
dir
)
>
len
(
longest
):
longest
=
dir
base
=
path
[
len
(
longest
)
+
1
:]
.
replace
(
"/"
,
"."
)
filename
,
ext
=
os
.
path
.
splitext
(
base
)
return
filename
class
CoverageResults
:
def
__init__
(
self
,
counts
=
None
,
calledfuncs
=
None
,
infile
=
None
,
outfile
=
None
):
...
...
@@ -225,7 +244,7 @@ class CoverageResults:
# skip some "files" we don't care about...
if
filename
==
"<string>"
:
continue
modulename
=
modname
(
filename
)
modulename
=
full
modname
(
filename
)
if
filename
.
endswith
(
".pyc"
)
or
filename
.
endswith
(
".pyo"
):
filename
=
filename
[:
-
1
]
...
...
@@ -470,6 +489,8 @@ class Trace:
code
=
frame
.
f_code
filename
=
code
.
co_filename
if
filename
:
# XXX modname() doesn't work right for packages, so
# the ignore support won't work right for packages
modulename
=
modname
(
filename
)
if
modulename
is
not
None
:
ignore_it
=
self
.
ignore
.
names
(
filename
,
modulename
)
...
...
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