The example (and even the user manual ) contradicts the documentation for bokeh.plotting.figure()which explicitly says that it returns None, which explains the error you are observing.
Using line()directly, therefore, seems like a way.
bokeh 0,7: 0.7, . , figure().line() bokeh 0.7+. figure(), -, .