Changeset - 0dd05e9d4ae7
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-24 06:43:07
drewp@bigasterisk.com
ran into this line- maybe it is not NotImplemented after all?
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/effect/settings.py
Show inline comments
 
@@ -75,49 +75,49 @@ class _Settings:
 
        # self._compiled may not be final yet- see _fromCompiled
 
        self._delZeros()
 

	
 
    @classmethod
 
    def _fromCompiled(cls, graph: GraphType, compiled: Dict[EntityType, Dict[AttrType, VTUnion]]):
 
        obj = cls(graph, [])
 
        obj._compiled = compiled
 
        obj._delZeros()
 
        return obj
 

	
 
    @classmethod
 
    def fromList(cls, graph: GraphType, others: List[_Settings]):
 
        """note that others may have multiple values for an attr"""
 
        self = cls(graph, [])
 
        for s in others:
 
            # if not isinstance(s, cls):
 
            #     raise TypeError(s)
 
            for row in s.asList():  # could work straight from s._compiled
 
                if row[0] is None:
 
                    raise TypeError('bad row %r' % (row,))
 
                dev, devAttr, value = row
 
                devDict = self._compiled.setdefault(dev, {})
 
                if devAttr in devDict:
 
                    existingVal: VTUnion = devDict[devAttr]
 
                    raise NotImplementedError('fixme: dev is to be a deviceclass (but it is currently unused)')
 
                    # raise NotImplementedError('fixme: dev is to be a deviceclass (but it is currently unused)')
 
                    value = resolve(dev, devAttr, [existingVal, value])
 
                devDict[devAttr] = value
 
        self._delZeros()
 
        return self
 

	
 
    @classmethod
 
    def _mult(cls, weight, row, dd) -> VTUnion:
 
        if isinstance(row[2], str):
 
            prev = parseHexNorm(dd.get(row[1], '#000000'))
 
            return toHex(prev + weight * numpy.array(parseHexNorm(row[2])))
 
        else:
 
            return dd.get(row[1], 0) + weight * row[2]
 

	
 
    @classmethod
 
    def fromBlend(cls, graph: GraphType, others: List[Tuple[float, _Settings]]):
 
        """others is a list of (weight, Settings) pairs"""
 
        out = cls(graph, [])
 
        for weight, s in others:
 
            if not isinstance(s, cls):
 
                raise TypeError(s)
 
            for row in s.asList():  # could work straight from s._compiled
 
                if row[0] is None:
 
                    raise TypeError('bad row %r' % (row,))
 
                dd = out._compiled.setdefault(row[0], {})
0 comments (0 inline, 0 general)