Author: Armin Rigo <[email protected]>
Branch: dict-move-to-end
Changeset: r89932:6670eee6f62f
Date: 2017-02-05 08:10 +0100
http://bitbucket.org/pypy/pypy/changeset/6670eee6f62f/
Log: rename beginning/really_end => first/last
diff --git a/rpython/rtyper/lltypesystem/rordereddict.py
b/rpython/rtyper/lltypesystem/rordereddict.py
--- a/rpython/rtyper/lltypesystem/rordereddict.py
+++ b/rpython/rtyper/lltypesystem/rordereddict.py
@@ -1421,11 +1421,11 @@
def ll_dict_move_to_end(d, key, last):
if last:
- ll_dict_move_to_end_really(d, key)
+ ll_dict_move_to_last(d, key)
else:
- ll_dict_move_to_beginning(d, key)
+ ll_dict_move_to_first(d, key)
-def ll_dict_move_to_end_really(d, key):
+def ll_dict_move_to_last(d, key):
hash = d.keyhash(key)
old_index = d.lookup_function(d, key, hash, FLAG_LOOKUP)
if old_index < 0:
@@ -1449,7 +1449,7 @@
replace_with = VALID_OFFSET + d.num_ever_used_items)
_ll_dict_setitem_lookup_done(d, key, value, hash, -1)
-def ll_dict_move_to_beginning(d, key):
+def ll_dict_move_to_first(d, key):
# In this function, we might do a bit more than the strict minimum
# of walks over parts of the array, trying to keep the code at least
# semi-reasonable, while the goal is still amortized constant-time
@@ -1506,19 +1506,19 @@
# remove the entry at the old position
ll_assert(d.entries.valid(old_index),
- "ll_dict_move_to_beginning: lost old_index")
+ "ll_dict_move_to_first: lost old_index")
ENTRY = lltype.typeOf(d.entries).TO.OF
old_entry = d.entries[old_index]
key = old_entry.key
value = old_entry.value
if hasattr(ENTRY, 'f_hash'):
ll_assert(old_entry.f_hash == hash,
- "ll_dict_move_to_beginning: bad hash")
+ "ll_dict_move_to_first: bad hash")
_ll_dict_del_entry(d, old_index)
# put the entry at its new position
ll_assert(not d.entries.valid(idst),
- "ll_dict_move_to_beginning: overwriting idst")
+ "ll_dict_move_to_first: overwriting idst")
new_entry = d.entries[idst]
new_entry.key = key
new_entry.value = value
diff --git a/rpython/rtyper/test/test_rdict.py
b/rpython/rtyper/test/test_rdict.py
--- a/rpython/rtyper/test/test_rdict.py
+++ b/rpython/rtyper/test/test_rdict.py
@@ -1191,7 +1191,7 @@
def move_to_end(self, key, last=True):
"For test_rordereddict"
- def move_to_beginning(self, key):
+ def move_to_first(self, key):
self.move_to_end(key, last=False)
def copydict(self):
@@ -1260,9 +1260,9 @@
return builds(Action,
just('move_to_end'), tuples(sampled_from(self.space.reference)))
- def st_move_to_beginning(self):
+ def st_move_to_first(self):
return builds(Action,
- just('move_to_beginning'),
+ just('move_to_first'),
tuples(sampled_from(self.space.reference)))
def steps(self):
@@ -1274,7 +1274,7 @@
return (
self.st_setitem() | sampled_from(global_actions) |
self.st_updateitem() | self.st_delitem() |
- self.st_move_to_end() | self.st_move_to_beginning())
+ self.st_move_to_end() | self.st_move_to_first())
else:
return (self.st_setitem() | sampled_from(global_actions))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit