synapse/state.py
def _resolve_state_events(conflicted_state, auth_events):
    """ This is where we actually decide which of the conflicted state to
    use.

    We resolve conflicts in the following order:
        1. power levels
        2. join rules
        3. memberships
        4. other events.
    """
    resolved_state = {}
    if POWER_KEY in conflicted_state:
        events = conflicted_state[POWER_KEY]
        logger.debug("Resolving conflicted power levels %r", events)
        resolved_state[POWER_KEY] = _resolve_auth_events(
            events, auth_events)

    auth_events.update(resolved_state)

    for key, events in conflicted_state.iteritems():
        if key[0] == EventTypes.JoinRules:
            logger.debug("Resolving conflicted join rules %r", events)
            resolved_state[key] = _resolve_auth_events(
                events,
                auth_events
            )

    auth_events.update(resolved_state)

    for key, events in conflicted_state.iteritems():
        if key[0] == EventTypes.Member:
            logger.debug("Resolving conflicted member lists %r", events)
            resolved_state[key] = _resolve_auth_events(
                events,
                auth_events
            )

    auth_events.update(resolved_state)

    for key, events in conflicted_state.iteritems():
        if key not in resolved_state:
            logger.debug("Resolving conflicted state %r:%r", key, events)
            resolved_state[key] = _resolve_normal_events(
                events, auth_events
            )

    return resolved_state
 This is where we actually decide which of the conflicted state to
    use.

    We resolve conflicts in the following order:
        1. power levels
        2. join rules
        3. memberships
        4. other events.
    
This is where we actually decide which of the conflicted state to
use.

We resolve conflicts in the following order:
1. power levels
2. join rules
3. memberships
4. other events.
This is where we actually decide which of the conflicted state to use . We resolve conflicts in the following order : 1 . power levels 2 . join rules 3 . memberships 4 . other events .
def _resolve_state_events(conflicted_state, auth_events):
    resolved_state = {}
    if POWER_KEY in conflicted_state:
        events = conflicted_state[POWER_KEY]
        logger.debug("Resolving conflicted power levels %r", events)
        resolved_state[POWER_KEY] = _resolve_auth_events(
            events, auth_events)
    auth_events.update(resolved_state)
    for key, events in conflicted_state.iteritems():
        if key[0] == EventTypes.JoinRules:
            logger.debug("Resolving conflicted join rules %r", events)
            resolved_state[key] = _resolve_auth_events(
                events,
                auth_events
            )
    auth_events.update(resolved_state)
    for key, events in conflicted_state.iteritems():
        if key[0] == EventTypes.Member:
            logger.debug("Resolving conflicted member lists %r", events)
            resolved_state[key] = _resolve_auth_events(
                events,
                auth_events
            )
    auth_events.update(resolved_state)
    for key, events in conflicted_state.iteritems():
        if key not in resolved_state:
            logger.debug("Resolving conflicted state %r:%r", key, events)
            resolved_state[key] = _resolve_normal_events(
                events, auth_events
            )
    return resolved_state
def _resolve_state_events ( conflicted_state , auth_events ) : resolved_state = { } if POWER_KEY in conflicted_state : events = conflicted_state [ POWER_KEY ] logger . debug ( "Resolving conflicted power levels %r" , events ) resolved_state [ POWER_KEY ] = _resolve_auth_events ( events , auth_events ) auth_events . update ( resolved_state ) for key , events in conflicted_state . iteritems ( ) : if key [ 0 ] == EventTypes . JoinRules : logger . debug ( "Resolving conflicted join rules %r" , events ) resolved_state [ key ] = _resolve_auth_events ( events , auth_events ) auth_events . update ( resolved_state ) for key , events in conflicted_state . iteritems ( ) : if key [ 0 ] == EventTypes . Member : logger . debug ( "Resolving conflicted member lists %r" , events ) resolved_state [ key ] = _resolve_auth_events ( events , auth_events ) auth_events . update ( resolved_state ) for key , events in conflicted_state . iteritems ( ) : if key not in resolved_state : logger . debug ( "Resolving conflicted state %r:%r" , key , events ) resolved_state [ key ] = _resolve_normal_events ( events , auth_events ) return resolved_state
This is where we actually decide which of the conflicted state to
use.
This is where we actually decide which of the conflicted state to use .
""" This is where we actually decide which of the conflicted state to
    use.

    We resolve conflicts in the following order:
        1. power levels
        2. join rules
        3. memberships
        4. other events.
    """
conflicted_state
auth_events