checking in before i change a regex pattern. this currently will grab commented out defaults, but we don't want that since it complicates things - so we hardcode in shipped defaults.
This commit is contained in:
19
aif/pacman/_common.py
Normal file
19
aif/pacman/_common.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import configparser
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
_logger = logging.getLogger('pacman:_common')
|
||||
|
||||
|
||||
class MultiOrderedDict(OrderedDict):
|
||||
# Thanks, dude: https://stackoverflow.com/a/38286559/733214
|
||||
def __setitem__(self, key, value):
|
||||
if key in self:
|
||||
if isinstance(value, list):
|
||||
self[key].extend(value)
|
||||
return(None)
|
||||
elif isinstance(value, str):
|
||||
if len(self[key]) > 1:
|
||||
return(None)
|
||||
super(MultiOrderedDict, self).__setitem__(key, value)
|
||||
Reference in New Issue
Block a user