Ejemplo n.º 1
0
    def get_passives_for_section(self, section):

        sectionptas = [pta for pta in self.appliedpassives
                       if pta.targetter.does_target_section(section)]
        passivemechs = {}
        for passiveproperty in PassiveProperty.all:
            section_property_ptas = [spta for spta in sectionptas if spta.passiveproperty == passiveproperty]
            highest_prority_mech = SeqUtils.max_with_unique_check(section_property_ptas, key=lambda pta: pta.targetter.get_priority())
            passivemechs[passiveproperty] = highest_prority_mech
        return passivemechs
Ejemplo n.º 2
0
    def get_resolved_mtas_for_section(self, section):

        # TODO: Some basic error checking here: we should ensure that if we specialise a region/section, then we also
        # cover the Everywhere. This should help us catch errors in ehich the user creates 2 mechanisms of the same thing, and 
        # and so applies the same channel twice accidentally.

        # All the mechanisms targetting a certain region:
        mtas_targetting_section = [mta for mta in self.appliedmechanisms if mta.targetter.does_target_section(section)]
        mechs_targetting_section = set([ mta.mechanism for mta in self.appliedmechanisms])

        resolved_mechs = []
        for mech in mechs_targetting_section:
            mtas_with_mech = [mta for mta in mtas_targetting_section if mta.mechanism is mech]
            highest_prority_mech = SeqUtils.max_with_unique_check(mtas_with_mech, key=lambda pta: pta.targetter.get_priority())
            resolved_mechs.append(highest_prority_mech)
        return resolved_mechs
Ejemplo n.º 3
0
    def get_passives_for_section(self, section):

        sectionptas = [
            pta for pta in self.appliedpassives
            if pta.targetter.does_target_section(section)
        ]
        passivemechs = {}
        for passiveproperty in PassiveProperty.all:
            section_property_ptas = [
                spta for spta in sectionptas
                if spta.passiveproperty == passiveproperty
            ]
            highest_prority_mech = SeqUtils.max_with_unique_check(
                section_property_ptas,
                key=lambda pta: pta.targetter.get_priority())
            passivemechs[passiveproperty] = highest_prority_mech
        return passivemechs
Ejemplo n.º 4
0
    def get_resolved_mtas_for_section(self, section):

        # TODO: Some basic error checking here: we should ensure that if we specialise a region/section, then we also
        # cover the Everywhere. This should help us catch errors in ehich the user creates 2 mechanisms of the same thing, and
        # and so applies the same channel twice accidentally.

        # All the mechanisms targetting a certain region:
        mtas_targetting_section = [
            mta for mta in self.appliedmechanisms
            if mta.targetter.does_target_section(section)
        ]
        mechs_targetting_section = set(
            [mta.mechanism for mta in self.appliedmechanisms])

        resolved_mechs = []
        for mech in mechs_targetting_section:
            mtas_with_mech = [
                mta for mta in mtas_targetting_section if mta.mechanism is mech
            ]
            highest_prority_mech = SeqUtils.max_with_unique_check(
                mtas_with_mech, key=lambda pta: pta.targetter.get_priority())
            resolved_mechs.append(highest_prority_mech)
        return resolved_mechs