Converter¶
HEPData Converter. |
|
HEPData Converter Tasks. |
|
HEPData Converter Views. |
hepdata.modules.converter¶
HEPData Converter.
- hepdata.modules.converter.convert_zip_archive(input_archive, output_archive, options)[source]¶
Convert a zip archive into a targz path with given options.
- Parameters:
input_archive –
output_archive –
options –
- Returns:
output_file
hepdata.modules.converter.tasks¶
HEPData Converter Tasks.
hepdata.modules.converter.views¶
HEPData Converter Views.
- hepdata.modules.converter.views.download_submission_with_inspire_id(*args, **kwargs)[source]¶
Gets the submission file and either serves it back directly from YAML, or converts it for other formats. Routes:
/submission/<inspire_id>/<file_format>
/submission/<inspire_id>/<int:version>/<file_format>
/submission/<inspire_id>/<int:version>/<file_format>/<rivet>
- Parameters:
inspire_id – inspire id
version – version of submission to export. If absent, returns the latest.
file_format – json, yaml, csv, root, yoda, yoda1 or original
rivet – Rivet analysis name to override default written in YODA export
- Returns:
download_submission
- hepdata.modules.converter.views.download_submission_with_recid(*args, **kwargs)[source]¶
Gets the submission file and either serves it back directly from YAML, or converts it for other formats. Routes:
/submission/<int:recid>/<file_format>
/submission/<int:recid>/<int:version>/<file_format>
/submission/<int:recid>/<int:version>/<file_format>/<rivet>
- Parameters:
recid – submissions recid
version – version of submission to export. If absent, returns the latest.
file_format – json, yaml, csv, root, yoda, yoda1 or original
rivet – Rivet analysis name to override default written in YODA export
- Returns:
download_submission
- hepdata.modules.converter.views.download_submission(submission, file_format, offline=False, force=False, rivet_analysis_name='')[source]¶
Gets the submission file and either serves it back directly from YAML, or converts it for other formats.
- Parameters:
submission – HEPSubmission
file_format – json, yaml, csv, root, yoda, yoda1 or original
offline – offline creation of the conversion when a record is finalised
force – force recreation of the conversion
rivet_analysis_name – Rivet analysis name to override default written in YODA export
- Returns:
display_error or send_file depending on success of conversion
- hepdata.modules.converter.views.download_data_table_by_inspire_id(*args, **kwargs)[source]¶
Downloads the latest data file given the url
/download/submission/ins1283842/Table 1/yaml
or by a particular version given/download/submission/ins1283842/Table 1/1/yaml
. Routes:/table/<inspire_id>/<path:table_name>/<file_format>
/table/<inspire_id>/<path:table_name>/<int:version>/<file_format>
/table/<inspire_id>/<path:table_name>/<int:version>/<file_format>/<rivet>
- Parameters:
args –
kwargs – inspire_id, table_name, version (optional), and file_format
- Returns:
display_error or download_datatable depending on success of conversion
- hepdata.modules.converter.views.download_data_table_by_recid(*args, **kwargs)[source]¶
Record ID download. Downloads the latest data file given the url
/download/submission/1231/Table 1/yaml
or by a particular version given/download/submission/1231/Table 1/1/yaml
. Routes:/table/<int:recid>/<path:table_name>/<file_format>
/table/<int:recid>/<path:table_name>/<int:version>/<file_format>
/table/<int:recid>/<path:table_name>/<int:version>/<file_format>/<rivet>
- Parameters:
args –
kwargs – inspire_id, table_name, version (optional), and file_format
- Returns:
display_error or download_datatable depending on success of conversion
- hepdata.modules.converter.views.download_datatable_by_dataid(data_id, file_format)[source]¶
Download a particular data table in a given format.
- Parameters:
data_id –
file_format –
- Returns:
download_datatable
- hepdata.modules.converter.views.download_datatable(datasubmission, file_format, *args, **kwargs)[source]¶
Download a particular data table given a
datasubmission
.- Parameters:
datasubmission –
file_format –
args –
kwargs –
- Returns:
display_error or send_file depending on success of conversion
- hepdata.modules.converter.views.display_error(title='Unknown Error', description='')[source]¶
Return an HTML page containing a description of the conversion error.
- Parameters:
title –
description –
- Returns:
render_template
- hepdata.modules.converter.views.create_original_with_resources(submission, data_filepath, output_path)[source]¶
Copy or create ‘original’ zip file, i.e. yaml files with resources. If resources were imported from hepdata.cedar.ac.uk we create a new zip in a format that could be re-uploaded as a submission.