Skip to content

Commit

Permalink
Merge pull request Kozea#316 from sattel/speedup_config_update
Browse files Browse the repository at this point in the history
config.py: speedup method BaseConfig._update(...)
  • Loading branch information
paradoxxxzero committed Apr 21, 2016
2 parents 88adb02 + c7b5097 commit 71f5a34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pygal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ def __call__(self, **kwargs):

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"""
Expand Down

0 comments on commit 71f5a34

Please sign in to comment.