DMB vote funtion

Developer Membership Board (DMB) series

The article series covers the different Ubuntu developer memberships, their implied upload permissions, and the Developer Membership Board that governs them.

Developer roles:

DMB operations:

The text on DMB rules should be easier to consume, but if in doubt here a different way to express it.

These rules were proposed in

All that is summarized in this Python-like function:

def do_vote(votes):
    """
    This function returns the outcome of a DMB vote as a string.

    :param votes: list of integers (-1, 0, +1) representing votes cast by members present
    """
    quorum = 4
    total_members=7

    dmb_members_voting = len(votes)
    missing_votes = total_members - dmb_members_voting

    sum_of_votes = sum(votes)
    non_abstain_votes = [v for v in votes if v != 0]

    if dmb_members_voting < quorum:
        return "Not quorate - require follow up, next time majority of present members votes will suffice"

    if non_abstain_votes and all(v == 1 for v in non_abstain_votes):
        return "quorum and unanimous - passed and final"
    if non_abstain_votes and all(v == -1 for v in non_abstain_votes):
        return "quorum and unanimous - failed and final"

    if sum_of_votes > 0:
        if sum_of_votes > missing_votes:
            return "quorum, missing votes could not overturn it - passed and final"
        else
            return "quorum and passed, but missing votes could be overturn it - absent members are asked to vote by mail until or at next meeting"

    if sum_of_votes < 0:
        if abs(sum_of_votes) > missing_votes:
            return "quorum, missing votes could not overturn it - failed and final"
        else:
            return "quorum and failed, but missing votes could be overturn it - absent members are asked to vote by mail until or at next meeting"

    return "hung, absent members are asked to vote by mail until or at next meeting"