13aa194e1878e7268fcd338c4c6f6cf479a9459f,pyemma/util/contexts.py,,settings,#,68

Before Change


    // validate:
    valid_keys = config.keys()
    for k in kwargs.keys():
        if k not in valid_keys:
            raise ValueError("not a valid settings: {key}".format(key=k))

    old_settings = {}
    for k, v in kwargs.items():
        old_settings[k] = getattr(config, k)
        setattr(config, k, v)

    yield

    // restore old settings
    for k, v in old_settings.items():
        setattr(config, k, v)

After Change


        for k, v in kwargs.items():
            old_settings[k] = getattr(config, k)
            setattr(config, k, v)
        yield
    finally:
        // restore old settings
        for k, v in old_settings.items():
            setattr(config, k, v)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: markovmodel/PyEMMA
Commit Name: 13aa194e1878e7268fcd338c4c6f6cf479a9459f
Time: 2018-06-18
Author: m.scherer@fu-berlin.de
File Name: pyemma/util/contexts.py
Class Name:
Method Name: settings


Project Name: pandas-dev/pandas
Commit Name: 6ff2e7c602123787c3b0061466ab5bb8663eae81
Time: 2021-01-18
Author: twoertwein@users.noreply.github.com
File Name: pandas/_testing/contexts.py
Class Name:
Method Name: ensure_clean


Project Name: RaRe-Technologies/gensim
Commit Name: 1aa7e115fcf87b443373c14b7b2f3dd2e3383584
Time: 2011-02-19
Author: radimrehurek@seznam.cz
File Name: src/gensim/corpora/bleicorpus.py
Class Name: BleiCorpus
Method Name: __iter__