From aa31a4e192d1f2bae250e4dd8fa97b460bc5c071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Tue, 24 Oct 2017 13:12:17 +0200 Subject: [PATCH] empty_array --- src/c3nav/mapdata/cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/c3nav/mapdata/cache.py b/src/c3nav/mapdata/cache.py index c5b6de1e..11a5295b 100644 --- a/src/c3nav/mapdata/cache.py +++ b/src/c3nav/mapdata/cache.py @@ -26,8 +26,9 @@ class MapHistory: # 4 bytes (uint32): timestamp # width*height*2 bytes: # data array (line after line) with uint16 cells + empty_array = np.empty((0, 0), dtype=np.uint16) - def __init__(self, resolution=settings.CACHE_RESOLUTION, x=0, y=0, updates=None, data=np.empty((0, 0))): + def __init__(self, resolution=settings.CACHE_RESOLUTION, x=0, y=0, updates=None, data=empty_array): self.resolution = resolution self.x = x self.y = y @@ -112,7 +113,7 @@ class MapHistory: # remove borders rows = self.data.any(axis=1).nonzero()[0] if not rows.size: - self.data = np.empty((0, 0)) + self.data = self.empty_array self.x = 0 self.y = 0 return