Skip to content

Commit

Permalink
Fix issue with reading of configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
igsekor committed Jan 11, 2021
1 parent a1250ce commit da85071
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions extract-lang.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import yaml
import sys

def remove_duplicates(l):
return list(dict.fromkeys(l))

def find_languges(yaml, starting_list = []):
lang_list = starting_list
if isinstance(yaml, dict):
for k in yaml.keys():
if k == 'lang':
if k == 'lang' or k == 'd':
lang_list.append(yaml[k])
elif isinstance(yaml[k], list):
for l in yaml[k]:
Expand Down Expand Up @@ -46,10 +49,16 @@ def find_engines(yaml, starting_list = []):
lang_list = find_languges(yaml)
engine_list = find_engines(yaml)

output_list = []
output_string = ''

for e in engine_list:
for l in lang_list:
output_string += ' ' + e + '-' + l
output_list.append(e + '-' + l)

for l in remove_duplicates(output_list):
output_string += ' ' + l

output_string = output_string.replace('_', '-')

print(output_string)
print(output_string.lower())

0 comments on commit da85071

Please sign in to comment.