f = Piecewise([[(-infinity,1),1],[(1,+infinity),x]])

Or more generally: If h is another function. How to define $g = f\circ h$ in sage?