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
68b56d02
Kaydet (Commit)
68b56d02
authored
Ara 02, 2018
tarafından
Ismo Toijala
Kaydeden (comit)
Ivan Levkivskyi
Ara 02, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-35341: Add generic version of OrderedDict to typing (GH-10850)
üst
32bc11c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
0 deletions
+24
-0
typing.rst
Doc/library/typing.rst
+6
-0
test_typing.py
Lib/test/test_typing.py
+16
-0
typing.py
Lib/typing.py
+1
-0
2018-12-02-13-50-52.bpo-35341.32E8T_.rst
...S.d/next/Library/2018-12-02-13-50-52.bpo-35341.32E8T_.rst
+1
-0
No files found.
Doc/library/typing.rst
Dosyayı görüntüle @
68b56d02
...
@@ -689,6 +689,12 @@ The module defines the following classes, functions and decorators:
...
@@ -689,6 +689,12 @@ The module defines the following classes, functions and decorators:
.. versionadded:: 3.5.2
.. versionadded:: 3.5.2
.. class:: OrderedDict(collections.OrderedDict, MutableMapping[KT, VT])
A generic version of :class:`collections.OrderedDict`.
.. versionadded:: 3.7.2
.. class:: Counter(collections.Counter, Dict[T, int])
.. class:: Counter(collections.Counter, Dict[T, int])
A generic version of :class:`collections.Counter`.
A generic version of :class:`collections.Counter`.
...
...
Lib/test/test_typing.py
Dosyayı görüntüle @
68b56d02
...
@@ -2075,6 +2075,22 @@ class CollectionsAbcTests(BaseTestCase):
...
@@ -2075,6 +2075,22 @@ class CollectionsAbcTests(BaseTestCase):
self
.
assertIsSubclass
(
MyDefDict
,
collections
.
defaultdict
)
self
.
assertIsSubclass
(
MyDefDict
,
collections
.
defaultdict
)
self
.
assertNotIsSubclass
(
collections
.
defaultdict
,
MyDefDict
)
self
.
assertNotIsSubclass
(
collections
.
defaultdict
,
MyDefDict
)
def
test_ordereddict_instantiation
(
self
):
self
.
assertIs
(
type
(
typing
.
OrderedDict
()),
collections
.
OrderedDict
)
self
.
assertIs
(
type
(
typing
.
OrderedDict
[
KT
,
VT
]()),
collections
.
OrderedDict
)
self
.
assertIs
(
type
(
typing
.
OrderedDict
[
str
,
int
]()),
collections
.
OrderedDict
)
def
test_ordereddict_subclass
(
self
):
class
MyOrdDict
(
typing
.
OrderedDict
[
str
,
int
]):
pass
od
=
MyOrdDict
()
self
.
assertIsInstance
(
od
,
MyOrdDict
)
self
.
assertIsSubclass
(
MyOrdDict
,
collections
.
OrderedDict
)
self
.
assertNotIsSubclass
(
collections
.
OrderedDict
,
MyOrdDict
)
@skipUnless
(
sys
.
version_info
>=
(
3
,
3
),
'ChainMap was added in 3.3'
)
@skipUnless
(
sys
.
version_info
>=
(
3
,
3
),
'ChainMap was added in 3.3'
)
def
test_chainmap_instantiation
(
self
):
def
test_chainmap_instantiation
(
self
):
self
.
assertIs
(
type
(
typing
.
ChainMap
()),
collections
.
ChainMap
)
self
.
assertIs
(
type
(
typing
.
ChainMap
()),
collections
.
ChainMap
)
...
...
Lib/typing.py
Dosyayı görüntüle @
68b56d02
...
@@ -1241,6 +1241,7 @@ ContextManager = _alias(contextlib.AbstractContextManager, T_co)
...
@@ -1241,6 +1241,7 @@ ContextManager = _alias(contextlib.AbstractContextManager, T_co)
AsyncContextManager
=
_alias
(
contextlib
.
AbstractAsyncContextManager
,
T_co
)
AsyncContextManager
=
_alias
(
contextlib
.
AbstractAsyncContextManager
,
T_co
)
Dict
=
_alias
(
dict
,
(
KT
,
VT
),
inst
=
False
)
Dict
=
_alias
(
dict
,
(
KT
,
VT
),
inst
=
False
)
DefaultDict
=
_alias
(
collections
.
defaultdict
,
(
KT
,
VT
))
DefaultDict
=
_alias
(
collections
.
defaultdict
,
(
KT
,
VT
))
OrderedDict
=
_alias
(
collections
.
OrderedDict
,
(
KT
,
VT
))
Counter
=
_alias
(
collections
.
Counter
,
T
)
Counter
=
_alias
(
collections
.
Counter
,
T
)
ChainMap
=
_alias
(
collections
.
ChainMap
,
(
KT
,
VT
))
ChainMap
=
_alias
(
collections
.
ChainMap
,
(
KT
,
VT
))
Generator
=
_alias
(
collections
.
abc
.
Generator
,
(
T_co
,
T_contra
,
V_co
))
Generator
=
_alias
(
collections
.
abc
.
Generator
,
(
T_co
,
T_contra
,
V_co
))
...
...
Misc/NEWS.d/next/Library/2018-12-02-13-50-52.bpo-35341.32E8T_.rst
0 → 100644
Dosyayı görüntüle @
68b56d02
Add generic version of ``collections.OrderedDict`` to the ``typing`` module. Patch by Ismo Toijala.
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