010580845043ef751687b0ab34f694939a2fa4f5,cirq/study/sweepable.py,,to_sweeps,#Any#,53

Before Change


    if isinstance(sweepable, dict):
        // change dictionary of lists to list of dictionaries
        // of single values using Cartesian product.
        newsweepable = {}
        for key, value in sweepable.items():
            if isinstance(value, Iterable):
                newsweepable[key] = value
            else:
                newsweepable[key] = [value]
        expandsweepable = [
            dict(zip(newsweepable.keys(), v))
            for v in itertools.product(*newsweepable.values())
        ]
        return [
            _resolver_to_sweep(ParamResolver(cast(Dict, dictitem)))
            for dictitem in expandsweepable
        ]
    if isinstance(sweepable, Iterable) and not isinstance(sweepable, str):
        return [

After Change


                DeprecationWarning,
                stacklevel=2)
        product_sweep = dict_to_product_sweep(sweepable)
        return [_resolver_to_sweep(resolver) for resolver in product_sweep]
    if isinstance(sweepable, Iterable) and not isinstance(sweepable, str):
        return [
            sweep for item in sweepable for sweep in to_sweeps(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: quantumlib/Cirq
Commit Name: 010580845043ef751687b0ab34f694939a2fa4f5
Time: 2020-09-17
Author: kevinjefferysung@gmail.com
File Name: cirq/study/sweepable.py
Class Name:
Method Name: to_sweeps


Project Name: kengz/SLM-Lab
Commit Name: 8c17debc9dc6552da8c317c0c852b55f03c80c61
Time: 2017-12-24
Author: kengzwl@gmail.com
File Name: slm_lab/spec/spec_util.py
Class Name:
Method Name: resolve_aeb


Project Name: stanford-mast/nn_dataflow
Commit Name: a4d6623b1d6b3064e77f07a9b5e182045e20fe67
Time: 2019-12-02
Author: 16973185+Pingziwalk@users.noreply.github.com
File Name: nn_dataflow/core/nn_dataflow.py
Class Name: NNDataflow
Method Name: _gen_input_layout


Project Name: pgmpy/pgmpy
Commit Name: fa6a87eaf692f72ecd12aa24eff8071062c88516
Time: 2015-06-14
Author: pratyaksh@me.com
File Name: pgmpy/inference/Sampling.py
Class Name: BayesianModelSampling
Method Name: forward_sample