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
4997a69f
Kaydet (Commit)
4997a69f
authored
Eyl 10, 2003
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
display link to module docs when it looks like the object module is a core
module
üst
0d6e8cde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
1 deletion
+47
-1
pydoc.py
Lib/pydoc.py
+47
-1
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
4997a69f
...
...
@@ -24,6 +24,14 @@ and also pops up a little window for controlling it.
Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".
Module docs for core modules are assumed to be in
http://www.python.org/doc/current/lib/
This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
"""
__author__
=
"Ka-Ping Yee <ping@lfw.org>"
...
...
@@ -295,6 +303,33 @@ class Doc:
docmodule
=
docclass
=
docroutine
=
docother
=
fail
def
getdocloc
(
self
,
object
):
"""Return the location of module docs or None"""
try
:
file
=
inspect
.
getabsfile
(
object
)
except
TypeError
:
file
=
'(built-in)'
docloc
=
os
.
environ
.
get
(
"PYTHONDOCS"
,
"http://www.python.org/doc/current/lib"
)
basedir
=
os
.
path
.
join
(
sys
.
exec_prefix
,
"lib"
,
"python"
+
sys
.
version
[
0
:
3
])
if
(
isinstance
(
object
,
type
(
os
))
and
(
object
.
__name__
in
(
'errno'
,
'exceptions'
,
'gc'
,
'imp'
,
'marshal'
,
'posix'
,
'signal'
,
'sys'
,
'thread'
,
'zipimport'
)
or
(
file
.
startswith
(
basedir
)
and
not
file
.
startswith
(
os
.
path
.
join
(
basedir
,
'site-packages'
))))):
if
docloc
.
startswith
(
"http://"
):
docloc
=
(
docloc
.
rstrip
(
"/"
)
+
"/module-
%
s.html"
%
object
.
__name__
)
else
:
docloc
=
os
.
path
.
join
(
docloc
,
"module-
%
s.html"
%
name
)
else
:
docloc
=
None
return
docloc
# -------------------------------------------- HTML documentation generator
class
HTMLRepr
(
Repr
):
...
...
@@ -535,8 +570,14 @@ class HTMLDoc(Doc):
info
.
append
(
self
.
escape
(
str
(
object
.
__date__
)))
if
info
:
head
=
head
+
' (
%
s)'
%
join
(
info
,
', '
)
docloc
=
self
.
getdocloc
(
object
)
if
docloc
is
not
None
:
docloc
=
'<br><a href="
%(docloc)
s">Module Docs</a>'
%
locals
()
else
:
docloc
=
''
result
=
self
.
heading
(
head
,
'#ffffff'
,
'#7799ee'
,
'<a href=".">index</a><br>'
+
filelink
)
head
,
'#ffffff'
,
'#7799ee'
,
'<a href=".">index</a><br>'
+
filelink
+
docloc
)
modules
=
inspect
.
getmembers
(
object
,
inspect
.
ismodule
)
...
...
@@ -950,6 +991,11 @@ class TextDoc(Doc):
except
TypeError
:
file
=
'(built-in)'
result
=
result
+
self
.
section
(
'FILE'
,
file
)
docloc
=
self
.
getdocloc
(
object
)
if
docloc
is
not
None
:
result
=
result
+
self
.
section
(
'MODULE DOCS'
,
docloc
)
if
desc
:
result
=
result
+
self
.
section
(
'DESCRIPTION'
,
desc
)
...
...
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