def _add_helpingmaterials(config, helping_file, helping_type):
try:<EOL><INDENT>project = find_project_by_short_name(config.project['<STR_LIT>'],<EOL>config.pbclient,<EOL>config.all)<EOL>data = _load_data(helping_file, helping_type)<EOL>if len(data) == <NUM_LIT:0>:<EOL><INDENT>return ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>with click.progressbar(data, label="<STR_LIT>") as pgbar:<EOL><INDENT>for d in pgbar:<EOL><INDENT>helping_info, file_path = create_helping_material_info(d)<EOL>if file_path:<EOL><INDENT>hm = config.pbclient.create_helpingmaterial(project_id=project.id,<EOL>info=helping_info,<EOL>file_path=file_path)<EOL>check_api_error(hm)<EOL>z = hm.info.copy()<EOL>z.update(helping_info)<EOL>hm.info = z<EOL>response = config.pbclient.update_helping_material(hm)<EOL>check_api_error(response)<EOL><DEDENT>else:<EOL><INDENT>response = config.pbclient.create_helpingmaterial(project_id=project.id,<EOL>info=helping_info)<EOL><DEDENT>check_api_error(response)<EOL>sleep, msg = enable_auto_throttling(config, data,<EOL>endpoint='<STR_LIT>')<EOL>if sleep:  <EOL><INDENT>click.secho(msg, fg='<STR_LIT>')<EOL><DEDENT>if sleep:  <EOL><INDENT>time.sleep(sleep)<EOL><DEDENT><DEDENT>return ("<STR_LIT>" % (len(data),<EOL>config.project['<STR_LIT>']))<EOL><DEDENT><DEDENT>except exceptions.ConnectionError:<EOL><INDENT>return ("<STR_LIT>" % config.server)<EOL><DEDENT>except (ProjectNotFound, TaskNotFound):<EOL><INDENT>raise<EOL><DEDENT>
Add helping materials to a project.