Refactor scope relationships creation

This version reduces the number of access to dictionaries data.
This commit is contained in:
Samuel Gaist
2021-06-17 15:56:13 +02:00
parent e9686376ca
commit 5a4314ea8c

View File

@@ -32,9 +32,10 @@ class ScopeTableGenerator:
used for creating hierarchical scope table in _parse_scopes() used for creating hierarchical scope table in _parse_scopes()
""" """
pairs = [] pairs = []
for scope in self.scopes.keys(): for scope, data in self.scopes.items():
if self.scopes[scope].get('subscopes'): subscopes = data.get('subscopes')
for subscope in self.scopes[scope]['subscopes']: if subscopes is not None:
for subscope in subscopes:
pairs.append((scope, subscope)) pairs.append((scope, subscope))
else: else:
pairs.append((scope, None)) pairs.append((scope, None))