/usr/lib/python2.7/dist-packages/canmatrix/cancluster.py is in python-canmatrix 0.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | class canCluster(dict):
def __init__(self, *arg, **kw):
super(canCluster, self).__init__(*arg, **kw)
self.update()
def updateFrames(self):
frameArray = []
frameArrayName = []
for matrixName in self:
for frame in self[matrixName].frames:
if frame._name not in frameArrayName:
frameArrayName.append(frame._name)
frameArray.append(frame)
else:
index = frameArrayName.index(frame._name)
for transmitter in frame.transmitter:
frameArray[index].addTransmitter(transmitter)
for receiver in frame.receiver:
frameArray[index].addReceiver(receiver)
self._frames = frameArray
return frameArray
def updateSignals(self):
signalArray = []
signalArrayName = []
for matrixName in self:
for frame in self[matrixName].frames:
for signal in frame.signals:
if signal._name not in signalArrayName:
signalArrayName.append(signal._name)
signalArray.append(signal)
else:
index = signalArrayName.index(signal._name)
for receiver in signal.receiver:
signalArray[index].addReceiver(receiver)
self._signals = signalArray
def updateECUs(self):
ECUArray = []
ECUArrayName = []
for matrixName in self:
for ecu in self[matrixName].boardUnits:
if ecu._name not in ECUArrayName:
ECUArrayName.append(ecu._name)
ECUArray.append(ecu)
self._ecus = ECUArray
def update(self):
self.updateFrames()
self.updateSignals()
self.updateECUs()
@property
def ecus(self):
if not self._ecus:
self.updateECUs()
return self._ecus
@property
def boardUnits(self):
return self.ecus
@property
def frames(self):
if not self._frames:
self.updateFrames()
return self._frames
@property
def signals(self):
if not self._signals:
self.updateSignals()
return self._signals
|