<s> """<STR_LIT>""" <EOL> from kraken . core . objects . scene_item import SceneItem <EOL> class Operator ( SceneItem ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , parent = None ) : <EOL> super ( Operator , self ) . __init__ ( name , parent ) <EOL> self . inputs = { } <EOL> self . outputs = { } <EOL> def resizeInput ( self , name , count ) : <EOL> """<STR_LIT>""" <EOL> if name not in self . inputs : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT>" + self . getName ( ) + "<STR_LIT:.>" ) <EOL> if isinstance ( self . inputs [ name ] , list ) : <EOL> self . inputs . resize ( count ) <EOL> else : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT:.>" ) <EOL> return True <EOL> def setInput ( self , name , operatorInput , index = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if name not in self . inputs : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT>" + self . getName ( ) + "<STR_LIT>" + "<STR_LIT:\n>" . join ( self . inputs . keys ( ) ) ) <EOL> if isinstance ( self . inputs [ name ] , list ) : <EOL> if isinstance ( operatorInput , list ) : <EOL> self . inputs [ name ] = operatorInput <EOL> else : <EOL> if index >= len ( self . inputs [ name ] ) : <EOL> raise Exception ( "<STR_LIT>" + str ( index ) + "<STR_LIT>" + str ( len ( self . inputs [ name ] ) ) + "<STR_LIT:.>" ) <EOL> self . inputs [ name ] [ index ] = operatorInput <EOL> else : <EOL> self . inputs [ name ] = operatorInput <EOL> return True <EOL> def getInput ( self , name ) : <EOL> """<STR_LIT>""" <EOL> if name not in self . inputs : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT>" + self . getName ( ) + "<STR_LIT:.>" ) <EOL> return self . inputs [ name ] <EOL> def getInputNames ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . inputs . keys ( ) <EOL> def resizeOutput ( self , name , count ) : <EOL> """<STR_LIT>""" <EOL> if name not in self . outputs : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT>" + self . getName ( ) + "<STR_LIT:.>" ) <EOL> if isinstance ( self . outputs [ name ] , list ) : <EOL> self . outputs . resize ( count ) <EOL> else : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT:.>" ) <EOL> return True <EOL> def setOutput ( self , name , operatorOutput , index = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if name not in self . outputs : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT>" + self . getName ( ) + "<STR_LIT:.>" ) <EOL> if isinstance ( self . outputs [ name ] , list ) : <EOL> if isinstance ( operatorOutput , list ) : <EOL> self . outputs [ name ] = operatorOutput <EOL> else : <EOL> if index >= len ( self . outputs [ name ] ) : <EOL> raise Exception ( "<STR_LIT>" + str ( index ) + "<STR_LIT>" + str ( len ( self . outputs [ name ] ) ) + "<STR_LIT:.>" ) <EOL> self . outputs [ name ] [ index ] = operatorOutput <EOL> else : <EOL> self . outputs [ name ] = operatorOutput <EOL> return True <EOL> def getOutput ( self , name ) : <EOL> """<STR_LIT>""" <EOL> if name not in self . outputs . keys ( ) : <EOL> raise Exception ( "<STR_LIT>" + name + "<STR_LIT>" + self . getName ( ) + "<STR_LIT:.>" ) <EOL> return self . outputs [ name ] <EOL> def getOutputNames ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . outputs . keys ( ) </s>
