def generate_model(root_class=ROOT_CLASS):
 classes_result = {}
 result = {u'root': fqpn(root_class), u'classes': classes_result}
 classes = {root_class}
 while classes:
  klass = classes.pop()
  klass_name = fqpn(klass)
  if (klass_name in classes_result):
   continue
  if issubclass(klass, (PRecord, PClass)):
   to_model = _precord_model
  elif issubclass(klass, CheckedPMap):
   to_model = _pmap_model
  elif issubclass(klass, (CheckedPSet, CheckedPVector)):
   to_model = _psequence_model
  else:
   to_model = _default_model
  (record, further_classes) = to_model(klass)
  classes_result[klass_name] = record
  classes |= further_classes
 return result

def generate_model ( root_class = ROOT_CLASS ) : classes_result = { } result = { u'root' : fqpn ( root_class ) , u'classes' : classes_result } classes = { root_class } while classes : klass = classes . pop ( ) klass_name = fqpn ( klass ) if ( klass_name in classes_result ) : continue if issubclass ( klass , ( PRecord , PClass ) ) : to_model = _precord_model elif issubclass ( klass , CheckedPMap ) : to_model = _pmap_model elif issubclass ( klass , ( CheckedPSet , CheckedPVector ) ) : to_model = _psequence_model else : to_model = _default_model ( record , further_classes ) = to_model ( klass ) classes_result [ klass_name ] = record classes |= further_classes return result
generate a data-structure that represents the current configuration model .