Commit cb78d48b045cb4962b7181041817d820c607b60c

Authored by Nathanael Jourdane
1 parent 2fcfc5f2
Exists in master

Invert boolean value of 'mandatory'.

Showing 1 changed file with 6 additions and 6 deletions   Show diff stats
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 @@ -11,7 +11,7 @@ This script parse the Parameters table on the EpnTAPv2 VO-Paris Confluence page
11 example: `"incidence_min";"";"incidence_min";"Double";"deg";"Min incidence angle (solar zenithal angle)";"pos.posAng;stat.min";"";"N"` 11 example: `"incidence_min";"";"incidence_min";"Double";"deg";"Min incidence angle (solar zenithal angle)";"pos.posAng;stat.min";"";"N"`
12 - init: A Java code for parameters initalisation, in camelCase 12 - init: A Java code for parameters initalisation, in camelCase
13 example: `public double incidenceMin;` 13 example: `public double incidenceMin;`
14 -- enum: A Java code for emuration, as `THE_PARAMETER(name, class, isOptional, mustBeFilled, unit, UCD, desciption)` 14 +- enum: A Java code for emuration, as `THE_PARAMETER(name, class, isMandatory, mustBeFilled, unit, UCD, desciption)`
15 example: `INCIDENCE_MIN("incidence_min", class.Double, false, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),` 15 example: `INCIDENCE_MIN("incidence_min", class.Double, false, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),`
16 """ 16 """
17 17
@@ -25,7 +25,7 @@ soup = BeautifulSoup(html.read(), 'html.parser') @@ -25,7 +25,7 @@ soup = BeautifulSoup(html.read(), 'html.parser')
25 # EPN-TAP table is the first one. 25 # EPN-TAP table is the first one.
26 table = soup.find_all('table', 'confluenceTable')[0].find('tbody').find_all('tr') 26 table = soup.find_all('table', 'confluenceTable')[0].find('tbody').find_all('tr')
27 27
28 -optional = False 28 +mandatory = True
29 29
30 for tr in table: 30 for tr in table:
31 row=[] 31 row=[]
@@ -33,10 +33,10 @@ for tr in table: @@ -33,10 +33,10 @@ for tr in table:
33 txt = td.string if td.string and td.string != None else '' 33 txt = td.string if td.string and td.string != None else ''
34 row.append(sub(r'[^\x00-\x7F]', r' ', txt).strip()) 34 row.append(sub(r'[^\x00-\x7F]', r' ', txt).strip())
35 if row and row[0] == 'Optional parameters': 35 if row and row[0] == 'Optional parameters':
36 - optional = True 36 + mandatory = False
37 if not row or row[0] == "" or (row[1]=="" and row[2]=="" and row[3]==""): 37 if not row or row[0] == "" or (row[1]=="" and row[2]=="" and row[3]==""):
38 continue 38 continue
39 - row.append('Y' if optional else 'N') 39 + row.append('N' if mandatory else 'Y')
40 40
41 if EXPORT_TYPE == 'CSV': 41 if EXPORT_TYPE == 'CSV':
42 print('"' + '";"'.join(row) + '"') 42 print('"' + '";"'.join(row) + '"')
@@ -46,6 +46,6 @@ for tr in table: @@ -46,6 +46,6 @@ for tr in table:
46 print('public %s %s;' % (var_type, var_name)) 46 print('public %s %s;' % (var_type, var_name))
47 elif EXPORT_TYPE == 'enum': 47 elif EXPORT_TYPE == 'enum':
48 var_type = row[3].replace('Text', 'String') 48 var_type = row[3].replace('Text', 'String')
49 - print('%s("%s", class.%s, %s, %s, "%s", "%s", "%s"),'  
50 - % (row[0].upper(), row[0], var_type, 'true' if optional else 'false', \ 49 + print('%s("%s", %s.class, %s, %s, "%s", "%s", "%s"),'
  50 + % (row[0].upper(), row[0], var_type, 'true' if mandatory else 'false', \
51 'true' if row[1]=='Y' else 'false', row[4], row[6], row[5])) 51 'true' if row[1]=='Y' else 'false', row[4], row[6], row[5]))