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
0e717add
Kaydet (Commit)
0e717add
authored
Mar 02, 2010
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
remove cross-version compatibility code
üst
bd56722a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
50 deletions
+9
-50
argparse.py
Lib/argparse.py
+7
-28
test_argparse.py
Lib/test/test_argparse.py
+2
-22
No files found.
Lib/argparse.py
Dosyayı görüntüle @
0e717add
...
...
@@ -95,27 +95,6 @@ import textwrap as _textwrap
from
gettext
import
gettext
as
_
try
:
_set
=
set
except
NameError
:
from
sets
import
Set
as
_set
try
:
_basestring
=
basestring
except
NameError
:
_basestring
=
str
try
:
_sorted
=
sorted
except
NameError
:
def
_sorted
(
iterable
,
reverse
=
False
):
result
=
list
(
iterable
)
result
.
sort
()
if
reverse
:
result
.
reverse
()
return
result
def
_callable
(
obj
):
return
hasattr
(
obj
,
'__call__'
)
or
hasattr
(
obj
,
'__bases__'
)
...
...
@@ -152,7 +131,7 @@ class _AttributeHolder(object):
return
'
%
s(
%
s)'
%
(
type_name
,
', '
.
join
(
arg_strings
))
def
_get_kwargs
(
self
):
return
_
sorted
(
self
.
__dict__
.
items
())
return
sorted
(
self
.
__dict__
.
items
())
def
_get_args
(
self
):
return
[]
...
...
@@ -405,7 +384,7 @@ class HelpFormatter(object):
def
_format_actions_usage
(
self
,
actions
,
groups
):
# find group indices and identify actions in groups
group_actions
=
_
set
()
group_actions
=
set
()
inserts
=
{}
for
group
in
groups
:
try
:
...
...
@@ -475,7 +454,7 @@ class HelpFormatter(object):
parts
.
append
(
part
)
# insert things at the necessary indices
for
i
in
_
sorted
(
inserts
,
reverse
=
True
):
for
i
in
sorted
(
inserts
,
reverse
=
True
):
parts
[
i
:
i
]
=
[
inserts
[
i
]]
# join all the action items with spaces
...
...
@@ -1705,7 +1684,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
if
not
hasattr
(
namespace
,
action
.
dest
):
if
action
.
default
is
not
SUPPRESS
:
default
=
action
.
default
if
isinstance
(
action
.
default
,
_
basestring
):
if
isinstance
(
action
.
default
,
basestring
):
default
=
self
.
_get_value
(
action
,
default
)
setattr
(
namespace
,
action
.
dest
,
default
)
...
...
@@ -1765,8 +1744,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
arg_strings_pattern
=
''
.
join
(
arg_string_pattern_parts
)
# converts arg strings to the appropriate and then takes the action
seen_actions
=
_
set
()
seen_non_default_actions
=
_
set
()
seen_actions
=
set
()
seen_non_default_actions
=
set
()
def
take_action
(
action
,
argument_strings
,
option_string
=
None
):
seen_actions
.
add
(
action
)
...
...
@@ -2179,7 +2158,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
value
=
action
.
const
else
:
value
=
action
.
default
if
isinstance
(
value
,
_
basestring
):
if
isinstance
(
value
,
basestring
):
value
=
self
.
_get_value
(
action
,
value
)
self
.
_check_value
(
action
,
value
)
...
...
Lib/test/test_argparse.py
Dosyayı görüntüle @
0e717add
...
...
@@ -22,29 +22,9 @@ import unittest
import
warnings
import
argparse
from
test
import
test_support
try
:
from
StringIO
import
StringIO
except
ImportError
:
from
io
import
StringIO
try
:
set
except
NameError
:
from
sets
import
Set
as
set
try
:
sorted
except
NameError
:
def
sorted
(
iterable
,
reverse
=
False
):
result
=
list
(
iterable
)
result
.
sort
()
if
reverse
:
result
.
reverse
()
return
result
from
StringIO
import
StringIO
from
test
import
test_support
class
TestCase
(
unittest
.
TestCase
):
...
...
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