Commit 6dd71f50 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Fix bug: info command lists some providers multiple times

parent a7a6c443
......@@ -10,7 +10,10 @@ def _load_providers(path):
data = []
with open(path) as data_file:
data = yaml.load(data_file)
return normalize_index(index_providers(data))
return data
def load_indexed_providers():
return normalize_index(index_providers(load_providers()))
def index_providers(providers):
index = {}
......@@ -24,10 +27,10 @@ def normalize_index(index):
return {k.lower():v for (k,v) in index.items()}
def has_provider(provider):
return _has_provider(load_providers(), provider)
return _has_provider(load_indexed_providers(), provider)
def _has_provider(providers, provider):
return provider.lower() in providers
def get_provider(provider):
return load_providers()[provider.lower()]
return load_indexed_providers()[provider.lower()]
......@@ -43,8 +43,7 @@ def info(args, cfg):
print ('')
print ('Supported dbxref databases:')
providers = config.load_providers()
for key in providers:
provider = providers[key]
for provider in providers:
print (' ' + provider['name'])
print (' Prefixes: ' + str.join(', ', [x for x in provider['prefixes']]))
print (' Formats : ' + str.join(', ', [x for x in provider['resources']]))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment