def read_model_metadata(source):
 if isinstance(source, compat.string_type):
  parts = compat.urlparse(source)
  if ((parts.scheme in ('', 'file')) and os.path.isdir(parts.path)):
   source = parts.path
   return read_model_metadata_bundle(source)
  elif ((len(parts.scheme) == 1) and os.path.isdir(source)):
   return read_model_metadata_bundle(source)
  else:
   return _json_from_url(source)
 else:
  return json.load(source)

def read_model_metadata ( source ) : if isinstance ( source , compat . string_type ) : parts = compat . urlparse ( source ) if ( ( parts . scheme in ( '' , 'file' ) ) and os . path . isdir ( parts . path ) ) : source = parts . path return read_model_metadata_bundle ( source ) elif ( ( len ( parts . scheme ) == 1 ) and os . path . isdir ( source ) ) : return read_model_metadata_bundle ( source ) else : return _json_from_url ( source ) else : return json . load ( source )
reads a model description from source which can be a filename .