def cut_from_dict(desc, cube=None):
 cut_type = desc['type'].lower()
 dim = desc.get('dimension')
 if (dim and cube):
  dim = cube.dimension(dim)
 if (cut_type == 'point'):
  return PointCut(dim, desc.get('path'), desc.get('hierarchy'), desc.get('invert', False))
 elif (cut_type == 'set'):
  return SetCut(dim, desc.get('paths'), desc.get('hierarchy'), desc.get('invert', False))
 elif (cut_type == 'range'):
  return RangeCut(dim, desc.get('from'), desc.get('to'), desc.get('hierarchy'), desc.get('invert', False))
 else:
  raise ArgumentError(('Unknown cut type %s' % cut_type))

def cut_from_dict ( desc , cube = None ) : cut_type = desc [ 'type' ] . lower ( ) dim = desc . get ( 'dimension' ) if ( dim and cube ) : dim = cube . dimension ( dim ) if ( cut_type == 'point' ) : return PointCut ( dim , desc . get ( 'path' ) , desc . get ( 'hierarchy' ) , desc . get ( 'invert' , False ) ) elif ( cut_type == 'set' ) : return SetCut ( dim , desc . get ( 'paths' ) , desc . get ( 'hierarchy' ) , desc . get ( 'invert' , False ) ) elif ( cut_type == 'range' ) : return RangeCut ( dim , desc . get ( 'from' ) , desc . get ( 'to' ) , desc . get ( 'hierarchy' ) , desc . get ( 'invert' , False ) ) else : raise ArgumentError ( ( 'Unknown cut type %s' % cut_type ) )
returns a cut from desc dictionary .