<s> import IECore <EOL> import Gaffer <EOL> class ParameterPath ( Gaffer . Path ) : <EOL> def __init__ ( self , rootParameter , path , root = "<STR_LIT:/>" , filter = None , forcedLeafTypes = ( ) ) : <EOL> Gaffer . Path . __init__ ( self , path , root , filter = filter ) <EOL> assert ( isinstance ( rootParameter , IECore . Parameter ) ) <EOL> self . __forcedLeafTypes = forcedLeafTypes <EOL> self . __rootParameter = rootParameter <EOL> def isValid ( self ) : <EOL> try : <EOL> self . __parameter ( ) <EOL> return True <EOL> except : <EOL> return False <EOL> def isLeaf ( self ) : <EOL> try : <EOL> p = self . __parameter ( ) <EOL> except : <EOL> return False <EOL> return isinstance ( p , self . __forcedLeafTypes ) or not isinstance ( p , IECore . CompoundParameter ) <EOL> def propertyNames ( self ) : <EOL> return Gaffer . Path . propertyNames ( self ) + [ "<STR_LIT>" ] <EOL> def property ( self , name ) : <EOL> if name == "<STR_LIT>" : <EOL> with IECore . IgnoredExceptions ( ) : <EOL> return self . __parameter ( ) <EOL> return None <EOL> return Gaffer . Path . property ( self , name ) <EOL> def copy ( self ) : <EOL> return ParameterPath ( self . __rootParameter , self [ : ] , self . root ( ) , self . getFilter ( ) , self . __forcedLeafTypes ) <EOL> def _children ( self ) : <EOL> try : <EOL> p = self . __parameter ( ) <EOL> except : <EOL> return [ ] <EOL> if isinstance ( p , IECore . CompoundParameter ) and not isinstance ( p , self . __forcedLeafTypes ) : <EOL> return [ ParameterPath ( self . __rootParameter , self [ : ] + [ x ] , self . root ( ) , self . getFilter ( ) , forcedLeafTypes = self . __forcedLeafTypes ) for x in p . keys ( ) ] <EOL> return [ ] <EOL> def __parameter ( self ) : <EOL> result = self . __rootParameter <EOL> for p in self : <EOL> result = result [ p ] <EOL> return result <EOL> IECore . registerRunTimeTyped ( ParameterPath , typeName = "<STR_LIT>" ) </s>
