f03ae01198c24d0a1abd69b583199b7730ecdfe7,skbio/io/format/stockholm.py,,_write_padded_data,#Any#Any#,642

Before Change



def _write_padded_data(data, fh):
    n = 0
    for i in range(len(data)):
        tag_string = str(data[i][0])
        if len(tag_string) > n:
            n = len(tag_string)
    for i in range(len(data)):
        tag_string, data_string = data[i]
        tag_string = str(tag_string)
        // Padding is extended by 1 to account for the extra space after
        // longest tag string
        padding = "".join(" " for j in range(n-len(tag_string)+1))
        fh.write("%s%s%s\n" % (tag_string, padding, data_string))

After Change


    max_data_len = 0
    for label, _ in data:
        if len(label) > max_data_len:
            max_data_len = len(label)
    fmt = "{0:%d} {1}\n" % max_data_len
    for label, value in data:
        // Padding is extended by 1 to account for the extra space after
        // longest tag string
        fh.write(fmt.format(label, value))


def _check_positional_metadata(df, data_type):
    // Asserts positional metadata feature names are unique
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: biocore/scikit-bio
Commit Name: f03ae01198c24d0a1abd69b583199b7730ecdfe7
Time: 2016-02-16
Author: kestrel.gorlick@gmail.com
File Name: skbio/io/format/stockholm.py
Class Name:
Method Name: _write_padded_data


Project Name: pytorch/examples
Commit Name: d5a75ba09ae0595ca284fd806475eb8d3f771387
Time: 2017-01-17
Author: adam.paszke@gmail.com
File Name: word_language_model/generate.py
Class Name:
Method Name: