Skip to content

Commit

Permalink
All tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
mlenzen committed Mar 26, 2016
1 parent 3400461 commit 3d29e99
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions collections_extended/range_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,15 @@ def set(self, value, start=None, stop=None):
stop_index = len(self._ordered_keys)
else:
stop_index = bisect_left(self._ordered_keys, stop)
if stop_index != len(self._ordered_keys) and self._ordered_keys[stop_index] == stop:
new_keys = [start]
if self._key_mapping[self._ordered_keys[stop_index]] == self._key_mapping[self._ordered_keys[start_index]]:
stop_index += 1
else:
new_keys = [start, stop]
new_keys = [start, stop]
self._key_mapping[stop] = self.__getitem(stop)
if stop_index != len(self._ordered_keys):
next_key = self._ordered_keys[stop_index]
if next_key == stop:
new_keys = [start]
next_value = self._key_mapping[next_key]
if next_value == value:
stop_index += 1
for key in self._ordered_keys[start_index:stop_index]:
del self._key_mapping[key]
self._ordered_keys[start_index:stop_index] = new_keys
Expand Down

1 comment on commit 3d29e99

@mlenzen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix #43

Please sign in to comment.