def _readRoleRanks(xmlCtx, section, ranks):
    roleRanks = tankmen_components.RoleRanks()
    for roleName in skills_constants.ROLES:
        rankIDs = []
        for rankName in _xml.readNonEmptyString(xmlCtx, section, roleName).split():
            rankIDs.append(ranks.getIDByName(rankName))

        roleRanks.setRanksIDs(roleName, tuple(rankIDs))

    return roleRanks
def _readRoleRanks(xmlCtx, section, ranks):
    """Reads section containing mapping role -> ranks and stores it to RoleRanks.
    :param xmlCtx: tuple(root ctx or None, path to section).
    :param section: instance of DataSection.
    :param ranks: instance of RanksSet.
    :return: instance of RoleRanks.
    """
    roleRanks = tankmen_components.RoleRanks()
    for roleName in skills_constants.ROLES:
        rankIDs = []
        for rankName in _xml.readNonEmptyString(xmlCtx, section, roleName).split():
            rankIDs.append(ranks.getIDByName(rankName))

        roleRanks.setRanksIDs(roleName, tuple(rankIDs))

    return roleRanks