Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tuples for bisect calls #67

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rqt_bag/src/rqt_bag/timeline_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_item(self, topic, stamp, time_threshold):
# Attempt to get a item from the cache that's within time_threshold secs from stamp
topic_cache = self.items.get(topic)
if topic_cache:
cache_index = max(0, bisect.bisect_right(topic_cache, (stamp, None)) - 1)
cache_index = max(0, bisect.bisect_right(topic_cache, (stamp, )) - 1)

if cache_index <= len(topic_cache) - 1:
# Get cache entry before (or at) timestamp, and entry after
Expand Down Expand Up @@ -153,7 +153,7 @@ def _update_last_accessed(self, topic, stamp):
if stamp in topic_item_access:
last_access = topic_item_access[stamp]

index = bisect.bisect_left(topic_last_accessed, (last_access, None))
index = bisect.bisect_left(topic_last_accessed, (last_access, ))
assert(topic_last_accessed[index][1] == stamp)

del topic_last_accessed[index]
Expand All @@ -170,7 +170,7 @@ def _limit_cache(self):
while len(topic_cache) > self.max_cache_size:
lru_stamp = self.last_accessed[topic][0][1]

cache_index = bisect.bisect_left(topic_cache, (lru_stamp, None))
cache_index = bisect.bisect_left(topic_cache, (lru_stamp, ))
assert(topic_cache[cache_index][0] == lru_stamp)

del topic_cache[cache_index]
Expand Down