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
d74bc432
Kaydet (Commit)
d74bc432
authored
Mar 02, 2001
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make names in __future__.py bind to class instances instead of 2-tuples.
Suggested on c.l.py by William Tanksley, and I like it.
üst
239432a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
10 deletions
+34
-10
__future__.py
Lib/__future__.py
+32
-7
test___future__.py
Lib/test/test___future__.py
+2
-3
No files found.
Lib/__future__.py
Dosyayı görüntüle @
d74bc432
...
...
@@ -2,11 +2,7 @@
Each line is of the form:
FeatureName = ReleaseInfo
ReleaseInfo is a pair of the form:
(OptionalRelease, MandatoryRelease)
FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease) ")"
where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples
of the same form as sys.version_info:
...
...
@@ -38,7 +34,36 @@ to use the feature in question, but may continue to use such imports.
MandatoryRelease may also be None, meaning that a planned feature got
dropped.
No line is ever to be deleted from this file.
Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().
No feature line is ever to be deleted from this file.
"""
nested_scopes
=
(
2
,
1
,
0
,
"beta"
,
1
),
(
2
,
2
,
0
,
"final"
,
0
)
class
_Feature
:
def
__init__
(
self
,
optionalRelease
,
mandatoryRelease
):
self
.
optional
=
optionalRelease
self
.
mandatory
=
mandatoryRelease
def
getOptionalRelease
(
self
):
"""Return first release in which this feature was recognized.
This is a 5-tuple, of the same form as sys.version_info.
"""
return
self
.
optional
def
getMandatoryRelease
(
self
):
"""Return release in which this feature will become mandatory.
This is a 5-tuple, of the same form as sys.version_info, or, if
the feature was dropped, is None.
"""
return
self
.
mandatory
def
__repr__
(
self
):
return
"Feature("
+
`self.getOptionalRelease()`
+
", "
+
\
`self.getMandatoryRelease()`
+
")"
nested_scopes
=
_Feature
((
2
,
1
,
0
,
"beta"
,
1
),
(
2
,
2
,
0
,
"final"
,
0
))
Lib/test/test___future__.py
Dosyayı görüntüle @
d74bc432
...
...
@@ -10,10 +10,9 @@ for feature in features:
value
=
getattr
(
__future__
,
feature
)
if
verbose
:
print
"Checking __future__ "
,
feature
,
"value"
,
value
verify
(
type
(
value
)
is
TupleType
,
"feature value isn't tuple"
)
verify
(
len
(
value
)
==
2
,
"feature value isn't 2-tuple"
)
optional
,
mandatory
=
value
optional
=
value
.
getOptionalRelease
()
mandatory
=
value
.
getMandatoryRelease
()
verify
(
type
(
optional
)
is
TupleType
,
"optional isn't tuple"
)
verify
(
len
(
optional
)
==
5
,
"optional isn't 5-tuple"
)
...
...
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