diff --git a/src/main/resources/scripts/get_epncore_parameters.py b/src/main/resources/scripts/get_epncore_parameters.py index f36e38d..ce5a5da 100755 --- a/src/main/resources/scripts/get_epncore_parameters.py +++ b/src/main/resources/scripts/get_epncore_parameters.py @@ -11,7 +11,7 @@ This script parse the Parameters table on the EpnTAPv2 VO-Paris Confluence page 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;` -- enum: A Java code for emuration, as `THE_PARAMETER(name, class, isOptional, mustBeFilled, unit, UCD, desciption)` +- enum: A Java code for emuration, as `THE_PARAMETER(name, class, isMandatory, mustBeFilled, unit, UCD, desciption)` example: `INCIDENCE_MIN("incidence_min", class.Double, false, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),` """ @@ -25,7 +25,7 @@ soup = BeautifulSoup(html.read(), 'html.parser') # EPN-TAP table is the first one. table = soup.find_all('table', 'confluenceTable')[0].find('tbody').find_all('tr') -optional = False +mandatory = True for tr in table: row=[] @@ -33,10 +33,10 @@ for tr in table: txt = td.string if td.string and td.string != None else '' row.append(sub(r'[^\x00-\x7F]', r' ', txt).strip()) if row and row[0] == 'Optional parameters': - optional = True + mandatory = False if not row or row[0] == "" or (row[1]=="" and row[2]=="" and row[3]==""): continue - row.append('Y' if optional else 'N') + row.append('N' if mandatory else 'Y') if EXPORT_TYPE == 'CSV': print('"' + '";"'.join(row) + '"') @@ -46,6 +46,6 @@ for tr in table: print('public %s %s;' % (var_type, var_name)) elif EXPORT_TYPE == 'enum': var_type = row[3].replace('Text', 'String') - print('%s("%s", class.%s, %s, %s, "%s", "%s", "%s"),' - % (row[0].upper(), row[0], var_type, 'true' if optional else 'false', \ + print('%s("%s", %s.class, %s, %s, "%s", "%s", "%s"),' + % (row[0].upper(), row[0], var_type, 'true' if mandatory else 'false', \ 'true' if row[1]=='Y' else 'false', row[4], row[6], row[5])) -- libgit2 0.21.2