Skip to content

Commit

Permalink
ConfigHub: re-initialize ChainMap.maps as a list of ConfigObj. Re #155.
Browse files Browse the repository at this point in the history
Mypy: re-initialize ChainMap.maps as a list of ConfigObj. This complies with ChainMap specification in that maps is a list of mappings, and ConfigObj, as a dictionary/section, is indeed a mapping. To acknowledge that ConfigHub is powered by ChainMap, call super method, and then re-initialize self.maps. This resolves attribute definition errors from Mypy when accessing ConfigObj attributes.
  • Loading branch information
josephsl committed Jan 25, 2021
1 parent cc4cee9 commit aced8a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addon/appModules/splstudio/splconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def __init__(self, splComponent: Optional[str] = None) -> None:
if splComponent not in _SPLComponents_:
raise RuntimeError("Not a StationPlaylist component, cannot create SPL add-on Config Hub database")
# Create a "fake" map entry, to be replaced by the normal profile later.
# Super method is called to acknowledge the fact that this is powered by ChainMap.
super(ConfigHub, self).__init__()
# #155 (21.03): re-initialize maps to be a list of config objects to satisfy Mypy and friends.
self.maps: list[ConfigObj] = [{}]
# #64 (18.07): keep an eye on which SPL component opened this map.
self.splComponents = set()
self.splComponents.add(splComponent)
Expand Down

0 comments on commit aced8a1

Please sign in to comment.