From 63a8f43735821eedd536ed586d3ea7b6d10d98a2 Mon Sep 17 00:00:00 2001 From: Sinisa Veseli Date: Wed, 29 Mar 2023 16:24:19 -0500 Subject: [PATCH 1/2] ensure frames array is scriptable --- pvapy/cli/adSimServer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvapy/cli/adSimServer.py b/pvapy/cli/adSimServer.py index d89a683..01f381e 100755 --- a/pvapy/cli/adSimServer.py +++ b/pvapy/cli/adSimServer.py @@ -35,7 +35,7 @@ class FrameGenerator: ''' Base frame generator class. ''' def __init__(self): - self.frames = None + self.frames = [] self.nInputFrames = 0 self.rows = 0 self.cols = 0 @@ -48,7 +48,7 @@ def getFrameData(self, frameId): return None def getFrameInfo(self): - if self.frames is not None and not self.nInputFrames: + if self.frames and not self.nInputFrames: self.nInputFrames, self.rows, self.cols = self.frames.shape self.dtype = self.frames.dtype return (self.nInputFrames, self.rows, self.cols, self.dtype, self.compressorName) From b00f4c697874592d30a78ad268a2dd05eccff08c Mon Sep 17 00:00:00 2001 From: Sinisa Veseli Date: Wed, 29 Mar 2023 16:33:50 -0500 Subject: [PATCH 2/2] fix lint error --- pvapy/cli/adSimServer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvapy/cli/adSimServer.py b/pvapy/cli/adSimServer.py index 01f381e..0c48006 100755 --- a/pvapy/cli/adSimServer.py +++ b/pvapy/cli/adSimServer.py @@ -35,7 +35,7 @@ class FrameGenerator: ''' Base frame generator class. ''' def __init__(self): - self.frames = [] + self.frames = np.array([]) self.nInputFrames = 0 self.rows = 0 self.cols = 0 @@ -48,7 +48,7 @@ def getFrameData(self, frameId): return None def getFrameInfo(self): - if self.frames and not self.nInputFrames: + if len(self.frames) > 0 and not self.nInputFrames: self.nInputFrames, self.rows, self.cols = self.frames.shape self.dtype = self.frames.dtype return (self.nInputFrames, self.rows, self.cols, self.dtype, self.compressorName)