Skip to content

Commit 39b3891

Browse files
committed
api/cli: add support for legacy 'yoda1' format
* Bump version to 0.2.2.
1 parent 01acff3 commit 39b3891

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![GitHub Actions Status](https://github.com/HEPData/hepdata-cli/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/HEPData/hepdata-cli/actions?query=branch%3Amaster)
2-
[![Coveralls Status](https://coveralls.io/repos/github/HEPData/hepdata-cli/badge.svg?branch=master)](https://coveralls.io/github/HEPData/hepdata-cli?branch=master)
3-
[![License](https://img.shields.io/github/license/HEPData/hepdata-cli.svg)](https://github.com/HEPData/hepdata-cli/blob/master/LICENSE.txt)
1+
[![GitHub Actions Status](https://github.com/HEPData/hepdata-cli/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HEPData/hepdata-cli/actions?query=branch%3Amain)
2+
[![Coveralls Status](https://coveralls.io/repos/github/HEPData/hepdata-cli/badge.svg?branch=main)](https://coveralls.io/github/HEPData/hepdata-cli?branch=master)
3+
[![License](https://img.shields.io/github/license/HEPData/hepdata-cli.svg)](https://github.com/HEPData/hepdata-cli/blob/main/LICENSE.txt)
44
[![GitHub Releases](https://img.shields.io/github/release/hepdata/hepdata-cli.svg?maxAge=2592000)](https://github.com/HEPData/hepdata-cli/releases)
55
[![PyPI Version](https://img.shields.io/pypi/v/hepdata-cli)](https://pypi.org/project/hepdata-cli/)
66
[![GitHub Issues](https://img.shields.io/github/issues/hepdata/hepdata-cli.svg?maxAge=2592000)](https://github.com/HEPData/hepdata-cli/issues)
@@ -74,11 +74,11 @@ An exact match of the keyword is first attempted, otherwise partial matches are
7474

7575
The argument ```[-i/--ids IDTYPE]``` accepts ```IDTYPE``` equal to ```arxiv```, ```hepdata``` or```inspire```.
7676

77-
The argument ```[-f/--file-format FORMAT]``` accepts ```FORMAT``` equal to ```csv```, ```root```, ```yaml```, ```yoda```, or ```json```.
77+
The argument ```[-f/--file-format FORMAT]``` accepts ```FORMAT``` equal to ```csv```, ```root```, ```yaml```, ```yoda```, ```yoda1```, or ```json```.
7878
In the first four cases a .tar.gz archive is downloaded and unpacked as a directory, whereas in the last case a .json file is downloaded.
7979

8080
The argument ```[-t/--table-name TABLE-NAME]``` accepts a string giving the table name as input.
81-
In this case only the specified table is downloaded as a .csv, .root, .yaml, .yoda or .json file.
81+
In this case only the specified table is downloaded as a .csv, .root, .yaml, .yoda, .yoda1 or .json file.
8282

8383
The argument ```[-d/--download-dir DOWNLOAD-DIR]``` specifies the directory to download the files.
8484
If not specified, the default download directory is ```./hepdata-downloads```.

hepdata_cli/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def download(self, id_list, file_format=None, ids=None, table_name='', download_
8282
Downloads from the hepdata database the specified records.
8383
8484
:param id_list: list of ids to download. These can be obtained by the find function.
85-
:param file_format: accepts one of ('csv', 'root', 'yaml', 'yoda', 'json'). Specifies the download file format.
85+
:param file_format: accepts one of ('csv', 'root', 'yaml', 'yoda', 'yoda1', 'json'). Specifies the download file format.
8686
:param ids: accepts one of ('inspire', 'hepdata'). It specifies what type of ids have been passed.
8787
:param table_name: restricts download to specific tables.
8888
:param download_dir: defaults to ./hepdata-downloads. Specifies where to download the files.
@@ -139,7 +139,7 @@ def _build_urls(self, id_list, file_format, ids, table_name):
139139
if type(id_list) not in (tuple, list):
140140
id_list = id_list.split()
141141
assert len(id_list) > 0, 'Ids are required.'
142-
assert file_format in ['csv', 'root', 'yaml', 'yoda', 'json'], "allowed formats are: csv, root, yaml, yoda and json."
142+
assert file_format in ['csv', 'root', 'yaml', 'yoda', 'yoda1', 'json'], "allowed formats are: csv, root, yaml, yoda, yoda1 and json."
143143
assert ids in ['inspire', 'hepdata'], "allowed ids are: inspire and hepdata."
144144
if table_name == '':
145145
params = {'format': file_format}

hepdata_cli/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def find(client, query, keyword, ids):
2727

2828
@cli.command()
2929
@click.argument('id_list', nargs=-1, required=True, type=str)
30-
@click.option('-f', '--file-format', required=True, type=str, help='Specify file format (csv, root, yaml, yoda, or json) to be downloaded.')
30+
@click.option('-f', '--file-format', required=True, type=str, help='Specify file format (csv, root, yaml, yoda, yoda1, or json) to be downloaded.')
3131
@click.option('-i', '--ids', required=True, type=str, help='Specify which ids (hepdata or inspire) are given.')
3232
@click.option('-t', '--table-name', default='', type=str, help='Specify table to be downloaded.')
3333
@click.option('-d', '--download-dir', default='./hepdata-downloads', type=str, help='Specify where to download the files.')

hepdata_cli/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.1"
1+
__version__ = "0.2.2"

0 commit comments

Comments
 (0)