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
5a8a0378
Kaydet (Commit)
5a8a0378
authored
Ock 16, 2005
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use descriptors.
üst
fee7b93c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
11 deletions
+9
-11
test_datetime.py
Lib/test/test_datetime.py
+1
-1
test_descr.py
Lib/test/test_descr.py
+2
-2
test_descrtut.py
Lib/test/test_descrtut.py
+3
-3
test_doctest2.py
Lib/test/test_doctest2.py
+2
-4
test_userdict.py
Lib/test/test_userdict.py
+1
-1
No files found.
Lib/test/test_datetime.py
Dosyayı görüntüle @
5a8a0378
...
@@ -446,9 +446,9 @@ class TestTimeDelta(HarmlessMixedComparison):
...
@@ -446,9 +446,9 @@ class TestTimeDelta(HarmlessMixedComparison):
def
test_subclass_timedelta
(
self
):
def
test_subclass_timedelta
(
self
):
class
T
(
timedelta
):
class
T
(
timedelta
):
@staticmethod
def
from_td
(
td
):
def
from_td
(
td
):
return
T
(
td
.
days
,
td
.
seconds
,
td
.
microseconds
)
return
T
(
td
.
days
,
td
.
seconds
,
td
.
microseconds
)
from_td
=
staticmethod
(
from_td
)
def
as_hours
(
self
):
def
as_hours
(
self
):
sum
=
(
self
.
days
*
24
+
sum
=
(
self
.
days
*
24
+
...
...
Lib/test/test_descr.py
Dosyayı görüntüle @
5a8a0378
...
@@ -691,13 +691,13 @@ def metaclass():
...
@@ -691,13 +691,13 @@ def metaclass():
class
_instance
(
object
):
class
_instance
(
object
):
pass
pass
class
M2
(
object
):
class
M2
(
object
):
@staticmethod
def
__new__
(
cls
,
name
,
bases
,
dict
):
def
__new__
(
cls
,
name
,
bases
,
dict
):
self
=
object
.
__new__
(
cls
)
self
=
object
.
__new__
(
cls
)
self
.
name
=
name
self
.
name
=
name
self
.
bases
=
bases
self
.
bases
=
bases
self
.
dict
=
dict
self
.
dict
=
dict
return
self
return
self
__new__
=
staticmethod
(
__new__
)
def
__call__
(
self
):
def
__call__
(
self
):
it
=
_instance
()
it
=
_instance
()
# Early binding of methods
# Early binding of methods
...
@@ -2071,9 +2071,9 @@ def supers():
...
@@ -2071,9 +2071,9 @@ def supers():
aProp
=
property
(
lambda
self
:
"foo"
)
aProp
=
property
(
lambda
self
:
"foo"
)
class
Sub
(
Base
):
class
Sub
(
Base
):
@classmethod
def
test
(
klass
):
def
test
(
klass
):
return
super
(
Sub
,
klass
)
.
aProp
return
super
(
Sub
,
klass
)
.
aProp
test
=
classmethod
(
test
)
veris
(
Sub
.
test
(),
Base
.
aProp
)
veris
(
Sub
.
test
(),
Base
.
aProp
)
...
...
Lib/test/test_descrtut.py
Dosyayı görüntüle @
5a8a0378
...
@@ -246,9 +246,9 @@ static methods in C++ or Java. Here's an example:
...
@@ -246,9 +246,9 @@ static methods in C++ or Java. Here's an example:
>>> class C:
>>> class C:
...
...
... @staticmethod
... def foo(x, y):
... def foo(x, y):
... print "staticmethod", x, y
... print "staticmethod", x, y
... foo = staticmethod(foo)
>>> C.foo(1, 2)
>>> C.foo(1, 2)
staticmethod 1 2
staticmethod 1 2
...
@@ -260,9 +260,9 @@ Class methods use a similar pattern to declare methods that receive an
...
@@ -260,9 +260,9 @@ Class methods use a similar pattern to declare methods that receive an
implicit first argument that is the *class* for which they are invoked.
implicit first argument that is the *class* for which they are invoked.
>>> class C:
>>> class C:
... @classmethod
... def foo(cls, y):
... def foo(cls, y):
... print "classmethod", cls, y
... print "classmethod", cls, y
... foo = classmethod(foo)
>>> C.foo(1)
>>> C.foo(1)
classmethod test.test_descrtut.C 1
classmethod test.test_descrtut.C 1
...
@@ -286,10 +286,10 @@ call, not the class involved in the definition of foo().
...
@@ -286,10 +286,10 @@ call, not the class involved in the definition of foo().
But notice this:
But notice this:
>>> class E(C):
>>> class E(C):
... @classmethod
... def foo(cls, y): # override C.foo
... def foo(cls, y): # override C.foo
... print "E.foo() called"
... print "E.foo() called"
... C.foo(y)
... C.foo(y)
... foo = classmethod(foo)
>>> E.foo(1)
>>> E.foo(1)
E.foo() called
E.foo() called
...
...
Lib/test/test_doctest2.py
Dosyayı görüntüle @
5a8a0378
...
@@ -80,6 +80,7 @@ class C(object):
...
@@ -80,6 +80,7 @@ class C(object):
-12
-12
"""
)
"""
)
@staticmethod
def
statm
():
def
statm
():
"""
"""
A static method.
A static method.
...
@@ -91,8 +92,7 @@ class C(object):
...
@@ -91,8 +92,7 @@ class C(object):
"""
"""
return
666
return
666
statm
=
staticmethod
(
statm
)
@classmethod
def
clsm
(
cls
,
val
):
def
clsm
(
cls
,
val
):
"""
"""
A class method.
A class method.
...
@@ -104,8 +104,6 @@ class C(object):
...
@@ -104,8 +104,6 @@ class C(object):
"""
"""
return
val
return
val
clsm
=
classmethod
(
clsm
)
def
test_main
():
def
test_main
():
from
test
import
test_doctest2
from
test
import
test_doctest2
EXPECTED
=
19
EXPECTED
=
19
...
...
Lib/test/test_userdict.py
Dosyayı görüntüle @
5a8a0378
...
@@ -191,12 +191,12 @@ class SeqDict(UserDict.DictMixin):
...
@@ -191,12 +191,12 @@ class SeqDict(UserDict.DictMixin):
for
key
,
value
in
self
.
iteritems
():
for
key
,
value
in
self
.
iteritems
():
d
[
key
]
=
value
d
[
key
]
=
value
return
d
return
d
@classmethod
def
fromkeys
(
cls
,
keys
,
value
=
None
):
def
fromkeys
(
cls
,
keys
,
value
=
None
):
d
=
cls
()
d
=
cls
()
for
key
in
keys
:
for
key
in
keys
:
d
[
key
]
=
value
d
[
key
]
=
value
return
d
return
d
fromkeys
=
classmethod
(
fromkeys
)
class
UserDictMixinTest
(
mapping_tests
.
TestMappingProtocol
):
class
UserDictMixinTest
(
mapping_tests
.
TestMappingProtocol
):
type2test
=
SeqDict
type2test
=
SeqDict
...
...
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