def _get_block_types_from_json_file(xblock_json_file):
 if (not os.path.isfile(xblock_json_file)):
  print ('xBlock configuration file does not exist: %s' % xblock_json_file)
  sys.exit(2)
 with open(xblock_json_file, 'r') as json_file:
  type_set = set()
  try:
   json_data = json.loads(json_file.read())
  except ValueError as e:
   print ('xBlock configuration file does not match the expected layout and is missing "data" list: %s' % xblock_json_file)
   sys.exit(e.message)
  if ('data' in json_data):
   xblock_type_list = json_data['data']
   for xblock in xblock_type_list:
    type_set.add(xblock['name'])
   return type_set
  else:
   print ('xBlock configuration file does not match the expected layout and is missing "data" list: %s' % xblock_json_file)
   sys.exit(2)

def _get_block_types_from_json_file ( xblock_json_file ) : if ( not os . path . isfile ( xblock_json_file ) ) : print ( 'xBlock configuration file does not exist: %s' % xblock_json_file ) sys . exit ( 2 ) with open ( xblock_json_file , 'r' ) as json_file : type_set = set ( ) try : json_data = json . loads ( json_file . read ( ) ) except ValueError as e : print ( 'xBlock configuration file does not match the expected layout and is missing "data" list: %s' % xblock_json_file ) sys . exit ( e . message ) if ( 'data' in json_data ) : xblock_type_list = json_data [ 'data' ] for xblock in xblock_type_list : type_set . add ( xblock [ 'name' ] ) return type_set else : print ( 'xBlock configuration file does not match the expected layout and is missing "data" list: %s' % xblock_json_file ) sys . exit ( 2 )
retrieves the block types from the provided xblock configuration json file arguments: xblock_json_file : the name of the xblock configuration file :return: set: a set of strings for all the types that are available in the configuration file .