Skip to content

Error in method description in ismags.py #6594

@navyagarwal

Description

@navyagarwal

The docstring of partition_to_color method in ismags.py seems off to me. The description is not clear, and it's hard to understand what the method is supposed to do.

def partition_to_color(partitions):
     """
    Creates a dictionary with for every item in partition for every partition 
    in partitions the index of partition in partitions.
    
    Parameters
    ----------
    partitions: collections.abc.Sequence[collections.abc.Iterable]
        As returned by :func:`make_partitions`.
    Returns
    -------
    dict
    """
    colors = {}
    for color, keys in enumerate(partitions):
        for key in keys:
            colors[key] = color
    return colors

I think the following description explains the method better.

def partition_to_color(partitions):
    """
    Creates a dictionary that maps each item in each partition to the index of 
    the partition it belongs to
    """

If the new description looks alright, I'll go ahead and make the changes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions