From c6916817e8524013b01c28103b0a56159efff64a Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Thu, 9 Jun 2016 09:14:45 +0200 Subject: [PATCH] Add 'list' option to the python script. --- src/main/resources/scripts/get_epncore_parameters.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/resources/scripts/get_epncore_parameters.py b/src/main/resources/scripts/get_epncore_parameters.py index 75565b1..542c324 100755 --- a/src/main/resources/scripts/get_epncore_parameters.py +++ b/src/main/resources/scripts/get_epncore_parameters.py @@ -7,7 +7,8 @@ from re import sub """ This script parse the Parameters table on the EpnTAPv2 VO-Paris Confluence page (voparis-confluence.obspm.fr) and print them in several ways (by setting EXPORT_TYPE): -- CSV: A simple CSV table whicj have the same content as the Confluence table; +- list: A python list; +- CSV: A simple CSV table which have the same content as the Confluence table; example: `"incidence_min";"";"incidence_min";"Double";"deg";"Min incidence angle (solar zenithal angle)";"pos.posAng;stat.min";"";"N"` - init: A Java code for parameters initalisation, in camelCase example: `public double incidenceMin;` @@ -15,7 +16,7 @@ This script parse the Parameters table on the EpnTAPv2 VO-Paris Confluence page example: `INCIDENCE_MIN("incidence_min", class.Double, false, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),` """ -EXPORT_TYPE = 'init' # 'CSV', or 'init', or 'enum'. +EXPORT_TYPE = 'list' # 'list', 'CSV', or 'init', or 'enum'. URL = 'https://voparis-confluence.obspm.fr/display/VES/EPN-TAP+V2.0+parameters' tmp_file, headers = urllib.request.urlretrieve(URL) @@ -38,6 +39,11 @@ for tr in table: continue row.append('N' if mandatory else 'Y') + if EXPORT_TYPE == 'list': + var_type = row[3].lower().replace('double', 'double precision') + print("('%s', '%s', '%s', %s, %s, '%s', '%s')," + % (row[0], var_type, row[6], 'True' if mandatory else 'False', \ + 'True' if row[1]=='Y' else 'False', row[4], row[5])) if EXPORT_TYPE == 'CSV': print('"' + '";"'.join(row) + '"') elif EXPORT_TYPE == 'init': -- libgit2 0.21.2