bae902f30638942d08819ec9cd4acdc5f6e33682,pyglmnet/datasets.py,,fetch_group_lasso_datasets,#,106

Before Change



    if sys.version_info[0] == 3:
        pos_file = tempfile.NamedTemporaryFile("w+", buffering=1)
        neg_file = tempfile.NamedTemporaryFile("w+", buffering=1)
    elif sys.version_info[0] == 2:
        pos_file = tempfile.NamedTemporaryFile(bufsize=0)
        neg_file = tempfile.NamedTemporaryFile(bufsize=0)

After Change


    negative_url = \
        "http://hollywood.mit.edu/burgelab/maxent/ssdata/MEMset/train0_5_hs"

    with TemporaryDirectory(prefix="tmp_glm-tools") as dpath:
        pos_file = os.path.join(dpath, "pos")
        neg_file = os.path.join(dpath, "neg")

        urlretrieve(positive_url, pos_file, _reporthook)
        urlretrieve(negative_url, neg_file, _reporthook)

        with open(pos_file) as posfp:
            positive_sequences = [str(line.strip().upper()) for idx, line in
                                  enumerate(posfp.readlines())
                                  if ">" not in line and idx < 2 * 8000]

        with open(neg_file) as negfp:
            negative_sequences = [str(line.strip().upper()) for idx, line in
                                  enumerate(negfp.readlines())
                                  if ">" not in line and
                                  idx < 2 * len(positive_sequences)]

    assert len(positive_sequences) == len(negative_sequences), \
        "lengths were not the same: p={pos} n={neg}" \
        .format(pos=len(positive_sequences), neg=len(negative_sequences))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: glm-tools/pyglmnet
Commit Name: bae902f30638942d08819ec9cd4acdc5f6e33682
Time: 2019-06-03
Author: scotto@sharpleaf.org
File Name: pyglmnet/datasets.py
Class Name:
Method Name: fetch_group_lasso_datasets


Project Name: GoogleCloudPlatform/healthcare
Commit Name: 39aecdfcdb5903e32ffd61868e52312b542e62fa
Time: 2019-02-11
Author: noreply@google.com
File Name: deploy/create_project_test.py
Class Name: CreateProjectTest
Method Name: test_project_config_validate_check_raise


Project Name: glm-tools/pyglmnet
Commit Name: bae902f30638942d08819ec9cd4acdc5f6e33682
Time: 2019-06-03
Author: scotto@sharpleaf.org
File Name: pyglmnet/datasets.py
Class Name:
Method Name: fetch_group_lasso_datasets


Project Name: GoogleCloudPlatform/healthcare
Commit Name: 39aecdfcdb5903e32ffd61868e52312b542e62fa
Time: 2019-02-11
Author: noreply@google.com
File Name: deploy/create_project_test.py
Class Name: CreateProjectTest
Method Name: test_project_config_validate_check_correct