def _check_valid_cube(cube):
'''Checks if cube is one of str, NaiveCube or Cubie.Cube and returns
an instance of Cubie.Cube'''
if isinstance(cube, basestring):
c = NaiveCube()
c.set_cube(cube)
cube = c
if isinstance(cube, NaiveCube):
c = Cube()
c.from_naive_cube(cube)
cube = c
if not isinstance(cube, Cube):
raise ValueError('Cube is not one of (str, NaiveCube or Cubie.Cube)')
return cube
评论列表
文章目录