Browse Source

Merge pull request #316 from sattel/speedup_config_update

config.py: speedup method BaseConfig._update(...)
pull/317/head
Mounier Florian 9 years ago
parent
commit
71f5a34cc6
  1. 3
      pygal/config.py

3
pygal/config.py

@ -168,9 +168,10 @@ class BaseConfig(MetaConfig('ConfigBase', (object,), {})):
def _update(self, kwargs):
"""Update the config with the given dictionary"""
dir_self_set = set(dir(self))
self.__dict__.update(
dict([(k, v) for (k, v) in kwargs.items()
if not k.startswith('_') and k in dir(self)]))
if not k.startswith('_') and k in dir_self_set]))
def to_dict(self):
"""Export a JSON serializable dictionary of the config"""

Loading…
Cancel
Save