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
6d2ea213
Kaydet (Commit)
6d2ea213
authored
Ock 05, 2014
tarafından
Larry Hastings
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Argument Clinic: fixed test suite, improved howto.
üst
5ea97506
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
clinic.rst
Doc/howto/clinic.rst
+0
-0
clinic.py
Tools/clinic/clinic.py
+5
-4
clinic_test.py
Tools/clinic/clinic_test.py
+14
-10
No files found.
Doc/howto/clinic.rst
Dosyayı görüntüle @
6d2ea213
This diff is collapsed.
Click to expand it.
Tools/clinic/clinic.py
Dosyayı görüntüle @
6d2ea213
...
@@ -997,7 +997,8 @@ class BlockPrinter:
...
@@ -997,7 +997,8 @@ class BlockPrinter:
# "languages" maps the name of the language ("C", "Python").
# "languages" maps the name of the language ("C", "Python").
# "extensions" maps the file extension ("c", "py").
# "extensions" maps the file extension ("c", "py").
languages
=
{
'C'
:
CLanguage
,
'Python'
:
PythonLanguage
}
languages
=
{
'C'
:
CLanguage
,
'Python'
:
PythonLanguage
}
extensions
=
{
'c'
:
CLanguage
,
'h'
:
CLanguage
,
'py'
:
PythonLanguage
}
extensions
=
{
name
:
CLanguage
for
name
in
"c cc cpp cxx h hh hpp hxx"
.
split
()
}
extensions
[
'py'
]
=
PythonLanguage
# maps strings to callables.
# maps strings to callables.
...
@@ -2430,9 +2431,6 @@ class DSLParser:
...
@@ -2430,9 +2431,6 @@ class DSLParser:
# the final stanza of the DSL is the docstring.
# the final stanza of the DSL is the docstring.
def
state_function_docstring
(
self
,
line
):
def
state_function_docstring
(
self
,
line
):
if
not
self
.
function
.
self_converter
:
self
.
function
.
self_converter
=
self_converter
(
"self"
,
self
.
function
)
if
self
.
group
:
if
self
.
group
:
fail
(
"Function "
+
self
.
function
.
name
+
" has a ] without a matching [."
)
fail
(
"Function "
+
self
.
function
.
name
+
" has a ] without a matching [."
)
...
@@ -2604,6 +2602,9 @@ class DSLParser:
...
@@ -2604,6 +2602,9 @@ class DSLParser:
if
not
self
.
function
:
if
not
self
.
function
:
return
return
if
not
self
.
function
.
self_converter
:
self
.
function
.
self_converter
=
self_converter
(
"self"
,
self
.
function
)
if
self
.
keyword_only
:
if
self
.
keyword_only
:
values
=
self
.
function
.
parameters
.
values
()
values
=
self
.
function
.
parameters
.
values
()
if
not
values
:
if
not
values
:
...
...
Tools/clinic/clinic_test.py
Dosyayı görüntüle @
6d2ea213
...
@@ -296,9 +296,9 @@ os.stat as os_stat_fn
...
@@ -296,9 +296,9 @@ os.stat as os_stat_fn
Perform a stat system call on the given path."""
)
Perform a stat system call on the given path."""
)
self
.
assertEqual
(
"""
self
.
assertEqual
(
"""
stat(path)
Perform a stat system call on the given path.
Perform a stat system call on the given path.
os.stat(path)
path
path
Path to be examined
Path to be examined
"""
.
strip
(),
function
.
docstring
)
"""
.
strip
(),
function
.
docstring
)
...
@@ -316,9 +316,9 @@ This is the documentation for foo.
...
@@ -316,9 +316,9 @@ This is the documentation for foo.
Okay, we're done here.
Okay, we're done here.
"""
)
"""
)
self
.
assertEqual
(
"""
self
.
assertEqual
(
"""
bar(x, y)
This is the documentation for foo.
This is the documentation for foo.
foo.bar(x, y)
x
x
Documentation for x.
Documentation for x.
...
@@ -356,7 +356,7 @@ This/used to break Clinic!
...
@@ -356,7 +356,7 @@ This/used to break Clinic!
def
test_left_group
(
self
):
def
test_left_group
(
self
):
function
=
self
.
parse_function
(
"""
function
=
self
.
parse_function
(
"""
module curses
module curses
curses.
window.
addch
curses.addch
[
[
y: int
y: int
Y-coordinate.
Y-coordinate.
...
@@ -380,7 +380,9 @@ curses.window.addch
...
@@ -380,7 +380,9 @@ curses.window.addch
self
.
assertEqual
(
p
.
group
,
group
)
self
.
assertEqual
(
p
.
group
,
group
)
self
.
assertEqual
(
p
.
kind
,
inspect
.
Parameter
.
POSITIONAL_ONLY
)
self
.
assertEqual
(
p
.
kind
,
inspect
.
Parameter
.
POSITIONAL_ONLY
)
self
.
assertEqual
(
function
.
docstring
.
strip
(),
"""
self
.
assertEqual
(
function
.
docstring
.
strip
(),
"""
curses.window.addch([y, x,] ch, [attr])
addch([y, x,] ch, [attr])
y
y
Y-coordinate.
Y-coordinate.
x
x
...
@@ -394,7 +396,7 @@ curses.window.addch([y, x,] ch, [attr])
...
@@ -394,7 +396,7 @@ curses.window.addch([y, x,] ch, [attr])
def
test_nested_groups
(
self
):
def
test_nested_groups
(
self
):
function
=
self
.
parse_function
(
"""
function
=
self
.
parse_function
(
"""
module curses
module curses
curses.
window.
imaginary
curses.imaginary
[
[
[
[
y1: int
y1: int
...
@@ -439,7 +441,9 @@ curses.window.imaginary
...
@@ -439,7 +441,9 @@ curses.window.imaginary
self
.
assertEqual
(
p
.
kind
,
inspect
.
Parameter
.
POSITIONAL_ONLY
)
self
.
assertEqual
(
p
.
kind
,
inspect
.
Parameter
.
POSITIONAL_ONLY
)
self
.
assertEqual
(
function
.
docstring
.
strip
(),
"""
self
.
assertEqual
(
function
.
docstring
.
strip
(),
"""
curses.window.imaginary([[y1, y2,] x1, x2,] ch, [attr1, attr2, attr3, [attr4, attr5, attr6]])
imaginary([[y1, y2,] x1, x2,] ch, [attr1, attr2, attr3, [attr4, attr5, attr6]])
y1
y1
Y-coordinate.
Y-coordinate.
y2
y2
...
@@ -557,7 +561,7 @@ foo.bar
...
@@ -557,7 +561,7 @@ foo.bar
Docstring
Docstring
"""
)
"""
)
self
.
assertEqual
(
"
Docstring
\n\n
foo.bar()
"
,
function
.
docstring
)
self
.
assertEqual
(
"
bar()
\n
Docstring
"
,
function
.
docstring
)
self
.
assertEqual
(
0
,
len
(
function
.
parameters
))
self
.
assertEqual
(
0
,
len
(
function
.
parameters
))
def
test_illegal_module_line
(
self
):
def
test_illegal_module_line
(
self
):
...
@@ -652,9 +656,9 @@ foo.bar
...
@@ -652,9 +656,9 @@ foo.bar
Not at column 0!
Not at column 0!
"""
)
"""
)
self
.
assertEqual
(
"""
self
.
assertEqual
(
"""
bar(x, *, y)
Not at column 0!
Not at column 0!
foo.bar(x, *, y)
x
x
Nested docstring here, goeth.
Nested docstring here, goeth.
"""
.
strip
(),
function
.
docstring
)
"""
.
strip
(),
function
.
docstring
)
...
@@ -666,7 +670,7 @@ os.stat
...
@@ -666,7 +670,7 @@ os.stat
path: str
path: str
This/used to break Clinic!
This/used to break Clinic!
"""
)
"""
)
self
.
assertEqual
(
"
This/used to break Clinic!
\n\n
os.stat(path)
"
,
function
.
docstring
)
self
.
assertEqual
(
"
stat(path)
\n
This/used to break Clinic!
"
,
function
.
docstring
)
def
test_directive
(
self
):
def
test_directive
(
self
):
c
=
FakeClinic
()
c
=
FakeClinic
()
...
@@ -692,7 +696,7 @@ This/used to break Clinic!
...
@@ -692,7 +696,7 @@ This/used to break Clinic!
def
parse_function
(
self
,
text
):
def
parse_function
(
self
,
text
):
block
=
self
.
parse
(
text
)
block
=
self
.
parse
(
text
)
s
=
block
.
signatures
s
=
block
.
signatures
assert
len
(
s
)
==
2
self
.
assertEqual
(
len
(
s
),
2
)
assert
isinstance
(
s
[
0
],
clinic
.
Module
)
assert
isinstance
(
s
[
0
],
clinic
.
Module
)
assert
isinstance
(
s
[
1
],
clinic
.
Function
)
assert
isinstance
(
s
[
1
],
clinic
.
Function
)
return
s
[
1
]
return
s
[
1
]
...
...
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