def defaultExpression( self, plug ) :

		# If there's no parent scope, we can't make an expression.
		parentNode = plug.node().ancestor( Gaffer.Node )
		if parentNode is None :
			return ""

		# If we can't extract a value, we can't make an expression.
		if not hasattr( plug, "getValue" ) :
			return ""

		# If we can't store the value in an ObjectVector, we can't
		# return the value in execute().
		value = plug.getValue()
		objectVector = IECore.ObjectVector()
		try :
			objectVector.append( value )
		except :
			return ""

		# If we can't extract the appropriate value for every leaf
		# plug, we can't apply the value after execution.

		def canExtractValue( plug, topLevelPlug, value ) :

			if not len( plug ) :
				# no children - must be able to extract
				# a value for use in apply.
				return _extractPlugValue( plug, topLevelPlug, value ) is not None
			else :
				# compound plug - check all children.
				for child in plug.children() :
					if not canExtractValue( child, topLevelPlug, value ) :
						return False

				return True

		if not canExtractValue( plug, plug, objectVector[0] ) :
			return ""

		# Looks like we can support this plug, so make and return
		# a suitable expression.

		result = ""

		modulePath = Gaffer.Serialisation.modulePath( value )
		if modulePath not in ( "IECore", "" ) :
			result += "import " + modulePath + "\n\n"

		result += "parent[\""
		result += plug.relativeName( parentNode ).replace( ".", "\"][\"" )
		result += "\"] = "

		result += repr( value )

		return result
dataset/ETHPy150Open ImageEngine/gaffer/python/Gaffer/PythonExpressionEngine.py/PythonExpressionEngine.defaultExpression/original