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
a5616d22
Kaydet (Commit)
a5616d22
authored
Haz 11, 2004
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Respect a module's __all__ attribute. Closes #969938.
üst
c978633e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
pydoc.py
Lib/pydoc.py
+21
-8
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
a5616d22
...
@@ -151,14 +151,18 @@ def _split_list(s, predicate):
...
@@ -151,14 +151,18 @@ def _split_list(s, predicate):
no
.
append
(
x
)
no
.
append
(
x
)
return
yes
,
no
return
yes
,
no
def
visiblename
(
name
):
def
visiblename
(
name
,
all
=
None
):
"""Decide whether to show documentation on a variable."""
"""Decide whether to show documentation on a variable."""
# Certain special names are redundant.
# Certain special names are redundant.
if
name
in
[
'__builtins__'
,
'__doc__'
,
'__file__'
,
'__path__'
,
if
name
in
[
'__builtins__'
,
'__doc__'
,
'__file__'
,
'__path__'
,
'__module__'
,
'__name__'
]:
return
0
'__module__'
,
'__name__'
]:
return
0
# Private names are hidden, but special names are displayed.
# Private names are hidden, but special names are displayed.
if
name
.
startswith
(
'__'
)
and
name
.
endswith
(
'__'
):
return
1
if
name
.
startswith
(
'__'
)
and
name
.
endswith
(
'__'
):
return
1
return
not
name
.
startswith
(
'_'
)
if
all
is
not
None
:
# only document that which the programmer exported in __all__
return
name
in
all
else
:
return
not
name
.
startswith
(
'_'
)
# ----------------------------------------------------- module manipulation
# ----------------------------------------------------- module manipulation
...
@@ -544,6 +548,10 @@ class HTMLDoc(Doc):
...
@@ -544,6 +548,10 @@ class HTMLDoc(Doc):
def
docmodule
(
self
,
object
,
name
=
None
,
mod
=
None
,
*
ignored
):
def
docmodule
(
self
,
object
,
name
=
None
,
mod
=
None
,
*
ignored
):
"""Produce HTML documentation for a module object."""
"""Produce HTML documentation for a module object."""
name
=
object
.
__name__
# ignore the passed-in name
name
=
object
.
__name__
# ignore the passed-in name
try
:
all
=
object
.
__all__
except
AttributeError
:
all
=
None
parts
=
split
(
name
,
'.'
)
parts
=
split
(
name
,
'.'
)
links
=
[]
links
=
[]
for
i
in
range
(
len
(
parts
)
-
1
):
for
i
in
range
(
len
(
parts
)
-
1
):
...
@@ -585,7 +593,7 @@ class HTMLDoc(Doc):
...
@@ -585,7 +593,7 @@ class HTMLDoc(Doc):
classes
,
cdict
=
[],
{}
classes
,
cdict
=
[],
{}
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isclass
):
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isclass
):
if
(
inspect
.
getmodule
(
value
)
or
object
)
is
object
:
if
(
inspect
.
getmodule
(
value
)
or
object
)
is
object
:
if
visiblename
(
key
):
if
visiblename
(
key
,
all
):
classes
.
append
((
key
,
value
))
classes
.
append
((
key
,
value
))
cdict
[
key
]
=
cdict
[
value
]
=
'#'
+
key
cdict
[
key
]
=
cdict
[
value
]
=
'#'
+
key
for
key
,
value
in
classes
:
for
key
,
value
in
classes
:
...
@@ -599,13 +607,13 @@ class HTMLDoc(Doc):
...
@@ -599,13 +607,13 @@ class HTMLDoc(Doc):
funcs
,
fdict
=
[],
{}
funcs
,
fdict
=
[],
{}
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isroutine
):
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isroutine
):
if
inspect
.
isbuiltin
(
value
)
or
inspect
.
getmodule
(
value
)
is
object
:
if
inspect
.
isbuiltin
(
value
)
or
inspect
.
getmodule
(
value
)
is
object
:
if
visiblename
(
key
):
if
visiblename
(
key
,
all
):
funcs
.
append
((
key
,
value
))
funcs
.
append
((
key
,
value
))
fdict
[
key
]
=
'#-'
+
key
fdict
[
key
]
=
'#-'
+
key
if
inspect
.
isfunction
(
value
):
fdict
[
value
]
=
fdict
[
key
]
if
inspect
.
isfunction
(
value
):
fdict
[
value
]
=
fdict
[
key
]
data
=
[]
data
=
[]
for
key
,
value
in
inspect
.
getmembers
(
object
,
isdata
):
for
key
,
value
in
inspect
.
getmembers
(
object
,
isdata
):
if
visiblename
(
key
):
if
visiblename
(
key
,
all
):
data
.
append
((
key
,
value
))
data
.
append
((
key
,
value
))
doc
=
self
.
markup
(
getdoc
(
object
),
self
.
preformat
,
fdict
,
cdict
)
doc
=
self
.
markup
(
getdoc
(
object
),
self
.
preformat
,
fdict
,
cdict
)
...
@@ -987,6 +995,11 @@ class TextDoc(Doc):
...
@@ -987,6 +995,11 @@ class TextDoc(Doc):
synop
,
desc
=
splitdoc
(
getdoc
(
object
))
synop
,
desc
=
splitdoc
(
getdoc
(
object
))
result
=
self
.
section
(
'NAME'
,
name
+
(
synop
and
' - '
+
synop
))
result
=
self
.
section
(
'NAME'
,
name
+
(
synop
and
' - '
+
synop
))
try
:
all
=
object
.
__all__
except
AttributeError
:
all
=
None
try
:
try
:
file
=
inspect
.
getabsfile
(
object
)
file
=
inspect
.
getabsfile
(
object
)
except
TypeError
:
except
TypeError
:
...
@@ -1003,16 +1016,16 @@ class TextDoc(Doc):
...
@@ -1003,16 +1016,16 @@ class TextDoc(Doc):
classes
=
[]
classes
=
[]
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isclass
):
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isclass
):
if
(
inspect
.
getmodule
(
value
)
or
object
)
is
object
:
if
(
inspect
.
getmodule
(
value
)
or
object
)
is
object
:
if
visiblename
(
key
):
if
visiblename
(
key
,
all
):
classes
.
append
((
key
,
value
))
classes
.
append
((
key
,
value
))
funcs
=
[]
funcs
=
[]
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isroutine
):
for
key
,
value
in
inspect
.
getmembers
(
object
,
inspect
.
isroutine
):
if
inspect
.
isbuiltin
(
value
)
or
inspect
.
getmodule
(
value
)
is
object
:
if
inspect
.
isbuiltin
(
value
)
or
inspect
.
getmodule
(
value
)
is
object
:
if
visiblename
(
key
):
if
visiblename
(
key
,
all
):
funcs
.
append
((
key
,
value
))
funcs
.
append
((
key
,
value
))
data
=
[]
data
=
[]
for
key
,
value
in
inspect
.
getmembers
(
object
,
isdata
):
for
key
,
value
in
inspect
.
getmembers
(
object
,
isdata
):
if
visiblename
(
key
):
if
visiblename
(
key
,
all
):
data
.
append
((
key
,
value
))
data
.
append
((
key
,
value
))
if
hasattr
(
object
,
'__path__'
):
if
hasattr
(
object
,
'__path__'
):
...
...
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