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
bd88802c
Kaydet (Commit)
bd88802c
authored
Eyl 11, 2010
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert r84700 which had an unfortunate performance cost.
üst
5e1fdacc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
collections.py
Lib/collections.py
+6
-6
functools.py
Lib/functools.py
+2
-2
No files found.
Lib/collections.py
Dosyayı görüntüle @
bd88802c
...
@@ -47,7 +47,7 @@ class OrderedDict(dict, MutableMapping):
...
@@ -47,7 +47,7 @@ class OrderedDict(dict, MutableMapping):
self
.
__map
=
{}
self
.
__map
=
{}
self
.
update
(
*
args
,
**
kwds
)
self
.
update
(
*
args
,
**
kwds
)
def
__setitem__
(
self
,
key
,
value
,
*
,
PREV
=
0
,
NEXT
=
1
,
dict_setitem
=
dict
.
__setitem__
):
def
__setitem__
(
self
,
key
,
value
,
PREV
=
0
,
NEXT
=
1
,
dict_setitem
=
dict
.
__setitem__
):
'od.__setitem__(i, y) <==> od[i]=y'
'od.__setitem__(i, y) <==> od[i]=y'
# Setting a new item creates a new link which goes at the end of the linked
# Setting a new item creates a new link which goes at the end of the linked
# list, and the inherited dictionary is updated with the new key/value pair.
# list, and the inherited dictionary is updated with the new key/value pair.
...
@@ -57,7 +57,7 @@ class OrderedDict(dict, MutableMapping):
...
@@ -57,7 +57,7 @@ class OrderedDict(dict, MutableMapping):
last
[
NEXT
]
=
root
[
PREV
]
=
self
.
__map
[
key
]
=
[
last
,
root
,
key
]
last
[
NEXT
]
=
root
[
PREV
]
=
self
.
__map
[
key
]
=
[
last
,
root
,
key
]
dict_setitem
(
self
,
key
,
value
)
dict_setitem
(
self
,
key
,
value
)
def
__delitem__
(
self
,
key
,
*
,
PREV
=
0
,
NEXT
=
1
,
dict_delitem
=
dict
.
__delitem__
):
def
__delitem__
(
self
,
key
,
PREV
=
0
,
NEXT
=
1
,
dict_delitem
=
dict
.
__delitem__
):
'od.__delitem__(y) <==> del od[y]'
'od.__delitem__(y) <==> del od[y]'
# Deleting an existing item uses self.__map to find the link which is
# Deleting an existing item uses self.__map to find the link which is
# then removed by updating the links in the predecessor and successor nodes.
# then removed by updating the links in the predecessor and successor nodes.
...
@@ -68,7 +68,7 @@ class OrderedDict(dict, MutableMapping):
...
@@ -68,7 +68,7 @@ class OrderedDict(dict, MutableMapping):
link_prev
[
NEXT
]
=
link_next
link_prev
[
NEXT
]
=
link_next
link_next
[
PREV
]
=
link_prev
link_next
[
PREV
]
=
link_prev
def
__iter__
(
self
,
*
,
NEXT
=
1
,
KEY
=
2
):
def
__iter__
(
self
,
NEXT
=
1
,
KEY
=
2
):
'od.__iter__() <==> iter(od)'
'od.__iter__() <==> iter(od)'
# Traverse the linked list in order.
# Traverse the linked list in order.
root
=
self
.
__root
root
=
self
.
__root
...
@@ -77,7 +77,7 @@ class OrderedDict(dict, MutableMapping):
...
@@ -77,7 +77,7 @@ class OrderedDict(dict, MutableMapping):
yield
curr
[
KEY
]
yield
curr
[
KEY
]
curr
=
curr
[
NEXT
]
curr
=
curr
[
NEXT
]
def
__reversed__
(
self
,
*
,
PREV
=
0
,
KEY
=
2
):
def
__reversed__
(
self
,
PREV
=
0
,
KEY
=
2
):
'od.__reversed__() <==> reversed(od)'
'od.__reversed__() <==> reversed(od)'
# Traverse the linked list in reverse order.
# Traverse the linked list in reverse order.
root
=
self
.
__root
root
=
self
.
__root
...
@@ -108,7 +108,7 @@ class OrderedDict(dict, MutableMapping):
...
@@ -108,7 +108,7 @@ class OrderedDict(dict, MutableMapping):
pass
pass
dict
.
clear
(
self
)
dict
.
clear
(
self
)
def
popitem
(
self
,
last
=
True
,
*
,
PREV
=
0
,
NEXT
=
1
,
KEY
=
2
,
dict_pop
=
dict
.
pop
):
def
popitem
(
self
,
last
=
True
,
PREV
=
0
,
NEXT
=
1
,
KEY
=
2
,
dict_pop
=
dict
.
pop
):
'''od.popitem() -> (k, v), return and remove a (key, value) pair.
'''od.popitem() -> (k, v), return and remove a (key, value) pair.
Pairs are returned in LIFO order if last is true or FIFO order if false.
Pairs are returned in LIFO order if last is true or FIFO order if false.
...
@@ -173,7 +173,7 @@ class OrderedDict(dict, MutableMapping):
...
@@ -173,7 +173,7 @@ class OrderedDict(dict, MutableMapping):
def
__del__
(
self
):
def
__del__
(
self
):
self
.
clear
()
# eliminate cyclical references
self
.
clear
()
# eliminate cyclical references
def
move_to_end
(
self
,
key
,
last
=
True
,
*
,
PREV
=
0
,
NEXT
=
1
):
def
move_to_end
(
self
,
key
,
last
=
True
,
PREV
=
0
,
NEXT
=
1
):
'''Move an existing element to the end (or beginning if last==False).
'''Move an existing element to the end (or beginning if last==False).
Raises KeyError if the element does not exist.
Raises KeyError if the element does not exist.
...
...
Lib/functools.py
Dosyayı görüntüle @
bd88802c
...
@@ -123,8 +123,8 @@ def lru_cache(maxsize=100):
...
@@ -123,8 +123,8 @@ def lru_cache(maxsize=100):
http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
"""
"""
def
decorating_function
(
user_function
,
def
decorating_function
(
user_function
,
tuple
=
tuple
,
sorted
=
sorted
,
*
,
tuple
=
tuple
,
sorted
=
sorted
,
len
=
len
,
KeyError
=
KeyError
):
len
=
len
,
KeyError
=
KeyError
):
cache
=
OrderedDict
()
# ordered least recent to most recent
cache
=
OrderedDict
()
# ordered least recent to most recent
cache_popitem
=
cache
.
popitem
cache_popitem
=
cache
.
popitem
cache_renew
=
cache
.
move_to_end
cache_renew
=
cache
.
move_to_end
...
...
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