kifield/kifield.py
def reorder_sch_fields(fields):
        """Return the part fields with the named fields ordered alphabetically."""
        # Sort the named fields that come after the first four, unnamed fields.
        sort_key = operator.itemgetter("name")
        if USING_PYTHON2:
            sort_key_func = lambda s: unicode(sort_key(s))
        else:
            sort_key_func = sort_key
        named_fields = sorted(fields[4:], key=sort_key_func)
        # Renumber the ids of the sorted fields.
        for id, field in enumerate(named_fields, 4):
            field["id"] = str(id)
        # Return the first four fields plus the remaining sorted fields.
        return fields[:4] + named_fields
Return the part fields with the named fields ordered alphabetically.
Return the part fields with the named fields ordered alphabetically.
Return the part fields with the named fields ordered alphabetically .
def reorder_sch_fields(fields):
        sort_key = operator.itemgetter("name")
        if USING_PYTHON2:
            sort_key_func = lambda s: unicode(sort_key(s))
        else:
            sort_key_func = sort_key
        named_fields = sorted(fields[4:], key=sort_key_func)
        for id, field in enumerate(named_fields, 4):
            field["id"] = str(id)
        return fields[:4] + named_fields
def reorder_sch_fields ( fields ) : sort_key = operator . itemgetter ( "name" ) if USING_PYTHON2 : sort_key_func = lambda s : unicode ( sort_key ( s ) ) else : sort_key_func = sort_key named_fields = sorted ( fields [ 4 : ] , key = sort_key_func ) for id , field in enumerate ( named_fields , 4 ) : field [ "id" ] = str ( id ) return fields [ : 4 ] + named_fields
Return the part fields with the named fields ordered alphabetically.
Return the part fields with the named fields ordered alphabetically .
"""Return the part fields with the named fields ordered alphabetically.""" # Sort the named fields that come after the first four, unnamed fields. # Renumber the ids of the sorted fields. # Return the first four fields plus the remaining sorted fields.
fields