Skip to content

Commit

Permalink
Fix issue with other types for config file
Browse files Browse the repository at this point in the history
  • Loading branch information
igsekor committed Jan 11, 2021
1 parent 722ce16 commit a1250ce
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions extract-lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ def find_languges(yaml, starting_list = []):
find_languges(l, lang_list)
elif isinstance(yaml[k], dict):
find_languges(yaml[k], lang_list)
else:
pass
elif isinstance(yaml, list):
for l in yaml:
find_languges(l, lang_list)
else:
pass
return lang_list

def find_engines(yaml, starting_list = []):
Expand All @@ -28,20 +32,24 @@ def find_engines(yaml, starting_list = []):
find_engines(l, engine_list)
elif isinstance(yaml[k], dict):
find_engines(yaml[k], engine_list)
else:
pass
elif isinstance(yaml, list):
for l in yaml:
find_engines(l, engine_list)
else:
pass
return engine_list

with open(sys.argv[1], 'r') as file:
yaml = yaml.load(file, Loader=yaml.FullLoader)
lang_list = find_languges(yaml)
engine_list = find_engines(yaml)

output_string = ''

for e in engine_list:
for l in lang_list:
output_string += ' ' + e + '-' + l
print(output_string)

print(output_string)

0 comments on commit a1250ce

Please sign in to comment.