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
e3c11b44
Kaydet (Commit)
e3c11b44
authored
Nis 03, 2011
tarafından
Steven Bethard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9347: Fix formatting for tuples in argparse type= error messages.
üst
824504dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
argparse.py
Lib/argparse.py
+2
-2
test_argparse.py
Lib/test/test_argparse.py
+2
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/argparse.py
Dosyayı görüntüle @
e3c11b44
...
...
@@ -1277,13 +1277,13 @@ class _ActionsContainer(object):
# create the action object, and add it to the parser
action_class
=
self
.
_pop_action_class
(
kwargs
)
if
not
_callable
(
action_class
):
raise
ValueError
(
'unknown action "
%
s"'
%
action_class
)
raise
ValueError
(
'unknown action "
%
s"'
%
(
action_class
,)
)
action
=
action_class
(
**
kwargs
)
# raise an error if the action type is not callable
type_func
=
self
.
_registry_get
(
'type'
,
action
.
type
,
action
.
type
)
if
not
_callable
(
type_func
):
raise
ValueError
(
'
%
r is not callable'
%
type_func
)
raise
ValueError
(
'
%
r is not callable'
%
(
type_func
,)
)
# raise an error if the metavar does not match the type
if
hasattr
(
self
,
"_get_formatter"
):
...
...
Lib/test/test_argparse.py
Dosyayı görüntüle @
e3c11b44
...
...
@@ -4016,10 +4016,12 @@ class TestInvalidArgumentConstructors(TestCase):
def
test_invalid_type
(
self
):
self
.
assertValueError
(
'--foo'
,
type
=
'int'
)
self
.
assertValueError
(
'--foo'
,
type
=
(
int
,
float
))
def
test_invalid_action
(
self
):
self
.
assertValueError
(
'-x'
,
action
=
'foo'
)
self
.
assertValueError
(
'foo'
,
action
=
'baz'
)
self
.
assertValueError
(
'--foo'
,
action
=
(
'store'
,
'append'
))
parser
=
argparse
.
ArgumentParser
()
try
:
parser
.
add_argument
(
"--foo"
,
action
=
"store-true"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
e3c11b44
...
...
@@ -257,6 +257,8 @@ Library
-
Issue
#
9026
:
Fix
order
of
argparse
sub
-
commands
in
help
messages
.
-
Issue
#
9347
:
Fix
formatting
for
tuples
in
argparse
type
=
error
messages
.
Extension
Modules
-----------------
...
...
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