Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _trim_channel_chunk(chunk, skip=0, trim=0):
if skip == 0 and trim == 0:
return chunk
data = None
scaler_data = None
if chunk.data is not None:
data = chunk.data[skip:len(chunk.data) - trim]
if chunk.scaler_data is not None:
scaler_data = {
scale_id: d[skip:len(d) - trim]
for (scale_id, d) in chunk.scaler_data.items()}
return RawChannelDataChunk(data, scaler_data)
def channel_data(data):
channel_chunks = {
path: RawChannelDataChunk.channel_data(d)
for (path, d) in data.items()
}
return RawDataChunk(channel_chunks)
def scaler_data(data):
channel_chunks = {
path: RawChannelDataChunk.scaler_data(d)
for (path, d) in data.items()
}
return RawDataChunk(channel_chunks)
def scaler_data(data):
return RawChannelDataChunk(None, data)
def channel_data(data):
return RawChannelDataChunk(data, None)
def empty():
return RawChannelDataChunk(None, None)