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
b7a48300
Kaydet (Commit)
b7a48300
authored
Nis 12, 2001
tarafından
Ka-Ping Yee
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix linking to classes (in class tree, and add links on unbound methods).
üst
6dcfa388
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
24 deletions
+23
-24
pydoc.py
Lib/pydoc.py
+23
-24
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
b7a48300
...
...
@@ -342,12 +342,13 @@ TT { font-family: lucida console, lucida typewriter, courier }
return
'<a href="
%
s">
%
s</a>'
%
(
dict
[
name
],
name
)
return
name
def
classlink
(
self
,
object
,
modname
,
*
dicts
):
def
classlink
(
self
,
object
,
modname
):
"""Make a link for a class."""
name
=
classname
(
object
,
modname
)
for
dict
in
dicts
:
if
dict
.
has_key
(
object
):
return
'<a href="
%
s">
%
s</a>'
%
(
dict
[
object
],
name
)
if
sys
.
modules
.
has_key
(
object
.
__module__
)
and
\
getattr
(
sys
.
modules
[
object
.
__module__
],
object
.
__name__
)
is
object
:
return
'<a href="
%
s.html#
%
s">
%
s</a>'
%
(
object
.
__module__
,
object
.
__name__
,
name
)
return
name
def
modulelink
(
self
,
object
):
...
...
@@ -405,23 +406,23 @@ TT { font-family: lucida console, lucida typewriter, courier }
# ---------------------------------------------- type-specific routines
def
formattree
(
self
,
tree
,
modname
,
classes
=
{},
parent
=
None
):
def
formattree
(
self
,
tree
,
modname
,
parent
=
None
):
"""Produce HTML for a class tree as given by inspect.getclasstree()."""
result
=
''
for
entry
in
tree
:
if
type
(
entry
)
is
type
(()):
c
,
bases
=
entry
result
=
result
+
'<dt><font face="helvetica, arial"><small>'
result
=
result
+
self
.
classlink
(
c
,
modname
,
classes
)
result
=
result
+
self
.
classlink
(
c
,
modname
)
if
bases
and
bases
!=
(
parent
,):
parents
=
[]
for
base
in
bases
:
parents
.
append
(
self
.
classlink
(
base
,
modname
,
classes
))
parents
.
append
(
self
.
classlink
(
base
,
modname
))
result
=
result
+
'('
+
join
(
parents
,
', '
)
+
')'
result
=
result
+
'
\n
</small></font></dt>'
elif
type
(
entry
)
is
type
([]):
result
=
result
+
'<dd>
\n
%
s</dd>
\n
'
%
self
.
formattree
(
entry
,
modname
,
c
lasses
,
c
)
entry
,
modname
,
c
)
return
'<dl>
\n
%
s</dl>
\n
'
%
result
def
docmodule
(
self
,
object
,
name
=
None
,
mod
=
None
):
...
...
@@ -505,8 +506,8 @@ TT { font-family: lucida console, lucida typewriter, courier }
if
classes
:
classlist
=
map
(
lambda
(
key
,
value
):
value
,
classes
)
contents
=
[
self
.
formattree
(
inspect
.
getclasstree
(
classlist
,
1
),
name
,
cdict
)]
contents
=
[
self
.
formattree
(
inspect
.
getclasstree
(
classlist
,
1
),
name
)]
for
key
,
value
in
classes
:
contents
.
append
(
self
.
document
(
value
,
key
,
name
,
fdict
,
cdict
))
result
=
result
+
self
.
bigsection
(
...
...
@@ -558,8 +559,7 @@ TT { font-family: lucida console, lucida typewriter, courier }
if
bases
:
parents
=
[]
for
base
in
bases
:
parents
.
append
(
self
.
classlink
(
base
,
object
.
__module__
,
classes
))
parents
.
append
(
self
.
classlink
(
base
,
object
.
__module__
))
title
=
title
+
'(
%
s)'
%
join
(
parents
,
', '
)
doc
=
self
.
markup
(
getdoc
(
object
),
self
.
preformat
,
funcs
,
classes
,
mdict
)
...
...
@@ -583,16 +583,14 @@ TT { font-family: lucida console, lucida typewriter, courier }
imclass
=
object
.
im_class
if
cl
:
if
imclass
is
not
cl
:
url
=
'
%
s.html#
%
s-
%
s'
%
(
imclass
.
__module__
,
imclass
.
__name__
,
name
)
note
=
' from <a href="
%
s">
%
s</a>'
%
(
url
,
classname
(
imclass
,
mod
))
note
=
' from '
+
self
.
classlink
(
imclass
,
mod
)
skipdocs
=
1
else
:
inst
=
object
.
im_self
note
=
(
inst
and
' method of
%
s instance'
%
classname
(
inst
.
__class__
,
mod
)
or
' unbound
%
s method'
%
classname
(
imclass
,
mod
))
if
object
.
im_self
:
note
=
' method of
%
s instance'
%
self
.
classlink
(
object
.
im_self
.
__class__
,
mod
)
else
:
note
=
' unbound
%
s method'
%
self
.
classlink
(
imclass
,
mod
)
object
=
object
.
im_func
if
name
==
realname
:
...
...
@@ -848,10 +846,11 @@ class TextDoc(Doc):
note
=
' from '
+
classname
(
imclass
,
mod
)
skipdocs
=
1
else
:
inst
=
object
.
im_self
note
=
(
inst
and
' method of
%
s instance'
%
classname
(
inst
.
__class__
,
mod
)
or
' unbound
%
s method'
%
classname
(
imclass
,
mod
))
if
object
.
im_self
:
note
=
' method of
%
s instance'
%
classname
(
object
.
im_self
.
__class__
,
mod
)
else
:
note
=
' unbound
%
s method'
%
classname
(
imclass
,
mod
)
object
=
object
.
im_func
if
name
==
realname
:
...
...
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