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
c1a68363
Kaydet (Commit)
c1a68363
authored
Eki 27, 2010
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10193: Simplified instrospection used by turtle module
üst
7424dd35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
turtle.py
Lib/turtle.py
+25
-20
No files found.
Lib/turtle.py
Dosyayı görüntüle @
c1a68363
...
@@ -109,6 +109,7 @@ import types
...
@@ -109,6 +109,7 @@ import types
import
math
import
math
import
time
import
time
import
os
import
os
import
inspect
from
os.path
import
isfile
,
split
,
join
from
os.path
import
isfile
,
split
,
join
from
copy
import
deepcopy
from
copy
import
deepcopy
...
@@ -3889,31 +3890,35 @@ except:
...
@@ -3889,31 +3890,35 @@ except:
def
getmethparlist
(
ob
):
def
getmethparlist
(
ob
):
"Get strings describing the arguments for the given object"
"""Get strings describing the arguments for the given object
argText1
=
argText2
=
""
Returns a pair of strings representing function parameter lists
including parenthesis. The first string is suitable for use in
function definition and the second is suitable for use in function
call. The "self" parameter is not included.
"""
defText
=
callText
=
""
# bit of a hack for methods - turn it into a function
# bit of a hack for methods - turn it into a function
# but we drop the "self" param.
# but we drop the "self" param.
# Try and build one for Python defined functions
# Try and build one for Python defined functions
argOffset
=
1
args
,
varargs
,
varkw
=
inspect
.
getargs
(
ob
.
__code__
)
counter
=
ob
.
__code__
.
co_argcount
items2
=
args
[
1
:]
items2
=
list
(
ob
.
__code__
.
co_varnames
[
argOffset
:
counter
])
realArgs
=
args
[
1
:]
realArgs
=
ob
.
__code__
.
co_varnames
[
argOffset
:
counter
]
defaults
=
ob
.
__defaults__
or
[]
defaults
=
ob
.
__defaults__
or
[]
defaults
=
list
(
map
(
lambda
name
:
"=
%
s"
%
repr
(
name
),
defaults
))
defaults
=
[
"=
%
r"
%
(
value
,)
for
value
in
defaults
]
defaults
=
[
""
]
*
(
len
(
realArgs
)
-
len
(
defaults
))
+
defaults
defaults
=
[
""
]
*
(
len
(
realArgs
)
-
len
(
defaults
))
+
defaults
items1
=
list
(
map
(
lambda
arg
,
dflt
:
arg
+
dflt
,
realArgs
,
defaults
))
items1
=
[
arg
+
dflt
for
arg
,
dflt
in
zip
(
realArgs
,
defaults
)]
if
ob
.
__code__
.
co_flags
&
0x4
:
if
varargs
is
not
None
:
items1
.
append
(
"*"
+
ob
.
__code__
.
co_varnames
[
counter
])
items1
.
append
(
"*"
+
varargs
)
items2
.
append
(
"*"
+
ob
.
__code__
.
co_varnames
[
counter
])
items2
.
append
(
"*"
+
varargs
)
counter
+=
1
if
varkw
is
not
None
:
if
ob
.
__code__
.
co_flags
&
0x8
:
items1
.
append
(
"**"
+
varkw
)
items1
.
append
(
"**"
+
ob
.
__code__
.
co_varnames
[
counter
])
items2
.
append
(
"**"
+
varkw
)
items2
.
append
(
"**"
+
ob
.
__code__
.
co_varnames
[
counter
])
defText
=
", "
.
join
(
items1
)
argText1
=
", "
.
join
(
items1
)
defText
=
"(
%
s)"
%
defText
argText1
=
"(
%
s)"
%
argText1
callText
=
", "
.
join
(
items2
)
argText2
=
", "
.
join
(
items2
)
callText
=
"(
%
s)"
%
callText
argText2
=
"(
%
s)"
%
argText2
return
defText
,
callText
return
argText1
,
argText2
def
_turtle_docrevise
(
docstr
):
def
_turtle_docrevise
(
docstr
):
"""To reduce docstrings from RawTurtle class for functions
"""To reduce docstrings from RawTurtle class for functions
...
...
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