Ejemplo n.º 1
0
    def finalize(associations):
        """Check validity and duplications in an association list

        Parameters
        ----------
        associations:[association[, ...]]
            List of associations

        Returns
        -------
        finalized_associations : [association[, ...]]
            The validated list of associations
        """
        finalized_asns = []
        lv2_asns = []
        for asn in associations:
            if isinstance(asn, DMSLevel2bBase):
                finalized = asn.finalize()
                if finalized is not None:
                    lv2_asns.extend(finalized)
            else:
                finalized_asns.append(asn)

        # Having duplicate Level 2 associations is expected.
        # Suppress warnings.
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            lv2_asns = prune_duplicate_products(lv2_asns)

        # Ensure sequencing is correct.
        Utility_Level3.resequence(lv2_asns)

        return finalized_asns + lv2_asns
Ejemplo n.º 2
0
    def finalize(associations):
        """Check validity and duplications in an association list

        Parameters
        ----------
        associations:[association[, ...]]
            List of associations

        Returns
        -------
        finalized_associations : [association[, ...]]
            The validated list of associations
        """
        finalized_asns = []
        lv2_asns = []
        for asn in associations:
            if isinstance(asn, DMSLevel2bBase):
                finalized = asn.finalize()
                if finalized is not None:
                    lv2_asns.extend(finalized)
            else:
                finalized_asns.append(asn)
        lv2_asns = prune_duplicate_products(lv2_asns)

        # Ensure sequencing is correct.
        Utility_Level3.resequence(lv2_asns)

        return finalized_asns + lv2_asns
Ejemplo n.º 3
0
 def resequence(*args, **kwargs):
     """Resequence the numbers to conform to level 3 asns"""
     return Utility_Level3.resequence(*args, **kwargs)
Ejemplo n.º 4
0
 def resequence(*args, **kwargs):
     return Utility_Level3.resequence(*args, **kwargs)
Ejemplo n.º 5
0
 def resequence(*args, **kwargs):
     return Utility_Level3.resequence(*args, **kwargs)