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

Always check if a cache entry is None before slicing it #127

Merged
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
14 changes: 10 additions & 4 deletions speasy/core/cache/_providers_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ def wrapped(wrapped_self, product, start_time, stop_time, **kwargs):
if len(data_chunks):
if len(data_chunks) == 1:
return data_chunks[0][dt_range.start_time:dt_range.stop_time].copy()
data_chunks[0] = data_chunks[0][dt_range.start_time:]
data_chunks[-1] = data_chunks[-1][:dt_range.stop_time]
if data_chunks[0] is not None:
data_chunks[0] = data_chunks[0][dt_range.start_time:]
if data_chunks[-1] is not None:
data_chunks[-1] = data_chunks[-1][:dt_range.stop_time]
return merge_variables(data_chunks)[dt_range.start_time:dt_range.stop_time]
return None

Expand Down Expand Up @@ -273,8 +275,12 @@ def wrapped(wrapped_self, product, start_time, stop_time, **kwargs):

if len(data_chunks):
if len(data_chunks) == 1:
return data_chunks[0][dt_range.start_time:dt_range.stop_time].copy()
data_chunks[0] = data_chunks[0][dt_range.start_time:]
if data_chunks[0] is not None:
return data_chunks[0][dt_range.start_time:dt_range.stop_time].copy()
else:
return None
if data_chunks[0] is not None:
data_chunks[0] = data_chunks[0][dt_range.start_time:]
if data_chunks[-1] is not None:
data_chunks[-1] = data_chunks[-1][:dt_range.stop_time]
return merge_variables(data_chunks)[dt_range.start_time:dt_range.stop_time]
Expand Down
Loading