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
930795b7
Kaydet (Commit)
930795b7
authored
Tem 10, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clear the -3 warnings in optparse.py
üst
9be2ec10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
optparse.py
Lib/optparse.py
+9
-15
No files found.
Lib/optparse.py
Dosyayı görüntüle @
930795b7
...
...
@@ -602,7 +602,7 @@ class Option:
def
_set_attrs
(
self
,
attrs
):
for
attr
in
self
.
ATTRS
:
if
attr
s
.
has_key
(
attr
)
:
if
attr
in
attrs
:
setattr
(
self
,
attr
,
attrs
[
attr
])
del
attrs
[
attr
]
else
:
...
...
@@ -701,7 +701,7 @@ class Option:
def
_check_callback
(
self
):
if
self
.
action
==
"callback"
:
if
not
callable
(
self
.
callback
):
if
not
hasattr
(
self
.
callback
,
'__call__'
):
raise
OptionError
(
"callback not callable:
%
r"
%
self
.
callback
,
self
)
if
(
self
.
callback_args
is
not
None
and
...
...
@@ -817,12 +817,6 @@ class Option:
SUPPRESS_HELP
=
"SUPPRESS"
+
"HELP"
SUPPRESS_USAGE
=
"SUPPRESS"
+
"USAGE"
# For compatibility with Python 2.2
try
:
True
,
False
except
NameError
:
(
True
,
False
)
=
(
1
,
0
)
try
:
basestring
except
NameError
:
...
...
@@ -860,7 +854,7 @@ class Values:
are silently ignored.
"""
for
attr
in
dir
(
self
):
if
dict
.
has_key
(
attr
)
:
if
attr
in
dict
:
dval
=
dict
[
attr
]
if
dval
is
not
None
:
setattr
(
self
,
attr
,
dval
)
...
...
@@ -980,10 +974,10 @@ class OptionContainer:
def
_check_conflict
(
self
,
option
):
conflict_opts
=
[]
for
opt
in
option
.
_short_opts
:
if
self
.
_short_opt
.
has_key
(
opt
)
:
if
opt
in
self
.
_short_opt
:
conflict_opts
.
append
((
opt
,
self
.
_short_opt
[
opt
]))
for
opt
in
option
.
_long_opts
:
if
self
.
_long_opt
.
has_key
(
opt
)
:
if
opt
in
self
.
_long_opt
:
conflict_opts
.
append
((
opt
,
self
.
_long_opt
[
opt
]))
if
conflict_opts
:
...
...
@@ -1029,7 +1023,7 @@ class OptionContainer:
if
option
.
dest
is
not
None
:
# option has a dest, we need a default
if
option
.
default
is
not
NO_DEFAULT
:
self
.
defaults
[
option
.
dest
]
=
option
.
default
elif
not
self
.
defaults
.
has_key
(
option
.
dest
)
:
elif
option
.
dest
not
in
self
.
defaults
:
self
.
defaults
[
option
.
dest
]
=
None
return
option
...
...
@@ -1045,8 +1039,8 @@ class OptionContainer:
self
.
_long_opt
.
get
(
opt_str
))
def
has_option
(
self
,
opt_str
):
return
(
self
.
_short_opt
.
has_key
(
opt_str
)
or
self
.
_long_opt
.
has_key
(
opt_str
)
)
return
(
opt_str
in
self
.
_short_opt
or
opt_str
in
self
.
_long_opt
)
def
remove_option
(
self
,
opt_str
):
option
=
self
.
_short_opt
.
get
(
opt_str
)
...
...
@@ -1664,7 +1658,7 @@ def _match_abbrev(s, wordmap):
'words', raise BadOptionError.
"""
# Is there an exact match?
if
wordmap
.
has_key
(
s
)
:
if
s
in
wordmap
:
return
s
else
:
# Isolate all words with s as a prefix.
...
...
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