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
66246961
Kaydet (Commit)
66246961
authored
Nis 12, 2001
tarafından
Ka-Ping Yee
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Typo fixes and small touches.
üst
9aa0d909
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
pydoc.py
Lib/pydoc.py
+16
-13
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
66246961
...
...
@@ -1065,7 +1065,7 @@ def locate(path):
text
=
TextDoc
()
html
=
HTMLDoc
()
def
doc
(
thing
,
title
=
'Python Library Documentation: '
):
def
doc
(
thing
,
title
=
'Python Library Documentation:
%
s
'
):
"""Display text documentation, given an object or a path to an object."""
suffix
,
name
=
''
,
None
if
type
(
thing
)
is
type
(
''
):
...
...
@@ -1086,7 +1086,7 @@ def doc(thing, title='Python Library Documentation: '):
module
=
inspect
.
getmodule
(
thing
)
if
not
suffix
and
module
and
module
is
not
thing
:
suffix
=
' in module '
+
module
.
__name__
pager
(
title
+
desc
+
suffix
+
'
\n\n
'
+
text
.
document
(
object
,
name
))
pager
(
title
%
(
desc
+
suffix
)
+
'
\n\n
'
+
text
.
document
(
thing
,
name
))
def
writedoc
(
key
):
"""Write HTML documentation to a file in the current directory."""
...
...
@@ -1178,17 +1178,20 @@ class ModuleScanner(Scanner):
def
ispackage
(
self
,
(
dir
,
package
)):
return
ispackage
(
dir
)
def
run
(
self
,
key
,
callback
,
completer
=
None
):
key
=
lower
(
key
)
def
run
(
self
,
callback
,
key
=
None
,
completer
=
None
):
if
key
:
key
=
lower
(
key
)
self
.
quit
=
0
seen
=
{}
for
modname
in
sys
.
builtin_module_names
:
if
modname
!=
'__main__'
:
seen
[
modname
]
=
1
desc
=
split
(
freshimport
(
modname
)
.
__doc__
or
''
,
'
\n
'
)[
0
]
if
find
(
lower
(
modname
+
' - '
+
desc
),
key
)
>=
0
:
callback
(
None
,
modname
,
desc
)
if
key
is
None
:
callback
(
None
,
modname
,
''
)
else
:
desc
=
split
(
freshimport
(
modname
)
.
__doc__
or
''
,
'
\n
'
)[
0
]
if
find
(
lower
(
modname
+
' - '
+
desc
),
key
)
>=
0
:
callback
(
None
,
modname
,
desc
)
while
not
self
.
quit
:
node
=
self
.
next
()
...
...
@@ -1199,12 +1202,12 @@ class ModuleScanner(Scanner):
modname
=
package
+
(
package
and
'.'
)
+
modname
if
not
seen
.
has_key
(
modname
):
seen
[
modname
]
=
1
# if we see spam.py, skip spam.pyc
if
key
:
if
key
is
None
:
callback
(
path
,
modname
,
''
)
else
:
desc
=
synopsis
(
path
)
or
''
if
find
(
lower
(
modname
+
' - '
+
desc
),
key
)
>=
0
:
callback
(
path
,
modname
,
desc
)
else
:
callback
(
path
,
modname
,
''
)
if
completer
:
completer
()
def
apropos
(
key
):
...
...
@@ -1216,11 +1219,11 @@ def apropos(key):
try
:
import
warnings
except
ImportError
:
pass
else
:
warnings
.
filterwarnings
(
'ignore'
)
# ignore problems during import
ModuleScanner
()
.
run
(
key
,
callback
)
ModuleScanner
()
.
run
(
callback
,
key
)
# --------------------------------------------------- web browser interface
def
serve
(
port
,
callback
=
None
,
finaliz
er
=
None
):
def
serve
(
port
,
callback
=
None
,
complet
er
=
None
):
import
BaseHTTPServer
,
SocketServer
,
mimetools
,
select
# Patch up mimetools.Message so it doesn't break if rfc822 is reloaded.
...
...
@@ -1307,7 +1310,7 @@ pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font></small></small>'''
except
(
KeyboardInterrupt
,
select
.
error
):
pass
finally
:
if
finalizer
:
finaliz
er
()
if
completer
:
complet
er
()
# ----------------------------------------------------- graphical interface
...
...
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