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
21e83a55
Kaydet (Commit)
21e83a55
authored
Mar 27, 2014
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
inspect.signature: Use enum for parameter kind constants. Closes #19573
Patch by Antony Lee.
üst
4a692ce5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
inspect.py
Lib/inspect.py
+13
-14
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/inspect.py
Dosyayı görüntüle @
21e83a55
...
@@ -32,6 +32,7 @@ __author__ = ('Ka-Ping Yee <ping@lfw.org>',
...
@@ -32,6 +32,7 @@ __author__ = ('Ka-Ping Yee <ping@lfw.org>',
'Yury Selivanov <yselivanov@sprymix.com>'
)
'Yury Selivanov <yselivanov@sprymix.com>'
)
import
ast
import
ast
import
enum
import
importlib.machinery
import
importlib.machinery
import
itertools
import
itertools
import
linecache
import
linecache
...
@@ -2027,24 +2028,22 @@ class _empty:
...
@@ -2027,24 +2028,22 @@ class _empty:
pass
pass
class
_ParameterKind
(
int
):
class
_ParameterKind
(
enum
.
IntEnum
):
def
__new__
(
self
,
*
args
,
name
):
POSITIONAL_ONLY
=
0
obj
=
int
.
__new__
(
self
,
*
args
)
POSITIONAL_OR_KEYWORD
=
1
obj
.
_name
=
name
VAR_POSITIONAL
=
2
return
obj
KEYWORD_ONLY
=
3
VAR_KEYWORD
=
4
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
_name
return
self
.
_name_
def
__repr__
(
self
):
return
'<_ParameterKind: {!r}>'
.
format
(
self
.
_name
)
_POSITIONAL_ONLY
=
_ParameterKind
(
0
,
name
=
'POSITIONAL_ONLY'
)
_POSITIONAL_ONLY
=
_ParameterKind
.
POSITIONAL_ONLY
_POSITIONAL_OR_KEYWORD
=
_ParameterKind
(
1
,
name
=
'POSITIONAL_OR_KEYWORD'
)
_POSITIONAL_OR_KEYWORD
=
_ParameterKind
.
POSITIONAL_OR_KEYWORD
_VAR_POSITIONAL
=
_ParameterKind
(
2
,
name
=
'VAR_POSITIONAL'
)
_VAR_POSITIONAL
=
_ParameterKind
.
VAR_POSITIONAL
_KEYWORD_ONLY
=
_ParameterKind
(
3
,
name
=
'KEYWORD_ONLY'
)
_KEYWORD_ONLY
=
_ParameterKind
.
KEYWORD_ONLY
_VAR_KEYWORD
=
_ParameterKind
(
4
,
name
=
'VAR_KEYWORD'
)
_VAR_KEYWORD
=
_ParameterKind
.
VAR_KEYWORD
class
Parameter
:
class
Parameter
:
...
...
Misc/NEWS
Dosyayı görüntüle @
21e83a55
...
@@ -105,6 +105,8 @@ Library
...
@@ -105,6 +105,8 @@ Library
-
Issue
#
19748
:
On
AIX
,
time
.
mktime
()
now
raises
an
OverflowError
for
year
-
Issue
#
19748
:
On
AIX
,
time
.
mktime
()
now
raises
an
OverflowError
for
year
outsize
range
[
1902
;
2037
].
outsize
range
[
1902
;
2037
].
-
Issue
#
19573
:
inspect
.
signature
:
Use
enum
for
parameter
kind
constants
.
Documentation
Documentation
-------------
-------------
...
...
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