The example is correct, but in the first sentence pyb.cpu.Name must be pyb.Pin.cpu.NameCPU pins which correspond to the board pins are available as pyb.cpu.Name.
For the CPU pins, the names are the port letter followed by the pin number.
On the PYBv1.0, pyb.Pin.board.X1 and pyb.Pin.cpu.A0 are the same pin.
Otherwise you get an AttributeError: 'module' object has no attribute 'cpu'
Link: http://docs.micropython.org/en/latest/l ... .Pin.html
At first I was not looking at the example, of course - DOH